Bring on extra_data field

This commit is contained in:
Mikhail Kalinin 2021-09-17 18:23:21 +06:00
parent 9ca8c592c5
commit cb9e65ab85
2 changed files with 6 additions and 0 deletions

View File

@ -65,6 +65,7 @@ This patch adds transaction execution to the beacon chain as part of the Merge f
| `BYTES_PER_LOGS_BLOOM` | `uint64(2**8)` (= 256) | | `BYTES_PER_LOGS_BLOOM` | `uint64(2**8)` (= 256) |
| `GAS_LIMIT_DENOMINATOR` | `uint64(2**10)` (= 1,024) | | `GAS_LIMIT_DENOMINATOR` | `uint64(2**10)` (= 1,024) |
| `MIN_GAS_LIMIT` | `uint64(5000)` (= 5,000) | | `MIN_GAS_LIMIT` | `uint64(5000)` (= 5,000) |
| `MAX_EXTRA_DATA_BYTES` | `2**5` (= 32) |
## Configuration ## Configuration
@ -166,6 +167,7 @@ class ExecutionPayload(Container):
gas_limit: uint64 gas_limit: uint64
gas_used: uint64 gas_used: uint64
timestamp: uint64 timestamp: uint64
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
base_fee_per_gas: Bytes32 # base fee introduced in EIP-1559, little-endian serialized base_fee_per_gas: Bytes32 # base fee introduced in EIP-1559, little-endian serialized
# Extra payload fields # Extra payload fields
block_hash: Hash32 # Hash of execution block block_hash: Hash32 # Hash of execution block
@ -187,6 +189,7 @@ class ExecutionPayloadHeader(Container):
gas_limit: uint64 gas_limit: uint64
gas_used: uint64 gas_used: uint64
timestamp: uint64 timestamp: uint64
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
base_fee_per_gas: Bytes32 base_fee_per_gas: Bytes32
# Extra payload fields # Extra payload fields
block_hash: Hash32 # Hash of execution block block_hash: Hash32 # Hash of execution block
@ -317,6 +320,7 @@ def process_execution_payload(state: BeaconState, payload: ExecutionPayload, exe
gas_limit=payload.gas_limit, gas_limit=payload.gas_limit,
gas_used=payload.gas_used, gas_used=payload.gas_used,
timestamp=payload.timestamp, timestamp=payload.timestamp,
extra_data=payload.extra_data,
base_fee_per_gas=payload.base_fee_per_gas, base_fee_per_gas=payload.base_fee_per_gas,
block_hash=payload.block_hash, block_hash=payload.block_hash,
transactions_root=hash_tree_root(payload.transactions), transactions_root=hash_tree_root(payload.transactions),

View File

@ -20,6 +20,7 @@ def build_empty_execution_payload(spec, state, randao_mix=None):
gas_limit=latest.gas_limit, # retain same limit gas_limit=latest.gas_limit, # retain same limit
gas_used=0, # empty block, 0 gas gas_used=0, # empty block, 0 gas
timestamp=timestamp, timestamp=timestamp,
extra_data=spec.ByteList[spec.MAX_EXTRA_DATA_BYTES](),
base_fee_per_gas=latest.base_fee_per_gas, # retain same base_fee base_fee_per_gas=latest.base_fee_per_gas, # retain same base_fee
block_hash=spec.Hash32(), block_hash=spec.Hash32(),
transactions=empty_txs, transactions=empty_txs,
@ -42,6 +43,7 @@ def get_execution_payload_header(spec, execution_payload):
gas_limit=execution_payload.gas_limit, gas_limit=execution_payload.gas_limit,
gas_used=execution_payload.gas_used, gas_used=execution_payload.gas_used,
timestamp=execution_payload.timestamp, timestamp=execution_payload.timestamp,
extra_data=execution_payload.extra_data,
base_fee_per_gas=execution_payload.base_fee_per_gas, base_fee_per_gas=execution_payload.base_fee_per_gas,
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)