Skip to content

Commit 0bc9c0f

Browse files
authored
Merge of #6953
2 parents 2bd5bbd + 03df038 commit 0bc9c0f

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

consensus/types/src/fork_context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ impl ForkContext {
2525
let fork_to_digest: HashMap<ForkName, [u8; 4]> = ForkName::list_all()
2626
.into_iter()
2727
.filter_map(|fork| {
28-
if fork.fork_epoch(spec).is_some() {
28+
if spec.fork_epoch(fork).is_some() {
2929
Some((
3030
fork,
3131
ChainSpec::compute_fork_digest(
32-
ForkName::fork_version(fork, spec),
32+
spec.fork_version_for_name(fork),
3333
genesis_validators_root,
3434
),
3535
))

consensus/types/src/fork_name.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,35 +38,10 @@ impl ForkName {
3838
.into_iter()
3939
// Skip Base
4040
.skip(1)
41-
.map(|fork| (fork, fork.fork_epoch(spec)))
41+
.map(|fork| (fork, spec.fork_epoch(fork)))
4242
.collect()
4343
}
4444

45-
pub fn fork_epoch(self, spec: &ChainSpec) -> Option<Epoch> {
46-
match self {
47-
Self::Base => Some(Epoch::new(0)),
48-
Self::Altair => spec.altair_fork_epoch,
49-
Self::Bellatrix => spec.bellatrix_fork_epoch,
50-
Self::Capella => spec.capella_fork_epoch,
51-
Self::Deneb => spec.deneb_fork_epoch,
52-
Self::Electra => spec.electra_fork_epoch,
53-
Self::Fulu => spec.fulu_fork_epoch,
54-
}
55-
}
56-
57-
/// Returns the fork version of a fork
58-
pub fn fork_version(self, spec: &ChainSpec) -> [u8; 4] {
59-
match self {
60-
Self::Base => spec.genesis_fork_version,
61-
Self::Altair => spec.altair_fork_version,
62-
Self::Bellatrix => spec.bellatrix_fork_version,
63-
Self::Capella => spec.capella_fork_version,
64-
Self::Deneb => spec.deneb_fork_version,
65-
Self::Electra => spec.electra_fork_version,
66-
Self::Fulu => spec.fulu_fork_version,
67-
}
68-
}
69-
7045
pub fn latest() -> ForkName {
7146
// This unwrap is safe as long as we have 1+ forks. It is tested below.
7247
*ForkName::list_all().last().unwrap()

0 commit comments

Comments
 (0)