Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add reverting address to ExecutionResult::Revert#3494

Open
decofe wants to merge 1 commit into
mainfrom
tempo/revert-address
Open

feat: add reverting address to ExecutionResult::Revert#3494
decofe wants to merge 1 commit into
mainfrom
tempo/revert-address

Conversation

@decofe
Copy link
Copy Markdown
Collaborator

@decofe decofe commented Mar 11, 2026

Adds address: Option<Address> to ExecutionResult::Revert so consumers can identify which contract or precompile produced the revert.

Motivation: Chains with custom precompiles (e.g. Tempo) have multiple precompiles that share ABI error selectors (e.g. Unauthorized = 0x82b42900 exists in both ValidatorConfig and TIP-20). When a precompile reverts via PrecompileOutput::new_reverted(), the revert data flows through InstructionResult::RevertExecutionResult::Revert, but only the raw bytes are preserved—no address. The RPC layer's FromRevert::from_revert() receives just Bytes and cannot disambiguate which precompile the selector came from.

Changes:

  • ExecutionResult::Revert gains address: Option<Address>
  • post_execution::output() accepts and passes the address
  • Handler::execution_result() extracts TxKind::Call(addr)Some(addr), TxKind::CreateNone
  • Same for op-revm's execution_result

Testing:

cargo test --workspace  # all pass
cargo clippy --workspace --all-targets  # clean
cargo fmt --all --check  # clean

Co-Authored-By: Georgios Konstantopoulos [email protected]

Prompted by: georgios

Add `address: Option<Address>` to `ExecutionResult::Revert` so
consumers can identify which contract or precompile produced the
revert data. For `TxKind::Call` the target address is populated;
for `TxKind::Create` it is `None`.

This is needed by chains with custom precompiles (e.g. Tempo) where
multiple precompiles share error selectors—without the address,
downstream RPC error formatting cannot disambiguate which precompile
reverted.

Co-Authored-By: Georgios Konstantopoulos <[email protected]>
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 11, 2026

Merging this PR will not alter performance

✅ 176 untouched benchmarks


Comparing tempo/revert-address (fbc81fc) with main (5d1a7dd)

Open in CodSpeed

// FrameResult should be a generic that returns gas and interpreter result.
result: FrameResult,
result_gas: ResultGas,
address: Option<Address>,
Copy link
Copy Markdown
Contributor

@borngraced borngraced Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since post_execution::output already takes context: &mut CTX, you can use that to derive the address lazily inside the SuccessOrHalt::Revert match arm, instead of adding a new param and paying the derivation cost on every call regardless of outcome...like so:

        SuccessOrHalt::Revert => {
            let address = match context.tx().kind() {
                TxKind::Call(addr) => Some(addr),
                TxKind::Create => None,
            };
            ExecutionResult::Revert {
                gas: result_gas,
                logs,
                output: output.into_data(),
                address,
            }
        }

Comment on lines +352 to +358
// Extract target address for revert context.
let address = match evm.ctx().tx().kind() {
revm::primitives::TxKind::Call(addr) => Some(addr),
revm::primitives::TxKind::Create => None,
};

let exec_result = post_execution::output(evm.ctx(), frame_result, result_gas, address)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be reverted after my suggestion above

Comment on lines +483 to +489
// Extract target address for revert context.
let address = match evm.ctx().tx().kind() {
TxKind::Call(addr) => Some(addr),
TxKind::Create => None,
};

let exec_result = post_execution::output(evm.ctx(), result, result_gas, address);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants