-
Notifications
You must be signed in to change notification settings - Fork 107
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
feat(specs,fixtures,consume): Support Payload-Building tests #1175
base: main
Are you sure you want to change the base?
Conversation
2969ba8
to
8ff396f
Compare
1c91b20
to
6672261
Compare
fix(consume/engine): Assert no valid transactions left in mempool
e061a5d
to
a0de4aa
Compare
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.
Really cool PR! Gave this a run today and it works well :)
Most of my comments are tiny tweaks with minimal changes to the logic! I'd be happy to get this in soon for more Prague coverage and then follow through on some wider changes in the long term to reap its benefits across all (valid) tests!
A part of me thinks that it could be better to move this within its own consume command, like consume payload
, or creating sub-commands:
consume engine blocks
(existing)consume engine txs
Although I'd like to simmer on the idea a bit more. And preferably it would be another PR.
If an `invalidates` list is specified, when the transaction is included in a | ||
block, none of the transactions in the `invalidates` list should be included afterwards | ||
(same block or subsequent 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.
How do you find invalidated_txs
?
If an `invalidates` list is specified, when the transaction is included in a | |
block, none of the transactions in the `invalidates` list should be included afterwards | |
(same block or subsequent block). | |
If an `invalidated_txs` set is specified, when the primary transaction is included in a | |
block, none of the transactions in `invalidated_txs` should be included in that block | |
or any subsequent block. |
""" | ||
Error that should be returned by the client when sending the transaction. | ||
""" | ||
invalidates: Set[Hash] = Field(default_factory=set) |
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.
Similar to above.
invalidates: Set[Hash] = Field(default_factory=set) | |
invalidated_txs: Set[Hash] = Field(default_factory=set) |
|
||
step_type: Literal["payload_build"] = "payload_build" | ||
|
||
id: int |
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.
id: int | |
payload_id: int |
Monotonically increasing integer that identifies the payload, with zero being | ||
the genesis block. | ||
""" | ||
parent_id: int |
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.
parent_id: int | |
parent_payload_id: int |
The allocations are expected to be compounded with the expected allocation of previously | ||
and future included transactions. |
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.
The allocations are expected to be compounded with the expected allocation of previously | |
and future included transactions. | |
The allocations are expected to be compounded with the expected allocation of previous | |
and future transactions included in a block. |
raise Exception(f"Unsupported step type: {step}") | ||
|
||
return PayloadBuildingFixture( | ||
fork=network_info, |
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.
Should we pass in fork: Fork
here instead of network info? And then use that directly to get the engine versions within test_via_engine.py
, i.e fixture.fork.engine_..._version
? We could remove the 3 engine_
fields from PayloadBuildingFixture
by applying the latter?
def execute( | ||
self, | ||
*, | ||
fork: Fork, | ||
execute_format: ExecuteFormat, | ||
eips: Optional[List[int]] = None, | ||
) -> BaseExecute: | ||
"""Generate the list of test fixtures.""" | ||
raise Exception(f"Unsupported execute format: {execute_format}") |
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.
It looks like we could remove this as its not abstract in BaseTest
:)
@@ -5,9 +5,23 @@ | |||
Each `engine_newPayloadVX` is verified against the appropriate VALID/INVALID responses. |
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.
We should update docstring. It can probably be reduced to specify the different types of consume engine tests
@@ -91,3 +105,199 @@ def test_blockchain_via_engine( | |||
assert ( | |||
forkchoice_response.payload_status.status == PayloadStatusEnum.VALID | |||
), f"unexpected status: {forkchoice_response}" | |||
|
|||
|
|||
def check_post(expected_post: Alloc, eth_rpc: EthRPC): |
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.
Maybe check_post_from_rpc
?
I'm happy with this here, although we could also use this as an oppurtunity to create a src/ethereum_test_rpc/helpers.py
file and move it there with more granular methods like check_balance
, check_code
, etc - wrapping them all within the check_post
function. I'm imagining a future where we may use these elsewhere
steps=[ | ||
*txs, | ||
Payload(), # Should include some of the transactions | ||
Payload(), # Empty payload |
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.
Can we automate any of the Payload steps in the framework? I.e always having a second empty payload for tests with invalidated txs?
🗒️ Description
Adds support for writing tests based on the following discussion: #1143
Requires #1210- MergedThis is in the experimental phase, and a single EIP-7702 test has been included, which consists of a test that sends a single and valid type-4 transaction to the clients and then requests a payload, and the built payload must contain the transaction.
🔗 Related Issues
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.