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 1 commit
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
11 changes: 5 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 Down Expand Up @@ -397,14 +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 and their replacements.
///
/// See [Warning::DeprecatedKey]
pub static DEPRECATIONS: Lazy<HashMap<String, String>> =
Lazy::new(|| HashMap::from([("cancun".to_string(), "evm_version = Cancun".to_string())]));
pub const DEPRECATIONS: &[(&str, &str)] = &[("cancun", "evm_version = Cancun")];

impl Config {
/// The default profile: "default"
Expand Down Expand Up @@ -1538,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, fallback)| key == fallback)
{
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
Loading