From 62126669a4ec83edbe022320218347f8cea4d155 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 13 May 2025 14:46:50 +0200 Subject: [PATCH] remove eof leftovers --- crates/cli/src/opts/build/core.rs | 9 ---- crates/common/fmt/src/eof.rs | 78 ------------------------------- crates/config/src/lib.rs | 26 ----------- crates/forge/tests/cli/config.rs | 3 -- crates/forge/tests/cli/eof.rs | 25 ---------- crates/forge/tests/cli/main.rs | 1 - 6 files changed, 142 deletions(-) delete mode 100644 crates/common/fmt/src/eof.rs delete mode 100644 crates/forge/tests/cli/eof.rs diff --git a/crates/cli/src/opts/build/core.rs b/crates/cli/src/opts/build/core.rs index 652e3973d3276..dd7e49ec1c3ab 100644 --- a/crates/cli/src/opts/build/core.rs +++ b/crates/cli/src/opts/build/core.rs @@ -130,11 +130,6 @@ pub struct BuildOpts { #[serde(skip_serializing_if = "Option::is_none")] pub build_info_path: Option, - /// Whether to compile contracts to EOF bytecode. - #[arg(long)] - #[serde(skip)] - pub eof: bool, - /// Skip building files whose names contain the given filter. /// /// `test` and `script` are aliases for `.t.sol` and `.s.sol`. @@ -282,10 +277,6 @@ impl Provider for BuildOpts { dict.insert("revert_strings".to_string(), revert.to_string().into()); } - if self.eof { - dict.insert("eof".to_string(), true.into()); - } - Ok(Map::from([(Config::selected_profile(), dict)])) } } diff --git a/crates/common/fmt/src/eof.rs b/crates/common/fmt/src/eof.rs deleted file mode 100644 index 1527d42bb77bc..0000000000000 --- a/crates/common/fmt/src/eof.rs +++ /dev/null @@ -1,78 +0,0 @@ -use comfy_table::{modifiers::UTF8_ROUND_CORNERS, ContentArrangement, Table}; -use revm_primitives::{ - Eof, -}; -use std::fmt::{self, Write}; - -pub fn pretty_eof(eof: &Eof) -> Result { - let Eof { - header: - EofHeader { - types_size, - code_sizes, - container_sizes, - data_size, - sum_code_sizes: _, - sum_container_sizes: _, - }, - body: - EofBody { types_section, code_section, container_section, data_section, is_data_filled: _ }, - raw: _, - } = eof; - - let mut result = String::new(); - - let mut table = Table::new(); - table.apply_modifier(UTF8_ROUND_CORNERS); - table.add_row(vec!["type_size", &types_size.to_string()]); - table.add_row(vec!["num_code_sections", &code_sizes.len().to_string()]); - if !code_sizes.is_empty() { - table.add_row(vec!["code_sizes", &format!("{code_sizes:?}")]); - } - table.add_row(vec!["num_container_sections", &container_sizes.len().to_string()]); - if !container_sizes.is_empty() { - table.add_row(vec!["container_sizes", &format!("{container_sizes:?}")]); - } - table.add_row(vec!["data_size", &data_size.to_string()]); - - write!(result, "Header:\n{table}")?; - - if !code_section.is_empty() { - let mut table = Table::new(); - table.apply_modifier(UTF8_ROUND_CORNERS); - table.set_content_arrangement(ContentArrangement::Dynamic); - table.set_header(vec!["", "Inputs", "Outputs", "Max stack height", "Code"]); - for (idx, (code, type_section)) in code_section.iter().zip(types_section).enumerate() { - table.add_row(vec![ - &idx.to_string(), - &type_section.inputs.to_string(), - &type_section.outputs.to_string(), - &type_section.max_stack_size.to_string(), - &code.to_string(), - ]); - } - - write!(result, "\n\nCode sections:\n{table}")?; - } - - if !container_section.is_empty() { - let mut table = Table::new(); - table.apply_modifier(UTF8_ROUND_CORNERS); - table.set_content_arrangement(ContentArrangement::Dynamic); - for (idx, container) in container_section.iter().enumerate() { - table.add_row(vec![&idx.to_string(), &container.to_string()]); - } - - write!(result, "\n\nContainer sections:\n{table}")?; - } - - if !data_section.is_empty() { - let mut table = Table::new(); - table.apply_modifier(UTF8_ROUND_CORNERS); - table.set_content_arrangement(ContentArrangement::Dynamic); - table.add_row(vec![&data_section.to_string()]); - write!(result, "\n\nData section:\n{table}")?; - } - - Ok(result) -} diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 2abb5a04cb233..8be6dabc4e444 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -511,9 +511,6 @@ pub struct Config { /// Timeout for transactions in seconds. pub transaction_timeout: u64, - /// Use EOF-enabled solc for compilation. - pub eof: bool, - /// Warnings gathered when loading the Config. See [`WarningsProvider`] for more information. #[serde(rename = "__warnings", default, skip_serializing)] pub warnings: Vec, @@ -883,8 +880,6 @@ impl Config { config.libs.sort_unstable(); config.libs.dedup(); - config.sanitize_eof_settings(); - config } @@ -902,26 +897,6 @@ impl Config { } } - /// Adjusts settings if EOF compilation is enabled. - /// - /// This includes enabling optimizer, via_ir, eof_version and ensuring that evm_version is not - /// lower than Osaka. - pub fn sanitize_eof_settings(&mut self) { - if self.eof { - self.optimizer = Some(true); - self.normalize_optimizer_settings(); - - if self.eof_version.is_none() { - self.eof_version = Some(EofVersion::V1); - } - - self.via_ir = true; - if self.evm_version < EvmVersion::Osaka { - self.evm_version = EvmVersion::Osaka; - } - } - } - /// Returns the directory in which dependencies should be installed /// /// Returns the first dir from `libs` that is not `node_modules` or `lib` if `libs` is empty @@ -2438,7 +2413,6 @@ impl Default for Config { transaction_timeout: 120, additional_compiler_profiles: Default::default(), compilation_restrictions: Default::default(), - eof: false, script_execution_protection: true, _non_exhaustive: (), } diff --git a/crates/forge/tests/cli/config.rs b/crates/forge/tests/cli/config.rs index 41db96842d0ef..365b3b816ac52 100644 --- a/crates/forge/tests/cli/config.rs +++ b/crates/forge/tests/cli/config.rs @@ -169,7 +169,6 @@ forgetest!(can_extract_config_values, |prj, cmd| { transaction_timeout: 120, additional_compiler_profiles: Default::default(), compilation_restrictions: Default::default(), - eof: false, script_execution_protection: true, _non_exhaustive: (), }; @@ -1040,7 +1039,6 @@ assertions_revert = true legacy_assertions = false odyssey = false transaction_timeout = 120 -eof = false additional_compiler_profiles = [] compilation_restrictions = [] script_execution_protection = true @@ -1300,7 +1298,6 @@ exclude = [] "legacy_assertions": false, "odyssey": false, "transaction_timeout": 120, - "eof": false, "additional_compiler_profiles": [], "compilation_restrictions": [], "script_execution_protection": true diff --git a/crates/forge/tests/cli/eof.rs b/crates/forge/tests/cli/eof.rs deleted file mode 100644 index 0c422e5bf8e98..0000000000000 --- a/crates/forge/tests/cli/eof.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Ensure we can build and decode EOF bytecode. -forgetest_init!(test_build_with_eof, |prj, cmd| { - cmd.forge_fuse() - .args(["build", "src/Counter.sol", "--eof", "--use", "0.8.29"]) - .assert_success() - .stdout_eq(str![[r#" -[COMPILING_FILES] with [SOLC_VERSION] -[SOLC_VERSION] [ELAPSED] -Compiler run successful! - -"#]]); -}); - -// Ensure compiler fails if doesn't support EOFs but eof flag used. -forgetest_init!(test_unsupported_compiler, |prj, cmd| { - cmd.forge_fuse() - .args(["build", "src/Counter.sol", "--eof", "--use", "0.8.27"]) - .assert_failure() - .stderr_eq(str![[r#" -... -Error: Compiler run failed: -... - -"#]]); -}); diff --git a/crates/forge/tests/cli/main.rs b/crates/forge/tests/cli/main.rs index d48eae912c050..13367c85b9384 100644 --- a/crates/forge/tests/cli/main.rs +++ b/crates/forge/tests/cli/main.rs @@ -16,7 +16,6 @@ mod create; mod debug; mod doc; mod eip712; -mod eof; mod failure_assertions; mod geiger; mod inline_config;