Skip to content
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

refactor: rewrite revert and precompile decoding #6222

Merged
merged 11 commits into from
Nov 7, 2023

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Nov 6, 2023

Motivation

Closes #6102
Fixes #5337

Solution

@DaniPopes DaniPopes marked this pull request as draft November 6, 2023 15:47
@DaniPopes DaniPopes marked this pull request as ready for review November 6, 2023 19:49
Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

Super cool. Some comments:

@@ -29,7 +29,7 @@ use proptest::{
test_runner::{TestCaseError, TestRunner},
};
use revm::{
primitives::{Address as rAddress, HashMap, U256 as rU256},
primitives::{Address as aAddress, HashMap, U256 as rU256},
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just use alloy_primitives::Address now

Copy link
Member Author

Choose a reason for hiding this comment

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

Anvil stuff, I don't want to get into that

_ => unreachable!(),
};

// TODO: Other chain precompiles
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit unsure if we want to implement precompiles for other chains—we had discussed this is a thing we probably don't want to do (albeit we could probably do Optimism's easily?) cc @mattsse

Copy link
Member Author

Choose a reason for hiding this comment

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

crates/evm/traces/src/decoder/precompiles.rs Show resolved Hide resolved
node.decode_precompile(precompile_fn, &self.labels);
} else if let RawOrDecodedCall::Raw(ref bytes) = node.trace.data {
if bytes.len() >= 4 {
// TODO: chain ID argument
Copy link
Member

Choose a reason for hiding this comment

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

This is to decode different precompiles per chain id?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that's what I was thinking, but maybe I'm thinking ahead too much. Maybe we should just try to decode whatever revm has set as precompiles

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think might be best to stick to what revm has—I think soft consensus is to not get into maintaining precompiles for other chains—they can become a pain. IIRC arbitrum, which is the biggest offender, has a repo that simulates their custom precompile that ppl can use

Copy link
Member Author

Choose a reason for hiding this comment

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

Ref #748

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

i'm cool with the changes, the only contentious thing is decoding other precompiles—but as this is not implemented imho not a blocker

@DaniPopes
Copy link
Member Author

A thing to note is that now Error(string)/Panic(uint256) get displayed as revert: <msg> and panic: <msg> rather than just <msg>.

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.

Remove precompiles! macro ecpairing precompile decoding is incorrect
3 participants