Skip to content

Commit 665fc04

Browse files
authored
chore: activate prague hardfork and Solidity version 0.8.30 as default (#10565)
* start defaulting to prague, add fix for blob handle scaling post cancun * fix anvil test * switch to 0.8.30 for tests * switch foundry-compilers to default to prague, small test fixes * add workaround for Vyper not yet supporting Prague * fix issues * fix tests, questionable gas difference and address difference * make prague explicit * fix clippy * bump compilers version * bump to 0.16.3 * pass in blob params, add normalize vyper evm version helper, fix solar iter 0.1.4 * temporarily allow compilers git patch * bump to msrv 1.87 in line with foundry-compilers * bump compilers version * bump to foundry-compilers 0.17.1
1 parent 132cb13 commit 665fc04

File tree

22 files changed

+275
-234
lines changed

22 files changed

+275
-234
lines changed

Cargo.lock

Lines changed: 176 additions & 175 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ resolver = "2"
3131
version = "1.2.2"
3232
edition = "2021"
3333
# Remember to update clippy.toml as well
34-
rust-version = "1.86"
34+
rust-version = "1.87"
3535
authors = ["Foundry Contributors"]
3636
license = "MIT OR Apache-2.0"
3737
homepage = "https://github.com/foundry-rs/foundry"
@@ -198,14 +198,14 @@ foundry-wallets = { path = "crates/wallets" }
198198
foundry-linking = { path = "crates/linking" }
199199

200200
# solc & compilation utilities
201-
foundry-block-explorers = { version = "0.17.0", default-features = false }
202-
foundry-compilers = { version = "0.16.1", default-features = false }
201+
foundry-block-explorers = { version = "0.18.0", default-features = false }
202+
foundry-compilers = { version = "0.17.1", default-features = false }
203203
foundry-fork-db = "0.15"
204204
solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" }
205-
solar-ast = { version = "=0.1.3", default-features = false }
206-
solar-parse = { version = "=0.1.3", default-features = false }
207-
solar-interface = { version = "=0.1.3", default-features = false }
208-
solar-sema = { version = "=0.1.3", default-features = false }
205+
solar-ast = { version = "=0.1.4", default-features = false }
206+
solar-parse = { version = "=0.1.4", default-features = false }
207+
solar-interface = { version = "=0.1.4", default-features = false }
208+
solar-sema = { version = "=0.1.4", default-features = false }
209209

210210
## alloy
211211
alloy-consensus = { version = "1.0.7", default-features = false }
@@ -401,4 +401,5 @@ zip-extract = "=0.2.1"
401401
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors.git", rev = "a625c04" }
402402

403403
## foundry
404+
# foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", rev = "855dee4" }
404405
# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "811a61a" }

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
msrv = "1.86"
1+
msrv = "1.87"
22

33
# `bytes::Bytes` is included by default and `alloy_primitives::Bytes` is a wrapper around it,
44
# so it is safe to ignore it as well.

crates/anvil/src/eth/backend/mem/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,11 +780,17 @@ impl Backend {
780780

781781
/// Returns [`BlobParams`] corresponding to the current spec.
782782
pub fn blob_params(&self) -> BlobParams {
783-
if self.env.read().evm_env.cfg_env.spec >= SpecId::PRAGUE {
784-
BlobParams::prague()
785-
} else {
786-
BlobParams::cancun()
783+
let spec_id = self.env.read().evm_env.cfg_env.spec;
784+
785+
if spec_id >= SpecId::OSAKA {
786+
return BlobParams::osaka();
787787
}
788+
789+
if spec_id >= SpecId::PRAGUE {
790+
return BlobParams::prague();
791+
}
792+
793+
BlobParams::cancun()
788794
}
789795

790796
/// Returns an error if EIP1559 is not active (pre Berlin)

crates/anvil/src/eth/fees.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ pub fn calculate_next_block_base_fee(gas_used: u64, gas_limit: u64, base_fee: u6
192192

193193
/// An async service that takes care of the `FeeHistory` cache
194194
pub struct FeeHistoryService {
195+
/// blob parameters for the current spec
196+
blob_params: BlobParams,
195197
/// incoming notifications about new blocks
196198
new_blocks: NewBlockNotifications,
197199
/// contains all fee history related entries
@@ -204,11 +206,18 @@ pub struct FeeHistoryService {
204206

205207
impl FeeHistoryService {
206208
pub fn new(
209+
blob_params: BlobParams,
207210
new_blocks: NewBlockNotifications,
208211
cache: FeeHistoryCache,
209212
storage_info: StorageInfo,
210213
) -> Self {
211-
Self { new_blocks, cache, fee_history_limit: MAX_FEE_HISTORY_CACHE_SIZE, storage_info }
214+
Self {
215+
blob_params,
216+
new_blocks,
217+
cache,
218+
fee_history_limit: MAX_FEE_HISTORY_CACHE_SIZE,
219+
storage_info,
220+
}
212221
}
213222

214223
/// Returns the configured history limit
@@ -245,7 +254,8 @@ impl FeeHistoryService {
245254
let base_fee = header.base_fee_per_gas.map(|g| g as u128).unwrap_or_default();
246255
let excess_blob_gas = header.excess_blob_gas.map(|g| g as u128);
247256
let blob_gas_used = header.blob_gas_used.map(|g| g as u128);
248-
let base_fee_per_blob_gas = header.blob_fee(BlobParams::cancun());
257+
let base_fee_per_blob_gas = header.blob_fee(self.blob_params);
258+
249259
let mut item = FeeHistoryCacheItem {
250260
base_fee,
251261
gas_used_ratio: 0f64,

crates/anvil/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ use crate::{
1919
shutdown::Signal,
2020
tasks::TaskManager,
2121
};
22+
use alloy_eips::eip7840::BlobParams;
2223
use alloy_primitives::{Address, U256};
2324
use alloy_signer_local::PrivateKeySigner;
2425
use eth::backend::fork::ClientFork;
2526
use eyre::Result;
2627
use foundry_common::provider::{ProviderBuilder, RetryProvider};
2728
use futures::{FutureExt, TryFutureExt};
2829
use parking_lot::Mutex;
30+
use revm::primitives::hardfork::SpecId;
2931
use server::try_spawn_ipc;
3032
use std::{
3133
future::Future,
@@ -198,6 +200,11 @@ pub async fn try_spawn(mut config: NodeConfig) -> Result<(EthApi, NodeHandle)> {
198200

199201
let fee_history_cache = Arc::new(Mutex::new(Default::default()));
200202
let fee_history_service = FeeHistoryService::new(
203+
match backend.spec_id() {
204+
SpecId::OSAKA => BlobParams::osaka(),
205+
SpecId::PRAGUE => BlobParams::prague(),
206+
_ => BlobParams::cancun(),
207+
},
201208
backend.new_block_notifications(),
202209
Arc::clone(&fee_history_cache),
203210
StorageInfo::new(Arc::clone(&backend)),

crates/cast/src/cmd/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl RunArgs {
165165
if evm_version.is_none() {
166166
// if the block has the excess_blob_gas field, we assume it's a Cancun block
167167
if block.header.excess_blob_gas.is_some() {
168-
evm_version = Some(EvmVersion::Cancun);
168+
evm_version = Some(EvmVersion::Prague);
169169
}
170170
}
171171
apply_chain_and_block_specific_env_changes::<AnyNetwork>(env.as_env_mut(), block);

crates/cast/tests/cli/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ contract CounterInExternalLibScript is Script {
23292329
...
23302330
Traces:
23312331
[..] → new <unknown>@0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
2332-
├─ [..] 0x52F3e85EC3F0f9D0a2200D646482fcD134D5adc9::updateCounterInExternalLib(0, 100) [delegatecall]
2332+
├─ [..] 0x6fD8bf6770F4bEe578348D24028000cE9c4D2bB9::updateCounterInExternalLib(0, 100) [delegatecall]
23332333
│ └─ ← [Stop]
23342334
└─ ← [Return] 62 bytes of code
23352335

crates/common/src/preprocessor/deps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<'hir> Visit<'hir> for BytecodeDependencyCollector<'hir> {
234234
for &var in clause.args {
235235
self.visit_nested_var(var)?;
236236
}
237-
for stmt in clause.block {
237+
for stmt in clause.block.stmts {
238238
self.visit_stmt(stmt)?;
239239
}
240240
}

crates/config/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ allow_paths = []
7979
# additional solc include paths
8080
include_paths = []
8181
force = false
82-
evm_version = 'shanghai'
82+
evm_version = 'prague'
8383
gas_reports = ['*']
8484
gas_reports_ignore = []
8585
## Sets the concrete solc version to use, this overrides the `auto_detect_solc` value

crates/config/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub mod soldeer;
118118
use soldeer::{SoldeerConfig, SoldeerDependencyConfig};
119119

120120
mod vyper;
121-
use vyper::VyperConfig;
121+
pub use vyper::{normalize_evm_version_vyper, VyperConfig};
122122

123123
mod bind_json;
124124
use bind_json::BindJsonConfig;
@@ -1549,7 +1549,7 @@ impl Config {
15491549
/// - evm version
15501550
pub fn vyper_settings(&self) -> Result<VyperSettings, SolcError> {
15511551
Ok(VyperSettings {
1552-
evm_version: Some(self.evm_version),
1552+
evm_version: Some(normalize_evm_version_vyper(self.evm_version)),
15531553
optimize: self.vyper.optimize,
15541554
bytecode_metadata: None,
15551555
// TODO: We don't yet have a way to deserialize other outputs correctly, so request only
@@ -2315,7 +2315,7 @@ impl Default for Config {
23152315
allow_paths: vec![],
23162316
include_paths: vec![],
23172317
force: false,
2318-
evm_version: EvmVersion::Cancun,
2318+
evm_version: EvmVersion::Prague,
23192319
gas_reports: vec!["*".to_string()],
23202320
gas_reports_ignore: vec![],
23212321
gas_reports_include_tests: false,

crates/config/src/vyper.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Vyper specific configuration types.
22
3-
use foundry_compilers::artifacts::vyper::VyperOptimizationMode;
3+
use foundry_compilers::artifacts::{vyper::VyperOptimizationMode, EvmVersion};
44
use serde::{Deserialize, Serialize};
55
use std::path::PathBuf;
66

@@ -16,3 +16,13 @@ pub struct VyperConfig {
1616
#[serde(default, skip_serializing_if = "Option::is_none")]
1717
pub experimental_codegen: Option<bool>,
1818
}
19+
20+
/// Vyper does not yet support the Prague EVM version, so we normalize it to Cancun.
21+
/// This is a temporary workaround until Vyper supports Prague.
22+
pub fn normalize_evm_version_vyper(evm_version: EvmVersion) -> EvmVersion {
23+
if evm_version >= EvmVersion::Prague {
24+
return EvmVersion::Cancun;
25+
}
26+
27+
evm_version
28+
}

crates/forge/src/cmd/compiler.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clap::{Parser, Subcommand, ValueHint};
22
use eyre::Result;
33
use foundry_common::shell;
44
use foundry_compilers::{artifacts::EvmVersion, Graph};
5-
use foundry_config::Config;
5+
use foundry_config::{normalize_evm_version_vyper, Config};
66
use semver::Version;
77
use serde::Serialize;
88
use std::{collections::BTreeMap, path::PathBuf};
@@ -93,11 +93,16 @@ impl ResolveArgs {
9393
.collect();
9494

9595
let evm_version = if shell::verbosity() > 1 {
96-
Some(
97-
EvmVersion::default()
98-
.normalize_version_solc(version)
99-
.unwrap_or_default(),
100-
)
96+
let evm = EvmVersion::default()
97+
.normalize_version_solc(version)
98+
.unwrap_or_default();
99+
100+
// Vyper does not yet support Prague, so we normalize it to Cancun.
101+
if language.is_vyper() {
102+
Some(normalize_evm_version_vyper(evm))
103+
} else {
104+
Some(evm)
105+
}
101106
} else {
102107
None
103108
};

crates/forge/tests/cli/cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3673,7 +3673,7 @@ forgetest_init!(can_inspect_standard_json, |prj, cmd| {
36733673
]
36743674
}
36753675
},
3676-
"evmVersion": "cancun",
3676+
"evmVersion": "prague",
36773677
"viaIR": false,
36783678
"libraries": {}
36793679
}

crates/forge/tests/cli/compiler.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ contract ContractB {}
1818

1919
const CONTRACT_C: &str = r#"
2020
// SPDX-license-identifier: MIT
21-
pragma solidity 0.8.27;
21+
pragma solidity 0.8.30;
2222
2323
contract ContractC {}
2424
"#;
2525

2626
const CONTRACT_D: &str = r#"
2727
// SPDX-license-identifier: MIT
28-
pragma solidity 0.8.27;
28+
pragma solidity 0.8.30;
2929
3030
contract ContractD {}
3131
"#;
@@ -111,7 +111,7 @@ forgetest!(can_list_resolved_compiler_versions_verbose, |prj, cmd| {
111111
cmd.args(["compiler", "resolve", "-v"]).assert_success().stdout_eq(str![[r#"
112112
Solidity:
113113
114-
0.8.27:
114+
0.8.30:
115115
├── src/ContractC.sol
116116
└── src/ContractD.sol
117117
@@ -128,7 +128,7 @@ forgetest!(can_list_resolved_compiler_versions_verbose_json, |prj, cmd| {
128128
{
129129
"Solidity": [
130130
{
131-
"version": "0.8.27",
131+
"version": "0.8.30",
132132
"paths": [
133133
"src/ContractC.sol",
134134
"src/ContractD.sol"
@@ -153,7 +153,7 @@ forgetest!(can_list_resolved_multiple_compiler_versions, |prj, cmd| {
153153
Solidity:
154154
- 0.8.4
155155
- 0.8.11
156-
- 0.8.27
156+
- 0.8.30
157157
158158
Vyper:
159159
- 0.4.0
@@ -198,7 +198,7 @@ forgetest!(can_list_resolved_multiple_compiler_versions_skipped_json, |prj, cmd|
198198
{
199199
"Solidity": [
200200
{
201-
"version": "0.8.27",
201+
"version": "0.8.30",
202202
"paths": [
203203
"src/ContractD.sol"
204204
]
@@ -236,7 +236,7 @@ Solidity:
236236
0.8.11 (<= london):
237237
└── src/ContractB.sol
238238
239-
0.8.27 (<= [..]):
239+
0.8.30 (<= prague):
240240
├── src/ContractC.sol
241241
└── src/ContractD.sol
242242
@@ -277,7 +277,7 @@ forgetest!(can_list_resolved_multiple_compiler_versions_verbose_json, |prj, cmd|
277277
]
278278
},
279279
{
280-
"version": "0.8.27",
280+
"version": "0.8.30",
281281
"evm_version": "[..]",
282282
"paths": [
283283
"src/ContractC.sol",

crates/forge/tests/cli/config.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ allow_paths = []
983983
include_paths = []
984984
skip = []
985985
force = false
986-
evm_version = "cancun"
986+
evm_version = "prague"
987987
gas_reports = ["*"]
988988
gas_reports_ignore = []
989989
gas_reports_include_tests = false
@@ -1146,7 +1146,7 @@ exclude = []
11461146
"include_paths": [],
11471147
"skip": [],
11481148
"force": false,
1149-
"evm_version": "cancun",
1149+
"evm_version": "prague",
11501150
"gas_reports": [
11511151
"*"
11521152
],
@@ -1712,7 +1712,7 @@ contract Counter {
17121712
let v1_profile = SettingsOverrides {
17131713
name: "v1".to_string(),
17141714
via_ir: Some(true),
1715-
evm_version: Some(EvmVersion::Cancun),
1715+
evm_version: Some(EvmVersion::Prague),
17161716
optimizer: None,
17171717
optimizer_runs: Some(44444444),
17181718
bytecode_hash: None,
@@ -1798,19 +1798,19 @@ contract Counter {
17981798

17991799
let (via_ir, evm_version, enabled, runs) = artifact_settings("Counter.sol/Counter.json");
18001800
assert_eq!(None, via_ir);
1801-
assert_eq!("\"cancun\"", evm_version.unwrap().to_string());
1801+
assert_eq!("\"prague\"", evm_version.unwrap().to_string());
18021802
assert_eq!("false", enabled.unwrap().to_string());
18031803
assert_eq!("200", runs.unwrap().to_string());
18041804

18051805
let (via_ir, evm_version, enabled, runs) = artifact_settings("v1/Counter.sol/Counter.json");
18061806
assert_eq!("true", via_ir.unwrap().to_string());
1807-
assert_eq!("\"cancun\"", evm_version.unwrap().to_string());
1807+
assert_eq!("\"prague\"", evm_version.unwrap().to_string());
18081808
assert_eq!("true", enabled.unwrap().to_string());
18091809
assert_eq!("44444444", runs.unwrap().to_string());
18101810

18111811
let (via_ir, evm_version, enabled, runs) = artifact_settings("v2/Counter.sol/Counter.json");
18121812
assert_eq!("true", via_ir.unwrap().to_string());
1813-
assert_eq!("\"cancun\"", evm_version.unwrap().to_string());
1813+
assert_eq!("\"prague\"", evm_version.unwrap().to_string());
18141814
assert_eq!("true", enabled.unwrap().to_string());
18151815
assert_eq!("111", runs.unwrap().to_string());
18161816

crates/forge/tests/cli/script.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2576,7 +2576,7 @@ Chain 31337
25762576
25772577
accessList []
25782578
chainId 31337
2579-
gasLimit 228231
2579+
gasLimit [..]
25802580
gasPrice
25812581
input [..]
25822582
maxFeePerBlobGas

0 commit comments

Comments
 (0)