ethereum.forks.bpo5.fork_typesethereum.forks.amsterdam.fork_types

Ethereum Types.

.. contents:: Table of Contents :backlinks: none :local:

Introduction

Types reused throughout the specification, which are specific to Ethereum.

BlockAccessIndex

Position within the set of all changes in a Block.

25
BlockAccessIndex = U32

VersionedHash

32
VersionedHash = Hash32

Bloom

34
Bloom = Bytes256

RegularGas

37
RegularGas = NewType("RegularGas", Uint)

StateGas

39
StateGas = NewType("StateGas", Uint)

StateGasPerByte

State gas charged per byte of state growth, per EIP-8037.

A rate, not an amount: deliberately not a Uint, since adding a rate to a gas amount is meaningless. Multiplying it by a byte count, in either operand order, yields a StateGas.

42
@final
43
@slotted_freezable
44
@dataclass
class StateGasPerByte:

rate

56
    rate: Uint

__mul__

Return the state gas for num_bytes charged at this rate.

def __mul__(self, ​​num_bytes: Uint) -> StateGas:
59
        <snip>
60
        return StateGas(self.rate * num_bytes)

__rmul__

Return the state gas for num_bytes charged at this rate.

def __rmul__(self, ​​num_bytes: Uint) -> StateGas:
63
        <snip>
64
        return StateGas(self.rate * num_bytes)

encode_account

Encode Account dataclass.

Storage is not stored in the Account dataclass, so Accounts cannot be encoded without providing a storage root.

def encode_account(raw_account_data: Account, ​​storage_root: Bytes) -> Bytes:
68
    <snip>
74
    return rlp.encode(
75
        (
76
            raw_account_data.nonce,
77
            raw_account_data.balance,
78
            storage_root,
79
            raw_account_data.code_hash,
80
        )
81
    )

Authorization

The authorization for a set code transaction.

84
@final
85
@slotted_freezable
86
@dataclass
class Authorization:

chain_id

92
    chain_id: U256

address

93
    address: Address

nonce

94
    nonce: U64

y_parity

95
    y_parity: U8

r

96
    r: U256

s

97
    s: U256