-
Notifications
You must be signed in to change notification settings - Fork 2.4k
refactor: move evm-spec-id to config #5786
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,12 @@ | |
|
|
||
| use crate::Config; | ||
| use ethers_core::types::{serde_helpers::Numeric, U256}; | ||
| use ethers_solc::remappings::{Remapping, RemappingError}; | ||
| use ethers_solc::{ | ||
| remappings::{Remapping, RemappingError}, | ||
| EvmVersion, | ||
| }; | ||
| use figment::value::Value; | ||
| use revm_primitives::SpecId; | ||
| use serde::{de::Error, Deserialize, Deserializer}; | ||
| use std::{ | ||
| path::{Path, PathBuf}, | ||
|
|
@@ -255,6 +259,24 @@ where | |
| Ok(num) | ||
| } | ||
|
|
||
| /// Returns the [SpecId] derived from [EvmVersion] | ||
| #[inline] | ||
| pub fn evm_spec_id(evm_version: &EvmVersion) -> SpecId { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrapped this in a simple util function, and we use this on config |
||
| match evm_version { | ||
| EvmVersion::Homestead => SpecId::HOMESTEAD, | ||
| EvmVersion::TangerineWhistle => SpecId::TANGERINE, | ||
| EvmVersion::SpuriousDragon => SpecId::SPURIOUS_DRAGON, | ||
| EvmVersion::Byzantium => SpecId::BYZANTIUM, | ||
| EvmVersion::Constantinople => SpecId::CONSTANTINOPLE, | ||
| EvmVersion::Petersburg => SpecId::PETERSBURG, | ||
| EvmVersion::Istanbul => SpecId::ISTANBUL, | ||
| EvmVersion::Berlin => SpecId::BERLIN, | ||
| EvmVersion::London => SpecId::LONDON, | ||
| EvmVersion::Paris => SpecId::MERGE, | ||
| EvmVersion::Shanghai => SpecId::SHANGHAI, | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use crate::get_available_profiles; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| use ethers::{ | ||
| abi::{Abi, FixedBytes, Function}, | ||
| solc::EvmVersion, | ||
| types::{Block, Chain, H256, U256}, | ||
| }; | ||
| use eyre::ContextCompat; | ||
|
|
@@ -112,24 +111,6 @@ pub fn halt_to_instruction_result(halt: Halt) -> InstructionResult { | |
| } | ||
| } | ||
|
|
||
| /// Converts an `EvmVersion` into a `SpecId`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed this as this was duped from this pr onwards |
||
| #[inline] | ||
| pub fn evm_spec(evm: EvmVersion) -> SpecId { | ||
| match evm { | ||
| EvmVersion::Homestead => SpecId::HOMESTEAD, | ||
| EvmVersion::TangerineWhistle => SpecId::TANGERINE, | ||
| EvmVersion::SpuriousDragon => SpecId::SPURIOUS_DRAGON, | ||
| EvmVersion::Byzantium => SpecId::BYZANTIUM, | ||
| EvmVersion::Constantinople => SpecId::CONSTANTINOPLE, | ||
| EvmVersion::Petersburg => SpecId::PETERSBURG, | ||
| EvmVersion::Istanbul => SpecId::ISTANBUL, | ||
| EvmVersion::Berlin => SpecId::BERLIN, | ||
| EvmVersion::London => SpecId::LONDON, | ||
| EvmVersion::Paris => SpecId::MERGE, | ||
| EvmVersion::Shanghai => SpecId::SHANGHAI, | ||
| } | ||
| } | ||
|
|
||
| /// Depending on the configured chain id and block number this should apply any specific changes | ||
| /// | ||
| /// This checks for: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.