Introduce ExecutionAddress type

This commit is contained in:
Mikhail Kalinin 2021-09-23 14:35:55 +06:00
parent b7deef1629
commit 7d577ed422
4 changed files with 7 additions and 6 deletions

View File

@ -535,7 +535,7 @@ class NoopExecutionEngine(ExecutionEngine):
parent_hash: Hash32,
timestamp: uint64,
random: Bytes32,
feeRecipient: Bytes20) -> uint64:
feeRecipient: ExecutionAddress) -> uint64:
raise NotImplementedError("no default block production")
def get_payload(self: ExecutionEngine, payload_id: uint64) -> ExecutionPayload:

View File

@ -54,6 +54,7 @@ This patch adds transaction execution to the beacon chain as part of the Merge f
| - | - | - |
| `OpaqueTransaction` | `ByteList[MAX_BYTES_PER_OPAQUE_TRANSACTION]` | a [typed transaction envelope](https://eips.ethereum.org/EIPS/eip-2718#opaque-byte-array-rather-than-an-rlp-array) structured as `TransactionType \|\| TransactionPayload` |
| `Transaction` | `Union[OpaqueTransaction]` | a transaction |
| `ExecutionAddress` | `Bytes20` | Address of account on the execution layer |
## Constants
@ -159,7 +160,7 @@ class BeaconState(Container):
class ExecutionPayload(Container):
# Execution block header fields
parent_hash: Hash32
coinbase: Bytes20 # 'beneficiary' in the yellow paper
coinbase: ExecutionAddress # 'beneficiary' in the yellow paper
state_root: Bytes32
receipt_root: Bytes32 # 'receipts root' in the yellow paper
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
@ -181,7 +182,7 @@ class ExecutionPayload(Container):
class ExecutionPayloadHeader(Container):
# Execution block header fields
parent_hash: Hash32
coinbase: Bytes20
coinbase: ExecutionAddress
state_root: Bytes32
receipt_root: Bytes32
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]

View File

@ -53,7 +53,7 @@ def prepare_payload(self: ExecutionEngine,
parent_hash: Hash32,
timestamp: uint64,
random: Bytes32,
fee_recipient: Bytes20) -> uint64:
fee_recipient: ExecutionAddress) -> uint64:
"""
Return ``payload_id`` that is used to obtain the execution payload in a subsequent ``get_payload`` call.
"""
@ -103,7 +103,7 @@ def get_pow_block_at_total_difficulty(total_difficulty: uint256, pow_chain: Sequ
def prepare_execution_payload(state: BeaconState,
pow_chain: Sequence[PowBlock],
fee_recipient: Bytes20,
fee_recipient: ExecutionAddress,
execution_engine: ExecutionEngine) -> Optional[uint64]:
if not is_merge_complete(state):
terminal_pow_block = get_pow_block_at_total_difficulty(TERMINAL_TOTAL_DIFFICULTY, pow_chain)

View File

@ -11,7 +11,7 @@ def build_empty_execution_payload(spec, state, randao_mix=None):
payload = spec.ExecutionPayload(
parent_hash=latest.block_hash,
coinbase=spec.Bytes20(),
coinbase=spec.ExecutionAddress(),
state_root=latest.state_root, # no changes to the state
receipt_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?