ethereum.forks.gray_glacier.fork_typesethereum.forks.paris.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 |
|---|
Bloom¶
| 19 | Bloom = Bytes256 |
|---|
EMPTY_CODE_HASH¶
| 28 | EMPTY_CODE_HASH = keccak256(b"") |
|---|
Account ¶
State associated with an address.
| 31 | @slotted_freezable |
|---|
| 32 | @dataclass |
|---|
class Account:
nonce¶
| 38 | nonce: Uint |
|---|
balance¶
| 39 | balance: U256 |
|---|
code_hash¶
| 40 | code_hash: Hash32 |
|---|
EMPTY_ACCOUNT¶
| 43 | EMPTY_ACCOUNT = Account( |
|---|---|
| 44 | nonce=Uint(0), |
| 45 | balance=U256(0), |
| 46 | code_hash=EMPTY_CODE_HASH, |
| 47 | ) |
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: AccountAccount, storage_root: Bytes) -> Bytes:
| 23 | """ |
|---|---|
| 24 | Encode `Account` dataclass. |
| 25 | |
| 26 | Storage is not stored in the `Account` dataclass, so `Accounts` cannot be |
| 27 | encoded without providing a storage root. |
| 28 | """ |
| 29 | return rlp.encode( |
| 30 | ( |
| 31 | raw_account_data.nonce, |
| 32 | raw_account_data.balance, |
| 33 | storage_root, |
| 34 | raw_account_data.code_hash, |
| 35 | ) |
| 36 | ) |