feat: add a way for precompiles to revert#2711
Merged
Conversation
CodSpeed Performance ReportMerging #2711 will not alter performanceComparing Summary
|
mattsse
approved these changes
Jul 15, 2025
Comment on lines
+19
to
+20
| /// Whether the precompile reverted | ||
| pub reverted: bool, |
Collaborator
There was a problem hiding this comment.
this seems like the least invasive option to me,
the use case here is valid, since there exist precompiles that act as revert
This was referenced Jul 15, 2025
Closed
Closed
Closed
This was referenced Jul 21, 2025
Closed
Closed
Closed
will-2012
reviewed
Jul 22, 2025
| InstructionResult::Revert | ||
| } else { | ||
| InstructionResult::Return | ||
| }; |
There was a problem hiding this comment.
let precompile_result = precompile.call(PrecompileInput {
data: input_bytes,
gas: gas_limit,
caller: inputs.caller_address,
value: inputs.call_value,
internals: EvmInternals::new(journal, &context.block),
});
match precompile_result {
Ok(output) => {
let underflow = result.gas.record_cost(output.gas_used);
assert!(underflow, "Gas underflow is not possible");
result.result = InstructionResult::Return;
result.output = output.bytes;
}
Err(PrecompileError::Fatal(e)) => return Err(e),
Err(e) => {
result.result = if e.is_oog() {
InstructionResult::PrecompileOOG
} else {
InstructionResult::PrecompileError
};
}
Does alloy-rs/evm need to handle the revert error?
This was referenced Jul 22, 2025
Closed
Closed
Closed
Closed
Merged
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
revertedflag toPrecompileOutputthat allows precompiles to revert