feat: add reverting address to ExecutionResult::Revert#3494
Open
decofe wants to merge 1 commit into
Open
Conversation
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]>
borngraced
suggested changes
Mar 16, 2026
| // FrameResult should be a generic that returns gas and interpreter result. | ||
| result: FrameResult, | ||
| result_gas: ResultGas, | ||
| address: Option<Address>, |
Contributor
There was a problem hiding this comment.
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) |
Contributor
There was a problem hiding this comment.
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
address: Option<Address>toExecutionResult::Revertso 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=0x82b42900exists in both ValidatorConfig and TIP-20). When a precompile reverts viaPrecompileOutput::new_reverted(), the revert data flows throughInstructionResult::Revert→ExecutionResult::Revert, but only the raw bytes are preserved—no address. The RPC layer'sFromRevert::from_revert()receives justBytesand cannot disambiguate which precompile the selector came from.Changes:
ExecutionResult::Revertgainsaddress: Option<Address>post_execution::output()accepts and passes the addressHandler::execution_result()extractsTxKind::Call(addr)→Some(addr),TxKind::Create→Noneexecution_resultTesting:
Co-Authored-By: Georgios Konstantopoulos [email protected]
Prompted by: georgios