ethereum.forks.shanghai.fork_typesethereum.forks.cancun.fork_types
Ethereum Types.
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Types reused throughout the specification, which are specific to Ethereum.
Address¶
| 20 | Address = Bytes20 |
|---|
VersionedHash¶
| 22 | VersionedHash = Hash32 |
|---|
Root¶
| 24 | Root = Hash32 |
|---|
Bloom¶
| 26 | Bloom = Bytes256 |
|---|
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:
| 30 | """ |
|---|---|
| 31 | Encode `Account` dataclass. |
| 32 | |
| 33 | Storage is not stored in the `Account` dataclass, so `Accounts` cannot be |
| 34 | encoded without providing a storage root. |
| 35 | """ |
| 36 | return rlp.encode( |
| 37 | ( |
| 38 | raw_account_data.nonce, |
| 39 | raw_account_data.balance, |
| 40 | storage_root, |
| 41 | raw_account_data.code_hash, |
| 42 | ) |
| 43 | ) |