diff --git a/crates/artifacts/solc/src/lib.rs b/crates/artifacts/solc/src/lib.rs index 5d32d8a52..9ddcccc6a 100644 --- a/crates/artifacts/solc/src/lib.rs +++ b/crates/artifacts/solc/src/lib.rs @@ -40,7 +40,7 @@ use foundry_compilers_core::{ error::SolcError, utils::{ strip_prefix_owned, BERLIN_SOLC, BYZANTIUM_SOLC, CANCUN_SOLC, CONSTANTINOPLE_SOLC, - ISTANBUL_SOLC, LONDON_SOLC, PARIS_SOLC, PETERSBURG_SOLC, SHANGHAI_SOLC, + ISTANBUL_SOLC, LONDON_SOLC, PARIS_SOLC, PETERSBURG_SOLC, PRAGUE_SOLC, SHANGHAI_SOLC, }, }; pub use serde_helpers::{deserialize_bytes, deserialize_opt_bytes}; @@ -813,6 +813,7 @@ pub enum EvmVersion { Shanghai, #[default] Cancun, + Prague, } impl EvmVersion { @@ -822,8 +823,10 @@ impl EvmVersion { if *version >= BYZANTIUM_SOLC { // If the Solc version is the latest, it supports all EVM versions. // For all other cases, cap at the at-the-time highest possible fork. - let normalized = if *version >= CANCUN_SOLC { + let normalized = if *version >= PRAGUE_SOLC { self + } else if self >= Self::Cancun && *version >= CANCUN_SOLC { + Self::Cancun } else if self >= Self::Shanghai && *version >= SHANGHAI_SOLC { Self::Shanghai } else if self >= Self::Paris && *version >= PARIS_SOLC { @@ -864,6 +867,7 @@ impl EvmVersion { Self::Paris => "paris", Self::Shanghai => "shanghai", Self::Cancun => "cancun", + Self::Prague => "prague", } } @@ -932,6 +936,7 @@ impl FromStr for EvmVersion { "paris" => Ok(Self::Paris), "shanghai" => Ok(Self::Shanghai), "cancun" => Ok(Self::Cancun), + "prague" => Ok(Self::Prague), s => Err(format!("Unknown evm version: {s}")), } } @@ -2004,6 +2009,12 @@ mod tests { ("0.8.24", EvmVersion::Homestead, Some(EvmVersion::Homestead)), ("0.8.24", EvmVersion::Shanghai, Some(EvmVersion::Shanghai)), ("0.8.24", EvmVersion::Cancun, Some(EvmVersion::Cancun)), + // Prague + ("0.8.26", EvmVersion::Homestead, Some(EvmVersion::Homestead)), + ("0.8.26", EvmVersion::Shanghai, Some(EvmVersion::Shanghai)), + ("0.8.26", EvmVersion::Cancun, Some(EvmVersion::Cancun)), + ("0.8.26", EvmVersion::Prague, Some(EvmVersion::Cancun)), + ("0.8.27", EvmVersion::Prague, Some(EvmVersion::Prague)), ] { let version = Version::from_str(solc_version).unwrap(); assert_eq!( diff --git a/crates/core/src/utils.rs b/crates/core/src/utils.rs index 584f3fbf0..877d2d9fd 100644 --- a/crates/core/src/utils.rs +++ b/crates/core/src/utils.rs @@ -85,6 +85,11 @@ pub const SHANGHAI_SOLC: Version = Version::new(0, 8, 20); /// pub const CANCUN_SOLC: Version = Version::new(0, 8, 24); +/// Prague support +/// +/// Was merged between 0.8.26 and 0.8.27, so we are expecting it to be available in 0.8.27 +pub const PRAGUE_SOLC: Version = Version::new(0, 8, 27); + // `--base-path` was introduced in 0.6.9 pub static SUPPORTS_BASE_PATH: Lazy = Lazy::new(|| VersionReq::parse(">=0.6.9").unwrap());