ethereum.forks.prague.fork_typesethereum.forks.osaka.fork_types
Ethereum Types.
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Types reused throughout the specification, which are specific to Ethereum.
Address
23 | Address = Bytes20 |
---|
Root
24 | Root = Hash32 |
---|
VersionedHash
25 | VersionedHash = Hash32 |
---|
Bloom
27 | Bloom = Bytes256 |
---|
Account
State associated with an address.
30 | @slotted_freezable |
---|
31 | @dataclass |
---|
class Account:
nonce
37 | nonce: Uint |
---|
balance
38 | balance: U256 |
---|
code
39 | code: Bytes |
---|
EMPTY_ACCOUNT
42 | EMPTY_ACCOUNT = Account( |
---|---|
43 | nonce=Uint(0), |
44 | balance=U256(0), |
45 | code=b"", |
46 | ) |
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:
50 | """ |
---|---|
51 | Encode `Account` dataclass. |
52 |
|
53 | Storage is not stored in the `Account` dataclass, so `Accounts` cannot be |
54 | encoded without providing a storage root. |
55 | """ |
56 | return rlp.encode( |
57 | ( |
58 | raw_account_data.nonce, |
59 | raw_account_data.balance, |
60 | storage_root, |
61 | keccak256(raw_account_data.code), |
62 | ) |
63 | ) |
Authorization
The authorization for a set code transaction.
66 | @slotted_freezable |
---|
67 | @dataclass |
---|
class Authorization:
chain_id
73 | chain_id: U256 |
---|
address
74 | address: Address |
---|
nonce
75 | nonce: U64 |
---|
y_parity
76 | y_parity: U8 |
---|
r
77 | r: U256 |
---|
s
78 | s: U256 |
---|