Sitelet https://github.com/foundry-rs/compilers/commit/e6bd098a6b02ea7bb7b7df2acaf71dfafe03faed
Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Commit e6bd098

Browse files
authored
fix: normalize Vyper EVM version during input creation (#345)
## Summary `VyperInput::new()` was calling `sanitize_output_selection()` instead of `sanitize()`, which meant `normalize_evm_version()` was never invoked during input creation. This caused compilation failures when using EVM versions not supported by the Vyper compiler version. For example, using `osaka` (the new default in Foundry) with Vyper 0.4.3 would fail with: ``` Error: Compiler run failed: Location: <stdin> Unknown EVM version - 'osaka' ``` ## Fix Call `sanitize()` instead of `sanitize_output_selection()` in `VyperInput::new()`. The `sanitize()` method already calls both `sanitize_output_selection()` and `normalize_evm_version()`, so this ensures the EVM version is properly downgraded to the maximum supported by the Vyper version (e.g., `prague` for Vyper 0.4.3).
1 parent d86103b commit e6bd098

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

‎crates/artifacts/vyper/src/input.rs‎

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl VyperInput {
3131
}
3232
}
3333

34-
settings.sanitize_output_selection(version);
34+
settings.sanitize(version);
3535
Self { language: "Vyper".to_string(), sources: new_sources, interfaces, settings }
3636
}
3737

@@ -61,3 +61,47 @@ impl VyperInput {
6161
self
6262
}
6363
}
64+
65+
#[cfg(test)]
66+
mod tests {
67+
use super::*;
68+
use crate::VyperSettings;
69+
use foundry_compilers_artifacts_solc::EvmVersion;
70+
71+
#[test]
72+
fn normalizes_evm_version_on_creation() {
73+
// Vyper 0.4.3 only supports up to Prague, not Osaka
74+
let vyper_version = Version::new(0, 4, 3);
75+
let settings = VyperSettings { evm_version: Some(EvmVersion::Osaka), ..Default::default() };
76+
77+
let input = VyperInput::new(Sources::new(), settings, &vyper_version);
78+
79+
// Should be normalized to Prague (max supported by 0.4.3)
80+
assert_eq!(input.settings.evm_version, Some(EvmVersion::Prague));
81+
}
82+
83+
#[test]
84+
fn normalizes_evm_version_for_older_vyper() {
85+
// Vyper 0.3.7 only supports up to Paris
86+
let vyper_version = Version::new(0, 3, 7);
87+
let settings =
88+
VyperSettings { evm_version: Some(EvmVersion::Cancun), ..Default::default() };
89+
90+
let input = VyperInput::new(Sources::new(), settings, &vyper_version);
91+
92+
// Should be normalized to Paris (max supported by 0.3.7)
93+
assert_eq!(input.settings.evm_version, Some(EvmVersion::Paris));
94+
}
95+
96+
#[test]
97+
fn keeps_supported_evm_version() {
98+
let vyper_version = Version::new(0, 4, 3);
99+
let settings =
100+
VyperSettings { evm_version: Some(EvmVersion::Cancun), ..Default::default() };
101+
102+
let input = VyperInput::new(Sources::new(), settings, &vyper_version);
103+
104+
// Cancun is supported by 0.4.3, should remain unchanged
105+
assert_eq!(input.settings.evm_version, Some(EvmVersion::Cancun));
106+
}
107+
}

0 commit comments

Comments
 (0)