Skip to content

chore: clean up unused EOF code #10715

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

Merged
merged 13 commits into from
Jun 19, 2025
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
62 changes: 29 additions & 33 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ foundry-linking = { path = "crates/linking" }

# solc & compilation utilities
foundry-block-explorers = { version = "0.18.0", default-features = false }
foundry-compilers = { version = "0.17.1", default-features = false }
foundry-compilers = { version = "0.17.3", default-features = false }
foundry-fork-db = "0.15"
solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" }
solar-ast = { version = "=0.1.4", default-features = false }
Expand Down Expand Up @@ -406,5 +406,5 @@ zip-extract = "=0.2.1"
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors.git", rev = "a625c04" }

## foundry
# foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", rev = "855dee4" }
# foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", rev = "e4a9b04" }
# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "811a61a" }
21 changes: 12 additions & 9 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3412,6 +3412,8 @@ enum GasEstimationCallResult {
}

/// Converts the result of a call to revm EVM into a [`GasEstimationCallResult`].
///
/// Expected to stay up to date with: <https://github.com/bluealloy/revm/blob/main/crates/interpreter/src/instruction_result.rs>
impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEstimationCallResult {
type Error = BlockchainError;

Expand All @@ -3425,20 +3427,26 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
Ok((exit, output, gas, _)) => match exit {
return_ok!() | InstructionResult::CallOrCreate => Ok(Self::Success(gas)),

// Revert opcodes:
InstructionResult::Revert => Ok(Self::Revert(output.map(|o| o.into_data()))),
InstructionResult::CallTooDeep |
InstructionResult::OutOfFunds |
InstructionResult::CreateInitCodeStartingEF00 |
InstructionResult::InvalidEOFInitCode |
InstructionResult::InvalidExtDelegateCallTarget => Ok(Self::EvmError(exit)),

// Out of gas errors:
InstructionResult::OutOfGas |
InstructionResult::MemoryOOG |
InstructionResult::MemoryLimitOOG |
InstructionResult::PrecompileOOG |
InstructionResult::InvalidOperandOOG |
InstructionResult::ReentrancySentryOOG => Ok(Self::OutOfGas),

// Other errors:
InstructionResult::OpcodeNotFound |
InstructionResult::CallNotAllowedInsideStatic |
InstructionResult::StateChangeDuringStaticCall |
InstructionResult::InvalidExtDelegateCallTarget |
InstructionResult::InvalidEXTCALLTarget |
InstructionResult::InvalidFEOpcode |
InstructionResult::InvalidJump |
InstructionResult::NotActivated |
Expand All @@ -3453,17 +3461,12 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
InstructionResult::CreateContractStartingWithEF |
InstructionResult::CreateInitCodeSizeLimit |
InstructionResult::FatalExternalError |
InstructionResult::OutOfFunds |
InstructionResult::CallTooDeep => Ok(Self::EvmError(exit)),

// Handle Revm EOF InstructionResults: not supported
InstructionResult::ReturnContractInNotInitEOF |
InstructionResult::EOFOpcodeDisabledInLegacy |
InstructionResult::SubRoutineStackOverflow |
InstructionResult::CreateInitCodeStartingEF00 |
InstructionResult::InvalidEOFInitCode |
InstructionResult::EofAuxDataOverflow |
InstructionResult::EofAuxDataTooSmall => Ok(Self::EvmError(exit)),
InstructionResult::EofAuxDataTooSmall |
InstructionResult::InvalidEXTCALLTarget => Ok(Self::EvmError(exit)),
},
}
}
Expand Down
Loading
Loading