-
Notifications
You must be signed in to change notification settings - Fork 542
Improve template node #956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
template/node/Cargo.toml
Outdated
| "sc-consensus-manual-seal", | ||
| "frontier-template-runtime/manual-seal", | ||
| ] | ||
| aura = ["frontier-template-runtime/aura"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? Shouldn't sc-consensu-aura stays disabled when manual seal is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current implementation only has the sealing cli option to judge whether to enable the manual seal mode, the default is aura + grandpa.
I think this improvement can reduce the duplication of code caused by different features in the service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could even get rid of the aura and manual-seal features if possible, but this would require adding a value in genesis to be checked in the OnTimestampSet part in the runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like:
pub struct ConsensusOnTimestampSet<T>(PhantomData<T>);
impl<T: pallet_aura::Config> OnTimestampSet<T::Moment> for ConsensusOnTimestampSet<T> {
fn on_timestamp_set(moment: T::Moment) {
if storage::EnableManualSeal::get() {
return
}
<pallet_aura::Pallet<T> as OnTimestampSet<T::Moment>>::on_timestamp_set(moment)
}
}
impl pallet_timestamp::Config for Runtime {
type Moment = Moment;
type OnTimestampSet = ConsensusOnTimestampSet<Self>;
type MinimumPeriod = MinimumPeriod;
type WeightInfo = pallet_timestamp::weights::SubstrateWeight<Runtime>;
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good idea to me. We need to build both aura and manual-seal in CI anyway and this was sometimes forgotten. This is also just a template so simplicity is more important (than not building unused features).
|
@sorpaas PTAL again |
| - name: Run tests | ||
| run: cargo test --locked --verbose --all | ||
| - name: Ensure runtime-benchmarks and try-runtime features compiles | ||
| run: cargo check --release --features=runtime-benchmarks,try-runtime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this? We still need to check those features that aren't on by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have this check in the lint job
auraandmanual-sealfeaturesauraandmanual-sealfeaturesrpc_binary_search_estimate=>rpc-binary-search-estimate