Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7f46db2
start defaulting to prague, add fix for blob handle scaling post cancun
zerosnacks May 20, 2025
3eb91bb
fix anvil test
zerosnacks May 20, 2025
9ed7285
switch to 0.8.30 for tests
zerosnacks May 20, 2025
e62c33b
Merge branch 'master' into zerosnacks/chore-activate-prague-hardfork
zerosnacks May 20, 2025
898c2eb
fix merge conflict
zerosnacks May 20, 2025
1eca04d
switch foundry-compilers to default to prague, small test fixes
zerosnacks May 21, 2025
cdac80d
Merge branch 'master' into zerosnacks/chore-activate-prague-hardfork
zerosnacks May 21, 2025
1dd0d54
Merge branch 'master' into zerosnacks/chore-activate-prague-hardfork
zerosnacks May 26, 2025
fff560a
add workaround for Vyper not yet supporting Prague
zerosnacks May 26, 2025
2ee2f17
fix issues
zerosnacks May 27, 2025
ac42452
fix tests, questionable gas difference and address difference
zerosnacks May 27, 2025
ca6259c
make prague explicit
zerosnacks May 27, 2025
ee7d074
fix clippy
zerosnacks May 27, 2025
4e9348a
merge in master, upgrade Anvil to Prague
zerosnacks May 27, 2025
d67eadb
Merge branch 'master' into zerosnacks/chore-activate-prague-hardfork
zerosnacks May 28, 2025
f8f3b1c
bump compilers version
zerosnacks May 28, 2025
9edcccf
bump to 0.16.3
zerosnacks May 28, 2025
bd039fd
Merge branch 'master' into zerosnacks/chore-activate-prague-hardfork
zerosnacks Jun 2, 2025
d4a76cb
pass in blob params, add normalize vyper evm version helper, fix sola…
zerosnacks Jun 2, 2025
d6c18ec
temporarily allow compilers git patch
zerosnacks Jun 2, 2025
0355cc2
bump to msrv 1.87 in line with foundry-compilers
zerosnacks Jun 2, 2025
dd270f8
bump compilers version
zerosnacks Jun 2, 2025
32811de
bump to foundry-compilers 0.17.1
zerosnacks Jun 2, 2025
372d89d
Merge branch 'master' into zerosnacks/chore-activate-prague-hardfork
zerosnacks Jun 2, 2025
c5d39b5
Merge branch 'master' into zerosnacks/chore-activate-prague-hardfork
zerosnacks Jun 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/anvil/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct NodeArgs {

/// The EVM hardfork to use.
///
/// Choose the hardfork by name, e.g. `cancun`, `shanghai`, `paris`, `london`, etc...
/// Choose the hardfork by name, e.g. `prague`, `cancun`, `shanghai`, `paris`, `london`, etc...
/// [default: latest]
#[arg(long)]
pub hardfork: Option<String>,
Expand Down
14 changes: 10 additions & 4 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,17 @@ impl Backend {

/// Returns [`BlobParams`] corresponding to the current spec.
pub fn blob_params(&self) -> BlobParams {
if self.env.read().evm_env.cfg_env.spec >= SpecId::PRAGUE {
BlobParams::prague()
} else {
BlobParams::cancun()
let spec_id = self.env.read().evm_env.cfg_env.spec;

if spec_id >= SpecId::OSAKA {
return BlobParams::osaka();
}

if spec_id >= SpecId::PRAGUE {
return BlobParams::prague();
}

BlobParams::cancun()
}

/// Returns an error if EIP1559 is not active (pre Berlin)
Expand Down
19 changes: 17 additions & 2 deletions crates/anvil/src/eth/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ pub fn calculate_next_block_base_fee(gas_used: u64, gas_limit: u64, base_fee: u6

/// An async service that takes care of the `FeeHistory` cache
pub struct FeeHistoryService {
/// Hardfork identifier
spec_id: SpecId,
/// incoming notifications about new blocks
new_blocks: NewBlockNotifications,
/// contains all fee history related entries
Expand All @@ -204,11 +206,18 @@ pub struct FeeHistoryService {

impl FeeHistoryService {
pub fn new(
spec_id: SpecId,
new_blocks: NewBlockNotifications,
cache: FeeHistoryCache,
storage_info: StorageInfo,
) -> Self {
Self { new_blocks, cache, fee_history_limit: MAX_FEE_HISTORY_CACHE_SIZE, storage_info }
Self {
spec_id,
new_blocks,
cache,
fee_history_limit: MAX_FEE_HISTORY_CACHE_SIZE,
storage_info,
}
}

/// Returns the configured history limit
Expand Down Expand Up @@ -245,7 +254,13 @@ impl FeeHistoryService {
let base_fee = header.base_fee_per_gas.map(|g| g as u128).unwrap_or_default();
let excess_blob_gas = header.excess_blob_gas.map(|g| g as u128);
let blob_gas_used = header.blob_gas_used.map(|g| g as u128);
let base_fee_per_blob_gas = header.blob_fee(BlobParams::cancun());

let base_fee_per_blob_gas = match self.spec_id {
SpecId::OSAKA => header.blob_fee(BlobParams::osaka()),
SpecId::PRAGUE => header.blob_fee(BlobParams::prague()),
_ => header.blob_fee(BlobParams::cancun()),
};

let mut item = FeeHistoryCacheItem {
base_fee,
gas_used_ratio: 0f64,
Expand Down
9 changes: 5 additions & 4 deletions crates/anvil/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ impl EthereumHardfork {
Self::GrayGlacier => 15050000,
Self::Paris => 15537394,
Self::Shanghai => 17034870,
Self::Cancun | Self::Latest => 19426587,
Self::Cancun => 19426587,
Self::Prague | Self::Latest => 22431084,
// TODO: add block after activation
Self::Prague | Self::PragueEOF => unreachable!(),
Self::PragueEOF => unreachable!(),
}
}
}
Expand Down Expand Up @@ -134,8 +135,8 @@ impl From<EthereumHardfork> for SpecId {
EthereumHardfork::GrayGlacier => Self::GRAY_GLACIER,
EthereumHardfork::Paris => Self::MERGE,
EthereumHardfork::Shanghai => Self::SHANGHAI,
EthereumHardfork::Cancun | EthereumHardfork::Latest => Self::CANCUN,
EthereumHardfork::Prague => Self::PRAGUE,
EthereumHardfork::Cancun => Self::CANCUN,
EthereumHardfork::Prague | EthereumHardfork::Latest => Self::PRAGUE,
// TODO: switch to latest after activation
// EOF is included in OSAKA from Revm 16.0.0
EthereumHardfork::PragueEOF => Self::OSAKA,
Expand Down
1 change: 1 addition & 0 deletions crates/anvil/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ pub async fn try_spawn(mut config: NodeConfig) -> Result<(EthApi, NodeHandle)> {

let fee_history_cache = Arc::new(Mutex::new(Default::default()));
let fee_history_service = FeeHistoryService::new(
backend.spec_id(),
backend.new_block_notifications(),
Arc::clone(&fee_history_cache),
StorageInfo::new(Arc::clone(&backend)),
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/tests/it/anvil_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ async fn can_get_node_info() {

let block_number = provider.get_block_number().await.unwrap();
let block = provider.get_block(BlockId::from(block_number)).await.unwrap().unwrap();
let hard_fork: &str = SpecId::CANCUN.into();
let hard_fork: &str = SpecId::PRAGUE.into();

let expected_node_info = NodeInfo {
current_block_number: 0_u64,
Expand Down
2 changes: 1 addition & 1 deletion crates/cast/src/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl RunArgs {
if evm_version.is_none() {
// if the block has the excess_blob_gas field, we assume it's a Cancun block
if block.header.excess_blob_gas.is_some() {
evm_version = Some(EvmVersion::Cancun);
evm_version = Some(EvmVersion::Prague);
}
}
apply_chain_and_block_specific_env_changes::<AnyNetwork>(env.as_env_mut(), block);
Expand Down
2 changes: 1 addition & 1 deletion crates/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ allow_paths = []
# additional solc include paths
include_paths = []
force = false
evm_version = 'shanghai'
evm_version = 'prague'
gas_reports = ['*']
gas_reports_ignore = []
## Sets the concrete solc version to use, this overrides the `auto_detect_solc` value
Expand Down
2 changes: 1 addition & 1 deletion crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ impl Default for Config {
allow_paths: vec![],
include_paths: vec![],
force: false,
evm_version: EvmVersion::Cancun,
evm_version: EvmVersion::Prague,
gas_reports: vec!["*".to_string()],
gas_reports_ignore: vec![],
gas_reports_include_tests: false,
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/tests/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ allow_paths = []
include_paths = []
skip = []
force = false
evm_version = "cancun"
evm_version = "prague"
gas_reports = ["*"]
gas_reports_ignore = []
gas_reports_include_tests = false
Expand Down Expand Up @@ -1143,7 +1143,7 @@ exclude = []
"include_paths": [],
"skip": [],
"force": false,
"evm_version": "cancun",
"evm_version": "prague",
"gas_reports": [
"*"
],
Expand Down
Loading