-
Notifications
You must be signed in to change notification settings - Fork 1
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
fillers/eips/eip4844/blobhash_opcode.py: Pytest port of Blobhash Opcode Tests #15
Conversation
536a25d
to
0c8ee04
Compare
4e2c870
to
ba40cb4
Compare
…or blobhash opcode context tests.
37be660
to
fb0c18b
Compare
…-y, rename to blobhash.
Fixes to EIP 4844 blobhash PR
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.
Some comments! overall it looks really good :)
if tx_type >= 3 | ||
else None, | ||
) | ||
for i in range(TARGET_BLOB_PER_BLOCK) |
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.
I think we will only see the gas cost in the storage of the last transaction.
Maybe having the same code in multiple addresses (same amount as the number of transactions sent), and finally verifying each of the addresses' storage.
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.
Ahh yes! Damn nice find - I messed up the logic here in the port :D
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.
471f464 removes the parameterization of the blobhash_index_values
such that we have an individual blockchain test for each tx type 😄
""" | ||
Returns an BLOBHASH sstore to the given index. | ||
""" | ||
return Op.SSTORE(index, Op.BLOBHASH(index)) |
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.
One issue I see with this method is that it overwrites the previous read of BLOBHASH
.
E.g. if we do:
BLOBHASH(1)
BLOBHASH(1)
BLOBHASH(1)
And for some reason the middle one was incorrect, we will never know because the last BLOBHASH(1)
overwrote the middle one.
I propose using a list of blobhash indexes like so:
[1, 2, 3]
, which translates in the following bytecode:
SSTORE(0, BLOBHASH(1))
SSTORE(1, BLOBHASH(2))
SSTORE(2, BLOBHASH(3))
Then check use this same list of blob indexes to generate the expected storage based on the blobs contained in the transaction.
We can modify blobhash_sstore
to use memory to keep track of the last index used:
Op.SSTORE(Op.MLOAD(0), Op.BLOBHASH(blob_index)) + Op.MSTORE(0, Op.ADD(1, Op.MLOAD(0)))
If we make this modification, generate_blobhash_calls
could also take the list of blobs contained by the transaction as a parameter to generate the appropriate expected post for the address containing the bytecode (and called by the tx).
On test_blobhash_multiple_txs_in_block
we would indeed overwrite on the second tx, but I don't think it would matter there?
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.
I think I have resolved this in 84428dd
dad5837
into
danceratopz:feature/use-pytest-to-collect-and-hydrate-test-fillers-v2
Within this PR:
test_blobhash_opcode_contexts
to pytest ->blobhash_opcode_contexts.py
test_blobhash_gas_cost
to pytest ->blobhash_opcode.py
test_blobhash_blob_versioned_hash
to pytest ->blobhash_opcode.py
test_blobhash_invalid_blob_index
to pytest ->blobhash_opcode.py
test_blobhash_multiple_txs_in_block
to pytest ->blobhash_opcode.py
blobhash_util.py