mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-20 15:38:55 +00:00
Updated with requests on block body
This commit is contained in:
parent
9a2e08808e
commit
858402fc8a
@ -31,7 +31,6 @@
|
||||
- [`ConsolidationRequest`](#consolidationrequest)
|
||||
- [`PendingConsolidation`](#pendingconsolidation)
|
||||
- [`ValidatorRequests`](#validatorrequests)
|
||||
- [`ExecutionPayloadEnvelope`](#executionpayloadenvelope)
|
||||
- [Modified Containers](#modified-containers)
|
||||
- [`AttesterSlashing`](#attesterslashing)
|
||||
- [`BeaconBlockBody`](#beaconblockbody)
|
||||
@ -39,7 +38,6 @@
|
||||
- [`Attestation`](#attestation)
|
||||
- [`IndexedAttestation`](#indexedattestation)
|
||||
- [`ExecutionPayload`](#executionpayload)
|
||||
- [`ExecutionPayloadHeader`](#executionpayloadheader)
|
||||
- [`BeaconState`](#beaconstate)
|
||||
- [Helper functions](#helper-functions)
|
||||
- [Predicates](#predicates)
|
||||
@ -80,8 +78,6 @@
|
||||
- [Withdrawals](#withdrawals)
|
||||
- [Modified `get_expected_withdrawals`](#modified-get_expected_withdrawals)
|
||||
- [Modified `process_withdrawals`](#modified-process_withdrawals)
|
||||
- [Execution payload](#execution-payload)
|
||||
- [Modified `process_execution_payload`](#modified-process_execution_payload)
|
||||
- [Operations](#operations)
|
||||
- [Modified `process_operations`](#modified-process_operations)
|
||||
- [Attestations](#attestations)
|
||||
@ -262,8 +258,6 @@ class PendingConsolidation(Container):
|
||||
|
||||
#### `ValidatorRequests`
|
||||
|
||||
*Note*: The container is new in EIP????.
|
||||
|
||||
```python
|
||||
class ValidatorRequests(Container):
|
||||
deposit_requests: List[DepositRequest, MAX_DEPOSIT_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP6110]
|
||||
@ -271,16 +265,6 @@ class ValidatorRequests(Container):
|
||||
consolidation_requests: List[ConsolidationRequest, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD] # [New in Electra:EIP7251]
|
||||
```
|
||||
|
||||
#### `ExecutionPayloadEnvelope`
|
||||
|
||||
*Note*: The container is new in EIP????.
|
||||
|
||||
```python
|
||||
class ExecutionPayloadEnvelope(Container):
|
||||
execution_payload: ExecutionPayload # [Modified in Electra:EIP6110:EIP7002]
|
||||
requests: ValidatorRequests
|
||||
```
|
||||
|
||||
### Modified Containers
|
||||
|
||||
#### `AttesterSlashing`
|
||||
@ -306,9 +290,10 @@ class BeaconBlockBody(Container):
|
||||
voluntary_exits: List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS]
|
||||
sync_aggregate: SyncAggregate
|
||||
# Execution
|
||||
execution_payload_envelope: ExecutionPayloadEnvelope # [Modified in Electra:EIP????]
|
||||
execution_payload: ExecutionPayload
|
||||
bls_to_execution_changes: List[SignedBLSToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES]
|
||||
blob_kzg_commitments: List[KZGCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK]
|
||||
requests: ValidatorRequests # [New in Electra:EIP????]
|
||||
```
|
||||
|
||||
### Extended Containers
|
||||
@ -358,32 +343,6 @@ class ExecutionPayload(Container):
|
||||
excess_blob_gas: uint64
|
||||
```
|
||||
|
||||
#### `ExecutionPayloadHeader`
|
||||
|
||||
```python
|
||||
class ExecutionPayloadHeader(Container):
|
||||
# Execution block header fields
|
||||
parent_hash: Hash32
|
||||
fee_recipient: ExecutionAddress
|
||||
state_root: Bytes32
|
||||
receipts_root: Bytes32
|
||||
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
|
||||
prev_randao: Bytes32
|
||||
block_number: uint64
|
||||
gas_limit: uint64
|
||||
gas_used: uint64
|
||||
timestamp: uint64
|
||||
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
|
||||
base_fee_per_gas: uint256
|
||||
# Extra payload fields
|
||||
block_hash: Hash32
|
||||
transactions_root: Root
|
||||
withdrawals_root: Root
|
||||
blob_gas_used: uint64
|
||||
excess_blob_gas: uint64
|
||||
requests_root: Root # [New in Electra:EIP6110:EIP7002:EIP7251]
|
||||
```
|
||||
|
||||
#### `BeaconState`
|
||||
|
||||
```python
|
||||
@ -962,7 +921,7 @@ def process_effective_balance_updates(state: BeaconState) -> None:
|
||||
```python
|
||||
def process_block(state: BeaconState, block: BeaconBlock) -> None:
|
||||
process_block_header(state, block)
|
||||
process_withdrawals(state, block.body.execution_payload_envelope.execution_payload) # [Modified in Electra:EIP7251:EIP????]
|
||||
process_withdrawals(state, block.body.execution_payload) # [Modified in Electra:EIP7251:EIP????]
|
||||
process_execution_payload(state, block.body, EXECUTION_ENGINE) # [Modified in Electra:EIP6110:EIP????]
|
||||
process_randao(state, block.body)
|
||||
process_eth1_data(state, block.body)
|
||||
@ -1063,57 +1022,6 @@ def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None:
|
||||
next_validator_index = ValidatorIndex(next_index % len(state.validators))
|
||||
state.next_withdrawal_validator_index = next_validator_index
|
||||
```
|
||||
|
||||
#### Execution payload
|
||||
|
||||
##### Modified `process_execution_payload`
|
||||
|
||||
*Note*: The function `process_execution_payload` is modified to use the new `ExecutionPayloadHeader` and `ExecutionPayloadEnveloped` types.
|
||||
|
||||
```python
|
||||
def process_execution_payload(state: BeaconState, body: BeaconBlockBody, execution_engine: ExecutionEngine) -> None:
|
||||
payload = body.execution_payload_envelope.execution_payload # [Modified in EIP????]
|
||||
|
||||
# Verify consistency of the parent hash with respect to the previous execution payload header
|
||||
assert payload.parent_hash == state.latest_execution_payload_header.block_hash
|
||||
# Verify prev_randao
|
||||
assert payload.prev_randao == get_randao_mix(state, get_current_epoch(state))
|
||||
# Verify timestamp
|
||||
assert payload.timestamp == compute_timestamp_at_slot(state, state.slot)
|
||||
# Verify commitments are under limit
|
||||
assert len(body.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK
|
||||
# Verify the execution payload is valid
|
||||
versioned_hashes = [kzg_commitment_to_versioned_hash(commitment) for commitment in body.blob_kzg_commitments]
|
||||
assert execution_engine.verify_and_notify_new_payload(
|
||||
NewPayloadRequest(
|
||||
execution_payload=payload,
|
||||
versioned_hashes=versioned_hashes,
|
||||
parent_beacon_block_root=state.latest_block_header.parent_root,
|
||||
)
|
||||
)
|
||||
# Cache execution payload header
|
||||
state.latest_execution_payload_header = ExecutionPayloadHeader(
|
||||
parent_hash=payload.parent_hash,
|
||||
fee_recipient=payload.fee_recipient,
|
||||
state_root=payload.state_root,
|
||||
receipts_root=payload.receipts_root,
|
||||
logs_bloom=payload.logs_bloom,
|
||||
prev_randao=payload.prev_randao,
|
||||
block_number=payload.block_number,
|
||||
gas_limit=payload.gas_limit,
|
||||
gas_used=payload.gas_used,
|
||||
timestamp=payload.timestamp,
|
||||
extra_data=payload.extra_data,
|
||||
base_fee_per_gas=payload.base_fee_per_gas,
|
||||
block_hash=payload.block_hash,
|
||||
transactions_root=hash_tree_root(payload.transactions),
|
||||
withdrawals_root=hash_tree_root(payload.withdrawals),
|
||||
blob_gas_used=payload.blob_gas_used,
|
||||
excess_blob_gas=payload.excess_blob_gas,
|
||||
requests_root=hash_tree_root(body.execution_payload_envelope.requests), # [New in Electra:EIP6110:EIP7002:EIP7251]
|
||||
)
|
||||
```
|
||||
|
||||
#### Operations
|
||||
|
||||
##### Modified `process_operations`
|
||||
@ -1140,11 +1048,11 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
|
||||
for_ops(body.deposits, process_deposit) # [Modified in Electra:EIP7251]
|
||||
for_ops(body.voluntary_exits, process_voluntary_exit) # [Modified in Electra:EIP7251]
|
||||
for_ops(body.bls_to_execution_changes, process_bls_to_execution_change)
|
||||
for_ops(body.execution_payload_envelope.requests.deposit_requests, process_deposit_request) # [New in Electra:EIP6110:EIP????]
|
||||
for_ops(body.requests.deposit_requests, process_deposit_request) # [New in Electra:EIP6110:EIP????]
|
||||
# [New in Electra:EIP7002:EIP7251:EIP????]
|
||||
for_ops(body.execution_payload_envelope.requests.withdrawal_requests, process_withdrawal_request)
|
||||
for_ops(body.requests.withdrawal_requests, process_withdrawal_request)
|
||||
# [New in Electra:EIP7251:EIP????]
|
||||
for_ops(body.execution_payload_envelope.requests.consolidation_requests, process_consolidation_request)
|
||||
for_ops(body.requests.consolidation_requests, process_consolidation_request)
|
||||
```
|
||||
|
||||
##### Attestations
|
||||
|
Loading…
x
Reference in New Issue
Block a user