Skip to content

Commit 6181d51

Browse files
authored
chore: clean up unused EOF code (#10715)
1 parent bfc53de commit 6181d51

File tree

10 files changed

+307
-525
lines changed

10 files changed

+307
-525
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ foundry-linking = { path = "crates/linking" }
204204

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

408408
## foundry
409-
# foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", rev = "855dee4" }
409+
# foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", rev = "e4a9b04" }
410410
# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "811a61a" }

crates/anvil/src/eth/api.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,6 +3414,8 @@ enum GasEstimationCallResult {
34143414
}
34153415

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

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

3432+
// Revert opcodes:
34303433
InstructionResult::Revert => Ok(Self::Revert(output.map(|o| o.into_data()))),
3434+
InstructionResult::CallTooDeep |
3435+
InstructionResult::OutOfFunds |
3436+
InstructionResult::CreateInitCodeStartingEF00 |
3437+
InstructionResult::InvalidEOFInitCode |
3438+
InstructionResult::InvalidExtDelegateCallTarget => Ok(Self::EvmError(exit)),
34313439

3440+
// Out of gas errors:
34323441
InstructionResult::OutOfGas |
34333442
InstructionResult::MemoryOOG |
34343443
InstructionResult::MemoryLimitOOG |
34353444
InstructionResult::PrecompileOOG |
34363445
InstructionResult::InvalidOperandOOG |
34373446
InstructionResult::ReentrancySentryOOG => Ok(Self::OutOfGas),
34383447

3448+
// Other errors:
34393449
InstructionResult::OpcodeNotFound |
34403450
InstructionResult::CallNotAllowedInsideStatic |
34413451
InstructionResult::StateChangeDuringStaticCall |
3442-
InstructionResult::InvalidExtDelegateCallTarget |
3443-
InstructionResult::InvalidEXTCALLTarget |
34443452
InstructionResult::InvalidFEOpcode |
34453453
InstructionResult::InvalidJump |
34463454
InstructionResult::NotActivated |
@@ -3455,17 +3463,12 @@ impl TryFrom<Result<(InstructionResult, Option<Output>, u128, State)>> for GasEs
34553463
InstructionResult::CreateContractStartingWithEF |
34563464
InstructionResult::CreateInitCodeSizeLimit |
34573465
InstructionResult::FatalExternalError |
3458-
InstructionResult::OutOfFunds |
3459-
InstructionResult::CallTooDeep => Ok(Self::EvmError(exit)),
3460-
3461-
// Handle Revm EOF InstructionResults: not supported
34623466
InstructionResult::ReturnContractInNotInitEOF |
34633467
InstructionResult::EOFOpcodeDisabledInLegacy |
34643468
InstructionResult::SubRoutineStackOverflow |
3465-
InstructionResult::CreateInitCodeStartingEF00 |
3466-
InstructionResult::InvalidEOFInitCode |
34673469
InstructionResult::EofAuxDataOverflow |
3468-
InstructionResult::EofAuxDataTooSmall => Ok(Self::EvmError(exit)),
3470+
InstructionResult::EofAuxDataTooSmall |
3471+
InstructionResult::InvalidEXTCALLTarget => Ok(Self::EvmError(exit)),
34693472
},
34703473
}
34713474
}

0 commit comments

Comments
 (0)