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

reth-ethereum-forks crate #5621

Merged
merged 15 commits into from
Dec 1, 2023
Merged

reth-ethereum-forks crate #5621

merged 15 commits into from
Dec 1, 2023

Conversation

Arindam2407
Copy link
Contributor

Resolving issue #5524

Created reth-ethereum-forks crate. Flipped fork_id and fork_filter methods to make them methods defined on ChainSpec instead of Hardfork. The new methods are called hardfork_fork_id and hardfork_fork_filter since fork_id and fork_filter methods with different arguments are already defined for ChainSpec.

Fork Id:

/// Get the fork id for the given hardfork
pub fn hardfork_fork_id(&self, fork: Hardfork) -> Option<ForkId> {
    match self.fork(fork) {
        ForkCondition::Never => None,
        _ => Some(self.fork_id(&self.satisfy(self.fork(fork)))),
    }
}

Fork Filter:

/// Get the fork filter for the given hardfork
pub fn hardfork_fork_filter(&self, fork: Hardfork) -> Option<ForkFilter> {
    match self.fork(fork) {
        ForkCondition::Never => None,
        _ => Some(self.fork_filter(self.satisfy(self.fork(fork)))),
    }
}

@mattsse mattsse self-assigned this Nov 29, 2023
@mattsse mattsse added the C-debt Refactor of code section that is hard to understand or maintain label Nov 29, 2023
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great

I'd like to reexport everything in reth-primitives so we don't have to update all imports across the codebase

crates/blockchain-tree/src/blockchain_tree.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a cleanup, we probably need way less dependencies

crates/ethereum-forks/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, this just needs a bit more cleanup

crates/ethereum-forks/src/lib.rs Outdated Show resolved Hide resolved
crates/ethereum-forks/src/head.rs Outdated Show resolved Hide resolved
crates/ethereum-forks/Cargo.toml Show resolved Hide resolved
bin/reth/Cargo.toml Outdated Show resolved Hide resolved
crates/ethereum-forks/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great!
ty

@mattsse mattsse added this pull request to the merge queue Dec 1, 2023
Merged via the queue into paradigmxyz:main with commit 2144b97 Dec 1, 2023
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants