Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes custom implementations for:
In lib.rs, all these tie together in the
pub fn components
which has trait-bounds on ChainSpec, which is why all these changes have to be made together.Changes w.r.t Eth primitives for custom node components
GnosisChainSpec
GnosisNetworkBuilder
CLI
Reasoning behind the changes
Why new chainspec?
Gnosis adds some additional hardforks apart from standard Ethereum hardforks. Also, the genesis hash in reth's db is different from gnosis mainner genesis hash, owing to the 2 extra fields (step and signature), which aren't present in reth's format. To calculate the correct forkhashes, we need to start from the actual genesis hash, instead of the one in DB.
Why new Network?
Similar to the above reason, if reth broadcasts the genesis hash present in DB, peers will reject the EthStream request. We need a custom implementation to send the correct genesis hash and fork hash to peers.
Rationale behind PoolBuilder
The node components builder introduces a trait bound on the ChainSpec, needing all the components use the same chainspec type. So, if we introduce a custom GnosisChainSpec, and GnosisNetworkBuilder, we need custom implementations of the other components too. The GnosisPoolBuilder in particular is copied exactly from EthereumPoolBuilder without modifications beyond using GnosisChainSpec.
Custom CLI
CLI is also dependent on ChainSpec, but a bigger reason is it reduces a lot of duplicate code from main.rs (related to custom import and init commands) and moves them into the dedicated CLI file.
Other file changes are simply replacing ChainSpec with GnosisChainSpec.