-
Notifications
You must be signed in to change notification settings - Fork 168
feat(tests): add worst-case block test for 7702 set code #1758
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,6 +12,7 @@ | |||||
Account, | ||||||
Address, | ||||||
Alloc, | ||||||
AuthorizationTuple, | ||||||
Block, | ||||||
BlockchainTestFiller, | ||||||
Environment, | ||||||
|
@@ -156,3 +157,44 @@ def test_block_full_of_ether_transfers( | |||||
blocks=[Block(txs=txs)], | ||||||
exclude_full_post_state_in_output=True, | ||||||
) | ||||||
|
||||||
|
||||||
@pytest.mark.valid_from("Prague") | ||||||
def test_block_full_of_7702_set_code( | ||||||
blockchain_test: BlockchainTestFiller, | ||||||
pre: Alloc, | ||||||
iteration_count: int, | ||||||
): | ||||||
""" | ||||||
Test worst-case block scenario with 7702 set code. | ||||||
|
||||||
This test is designed to test the worst-case block scenario with 7702 set code. | ||||||
""" | ||||||
env = Environment() | ||||||
attack_gas_limit = env.gas_limit | ||||||
sender = pre.fund_eoa() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably need to pre-set these to an authorization for the reset to do something.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, but sounds it would only have effects for the first tx of the list. Starting with the second and further txs, the delegation will be considered a noop, no? So most tx won't be doing any real work. I wonder if this test should probably:
|
||||||
|
||||||
txs = [] | ||||||
for i in range(iteration_count): | ||||||
txs.append( | ||||||
Transaction( | ||||||
gas_limit=attack_gas_limit, | ||||||
to=sender, | ||||||
authorization_list=[ | ||||||
AuthorizationTuple( | ||||||
address=Address(0x0), | ||||||
nonce=i + 1, | ||||||
signer=sender, | ||||||
), | ||||||
], | ||||||
sender=sender, | ||||||
) | ||||||
) | ||||||
|
||||||
blockchain_test( | ||||||
genesis_environment=env, | ||||||
pre=pre, | ||||||
post={}, | ||||||
blocks=[Block(txs=txs)], | ||||||
exclude_full_post_state_in_output=True, | ||||||
) |
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.
Is this missing a defined parametrization?
(Edit: see also my message below)