-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(spec-specs): refactor EIP-7928 to use nested context frames #4
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
base: larger-refactoring
Are you sure you want to change the base?
refactor(spec-specs): refactor EIP-7928 to use nested context frames #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, sorry for the scattered and disorganized feedback!
block_access_lists/rlp_utils.py
rlp_encode_block_access_list
It looks like you've reimplemented the logic from ethereum-rlp (treat a dataclass as a list of its children). If the encoding algorithm is standard RLP, you can probably just use encode on the BlockAccessList itself. If it requires slight tweaking, you could look at With. If you've already investigated those options, please disregard!
validate_block_access_list_against_execution
Probably doesn't belong in this file, since it has little to do with RLP.
Also, seems unused?
block_access_lists/builder.py
build_block_access_list
You should use to_be_bytes32 to convert to Bytes32.
I haven't reached StateChanges yet, so this comment might be premature (and if it is, and you're reading this, I forgot to remove it), but what's different between a BlockAccessListBuilder and StateChanges? They seem to have very similar fields.
block_access_lists/rlp_types.py
These aren't specifically RLP types, though they do get encoded to RLP. I'd name the file something different.
I'm not sure adding the type aliases from EIP-7928 actually make anything more clear. If we do want to go down the road of making semantically meaningful types, we should do it more broadly and uniformly.
We can add U16 to ethereum-types if you'd like.
The constants here seem out of place.
fork.py
process_transaction
It seems like you're constructing a second stack of frames. Unless there's a reason not to, I'd rather add a member to TransactionEnvironment .
Is increment_index replaceable with TransactionEnvironment.index_in_block + 1 maybe? I'm not 100% sure how index_in_block interacts with system txs.
state.py
Seems a bit odd that we're passing the StateChanges into these functions. If we're trying to cleanly separate the "storage of state" from "tracking state changes", we'd want to avoid mixing the two.
state_tracker.py
Overall comment, we don't use methods (def x(self, ...)). Everything should be a free function.
StateChanges
Should we introduce some named tuples or something? There are a lot of one and two element tuples here, and I feel like that could get confusing without human readable names.
How do the pre-state captures interact with reverts and nested frames and such? I'm assuming that these are captured pre-transaction, so it might make more sense to put this in TransactionEnvironment?
get_block_access_index
Should this be set when constructing the StateChanges, or can its value change and therefore needs to be recomputed?
merge_on_success / merge_on_failure
Would it be better if these asserted self.parent is not None? Is there a case where we call it where we don't know where we are in the stack?
handle_in_transaction_selfdestruct
I'd probably just rename this to track_selfdestruct (or track_self_destruct, whichever is consistent with our naming). All self-destructs in recent forks are in the same tx, right?
And this is all I have time for today!
|
79ce5c4 to
8f1880e
Compare
b6a23d5 to
93d318b
Compare
Co-authored-by: spencer [email protected]
a97fe9f to
179259b
Compare
662c11b to
ab65a29
Compare
c11ce19 to
fb3462f
Compare
- add commit_transaction_frame() - no net-zero filtering for cross-tx changes - keep max nonce per transaction when building BAL, remove block-level code filtering - filter net-zero code changes at tracking time (for 7702 txs) - use commit_transaction_frame() instead of merge_on_success() for tx->block commits
869b34f to
fff84d0
Compare
fff84d0 to
77a271d
Compare
🗒️ Description
Related to comment here.
This is a rough first-pass implementation but one that is passing all EIP-7928 tests at the moment. If we decide to go with this approach, this is a good base to get the tests released and we can make tweaks to the design as future PRs on top of
eips/amsterdam/eip-7928.✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.Cute Animal Picture