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

Remove extra Total difficulty argument for execution #13174

Closed
mattsse opened this issue Dec 6, 2024 · 0 comments · Fixed by #13362
Closed

Remove extra Total difficulty argument for execution #13174

mattsse opened this issue Dec 6, 2024 · 0 comments · Fixed by #13362
Labels
C-discussion A discussion about the direction and design of the project C-enhancement New feature or request

Comments

@mattsse
Copy link
Collaborator

mattsse commented Dec 6, 2024

Describe the feature

currently we always provide block + TTD for execution:

/// A helper type for ethereum block inputs that consists of a block and the total difficulty.
#[derive(Debug)]
pub struct BlockExecutionInput<'a, Block> {
/// The block to execute.
pub block: &'a Block,
/// The total difficulty of the block.
pub total_difficulty: U256,
}

this is only relevant for pre-merge blocks because the hardfork is determined by the total difficulty.

this only affects sepolia+mainnet.

it would simplify a lot of things if we could only rely on the Block as input.
since all of these transition blocks are finalized and we sync in reverse we should be able to use the hardcoded transition blocks in the chainspec:

pub const fn mainnet_activation_block(&self) -> Option<u64> {
match self {
Self::Frontier => Some(0),
Self::Homestead => Some(1150000),
Self::Dao => Some(1920000),
Self::Tangerine => Some(2463000),
Self::SpuriousDragon => Some(2675000),
Self::Byzantium => Some(4370000),
Self::Constantinople | Self::Petersburg => Some(7280000),
Self::Istanbul => Some(9069000),
Self::MuirGlacier => Some(9200000),
Self::Berlin => Some(12244000),
Self::London => Some(12965000),
Self::ArrowGlacier => Some(13773000),
Self::GrayGlacier => Some(15050000),
Self::Paris => Some(15537394),
Self::Shanghai => Some(17034870),
Self::Cancun => Some(19426587),
_ => None,
}

and use that when we determine the appropriate revm specid:

pub fn revm_spec(chain_spec: &ChainSpec, block: &Head) -> revm_primitives::SpecId {

so that:

/// - The condition is satisfied by the block number;
/// - The condition is satisfied by the timestamp;
/// - or the condition is satisfied by the total difficulty
pub fn active_at_head(&self, head: &Head) -> bool {

no longer needs to check any total difficulty input

Additional context

No response

@mattsse mattsse added C-discussion A discussion about the direction and design of the project C-enhancement New feature or request labels Dec 6, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion A discussion about the direction and design of the project C-enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant