fix execution paylaod tests

This commit is contained in:
Danny Ryan 2022-02-24 15:29:34 -07:00
parent f5dab5b666
commit 0a55f062d7
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 10 additions and 1 deletions

View File

@ -162,6 +162,9 @@ class ExecutionPayloadHeader(Container):
New EIP-2718 transaction type, with the format being the single byte `TX_TYPE_WITHDRAWAL` New EIP-2718 transaction type, with the format being the single byte `TX_TYPE_WITHDRAWAL`
followed by an SSZ encoding of the `WithdrawalTransaction` container comprising the transaction contents. followed by an SSZ encoding of the `WithdrawalTransaction` container comprising the transaction contents.
*Note*: This container is used for both a special TX that goes into an `ExecutionPayload`
as well as in the `BeaconState`'s `withdrawal_receipts` queue.
```python ```python
class WithdrawalTransaction(Container): class WithdrawalTransaction(Container):
address: ExecutionAddress address: ExecutionAddress

View File

@ -1,3 +1,6 @@
from eth2spec.test.helpers.constants import FORKS_BEFORE_CAPELLA
def build_empty_execution_payload(spec, state, randao_mix=None): def build_empty_execution_payload(spec, state, randao_mix=None):
""" """
Assuming a pre-state of the same slot, build a valid ExecutionPayload without any transactions. Assuming a pre-state of the same slot, build a valid ExecutionPayload without any transactions.
@ -32,7 +35,7 @@ def build_empty_execution_payload(spec, state, randao_mix=None):
def get_execution_payload_header(spec, execution_payload): def get_execution_payload_header(spec, execution_payload):
return spec.ExecutionPayloadHeader( payload_header = spec.ExecutionPayloadHeader(
parent_hash=execution_payload.parent_hash, parent_hash=execution_payload.parent_hash,
fee_recipient=execution_payload.fee_recipient, fee_recipient=execution_payload.fee_recipient,
state_root=execution_payload.state_root, state_root=execution_payload.state_root,
@ -48,6 +51,9 @@ def get_execution_payload_header(spec, execution_payload):
block_hash=execution_payload.block_hash, block_hash=execution_payload.block_hash,
transactions_root=spec.hash_tree_root(execution_payload.transactions) transactions_root=spec.hash_tree_root(execution_payload.transactions)
) )
if spec.fork not in FORKS_BEFORE_CAPELLA:
payload_header.withdrawal_transactions_root = spec.hash_tree_root(execution_payload.withdrawal_transactions)
return payload_header
def build_state_with_incomplete_transition(spec, state): def build_state_with_incomplete_transition(spec, state):