Skip to content
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

Improve template node #956

Merged
merged 9 commits into from
Jan 18, 2023
Merged

Improve template node #956

merged 9 commits into from
Jan 18, 2023

Conversation

koushiro
Copy link
Collaborator

@koushiro koushiro commented Dec 21, 2022

  • improve the rpc module
  • remove the duplicated code because of the aura and manual-seal features
  • remove aura and manual-seal features
  • rename feature name rpc_binary_search_estimate => rpc-binary-search-estimate
  • update some deps

"sc-consensus-manual-seal",
"frontier-template-runtime/manual-seal",
]
aura = ["frontier-template-runtime/aura"]
Copy link
Member

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?

Copy link
Collaborator Author

@koushiro koushiro Dec 22, 2022

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

Copy link
Collaborator Author

@koushiro koushiro Dec 22, 2022

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.

Copy link
Collaborator Author

@koushiro koushiro Jan 6, 2023

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>;
}

Copy link
Member

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).

@koushiro koushiro changed the title improve template node Improve template node Jan 9, 2023
@koushiro
Copy link
Collaborator Author

@sorpaas PTAL again

@@ -29,8 +29,6 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- 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
Copy link
Member

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.

Copy link
Collaborator Author

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

@sorpaas sorpaas merged commit 239e040 into polkadot-evm:master Jan 18, 2023
@koushiro koushiro deleted the improve-template branch January 18, 2023 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants