Skip to content
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

chore: use EvmVersion::Cancun #6906

Merged
merged 4 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ foundry-test-utils = { path = "crates/test-utils" }

# solc & compilation utilities
foundry-block-explorers = { version = "0.2.0", default-features = false }
foundry-compilers = { version = "0.2.2", default-features = false }
foundry-compilers = { version = "0.2.3", default-features = false }

## revm
# no default features to avoid c-kzg
Expand Down
15 changes: 9 additions & 6 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use foundry_compilers::{
ConfigurableArtifacts, EvmVersion, Project, ProjectPathsConfig, Solc, SolcConfig,
};
use inflector::Inflector;
use once_cell::sync::Lazy;
use regex::Regex;
use revm_primitives::SpecId;
use semver::Version;
Expand All @@ -36,6 +35,7 @@ use std::{
fs,
path::{Path, PathBuf},
str::FromStr,
string::ToString,
};

// Macros useful for creating a figment.
Expand Down Expand Up @@ -396,11 +396,12 @@ pub struct Config {
}

/// Mapping of fallback standalone sections. See [`FallbackProfileProvider`]
pub static STANDALONE_FALLBACK_SECTIONS: Lazy<HashMap<&'static str, &'static str>> =
Lazy::new(|| HashMap::from([("invariant", "fuzz")]));
pub const STANDALONE_FALLBACK_SECTIONS: &[(&str, &str)] = &[("invariant", "fuzz")];

/// Deprecated keys.
pub static DEPRECATIONS: Lazy<HashMap<String, String>> = Lazy::new(|| HashMap::from([]));
/// Deprecated keys and their replacements.
///
/// See [Warning::DeprecatedKey]
pub const DEPRECATIONS: &[(&str, &str)] = &[("cancun", "evm_version = Cancun")];

impl Config {
/// The default profile: "default"
Expand Down Expand Up @@ -1534,7 +1535,9 @@ impl Config {
}
// merge special keys into config
for standalone_key in Config::STANDALONE_SECTIONS {
if let Some(fallback) = STANDALONE_FALLBACK_SECTIONS.get(standalone_key) {
if let Some((_, fallback)) =
STANDALONE_FALLBACK_SECTIONS.iter().find(|(key, _)| standalone_key == key)
{
figment = figment.merge(
provider
.fallback(standalone_key, fallback)
Expand Down
15 changes: 11 additions & 4 deletions crates/config/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,17 @@ impl<P: Provider> WarningsProvider<P> {
.unwrap_or_default()
.iter()
.flat_map(|(profile, dict)| dict.keys().map(move |key| format!("{profile}.{key}")))
.filter(|k| DEPRECATIONS.contains_key(k))
.map(|deprecated_key| Warning::DeprecatedKey {
old: deprecated_key.clone(),
new: DEPRECATIONS.get(&deprecated_key).unwrap().to_string(),
.filter_map(|key| {
DEPRECATIONS.iter().find_map(|(deprecated_key, new_value)| {
if key == *deprecated_key {
Some(Warning::DeprecatedKey {
old: deprecated_key.to_string(),
new: new_value.to_string(),
})
} else {
None
}
})
}),
);
Ok(out)
Expand Down
1 change: 1 addition & 0 deletions crates/config/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ pub fn evm_spec_id(evm_version: &EvmVersion) -> SpecId {
EvmVersion::London => SpecId::LONDON,
EvmVersion::Paris => SpecId::MERGE,
EvmVersion::Shanghai => SpecId::SHANGHAI,
EvmVersion::Cancun => SpecId::CANCUN,
}
}

Expand Down
Loading