Skip to content

Commit

Permalink
fix(primitives): remove Hardfork::Eip150, Eip158 (#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Jan 19, 2023
1 parent d0e3741 commit 78ffd0a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
3 changes: 1 addition & 2 deletions crates/executor/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ pub fn revm_spec(chain_spec: &ChainSpec, for_block: BlockNumber) -> revm::SpecId
b if chain_spec.fork_active(Hardfork::Petersburg, b) => revm::PETERSBURG,
b if chain_spec.fork_active(Hardfork::Byzantium, b) => revm::BYZANTIUM,
b if chain_spec.fork_active(Hardfork::SpuriousDragon, b) => revm::SPURIOUS_DRAGON,
b if chain_spec.fork_active(Hardfork::Eip150, b) => revm::TANGERINE,
b if chain_spec.fork_active(Hardfork::Eip158, b) => revm::TANGERINE,
b if chain_spec.fork_active(Hardfork::Tangerine, b) => revm::TANGERINE,
b if chain_spec.fork_active(Hardfork::Homestead, b) => revm::HOMESTEAD,
b if chain_spec.fork_active(Hardfork::Frontier, b) => revm::FRONTIER,
_ => panic!("wrong configuration"),
Expand Down
14 changes: 5 additions & 9 deletions crates/primitives/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ pub static MAINNET: Lazy<ChainSpec> = Lazy::new(|| ChainSpec {
(Hardfork::Frontier, 0),
(Hardfork::Homestead, 1150000),
(Hardfork::Dao, 1920000),
(Hardfork::Eip150, 2463000),
(Hardfork::Eip158, 2463000),
(Hardfork::Tangerine, 2463000),
(Hardfork::SpuriousDragon, 2675000),
(Hardfork::Byzantium, 4370000),
(Hardfork::Constantinople, 7280000),
Expand Down Expand Up @@ -201,8 +200,7 @@ impl From<EthersGenesis> for ChainSpec {
let hardfork_opts = vec![
(Hardfork::Homestead, genesis.config.homestead_block),
(Hardfork::Dao, genesis.config.dao_fork_block),
(Hardfork::Eip150, genesis.config.eip150_block),
(Hardfork::Eip158, genesis.config.eip158_block),
(Hardfork::Tangerine, genesis.config.eip150_block),
(Hardfork::SpuriousDragon, genesis.config.eip155_block),
(Hardfork::Byzantium, genesis.config.byzantium_block),
(Hardfork::Constantinople, genesis.config.constantinople_block),
Expand Down Expand Up @@ -300,8 +298,7 @@ impl ChainSpecBuilder {
/// Enables Tangerine
pub fn tangerine_whistle_activated(mut self) -> Self {
self = self.homestead_activated();
self.hardforks.insert(Hardfork::Eip150, 0);
self.hardforks.insert(Hardfork::Eip158, 0);
self.hardforks.insert(Hardfork::Tangerine, 0);
self
}

Expand Down Expand Up @@ -440,8 +437,7 @@ mod tests {
.genesis_hash(empty_sealed.hash())
.with_fork(Hardfork::Frontier, 0)
.with_fork(Hardfork::Homestead, 0)
.with_fork(Hardfork::Eip150, 0)
.with_fork(Hardfork::Eip158, 0)
.with_fork(Hardfork::Tangerine, 0)
.with_fork(Hardfork::SpuriousDragon, 0)
.with_fork(Hardfork::Byzantium, 0)
.with_fork(Hardfork::Constantinople, 0)
Expand Down Expand Up @@ -481,7 +477,7 @@ mod tests {
.genesis_hash(empty_sealed.hash())
.with_fork(Hardfork::Frontier, 0)
.with_fork(Hardfork::Homestead, 1)
.with_fork(Hardfork::Eip150, 1)
.with_fork(Hardfork::Tangerine, 1)
.build();

assert_eq!(unique_spec.fork_id(2), duplicate_spec.fork_id(2));
Expand Down
26 changes: 12 additions & 14 deletions crates/primitives/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub enum Hardfork {
Frontier,
Homestead,
Dao,
Eip150,
Eip158,
Tangerine,
SpuriousDragon,
Byzantium,
Constantinople,
Expand Down Expand Up @@ -86,19 +85,18 @@ impl FromStr for Hardfork {
"frontier" | "1" => Hardfork::Frontier,
"homestead" | "2" => Hardfork::Homestead,
"dao" | "3" => Hardfork::Dao,
"eip150" | "4" => Hardfork::Eip150,
"eip158" | "5" => Hardfork::Eip158,
"spuriousdragon" | "6" => Hardfork::SpuriousDragon,
"byzantium" | "7" => Hardfork::Byzantium,
"constantinople" | "8" => Hardfork::Constantinople,
"petersburg" | "9" => Hardfork::Petersburg,
"istanbul" | "10" => Hardfork::Istanbul,
"muirglacier" | "11" => Hardfork::Muirglacier,
"berlin" | "12" => Hardfork::Berlin,
"london" | "13" => Hardfork::London,
"arrowglacier" | "14" => Hardfork::ArrowGlacier,
"tangerine" | "4" => Hardfork::Tangerine,
"spuriousdragon" | "5" => Hardfork::SpuriousDragon,
"byzantium" | "6" => Hardfork::Byzantium,
"constantinople" | "7" => Hardfork::Constantinople,
"petersburg" | "8" => Hardfork::Petersburg,
"istanbul" | "9" => Hardfork::Istanbul,
"muirglacier" | "10" => Hardfork::Muirglacier,
"berlin" | "11" => Hardfork::Berlin,
"london" | "12" => Hardfork::London,
"arrowglacier" | "13" => Hardfork::ArrowGlacier,
"grayglacier" => Hardfork::GrayGlacier,
"latest" | "15" => Hardfork::Latest,
"latest" | "14" => Hardfork::Latest,
_ => return Err(format!("Unknown hardfork {s}")),
};
Ok(hardfork)
Expand Down

0 comments on commit 78ffd0a

Please sign in to comment.