Bellatrix: random -> prev_randao
This commit is contained in:
parent
8ae93b8265
commit
1280fe2a02
|
@ -171,7 +171,7 @@ class ExecutionPayload(Container):
|
|||
state_root: Bytes32
|
||||
receipts_root: Bytes32
|
||||
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
|
||||
random: Bytes32 # 'difficulty' in the yellow paper
|
||||
prev_randao: Bytes32 # 'difficulty' in the yellow paper
|
||||
block_number: uint64 # 'number' in the yellow paper
|
||||
gas_limit: uint64
|
||||
gas_used: uint64
|
||||
|
@ -193,7 +193,7 @@ class ExecutionPayloadHeader(Container):
|
|||
state_root: Bytes32
|
||||
receipts_root: Bytes32
|
||||
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
|
||||
random: Bytes32
|
||||
prev_randao: Bytes32
|
||||
block_number: uint64
|
||||
gas_limit: uint64
|
||||
gas_used: uint64
|
||||
|
@ -348,8 +348,8 @@ def process_execution_payload(state: BeaconState, payload: ExecutionPayload, exe
|
|||
# Verify consistency of the parent hash with respect to the previous execution payload header
|
||||
if is_merge_transition_complete(state):
|
||||
assert payload.parent_hash == state.latest_execution_payload_header.block_hash
|
||||
# Verify random
|
||||
assert payload.random == get_randao_mix(state, get_current_epoch(state))
|
||||
# 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 the execution payload is valid
|
||||
|
@ -361,7 +361,7 @@ def process_execution_payload(state: BeaconState, payload: ExecutionPayload, exe
|
|||
state_root=payload.state_root,
|
||||
receipts_root=payload.receipts_root,
|
||||
logs_bloom=payload.logs_bloom,
|
||||
random=payload.random,
|
||||
prev_randao=payload.prev_randao,
|
||||
block_number=payload.block_number,
|
||||
gas_limit=payload.gas_limit,
|
||||
gas_used=payload.gas_used,
|
||||
|
|
|
@ -80,7 +80,7 @@ Used to signal to initiate the payload build process via `notify_forkchoice_upda
|
|||
@dataclass
|
||||
class PayloadAttributes(object):
|
||||
timestamp: uint64
|
||||
random: Bytes32
|
||||
prev_randao: Bytes32
|
||||
suggested_fee_recipient: ExecutionAddress
|
||||
```
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ def prepare_execution_payload(state: BeaconState,
|
|||
# Set the forkchoice head and initiate the payload build process
|
||||
payload_attributes = PayloadAttributes(
|
||||
timestamp=compute_timestamp_at_slot(state, state.slot),
|
||||
random=get_randao_mix(state, get_current_epoch(state)),
|
||||
prev_randao=get_randao_mix(state, get_current_epoch(state)),
|
||||
suggested_fee_recipient=suggested_fee_recipient,
|
||||
)
|
||||
return execution_engine.notify_forkchoice_updated(parent_hash, finalized_block_hash, payload_attributes)
|
||||
|
|
|
@ -153,7 +153,7 @@ def test_bad_random_first_payload(spec, state):
|
|||
|
||||
# execution payload
|
||||
execution_payload = build_empty_execution_payload(spec, state)
|
||||
execution_payload.random = b'\x42' * 32
|
||||
execution_payload.prev_randao = b'\x42' * 32
|
||||
|
||||
yield from run_execution_payload_processing(spec, state, execution_payload, valid=False)
|
||||
|
||||
|
@ -167,7 +167,7 @@ def test_bad_random_regular_payload(spec, state):
|
|||
|
||||
# execution payload
|
||||
execution_payload = build_empty_execution_payload(spec, state)
|
||||
execution_payload.random = b'\x04' * 32
|
||||
execution_payload.prev_randao = b'\x04' * 32
|
||||
|
||||
yield from run_execution_payload_processing(spec, state, execution_payload, valid=False)
|
||||
|
||||
|
@ -182,7 +182,7 @@ def test_bad_everything_regular_payload(spec, state):
|
|||
# execution payload
|
||||
execution_payload = build_empty_execution_payload(spec, state)
|
||||
execution_payload.parent_hash = spec.Hash32()
|
||||
execution_payload.random = spec.Bytes32()
|
||||
execution_payload.prev_randao = spec.Bytes32()
|
||||
execution_payload.timestamp = 0
|
||||
|
||||
yield from run_execution_payload_processing(spec, state, execution_payload, valid=False)
|
||||
|
|
|
@ -103,7 +103,7 @@ def test_prepare_execution_payload(spec, state):
|
|||
|
||||
# 1. Handle `is_merge_complete`
|
||||
if is_merge_complete:
|
||||
state.latest_execution_payload_header = spec.ExecutionPayloadHeader(random=b'\x12' * 32)
|
||||
state.latest_execution_payload_header = spec.ExecutionPayloadHeader(prev_randao=b'\x12' * 32)
|
||||
else:
|
||||
state.latest_execution_payload_header = spec.ExecutionPayloadHeader()
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ def build_empty_execution_payload(spec, state, randao_mix=None):
|
|||
receipts_root=b"no receipts here" + b"\x00" * 16, # TODO: root of empty MPT may be better.
|
||||
logs_bloom=spec.ByteVector[spec.BYTES_PER_LOGS_BLOOM](), # TODO: zeroed logs bloom for empty logs ok?
|
||||
block_number=latest.block_number + 1,
|
||||
random=randao_mix,
|
||||
prev_randao=randao_mix,
|
||||
gas_limit=latest.gas_limit, # retain same limit
|
||||
gas_used=0, # empty block, 0 gas
|
||||
timestamp=timestamp,
|
||||
|
@ -38,7 +38,7 @@ def get_execution_payload_header(spec, execution_payload):
|
|||
state_root=execution_payload.state_root,
|
||||
receipts_root=execution_payload.receipts_root,
|
||||
logs_bloom=execution_payload.logs_bloom,
|
||||
random=execution_payload.random,
|
||||
prev_randao=execution_payload.prev_randao,
|
||||
block_number=execution_payload.block_number,
|
||||
gas_limit=execution_payload.gas_limit,
|
||||
gas_used=execution_payload.gas_used,
|
||||
|
|
|
@ -30,7 +30,7 @@ def get_sample_genesis_execution_payload_header(spec,
|
|||
state_root=b'\x20' * 32,
|
||||
receipts_root=b'\x20' * 32,
|
||||
logs_bloom=b'\x35' * spec.BYTES_PER_LOGS_BLOOM,
|
||||
random=eth1_block_hash,
|
||||
prev_randao=eth1_block_hash,
|
||||
block_number=0,
|
||||
gas_limit=30000000,
|
||||
base_fee_per_gas=1000000000,
|
||||
|
|
Loading…
Reference in New Issue