From b5036307e3e8da5e037529675d1cccb4a4356e96 Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Thu, 28 May 2026 12:52:38 -0400 Subject: [PATCH] chore(specs): add final decorator --- src/ethereum/crypto/blake2.py | 3 ++- src/ethereum/forks/amsterdam/block_access_lists.py | 10 +++++++++- src/ethereum/forks/amsterdam/blocks.py | 7 ++++++- src/ethereum/forks/amsterdam/fork.py | 4 +++- src/ethereum/forks/amsterdam/fork_types.py | 2 ++ src/ethereum/forks/amsterdam/state_tracker.py | 4 +++- src/ethereum/forks/amsterdam/transactions.py | 8 +++++++- src/ethereum/forks/amsterdam/vm/__init__.py | 7 ++++++- src/ethereum/forks/amsterdam/vm/gas.py | 4 +++- src/ethereum/forks/amsterdam/vm/interpreter.py | 3 ++- src/ethereum/forks/arrow_glacier/blocks.py | 6 +++++- src/ethereum/forks/arrow_glacier/fork.py | 3 ++- src/ethereum/forks/arrow_glacier/state_tracker.py | 4 +++- src/ethereum/forks/arrow_glacier/transactions.py | 6 +++++- src/ethereum/forks/arrow_glacier/vm/__init__.py | 7 ++++++- src/ethereum/forks/arrow_glacier/vm/gas.py | 4 +++- src/ethereum/forks/arrow_glacier/vm/interpreter.py | 3 ++- src/ethereum/forks/berlin/blocks.py | 6 +++++- src/ethereum/forks/berlin/fork.py | 3 ++- src/ethereum/forks/berlin/state_tracker.py | 4 +++- src/ethereum/forks/berlin/transactions.py | 5 ++++- src/ethereum/forks/berlin/vm/__init__.py | 7 ++++++- src/ethereum/forks/berlin/vm/gas.py | 4 +++- src/ethereum/forks/berlin/vm/interpreter.py | 3 ++- src/ethereum/forks/bpo1/blocks.py | 7 ++++++- src/ethereum/forks/bpo1/fork.py | 3 ++- src/ethereum/forks/bpo1/fork_types.py | 2 ++ src/ethereum/forks/bpo1/state_tracker.py | 4 +++- src/ethereum/forks/bpo1/transactions.py | 8 +++++++- src/ethereum/forks/bpo1/vm/__init__.py | 7 ++++++- src/ethereum/forks/bpo1/vm/gas.py | 4 +++- src/ethereum/forks/bpo1/vm/interpreter.py | 3 ++- src/ethereum/forks/bpo2/blocks.py | 7 ++++++- src/ethereum/forks/bpo2/fork.py | 3 ++- src/ethereum/forks/bpo2/fork_types.py | 2 ++ src/ethereum/forks/bpo2/state_tracker.py | 4 +++- src/ethereum/forks/bpo2/transactions.py | 8 +++++++- src/ethereum/forks/bpo2/vm/__init__.py | 7 ++++++- src/ethereum/forks/bpo2/vm/gas.py | 4 +++- src/ethereum/forks/bpo2/vm/interpreter.py | 3 ++- src/ethereum/forks/bpo3/blocks.py | 7 ++++++- src/ethereum/forks/bpo3/fork.py | 3 ++- src/ethereum/forks/bpo3/fork_types.py | 2 ++ src/ethereum/forks/bpo3/state_tracker.py | 4 +++- src/ethereum/forks/bpo3/transactions.py | 8 +++++++- src/ethereum/forks/bpo3/vm/__init__.py | 7 ++++++- src/ethereum/forks/bpo3/vm/gas.py | 4 +++- src/ethereum/forks/bpo3/vm/interpreter.py | 3 ++- src/ethereum/forks/bpo4/blocks.py | 7 ++++++- src/ethereum/forks/bpo4/fork.py | 3 ++- src/ethereum/forks/bpo4/fork_types.py | 2 ++ src/ethereum/forks/bpo4/state_tracker.py | 4 +++- src/ethereum/forks/bpo4/transactions.py | 8 +++++++- src/ethereum/forks/bpo4/vm/__init__.py | 7 ++++++- src/ethereum/forks/bpo4/vm/gas.py | 4 +++- src/ethereum/forks/bpo4/vm/interpreter.py | 3 ++- src/ethereum/forks/bpo5/blocks.py | 7 ++++++- src/ethereum/forks/bpo5/fork.py | 3 ++- src/ethereum/forks/bpo5/fork_types.py | 2 ++ src/ethereum/forks/bpo5/state_tracker.py | 4 +++- src/ethereum/forks/bpo5/transactions.py | 8 +++++++- src/ethereum/forks/bpo5/vm/__init__.py | 7 ++++++- src/ethereum/forks/bpo5/vm/gas.py | 4 +++- src/ethereum/forks/bpo5/vm/interpreter.py | 3 ++- src/ethereum/forks/byzantium/blocks.py | 6 +++++- src/ethereum/forks/byzantium/fork.py | 3 ++- src/ethereum/forks/byzantium/state_tracker.py | 4 +++- src/ethereum/forks/byzantium/transactions.py | 2 ++ src/ethereum/forks/byzantium/vm/__init__.py | 7 ++++++- src/ethereum/forks/byzantium/vm/gas.py | 4 +++- src/ethereum/forks/byzantium/vm/interpreter.py | 3 ++- src/ethereum/forks/cancun/blocks.py | 7 ++++++- src/ethereum/forks/cancun/fork.py | 3 ++- src/ethereum/forks/cancun/state_tracker.py | 4 +++- src/ethereum/forks/cancun/transactions.py | 7 ++++++- src/ethereum/forks/cancun/vm/__init__.py | 7 ++++++- src/ethereum/forks/cancun/vm/gas.py | 4 +++- src/ethereum/forks/cancun/vm/interpreter.py | 3 ++- src/ethereum/forks/constantinople/blocks.py | 6 +++++- src/ethereum/forks/constantinople/fork.py | 3 ++- src/ethereum/forks/constantinople/state_tracker.py | 4 +++- src/ethereum/forks/constantinople/transactions.py | 2 ++ src/ethereum/forks/constantinople/vm/__init__.py | 7 ++++++- src/ethereum/forks/constantinople/vm/gas.py | 4 +++- .../forks/constantinople/vm/interpreter.py | 3 ++- src/ethereum/forks/dao_fork/blocks.py | 6 +++++- src/ethereum/forks/dao_fork/fork.py | 3 ++- src/ethereum/forks/dao_fork/state_tracker.py | 4 +++- src/ethereum/forks/dao_fork/transactions.py | 2 ++ src/ethereum/forks/dao_fork/vm/__init__.py | 7 ++++++- src/ethereum/forks/dao_fork/vm/gas.py | 4 +++- src/ethereum/forks/dao_fork/vm/interpreter.py | 3 ++- src/ethereum/forks/frontier/blocks.py | 6 +++++- src/ethereum/forks/frontier/fork.py | 3 ++- src/ethereum/forks/frontier/state_tracker.py | 4 +++- src/ethereum/forks/frontier/transactions.py | 2 ++ src/ethereum/forks/frontier/vm/__init__.py | 7 ++++++- src/ethereum/forks/frontier/vm/gas.py | 4 +++- src/ethereum/forks/frontier/vm/interpreter.py | 3 ++- src/ethereum/forks/gray_glacier/blocks.py | 6 +++++- src/ethereum/forks/gray_glacier/fork.py | 3 ++- src/ethereum/forks/gray_glacier/state_tracker.py | 4 +++- src/ethereum/forks/gray_glacier/transactions.py | 6 +++++- src/ethereum/forks/gray_glacier/vm/__init__.py | 7 ++++++- src/ethereum/forks/gray_glacier/vm/gas.py | 4 +++- src/ethereum/forks/gray_glacier/vm/interpreter.py | 3 ++- src/ethereum/forks/homestead/blocks.py | 6 +++++- src/ethereum/forks/homestead/fork.py | 3 ++- src/ethereum/forks/homestead/state_tracker.py | 4 +++- src/ethereum/forks/homestead/transactions.py | 2 ++ src/ethereum/forks/homestead/vm/__init__.py | 7 ++++++- src/ethereum/forks/homestead/vm/gas.py | 4 +++- src/ethereum/forks/homestead/vm/interpreter.py | 3 ++- src/ethereum/forks/istanbul/blocks.py | 6 +++++- src/ethereum/forks/istanbul/fork.py | 3 ++- src/ethereum/forks/istanbul/state_tracker.py | 4 +++- src/ethereum/forks/istanbul/transactions.py | 2 ++ src/ethereum/forks/istanbul/vm/__init__.py | 7 ++++++- src/ethereum/forks/istanbul/vm/gas.py | 4 +++- src/ethereum/forks/istanbul/vm/interpreter.py | 3 ++- src/ethereum/forks/london/blocks.py | 6 +++++- src/ethereum/forks/london/fork.py | 3 ++- src/ethereum/forks/london/state_tracker.py | 4 +++- src/ethereum/forks/london/transactions.py | 6 +++++- src/ethereum/forks/london/vm/__init__.py | 7 ++++++- src/ethereum/forks/london/vm/gas.py | 4 +++- src/ethereum/forks/london/vm/interpreter.py | 3 ++- src/ethereum/forks/muir_glacier/blocks.py | 6 +++++- src/ethereum/forks/muir_glacier/fork.py | 3 ++- src/ethereum/forks/muir_glacier/state_tracker.py | 4 +++- src/ethereum/forks/muir_glacier/transactions.py | 2 ++ src/ethereum/forks/muir_glacier/vm/__init__.py | 7 ++++++- src/ethereum/forks/muir_glacier/vm/gas.py | 4 +++- src/ethereum/forks/muir_glacier/vm/interpreter.py | 3 ++- src/ethereum/forks/osaka/blocks.py | 7 ++++++- src/ethereum/forks/osaka/fork.py | 3 ++- src/ethereum/forks/osaka/fork_types.py | 2 ++ src/ethereum/forks/osaka/state_tracker.py | 4 +++- src/ethereum/forks/osaka/transactions.py | 8 +++++++- src/ethereum/forks/osaka/vm/__init__.py | 7 ++++++- src/ethereum/forks/osaka/vm/gas.py | 4 +++- src/ethereum/forks/osaka/vm/interpreter.py | 3 ++- src/ethereum/forks/paris/blocks.py | 6 +++++- src/ethereum/forks/paris/fork.py | 3 ++- src/ethereum/forks/paris/state_tracker.py | 4 +++- src/ethereum/forks/paris/transactions.py | 6 +++++- src/ethereum/forks/paris/vm/__init__.py | 7 ++++++- src/ethereum/forks/paris/vm/gas.py | 4 +++- src/ethereum/forks/paris/vm/interpreter.py | 3 ++- src/ethereum/forks/prague/blocks.py | 7 ++++++- src/ethereum/forks/prague/fork.py | 3 ++- src/ethereum/forks/prague/fork_types.py | 2 ++ src/ethereum/forks/prague/state_tracker.py | 4 +++- src/ethereum/forks/prague/transactions.py | 8 +++++++- src/ethereum/forks/prague/vm/__init__.py | 7 ++++++- src/ethereum/forks/prague/vm/gas.py | 4 +++- src/ethereum/forks/prague/vm/interpreter.py | 3 ++- src/ethereum/forks/shanghai/blocks.py | 7 ++++++- src/ethereum/forks/shanghai/fork.py | 3 ++- src/ethereum/forks/shanghai/state_tracker.py | 4 +++- src/ethereum/forks/shanghai/transactions.py | 6 +++++- src/ethereum/forks/shanghai/vm/__init__.py | 7 ++++++- src/ethereum/forks/shanghai/vm/gas.py | 4 +++- src/ethereum/forks/shanghai/vm/interpreter.py | 3 ++- src/ethereum/forks/spurious_dragon/blocks.py | 6 +++++- src/ethereum/forks/spurious_dragon/fork.py | 3 ++- .../forks/spurious_dragon/state_tracker.py | 4 +++- src/ethereum/forks/spurious_dragon/transactions.py | 2 ++ src/ethereum/forks/spurious_dragon/vm/__init__.py | 7 ++++++- src/ethereum/forks/spurious_dragon/vm/gas.py | 4 +++- .../forks/spurious_dragon/vm/interpreter.py | 3 ++- src/ethereum/forks/tangerine_whistle/blocks.py | 6 +++++- src/ethereum/forks/tangerine_whistle/fork.py | 3 ++- .../forks/tangerine_whistle/state_tracker.py | 4 +++- .../forks/tangerine_whistle/transactions.py | 2 ++ .../forks/tangerine_whistle/vm/__init__.py | 7 ++++++- src/ethereum/forks/tangerine_whistle/vm/gas.py | 4 +++- .../forks/tangerine_whistle/vm/interpreter.py | 3 ++- src/ethereum/genesis.py | 4 +++- src/ethereum/merkle_patricia_trie.py | 5 +++++ src/ethereum/state.py | 14 +++++++++++++- src/ethereum/trace.py | 11 ++++++++++- 182 files changed, 682 insertions(+), 164 deletions(-) diff --git a/src/ethereum/crypto/blake2.py b/src/ethereum/crypto/blake2.py index b50967749b0..568ad611e7c 100644 --- a/src/ethereum/crypto/blake2.py +++ b/src/ethereum/crypto/blake2.py @@ -2,7 +2,7 @@ import struct from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import Uint @@ -248,6 +248,7 @@ def compress( # Parameters specific to the Blake2b implementation +@final @dataclass class Blake2b(Blake2): """ diff --git a/src/ethereum/forks/amsterdam/block_access_lists.py b/src/ethereum/forks/amsterdam/block_access_lists.py index fd2cd2de405..55bec6463cc 100644 --- a/src/ethereum/forks/amsterdam/block_access_lists.py +++ b/src/ethereum/forks/amsterdam/block_access_lists.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import Dict, List, Optional, Set, Tuple, TypeAlias +from typing import Dict, List, Optional, Set, Tuple, TypeAlias, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes32 @@ -28,6 +28,7 @@ from .state_tracker import BlockState, TransactionState, get_code +@final @slotted_freezable @dataclass class StorageChange: @@ -54,6 +55,7 @@ class StorageChange: """ +@final @slotted_freezable @dataclass class BalanceChange: @@ -80,6 +82,7 @@ class BalanceChange: """ +@final @slotted_freezable @dataclass class NonceChange: @@ -106,6 +109,7 @@ class NonceChange: """ +@final @slotted_freezable @dataclass class CodeChange: @@ -132,6 +136,7 @@ class CodeChange: """ +@final @slotted_freezable @dataclass class SlotChanges: @@ -156,6 +161,7 @@ class SlotChanges: """ +@final @slotted_freezable @dataclass class AccountChanges: @@ -233,6 +239,7 @@ class AccountChanges: """ +@final @dataclass class AccountData: """ @@ -273,6 +280,7 @@ class AccountData: """ +@final @dataclass class BlockAccessListBuilder: """ diff --git a/src/ethereum/forks/amsterdam/blocks.py b/src/ethereum/forks/amsterdam/blocks.py index 302533da837..57b0e2c2874 100644 --- a/src/ethereum/forks/amsterdam/blocks.py +++ b/src/ethereum/forks/amsterdam/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -267,6 +269,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -320,6 +323,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -352,6 +356,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/amsterdam/fork.py b/src/ethereum/forks/amsterdam/fork.py index 4ab7ec8044b..7a487065cd1 100644 --- a/src/ethereum/forks/amsterdam/fork.py +++ b/src/ethereum/forks/amsterdam/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -135,6 +135,7 @@ BLOB_COUNT_LIMIT = 6 +@final @slotted_freezable @dataclass class ChainContext: @@ -152,6 +153,7 @@ class ChainContext: """Parent header used for header validation and system contracts.""" +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/amsterdam/fork_types.py b/src/ethereum/forks/amsterdam/fork_types.py index 6d115de6b36..3fb1d66d057 100644 --- a/src/ethereum/forks/amsterdam/fork_types.py +++ b/src/ethereum/forks/amsterdam/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -50,6 +51,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/amsterdam/state_tracker.py b/src/ethereum/forks/amsterdam/state_tracker.py index c75eb198f53..2e208ee764f 100644 --- a/src/ethereum/forks/amsterdam/state_tracker.py +++ b/src/ethereum/forks/amsterdam/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import TYPE_CHECKING, Callable, Dict, Optional, Set, Tuple +from typing import TYPE_CHECKING, Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -39,6 +39,7 @@ from .block_access_lists import BlockAccessListBuilder +@final @dataclass class BlockState: """ @@ -62,6 +63,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/amsterdam/transactions.py b/src/ethereum/forks/amsterdam/transactions.py index d0961a2ba35..f757be7d15d 100644 --- a/src/ethereum/forks/amsterdam/transactions.py +++ b/src/ethereum/forks/amsterdam/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -47,6 +47,7 @@ """ +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -109,6 +110,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -128,6 +130,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -200,6 +203,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -277,6 +281,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -365,6 +370,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/amsterdam/vm/__init__.py b/src/ethereum/forks/amsterdam/vm/__init__.py index 11cb126ee4f..2138e916a22 100644 --- a/src/ethereum/forks/amsterdam/vm/__init__.py +++ b/src/ethereum/forks/amsterdam/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -39,6 +39,7 @@ CALL_SUCCESS = U256(1) +@final @dataclass class BlockEnvironment: """ @@ -60,6 +61,7 @@ class BlockEnvironment: slot_number: U64 +@final @dataclass class BlockOutput: """ @@ -106,6 +108,7 @@ class BlockOutput: block_access_list: BlockAccessList = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -124,6 +127,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -149,6 +153,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/amsterdam/vm/gas.py b/src/ethereum/forks/amsterdam/vm/gas.py index 0762027af01..8b0dbae14fc 100644 --- a/src/ethereum/forks/amsterdam/vm/gas.py +++ b/src/ethereum/forks/amsterdam/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -197,6 +197,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -212,6 +213,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/amsterdam/vm/interpreter.py b/src/ethereum/forks/amsterdam/vm/interpreter.py index 6ab6f66bafb..78d276673da 100644 --- a/src/ethereum/forks/amsterdam/vm/interpreter.py +++ b/src/ethereum/forks/amsterdam/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/arrow_glacier/blocks.py b/src/ethereum/forks/arrow_glacier/blocks.py index ba2ce71d02a..6d9c41f774d 100644 --- a/src/ethereum/forks/arrow_glacier/blocks.py +++ b/src/ethereum/forks/arrow_glacier/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -29,6 +29,7 @@ ) +@final @slotted_freezable @dataclass class Header: @@ -183,6 +184,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -229,6 +231,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -261,6 +264,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/arrow_glacier/fork.py b/src/ethereum/forks/arrow_glacier/fork.py index d83e3fdffb4..2340b41ff9d 100644 --- a/src/ethereum/forks/arrow_glacier/fork.py +++ b/src/ethereum/forks/arrow_glacier/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -80,6 +80,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/arrow_glacier/state_tracker.py b/src/ethereum/forks/arrow_glacier/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/arrow_glacier/state_tracker.py +++ b/src/ethereum/forks/arrow_glacier/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/arrow_glacier/transactions.py b/src/ethereum/forks/arrow_glacier/transactions.py index 7ee0abbf8ef..902128e634c 100644 --- a/src/ethereum/forks/arrow_glacier/transactions.py +++ b/src/ethereum/forks/arrow_glacier/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -24,6 +24,7 @@ from .exceptions import TransactionTypeError +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -83,6 +84,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -102,6 +104,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -174,6 +177,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: diff --git a/src/ethereum/forks/arrow_glacier/vm/__init__.py b/src/ethereum/forks/arrow_glacier/vm/__init__.py index f53d3428ce0..de14a20dedf 100644 --- a/src/ethereum/forks/arrow_glacier/vm/__init__.py +++ b/src/ethereum/forks/arrow_glacier/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -52,6 +53,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -83,6 +85,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -99,6 +102,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -123,6 +127,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/arrow_glacier/vm/gas.py b/src/ethereum/forks/arrow_glacier/vm/gas.py index 00a47783f9a..898c7024d28 100644 --- a/src/ethereum/forks/arrow_glacier/vm/gas.py +++ b/src/ethereum/forks/arrow_glacier/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -161,6 +161,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -176,6 +177,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/arrow_glacier/vm/interpreter.py b/src/ethereum/forks/arrow_glacier/vm/interpreter.py index a57203fdefe..282e2bdfcf4 100644 --- a/src/ethereum/forks/arrow_glacier/vm/interpreter.py +++ b/src/ethereum/forks/arrow_glacier/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -64,6 +64,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/berlin/blocks.py b/src/ethereum/forks/berlin/blocks.py index 112a9846ab6..0bb4d2103ea 100644 --- a/src/ethereum/forks/berlin/blocks.py +++ b/src/ethereum/forks/berlin/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -24,6 +24,7 @@ from .transactions import AccessListTransaction, LegacyTransaction, Transaction +@final @slotted_freezable @dataclass class Header: @@ -160,6 +161,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -205,6 +207,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -237,6 +240,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/berlin/fork.py b/src/ethereum/forks/berlin/fork.py index c97256fddec..9d9431108b2 100644 --- a/src/ethereum/forks/berlin/fork.py +++ b/src/ethereum/forks/berlin/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -73,6 +73,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/berlin/state_tracker.py b/src/ethereum/forks/berlin/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/berlin/state_tracker.py +++ b/src/ethereum/forks/berlin/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/berlin/transactions.py b/src/ethereum/forks/berlin/transactions.py index cfba0193d4a..1c4bf3ca2f0 100644 --- a/src/ethereum/forks/berlin/transactions.py +++ b/src/ethereum/forks/berlin/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -24,6 +24,7 @@ from .exceptions import TransactionTypeError +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -82,6 +83,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -101,6 +103,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: diff --git a/src/ethereum/forks/berlin/vm/__init__.py b/src/ethereum/forks/berlin/vm/__init__.py index 85f73a618a2..3d45eb1942b 100644 --- a/src/ethereum/forks/berlin/vm/__init__.py +++ b/src/ethereum/forks/berlin/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -51,6 +52,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -82,6 +84,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -98,6 +101,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -122,6 +126,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/berlin/vm/gas.py b/src/ethereum/forks/berlin/vm/gas.py index 4b58c9f8a05..e69df508070 100644 --- a/src/ethereum/forks/berlin/vm/gas.py +++ b/src/ethereum/forks/berlin/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -161,6 +161,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -176,6 +177,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/berlin/vm/interpreter.py b/src/ethereum/forks/berlin/vm/interpreter.py index 9efc07bc5b4..eea97094a78 100644 --- a/src/ethereum/forks/berlin/vm/interpreter.py +++ b/src/ethereum/forks/berlin/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -63,6 +63,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/bpo1/blocks.py b/src/ethereum/forks/bpo1/blocks.py index 6b6711b29dd..cd4b2daca34 100644 --- a/src/ethereum/forks/bpo1/blocks.py +++ b/src/ethereum/forks/bpo1/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -245,6 +247,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -298,6 +301,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -330,6 +334,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/bpo1/fork.py b/src/ethereum/forks/bpo1/fork.py index d84cee05378..f3845c735e1 100644 --- a/src/ethereum/forks/bpo1/fork.py +++ b/src/ethereum/forks/bpo1/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -123,6 +123,7 @@ BLOB_COUNT_LIMIT = 6 +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/bpo1/fork_types.py b/src/ethereum/forks/bpo1/fork_types.py index c598e9876bf..4bec34810db 100644 --- a/src/ethereum/forks/bpo1/fork_types.py +++ b/src/ethereum/forks/bpo1/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -43,6 +44,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/bpo1/state_tracker.py b/src/ethereum/forks/bpo1/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/bpo1/state_tracker.py +++ b/src/ethereum/forks/bpo1/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/bpo1/transactions.py b/src/ethereum/forks/bpo1/transactions.py index 486b21f99b0..18953538456 100644 --- a/src/ethereum/forks/bpo1/transactions.py +++ b/src/ethereum/forks/bpo1/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -31,6 +31,7 @@ TX_MAX_GAS_LIMIT = Uint(16_777_216) +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -93,6 +94,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -112,6 +114,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -184,6 +187,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -261,6 +265,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -349,6 +354,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/bpo1/vm/__init__.py b/src/ethereum/forks/bpo1/vm/__init__.py index 64cb272d02b..69d8c0b4004 100644 --- a/src/ethereum/forks/bpo1/vm/__init__.py +++ b/src/ethereum/forks/bpo1/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -92,6 +94,7 @@ class BlockOutput: requests: List[Bytes] = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -110,6 +113,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -135,6 +139,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/bpo1/vm/gas.py b/src/ethereum/forks/bpo1/vm/gas.py index 5dbcbdaa520..4d7fe3f4c32 100644 --- a/src/ethereum/forks/bpo1/vm/gas.py +++ b/src/ethereum/forks/bpo1/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -189,6 +189,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -204,6 +205,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/bpo1/vm/interpreter.py b/src/ethereum/forks/bpo1/vm/interpreter.py index f637dac044c..64ffe56e7b8 100644 --- a/src/ethereum/forks/bpo1/vm/interpreter.py +++ b/src/ethereum/forks/bpo1/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/bpo2/blocks.py b/src/ethereum/forks/bpo2/blocks.py index 27c85b2382a..209862680f1 100644 --- a/src/ethereum/forks/bpo2/blocks.py +++ b/src/ethereum/forks/bpo2/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -245,6 +247,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -298,6 +301,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -330,6 +334,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/bpo2/fork.py b/src/ethereum/forks/bpo2/fork.py index d84cee05378..f3845c735e1 100644 --- a/src/ethereum/forks/bpo2/fork.py +++ b/src/ethereum/forks/bpo2/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -123,6 +123,7 @@ BLOB_COUNT_LIMIT = 6 +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/bpo2/fork_types.py b/src/ethereum/forks/bpo2/fork_types.py index c598e9876bf..4bec34810db 100644 --- a/src/ethereum/forks/bpo2/fork_types.py +++ b/src/ethereum/forks/bpo2/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -43,6 +44,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/bpo2/state_tracker.py b/src/ethereum/forks/bpo2/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/bpo2/state_tracker.py +++ b/src/ethereum/forks/bpo2/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/bpo2/transactions.py b/src/ethereum/forks/bpo2/transactions.py index 486b21f99b0..18953538456 100644 --- a/src/ethereum/forks/bpo2/transactions.py +++ b/src/ethereum/forks/bpo2/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -31,6 +31,7 @@ TX_MAX_GAS_LIMIT = Uint(16_777_216) +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -93,6 +94,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -112,6 +114,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -184,6 +187,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -261,6 +265,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -349,6 +354,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/bpo2/vm/__init__.py b/src/ethereum/forks/bpo2/vm/__init__.py index 64cb272d02b..69d8c0b4004 100644 --- a/src/ethereum/forks/bpo2/vm/__init__.py +++ b/src/ethereum/forks/bpo2/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -92,6 +94,7 @@ class BlockOutput: requests: List[Bytes] = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -110,6 +113,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -135,6 +139,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/bpo2/vm/gas.py b/src/ethereum/forks/bpo2/vm/gas.py index 22914dd22ae..653f6eb9ea1 100644 --- a/src/ethereum/forks/bpo2/vm/gas.py +++ b/src/ethereum/forks/bpo2/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -189,6 +189,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -204,6 +205,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/bpo2/vm/interpreter.py b/src/ethereum/forks/bpo2/vm/interpreter.py index ac08d1956c4..5be8a929f02 100644 --- a/src/ethereum/forks/bpo2/vm/interpreter.py +++ b/src/ethereum/forks/bpo2/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/bpo3/blocks.py b/src/ethereum/forks/bpo3/blocks.py index c057beefa76..df26affccfb 100644 --- a/src/ethereum/forks/bpo3/blocks.py +++ b/src/ethereum/forks/bpo3/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -245,6 +247,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -298,6 +301,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -330,6 +334,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/bpo3/fork.py b/src/ethereum/forks/bpo3/fork.py index d84cee05378..f3845c735e1 100644 --- a/src/ethereum/forks/bpo3/fork.py +++ b/src/ethereum/forks/bpo3/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -123,6 +123,7 @@ BLOB_COUNT_LIMIT = 6 +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/bpo3/fork_types.py b/src/ethereum/forks/bpo3/fork_types.py index c598e9876bf..4bec34810db 100644 --- a/src/ethereum/forks/bpo3/fork_types.py +++ b/src/ethereum/forks/bpo3/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -43,6 +44,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/bpo3/state_tracker.py b/src/ethereum/forks/bpo3/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/bpo3/state_tracker.py +++ b/src/ethereum/forks/bpo3/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/bpo3/transactions.py b/src/ethereum/forks/bpo3/transactions.py index 486b21f99b0..18953538456 100644 --- a/src/ethereum/forks/bpo3/transactions.py +++ b/src/ethereum/forks/bpo3/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -31,6 +31,7 @@ TX_MAX_GAS_LIMIT = Uint(16_777_216) +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -93,6 +94,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -112,6 +114,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -184,6 +187,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -261,6 +265,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -349,6 +354,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/bpo3/vm/__init__.py b/src/ethereum/forks/bpo3/vm/__init__.py index 64cb272d02b..69d8c0b4004 100644 --- a/src/ethereum/forks/bpo3/vm/__init__.py +++ b/src/ethereum/forks/bpo3/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -92,6 +94,7 @@ class BlockOutput: requests: List[Bytes] = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -110,6 +113,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -135,6 +139,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/bpo3/vm/gas.py b/src/ethereum/forks/bpo3/vm/gas.py index 22914dd22ae..653f6eb9ea1 100644 --- a/src/ethereum/forks/bpo3/vm/gas.py +++ b/src/ethereum/forks/bpo3/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -189,6 +189,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -204,6 +205,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/bpo3/vm/interpreter.py b/src/ethereum/forks/bpo3/vm/interpreter.py index 3b6ac4aed0a..b7995f3c6fc 100644 --- a/src/ethereum/forks/bpo3/vm/interpreter.py +++ b/src/ethereum/forks/bpo3/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/bpo4/blocks.py b/src/ethereum/forks/bpo4/blocks.py index a6e5ad56b59..5fcadec15d9 100644 --- a/src/ethereum/forks/bpo4/blocks.py +++ b/src/ethereum/forks/bpo4/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -245,6 +247,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -298,6 +301,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -330,6 +334,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/bpo4/fork.py b/src/ethereum/forks/bpo4/fork.py index d84cee05378..f3845c735e1 100644 --- a/src/ethereum/forks/bpo4/fork.py +++ b/src/ethereum/forks/bpo4/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -123,6 +123,7 @@ BLOB_COUNT_LIMIT = 6 +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/bpo4/fork_types.py b/src/ethereum/forks/bpo4/fork_types.py index c598e9876bf..4bec34810db 100644 --- a/src/ethereum/forks/bpo4/fork_types.py +++ b/src/ethereum/forks/bpo4/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -43,6 +44,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/bpo4/state_tracker.py b/src/ethereum/forks/bpo4/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/bpo4/state_tracker.py +++ b/src/ethereum/forks/bpo4/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/bpo4/transactions.py b/src/ethereum/forks/bpo4/transactions.py index 486b21f99b0..18953538456 100644 --- a/src/ethereum/forks/bpo4/transactions.py +++ b/src/ethereum/forks/bpo4/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -31,6 +31,7 @@ TX_MAX_GAS_LIMIT = Uint(16_777_216) +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -93,6 +94,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -112,6 +114,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -184,6 +187,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -261,6 +265,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -349,6 +354,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/bpo4/vm/__init__.py b/src/ethereum/forks/bpo4/vm/__init__.py index 64cb272d02b..69d8c0b4004 100644 --- a/src/ethereum/forks/bpo4/vm/__init__.py +++ b/src/ethereum/forks/bpo4/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -92,6 +94,7 @@ class BlockOutput: requests: List[Bytes] = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -110,6 +113,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -135,6 +139,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/bpo4/vm/gas.py b/src/ethereum/forks/bpo4/vm/gas.py index 22914dd22ae..653f6eb9ea1 100644 --- a/src/ethereum/forks/bpo4/vm/gas.py +++ b/src/ethereum/forks/bpo4/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -189,6 +189,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -204,6 +205,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/bpo4/vm/interpreter.py b/src/ethereum/forks/bpo4/vm/interpreter.py index 7c943b1b4c0..a778ad9af53 100644 --- a/src/ethereum/forks/bpo4/vm/interpreter.py +++ b/src/ethereum/forks/bpo4/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/bpo5/blocks.py b/src/ethereum/forks/bpo5/blocks.py index 87cb7bca1ba..eed86b7e175 100644 --- a/src/ethereum/forks/bpo5/blocks.py +++ b/src/ethereum/forks/bpo5/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -245,6 +247,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -298,6 +301,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -330,6 +334,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/bpo5/fork.py b/src/ethereum/forks/bpo5/fork.py index d84cee05378..f3845c735e1 100644 --- a/src/ethereum/forks/bpo5/fork.py +++ b/src/ethereum/forks/bpo5/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -123,6 +123,7 @@ BLOB_COUNT_LIMIT = 6 +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/bpo5/fork_types.py b/src/ethereum/forks/bpo5/fork_types.py index c598e9876bf..4bec34810db 100644 --- a/src/ethereum/forks/bpo5/fork_types.py +++ b/src/ethereum/forks/bpo5/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -43,6 +44,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/bpo5/state_tracker.py b/src/ethereum/forks/bpo5/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/bpo5/state_tracker.py +++ b/src/ethereum/forks/bpo5/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/bpo5/transactions.py b/src/ethereum/forks/bpo5/transactions.py index 486b21f99b0..18953538456 100644 --- a/src/ethereum/forks/bpo5/transactions.py +++ b/src/ethereum/forks/bpo5/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -31,6 +31,7 @@ TX_MAX_GAS_LIMIT = Uint(16_777_216) +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -93,6 +94,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -112,6 +114,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -184,6 +187,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -261,6 +265,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -349,6 +354,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/bpo5/vm/__init__.py b/src/ethereum/forks/bpo5/vm/__init__.py index 64cb272d02b..69d8c0b4004 100644 --- a/src/ethereum/forks/bpo5/vm/__init__.py +++ b/src/ethereum/forks/bpo5/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -92,6 +94,7 @@ class BlockOutput: requests: List[Bytes] = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -110,6 +113,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -135,6 +139,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/bpo5/vm/gas.py b/src/ethereum/forks/bpo5/vm/gas.py index 22914dd22ae..653f6eb9ea1 100644 --- a/src/ethereum/forks/bpo5/vm/gas.py +++ b/src/ethereum/forks/bpo5/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -189,6 +189,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -204,6 +205,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/bpo5/vm/interpreter.py b/src/ethereum/forks/bpo5/vm/interpreter.py index c09a3b4ef50..b94bab8b33b 100644 --- a/src/ethereum/forks/bpo5/vm/interpreter.py +++ b/src/ethereum/forks/bpo5/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/byzantium/blocks.py b/src/ethereum/forks/byzantium/blocks.py index 68cabfa1bee..26091316a9c 100644 --- a/src/ethereum/forks/byzantium/blocks.py +++ b/src/ethereum/forks/byzantium/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/byzantium/fork.py b/src/ethereum/forks/byzantium/fork.py index 66b4ffd8a13..ba029940c05 100644 --- a/src/ethereum/forks/byzantium/fork.py +++ b/src/ethereum/forks/byzantium/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.numeric import U64, U256, Uint @@ -68,6 +68,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/byzantium/state_tracker.py b/src/ethereum/forks/byzantium/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/byzantium/state_tracker.py +++ b/src/ethereum/forks/byzantium/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/byzantium/transactions.py b/src/ethereum/forks/byzantium/transactions.py index c2dda52bd71..8272ebea080 100644 --- a/src/ethereum/forks/byzantium/transactions.py +++ b/src/ethereum/forks/byzantium/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/byzantium/vm/__init__.py b/src/ethereum/forks/byzantium/vm/__init__.py index 657d2f7e6c3..34c17078ca7 100644 --- a/src/ethereum/forks/byzantium/vm/__init__.py +++ b/src/ethereum/forks/byzantium/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -51,6 +52,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -82,6 +84,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -96,6 +99,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -118,6 +122,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/byzantium/vm/gas.py b/src/ethereum/forks/byzantium/vm/gas.py index 5a0d5883a91..e1ca31b5748 100644 --- a/src/ethereum/forks/byzantium/vm/gas.py +++ b/src/ethereum/forks/byzantium/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -154,6 +154,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(700) +@final @dataclass class ExtendMemory: """ @@ -169,6 +170,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/byzantium/vm/interpreter.py b/src/ethereum/forks/byzantium/vm/interpreter.py index 89639e94588..5544b8a489e 100644 --- a/src/ethereum/forks/byzantium/vm/interpreter.py +++ b/src/ethereum/forks/byzantium/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -62,6 +62,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/cancun/blocks.py b/src/ethereum/forks/cancun/blocks.py index 981f9c7be6a..3507f8a3284 100644 --- a/src/ethereum/forks/cancun/blocks.py +++ b/src/ethereum/forks/cancun/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -30,6 +30,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -63,6 +64,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -234,6 +236,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -287,6 +290,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -319,6 +323,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/cancun/fork.py b/src/ethereum/forks/cancun/fork.py index 7f4be088993..9004a1deb6f 100644 --- a/src/ethereum/forks/cancun/fork.py +++ b/src/ethereum/forks/cancun/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -96,6 +96,7 @@ VERSIONED_HASH_VERSION_KZG = b"\x01" +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/cancun/state_tracker.py b/src/ethereum/forks/cancun/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/cancun/state_tracker.py +++ b/src/ethereum/forks/cancun/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/cancun/transactions.py b/src/ethereum/forks/cancun/transactions.py index b8f431f64e0..e8b3efbfddb 100644 --- a/src/ethereum/forks/cancun/transactions.py +++ b/src/ethereum/forks/cancun/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -25,6 +25,7 @@ from .fork_types import VersionedHash +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -86,6 +87,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -105,6 +107,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -177,6 +180,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -254,6 +258,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: diff --git a/src/ethereum/forks/cancun/vm/__init__.py b/src/ethereum/forks/cancun/vm/__init__.py index e2214f4810f..1fc58a4ca79 100644 --- a/src/ethereum/forks/cancun/vm/__init__.py +++ b/src/ethereum/forks/cancun/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -89,6 +91,7 @@ class BlockOutput: blob_gas_used: U64 = U64(0) +@final @dataclass class TransactionEnvironment: """ @@ -106,6 +109,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -130,6 +134,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/cancun/vm/gas.py b/src/ethereum/forks/cancun/vm/gas.py index b204e87342a..645f6b945be 100644 --- a/src/ethereum/forks/cancun/vm/gas.py +++ b/src/ethereum/forks/cancun/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -175,6 +175,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -190,6 +191,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/cancun/vm/interpreter.py b/src/ethereum/forks/cancun/vm/interpreter.py index 1157d0cf0c1..bb0687a666e 100644 --- a/src/ethereum/forks/cancun/vm/interpreter.py +++ b/src/ethereum/forks/cancun/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -63,6 +63,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/constantinople/blocks.py b/src/ethereum/forks/constantinople/blocks.py index f34abc2db12..94dd37899b8 100644 --- a/src/ethereum/forks/constantinople/blocks.py +++ b/src/ethereum/forks/constantinople/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/constantinople/fork.py b/src/ethereum/forks/constantinople/fork.py index 855faf3acb4..f609a3e990c 100644 --- a/src/ethereum/forks/constantinople/fork.py +++ b/src/ethereum/forks/constantinople/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.numeric import U64, U256, Uint @@ -68,6 +68,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/constantinople/state_tracker.py b/src/ethereum/forks/constantinople/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/constantinople/state_tracker.py +++ b/src/ethereum/forks/constantinople/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/constantinople/transactions.py b/src/ethereum/forks/constantinople/transactions.py index c2dda52bd71..8272ebea080 100644 --- a/src/ethereum/forks/constantinople/transactions.py +++ b/src/ethereum/forks/constantinople/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/constantinople/vm/__init__.py b/src/ethereum/forks/constantinople/vm/__init__.py index 657d2f7e6c3..34c17078ca7 100644 --- a/src/ethereum/forks/constantinople/vm/__init__.py +++ b/src/ethereum/forks/constantinople/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -51,6 +52,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -82,6 +84,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -96,6 +99,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -118,6 +122,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/constantinople/vm/gas.py b/src/ethereum/forks/constantinople/vm/gas.py index 4e13e5e779d..cec1b0c0608 100644 --- a/src/ethereum/forks/constantinople/vm/gas.py +++ b/src/ethereum/forks/constantinople/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -158,6 +158,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(700) +@final @dataclass class ExtendMemory: """ @@ -173,6 +174,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/constantinople/vm/interpreter.py b/src/ethereum/forks/constantinople/vm/interpreter.py index af3266e95c4..4796f0ff997 100644 --- a/src/ethereum/forks/constantinople/vm/interpreter.py +++ b/src/ethereum/forks/constantinople/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -62,6 +62,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/dao_fork/blocks.py b/src/ethereum/forks/dao_fork/blocks.py index ef30c3f0351..7e6320bb827 100644 --- a/src/ethereum/forks/dao_fork/blocks.py +++ b/src/ethereum/forks/dao_fork/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/dao_fork/fork.py b/src/ethereum/forks/dao_fork/fork.py index 4098bed5463..5e8f0dba7bf 100644 --- a/src/ethereum/forks/dao_fork/fork.py +++ b/src/ethereum/forks/dao_fork/fork.py @@ -14,7 +14,7 @@ """ from dataclasses import dataclass -from typing import List, Set, Tuple +from typing import List, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes32 @@ -68,6 +68,7 @@ MAX_OMMER_DEPTH = Uint(6) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/dao_fork/state_tracker.py b/src/ethereum/forks/dao_fork/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/dao_fork/state_tracker.py +++ b/src/ethereum/forks/dao_fork/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/dao_fork/transactions.py b/src/ethereum/forks/dao_fork/transactions.py index 1458316ce5b..f13e81f25b9 100644 --- a/src/ethereum/forks/dao_fork/transactions.py +++ b/src/ethereum/forks/dao_fork/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/dao_fork/vm/__init__.py b/src/ethereum/forks/dao_fork/vm/__init__.py index 3b5007aa541..9d49935eaaf 100644 --- a/src/ethereum/forks/dao_fork/vm/__init__.py +++ b/src/ethereum/forks/dao_fork/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -30,6 +30,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -46,6 +47,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -77,6 +79,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -91,6 +94,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -112,6 +116,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/dao_fork/vm/gas.py b/src/ethereum/forks/dao_fork/vm/gas.py index a2a5c638fae..4d56fd9486b 100644 --- a/src/ethereum/forks/dao_fork/vm/gas.py +++ b/src/ethereum/forks/dao_fork/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -147,6 +147,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(40) +@final @dataclass class ExtendMemory: """ @@ -162,6 +163,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/dao_fork/vm/interpreter.py b/src/ethereum/forks/dao_fork/vm/interpreter.py index 9ad12ee6428..bdd65600275 100644 --- a/src/ethereum/forks/dao_fork/vm/interpreter.py +++ b/src/ethereum/forks/dao_fork/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -57,6 +57,7 @@ STACK_DEPTH_LIMIT = Uint(1024) +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/frontier/blocks.py b/src/ethereum/forks/frontier/blocks.py index 3d19ab42f4b..b6a4db96624 100644 --- a/src/ethereum/forks/frontier/blocks.py +++ b/src/ethereum/forks/frontier/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/frontier/fork.py b/src/ethereum/forks/frontier/fork.py index 125ecfa001b..0ef816228cd 100644 --- a/src/ethereum/forks/frontier/fork.py +++ b/src/ethereum/forks/frontier/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Set, Tuple +from typing import List, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes32 @@ -64,6 +64,7 @@ MAX_OMMER_DEPTH = Uint(6) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/frontier/state_tracker.py b/src/ethereum/forks/frontier/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/frontier/state_tracker.py +++ b/src/ethereum/forks/frontier/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/frontier/transactions.py b/src/ethereum/forks/frontier/transactions.py index f08d2e435ef..831818542dd 100644 --- a/src/ethereum/forks/frontier/transactions.py +++ b/src/ethereum/forks/frontier/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/frontier/vm/__init__.py b/src/ethereum/forks/frontier/vm/__init__.py index d2e566bde19..3abcf73ef0c 100644 --- a/src/ethereum/forks/frontier/vm/__init__.py +++ b/src/ethereum/forks/frontier/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -30,6 +30,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -46,6 +47,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -77,6 +79,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -91,6 +94,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -111,6 +115,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/frontier/vm/gas.py b/src/ethereum/forks/frontier/vm/gas.py index d145ef1d372..6090e913e52 100644 --- a/src/ethereum/forks/frontier/vm/gas.py +++ b/src/ethereum/forks/frontier/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -145,6 +145,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(40) +@final @dataclass class ExtendMemory: """ @@ -160,6 +161,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/frontier/vm/interpreter.py b/src/ethereum/forks/frontier/vm/interpreter.py index c2a6e0d7c19..00a7c52c0db 100644 --- a/src/ethereum/forks/frontier/vm/interpreter.py +++ b/src/ethereum/forks/frontier/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -57,6 +57,7 @@ STACK_DEPTH_LIMIT = Uint(1024) +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/gray_glacier/blocks.py b/src/ethereum/forks/gray_glacier/blocks.py index 6735da330b3..e36a9a38aba 100644 --- a/src/ethereum/forks/gray_glacier/blocks.py +++ b/src/ethereum/forks/gray_glacier/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -29,6 +29,7 @@ ) +@final @slotted_freezable @dataclass class Header: @@ -183,6 +184,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -229,6 +231,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -261,6 +264,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/gray_glacier/fork.py b/src/ethereum/forks/gray_glacier/fork.py index 9d44f903b3e..072f74b8ab8 100644 --- a/src/ethereum/forks/gray_glacier/fork.py +++ b/src/ethereum/forks/gray_glacier/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -80,6 +80,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/gray_glacier/state_tracker.py b/src/ethereum/forks/gray_glacier/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/gray_glacier/state_tracker.py +++ b/src/ethereum/forks/gray_glacier/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/gray_glacier/transactions.py b/src/ethereum/forks/gray_glacier/transactions.py index 7ee0abbf8ef..902128e634c 100644 --- a/src/ethereum/forks/gray_glacier/transactions.py +++ b/src/ethereum/forks/gray_glacier/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -24,6 +24,7 @@ from .exceptions import TransactionTypeError +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -83,6 +84,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -102,6 +104,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -174,6 +177,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: diff --git a/src/ethereum/forks/gray_glacier/vm/__init__.py b/src/ethereum/forks/gray_glacier/vm/__init__.py index f53d3428ce0..de14a20dedf 100644 --- a/src/ethereum/forks/gray_glacier/vm/__init__.py +++ b/src/ethereum/forks/gray_glacier/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -52,6 +53,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -83,6 +85,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -99,6 +102,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -123,6 +127,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/gray_glacier/vm/gas.py b/src/ethereum/forks/gray_glacier/vm/gas.py index 00a47783f9a..898c7024d28 100644 --- a/src/ethereum/forks/gray_glacier/vm/gas.py +++ b/src/ethereum/forks/gray_glacier/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -161,6 +161,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -176,6 +177,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/gray_glacier/vm/interpreter.py b/src/ethereum/forks/gray_glacier/vm/interpreter.py index 945f839fa45..cb5b6a39d2c 100644 --- a/src/ethereum/forks/gray_glacier/vm/interpreter.py +++ b/src/ethereum/forks/gray_glacier/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -64,6 +64,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/homestead/blocks.py b/src/ethereum/forks/homestead/blocks.py index 12dca22e7f6..bc21e326b4e 100644 --- a/src/ethereum/forks/homestead/blocks.py +++ b/src/ethereum/forks/homestead/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/homestead/fork.py b/src/ethereum/forks/homestead/fork.py index 03dc0e80928..8d203bb9d71 100644 --- a/src/ethereum/forks/homestead/fork.py +++ b/src/ethereum/forks/homestead/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Set, Tuple +from typing import List, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes32 @@ -64,6 +64,7 @@ MAX_OMMER_DEPTH = Uint(6) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/homestead/state_tracker.py b/src/ethereum/forks/homestead/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/homestead/state_tracker.py +++ b/src/ethereum/forks/homestead/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/homestead/transactions.py b/src/ethereum/forks/homestead/transactions.py index 1458316ce5b..f13e81f25b9 100644 --- a/src/ethereum/forks/homestead/transactions.py +++ b/src/ethereum/forks/homestead/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/homestead/vm/__init__.py b/src/ethereum/forks/homestead/vm/__init__.py index 3b5007aa541..9d49935eaaf 100644 --- a/src/ethereum/forks/homestead/vm/__init__.py +++ b/src/ethereum/forks/homestead/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -30,6 +30,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -46,6 +47,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -77,6 +79,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -91,6 +94,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -112,6 +116,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/homestead/vm/gas.py b/src/ethereum/forks/homestead/vm/gas.py index a2a5c638fae..4d56fd9486b 100644 --- a/src/ethereum/forks/homestead/vm/gas.py +++ b/src/ethereum/forks/homestead/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -147,6 +147,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(40) +@final @dataclass class ExtendMemory: """ @@ -162,6 +163,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/homestead/vm/interpreter.py b/src/ethereum/forks/homestead/vm/interpreter.py index 25062166f80..21445abf5c8 100644 --- a/src/ethereum/forks/homestead/vm/interpreter.py +++ b/src/ethereum/forks/homestead/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -57,6 +57,7 @@ STACK_DEPTH_LIMIT = Uint(1024) +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/istanbul/blocks.py b/src/ethereum/forks/istanbul/blocks.py index 7573703a19d..3cdd475a33a 100644 --- a/src/ethereum/forks/istanbul/blocks.py +++ b/src/ethereum/forks/istanbul/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/istanbul/fork.py b/src/ethereum/forks/istanbul/fork.py index 3738b0bfc6e..2351ee2c9d2 100644 --- a/src/ethereum/forks/istanbul/fork.py +++ b/src/ethereum/forks/istanbul/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.numeric import U64, U256, Uint @@ -68,6 +68,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/istanbul/state_tracker.py b/src/ethereum/forks/istanbul/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/istanbul/state_tracker.py +++ b/src/ethereum/forks/istanbul/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/istanbul/transactions.py b/src/ethereum/forks/istanbul/transactions.py index c2dda52bd71..8272ebea080 100644 --- a/src/ethereum/forks/istanbul/transactions.py +++ b/src/ethereum/forks/istanbul/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/istanbul/vm/__init__.py b/src/ethereum/forks/istanbul/vm/__init__.py index 657d2f7e6c3..34c17078ca7 100644 --- a/src/ethereum/forks/istanbul/vm/__init__.py +++ b/src/ethereum/forks/istanbul/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -51,6 +52,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -82,6 +84,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -96,6 +99,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -118,6 +122,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/istanbul/vm/gas.py b/src/ethereum/forks/istanbul/vm/gas.py index a3c88ecef85..f122c967dc6 100644 --- a/src/ethereum/forks/istanbul/vm/gas.py +++ b/src/ethereum/forks/istanbul/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -161,6 +161,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(700) +@final @dataclass class ExtendMemory: """ @@ -176,6 +177,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/istanbul/vm/interpreter.py b/src/ethereum/forks/istanbul/vm/interpreter.py index f812a5139be..ed7b86a45d9 100644 --- a/src/ethereum/forks/istanbul/vm/interpreter.py +++ b/src/ethereum/forks/istanbul/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -63,6 +63,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/london/blocks.py b/src/ethereum/forks/london/blocks.py index 812df3325f9..d6708cc2f68 100644 --- a/src/ethereum/forks/london/blocks.py +++ b/src/ethereum/forks/london/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -29,6 +29,7 @@ ) +@final @slotted_freezable @dataclass class Header: @@ -183,6 +184,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -229,6 +231,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -261,6 +264,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/london/fork.py b/src/ethereum/forks/london/fork.py index 2bf18f3e413..306d04da06c 100644 --- a/src/ethereum/forks/london/fork.py +++ b/src/ethereum/forks/london/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -82,6 +82,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/london/state_tracker.py b/src/ethereum/forks/london/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/london/state_tracker.py +++ b/src/ethereum/forks/london/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/london/transactions.py b/src/ethereum/forks/london/transactions.py index 7ee0abbf8ef..902128e634c 100644 --- a/src/ethereum/forks/london/transactions.py +++ b/src/ethereum/forks/london/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -24,6 +24,7 @@ from .exceptions import TransactionTypeError +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -83,6 +84,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -102,6 +104,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -174,6 +177,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: diff --git a/src/ethereum/forks/london/vm/__init__.py b/src/ethereum/forks/london/vm/__init__.py index f53d3428ce0..de14a20dedf 100644 --- a/src/ethereum/forks/london/vm/__init__.py +++ b/src/ethereum/forks/london/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -52,6 +53,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -83,6 +85,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -99,6 +102,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -123,6 +127,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/london/vm/gas.py b/src/ethereum/forks/london/vm/gas.py index 00a47783f9a..898c7024d28 100644 --- a/src/ethereum/forks/london/vm/gas.py +++ b/src/ethereum/forks/london/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -161,6 +161,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -176,6 +177,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/london/vm/interpreter.py b/src/ethereum/forks/london/vm/interpreter.py index 5f32151ff55..1b42b4da68a 100644 --- a/src/ethereum/forks/london/vm/interpreter.py +++ b/src/ethereum/forks/london/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -64,6 +64,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/muir_glacier/blocks.py b/src/ethereum/forks/muir_glacier/blocks.py index ca5968194b4..426cfdb5dde 100644 --- a/src/ethereum/forks/muir_glacier/blocks.py +++ b/src/ethereum/forks/muir_glacier/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/muir_glacier/fork.py b/src/ethereum/forks/muir_glacier/fork.py index 451d36a80de..753315d933d 100644 --- a/src/ethereum/forks/muir_glacier/fork.py +++ b/src/ethereum/forks/muir_glacier/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.numeric import U64, U256, Uint @@ -68,6 +68,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/muir_glacier/state_tracker.py b/src/ethereum/forks/muir_glacier/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/muir_glacier/state_tracker.py +++ b/src/ethereum/forks/muir_glacier/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/muir_glacier/transactions.py b/src/ethereum/forks/muir_glacier/transactions.py index c2dda52bd71..8272ebea080 100644 --- a/src/ethereum/forks/muir_glacier/transactions.py +++ b/src/ethereum/forks/muir_glacier/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/muir_glacier/vm/__init__.py b/src/ethereum/forks/muir_glacier/vm/__init__.py index 657d2f7e6c3..34c17078ca7 100644 --- a/src/ethereum/forks/muir_glacier/vm/__init__.py +++ b/src/ethereum/forks/muir_glacier/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -51,6 +52,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -82,6 +84,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -96,6 +99,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -118,6 +122,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/muir_glacier/vm/gas.py b/src/ethereum/forks/muir_glacier/vm/gas.py index a3c88ecef85..f122c967dc6 100644 --- a/src/ethereum/forks/muir_glacier/vm/gas.py +++ b/src/ethereum/forks/muir_glacier/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -161,6 +161,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(700) +@final @dataclass class ExtendMemory: """ @@ -176,6 +177,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/muir_glacier/vm/interpreter.py b/src/ethereum/forks/muir_glacier/vm/interpreter.py index 684e677145a..12aef672173 100644 --- a/src/ethereum/forks/muir_glacier/vm/interpreter.py +++ b/src/ethereum/forks/muir_glacier/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -63,6 +63,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/osaka/blocks.py b/src/ethereum/forks/osaka/blocks.py index 121b925021a..f1f174f892a 100644 --- a/src/ethereum/forks/osaka/blocks.py +++ b/src/ethereum/forks/osaka/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -247,6 +249,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -300,6 +303,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -332,6 +336,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/osaka/fork.py b/src/ethereum/forks/osaka/fork.py index d84cee05378..f3845c735e1 100644 --- a/src/ethereum/forks/osaka/fork.py +++ b/src/ethereum/forks/osaka/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -123,6 +123,7 @@ BLOB_COUNT_LIMIT = 6 +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/osaka/fork_types.py b/src/ethereum/forks/osaka/fork_types.py index c598e9876bf..4bec34810db 100644 --- a/src/ethereum/forks/osaka/fork_types.py +++ b/src/ethereum/forks/osaka/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -43,6 +44,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/osaka/state_tracker.py b/src/ethereum/forks/osaka/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/osaka/state_tracker.py +++ b/src/ethereum/forks/osaka/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/osaka/transactions.py b/src/ethereum/forks/osaka/transactions.py index 486b21f99b0..18953538456 100644 --- a/src/ethereum/forks/osaka/transactions.py +++ b/src/ethereum/forks/osaka/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -31,6 +31,7 @@ TX_MAX_GAS_LIMIT = Uint(16_777_216) +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -93,6 +94,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -112,6 +114,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -184,6 +187,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -261,6 +265,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -349,6 +354,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/osaka/vm/__init__.py b/src/ethereum/forks/osaka/vm/__init__.py index 64cb272d02b..69d8c0b4004 100644 --- a/src/ethereum/forks/osaka/vm/__init__.py +++ b/src/ethereum/forks/osaka/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -92,6 +94,7 @@ class BlockOutput: requests: List[Bytes] = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -110,6 +113,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -135,6 +139,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/osaka/vm/gas.py b/src/ethereum/forks/osaka/vm/gas.py index e4e9b94712e..575129dfb49 100644 --- a/src/ethereum/forks/osaka/vm/gas.py +++ b/src/ethereum/forks/osaka/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -189,6 +189,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -204,6 +205,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/osaka/vm/interpreter.py b/src/ethereum/forks/osaka/vm/interpreter.py index 76e524c7196..a9edd1c28d2 100644 --- a/src/ethereum/forks/osaka/vm/interpreter.py +++ b/src/ethereum/forks/osaka/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/paris/blocks.py b/src/ethereum/forks/paris/blocks.py index 7e5af5891ff..15852ce82a1 100644 --- a/src/ethereum/forks/paris/blocks.py +++ b/src/ethereum/forks/paris/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -29,6 +29,7 @@ ) +@final @slotted_freezable @dataclass class Header: @@ -171,6 +172,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -215,6 +217,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -247,6 +250,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/paris/fork.py b/src/ethereum/forks/paris/fork.py index 624539868b5..94ff765db55 100644 --- a/src/ethereum/forks/paris/fork.py +++ b/src/ethereum/forks/paris/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Tuple +from typing import List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -72,6 +72,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/paris/state_tracker.py b/src/ethereum/forks/paris/state_tracker.py index 178ffa0a79f..a62bed0c09f 100644 --- a/src/ethereum/forks/paris/state_tracker.py +++ b/src/ethereum/forks/paris/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/paris/transactions.py b/src/ethereum/forks/paris/transactions.py index 7ee0abbf8ef..902128e634c 100644 --- a/src/ethereum/forks/paris/transactions.py +++ b/src/ethereum/forks/paris/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -24,6 +24,7 @@ from .exceptions import TransactionTypeError +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -83,6 +84,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -102,6 +104,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -174,6 +177,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: diff --git a/src/ethereum/forks/paris/vm/__init__.py b/src/ethereum/forks/paris/vm/__init__.py index 40b2000ce7f..4fdf9833803 100644 --- a/src/ethereum/forks/paris/vm/__init__.py +++ b/src/ethereum/forks/paris/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -30,6 +30,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -47,6 +48,7 @@ class BlockEnvironment: prev_randao: Bytes32 +@final @dataclass class BlockOutput: """ @@ -78,6 +80,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -94,6 +97,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -118,6 +122,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/paris/vm/gas.py b/src/ethereum/forks/paris/vm/gas.py index f791baefd4b..78cd45695e1 100644 --- a/src/ethereum/forks/paris/vm/gas.py +++ b/src/ethereum/forks/paris/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -161,6 +161,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -176,6 +177,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/paris/vm/interpreter.py b/src/ethereum/forks/paris/vm/interpreter.py index f1db0ca736f..f7b51029535 100644 --- a/src/ethereum/forks/paris/vm/interpreter.py +++ b/src/ethereum/forks/paris/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -62,6 +62,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/prague/blocks.py b/src/ethereum/forks/prague/blocks.py index 766f7e8b6e4..e34b1dc4e6f 100644 --- a/src/ethereum/forks/prague/blocks.py +++ b/src/ethereum/forks/prague/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -31,6 +31,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -64,6 +65,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -245,6 +247,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -298,6 +301,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -330,6 +334,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/prague/fork.py b/src/ethereum/forks/prague/fork.py index 486ed9861e6..26308472454 100644 --- a/src/ethereum/forks/prague/fork.py +++ b/src/ethereum/forks/prague/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Optional, Tuple +from typing import Final, List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -116,6 +116,7 @@ ) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/prague/fork_types.py b/src/ethereum/forks/prague/fork_types.py index c598e9876bf..4bec34810db 100644 --- a/src/ethereum/forks/prague/fork_types.py +++ b/src/ethereum/forks/prague/fork_types.py @@ -12,6 +12,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes256 @@ -43,6 +44,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes: ) +@final @slotted_freezable @dataclass class Authorization: diff --git a/src/ethereum/forks/prague/state_tracker.py b/src/ethereum/forks/prague/state_tracker.py index 09348663439..67ceaa86321 100644 --- a/src/ethereum/forks/prague/state_tracker.py +++ b/src/ethereum/forks/prague/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -54,6 +55,7 @@ class BlockState: code_writes: Dict[Hash32, Bytes] = field(default_factory=dict) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/prague/transactions.py b/src/ethereum/forks/prague/transactions.py index 48845de1aa6..b85dfd6536f 100644 --- a/src/ethereum/forks/prague/transactions.py +++ b/src/ethereum/forks/prague/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple, TypeGuard +from typing import Tuple, TypeGuard, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -25,6 +25,7 @@ from .fork_types import Authorization, VersionedHash +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -87,6 +88,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -106,6 +108,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -178,6 +181,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: @@ -255,6 +259,7 @@ class FeeMarketTransaction: """ +@final @slotted_freezable @dataclass class BlobTransaction: @@ -343,6 +348,7 @@ class BlobTransaction: """ +@final @slotted_freezable @dataclass class SetCodeTransaction: diff --git a/src/ethereum/forks/prague/vm/__init__.py b/src/ethereum/forks/prague/vm/__init__.py index 64cb272d02b..69d8c0b4004 100644 --- a/src/ethereum/forks/prague/vm/__init__.py +++ b/src/ethereum/forks/prague/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -31,6 +31,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -50,6 +51,7 @@ class BlockEnvironment: parent_beacon_block_root: Hash32 +@final @dataclass class BlockOutput: """ @@ -92,6 +94,7 @@ class BlockOutput: requests: List[Bytes] = field(default_factory=list) +@final @dataclass class TransactionEnvironment: """ @@ -110,6 +113,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -135,6 +139,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/prague/vm/gas.py b/src/ethereum/forks/prague/vm/gas.py index d7d839b8968..d1c7d94b649 100644 --- a/src/ethereum/forks/prague/vm/gas.py +++ b/src/ethereum/forks/prague/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U64, U256, Uint, ulen @@ -184,6 +184,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -199,6 +200,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/prague/vm/interpreter.py b/src/ethereum/forks/prague/vm/interpreter.py index e41c070b463..c52a6768ad9 100644 --- a/src/ethereum/forks/prague/vm/interpreter.py +++ b/src/ethereum/forks/prague/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -66,6 +66,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/shanghai/blocks.py b/src/ethereum/forks/shanghai/blocks.py index 0c56be4303f..04990ab04ff 100644 --- a/src/ethereum/forks/shanghai/blocks.py +++ b/src/ethereum/forks/shanghai/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32 @@ -29,6 +29,7 @@ ) +@final @slotted_freezable @dataclass class Withdrawal: @@ -62,6 +63,7 @@ class Withdrawal: """ +@final @slotted_freezable @dataclass class Header: @@ -210,6 +212,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -263,6 +266,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -295,6 +299,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/shanghai/fork.py b/src/ethereum/forks/shanghai/fork.py index cb1c9a52161..8f10dc466d8 100644 --- a/src/ethereum/forks/shanghai/fork.py +++ b/src/ethereum/forks/shanghai/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Optional, Tuple +from typing import List, Optional, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes @@ -73,6 +73,7 @@ EMPTY_OMMER_HASH = keccak256(rlp.encode([])) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/shanghai/state_tracker.py b/src/ethereum/forks/shanghai/state_tracker.py index 178ffa0a79f..a62bed0c09f 100644 --- a/src/ethereum/forks/shanghai/state_tracker.py +++ b/src/ethereum/forks/shanghai/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/shanghai/transactions.py b/src/ethereum/forks/shanghai/transactions.py index 459c70cb23c..2b76014505b 100644 --- a/src/ethereum/forks/shanghai/transactions.py +++ b/src/ethereum/forks/shanghai/transactions.py @@ -5,7 +5,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0, Bytes32 @@ -24,6 +24,7 @@ from .exceptions import InitCodeTooLargeError, TransactionTypeError +@final @slotted_freezable @dataclass class LegacyTransaction: @@ -83,6 +84,7 @@ class LegacyTransaction: """ +@final @slotted_freezable @dataclass class Access: @@ -102,6 +104,7 @@ class Access: """ +@final @slotted_freezable @dataclass class AccessListTransaction: @@ -174,6 +177,7 @@ class AccessListTransaction: """ +@final @slotted_freezable @dataclass class FeeMarketTransaction: diff --git a/src/ethereum/forks/shanghai/vm/__init__.py b/src/ethereum/forks/shanghai/vm/__init__.py index 147b1971c7d..49009b575e6 100644 --- a/src/ethereum/forks/shanghai/vm/__init__.py +++ b/src/ethereum/forks/shanghai/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0, Bytes32 from ethereum_types.numeric import U64, U256, Uint @@ -30,6 +30,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -47,6 +48,7 @@ class BlockEnvironment: prev_randao: Bytes32 +@final @dataclass class BlockOutput: """ @@ -83,6 +85,7 @@ class BlockOutput: ) +@final @dataclass class TransactionEnvironment: """ @@ -99,6 +102,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -123,6 +127,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/shanghai/vm/gas.py b/src/ethereum/forks/shanghai/vm/gas.py index ba9c5b7634e..8babf45d1d7 100644 --- a/src/ethereum/forks/shanghai/vm/gas.py +++ b/src/ethereum/forks/shanghai/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -163,6 +163,7 @@ class GasCosts: OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000) +@final @dataclass class ExtendMemory: """ @@ -178,6 +179,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/shanghai/vm/interpreter.py b/src/ethereum/forks/shanghai/vm/interpreter.py index 84c6af3660f..be7fbda75c2 100644 --- a/src/ethereum/forks/shanghai/vm/interpreter.py +++ b/src/ethereum/forks/shanghai/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -63,6 +63,7 @@ MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/spurious_dragon/blocks.py b/src/ethereum/forks/spurious_dragon/blocks.py index 79ddf72c20f..f1f063a18b3 100644 --- a/src/ethereum/forks/spurious_dragon/blocks.py +++ b/src/ethereum/forks/spurious_dragon/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/spurious_dragon/fork.py b/src/ethereum/forks/spurious_dragon/fork.py index 1d4f4e809d6..e09e6b79ce8 100644 --- a/src/ethereum/forks/spurious_dragon/fork.py +++ b/src/ethereum/forks/spurious_dragon/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Set, Tuple +from typing import List, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes32 @@ -66,6 +66,7 @@ MAX_OMMER_DEPTH = Uint(6) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/spurious_dragon/state_tracker.py b/src/ethereum/forks/spurious_dragon/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/spurious_dragon/state_tracker.py +++ b/src/ethereum/forks/spurious_dragon/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/spurious_dragon/transactions.py b/src/ethereum/forks/spurious_dragon/transactions.py index c2dda52bd71..8272ebea080 100644 --- a/src/ethereum/forks/spurious_dragon/transactions.py +++ b/src/ethereum/forks/spurious_dragon/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/spurious_dragon/vm/__init__.py b/src/ethereum/forks/spurious_dragon/vm/__init__.py index f5ada743d6d..eb20144174e 100644 --- a/src/ethereum/forks/spurious_dragon/vm/__init__.py +++ b/src/ethereum/forks/spurious_dragon/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -35,6 +35,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -51,6 +52,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -82,6 +84,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -96,6 +99,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -117,6 +121,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/spurious_dragon/vm/gas.py b/src/ethereum/forks/spurious_dragon/vm/gas.py index 4304e1364fc..6c82566515f 100644 --- a/src/ethereum/forks/spurious_dragon/vm/gas.py +++ b/src/ethereum/forks/spurious_dragon/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -147,6 +147,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(700) +@final @dataclass class ExtendMemory: """ @@ -162,6 +163,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/spurious_dragon/vm/interpreter.py b/src/ethereum/forks/spurious_dragon/vm/interpreter.py index 788b93aa336..622014f0047 100644 --- a/src/ethereum/forks/spurious_dragon/vm/interpreter.py +++ b/src/ethereum/forks/spurious_dragon/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -61,6 +61,7 @@ MAX_CODE_SIZE = 0x6000 +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/forks/tangerine_whistle/blocks.py b/src/ethereum/forks/tangerine_whistle/blocks.py index e9d4c3c3fe7..ddc52041b03 100644 --- a/src/ethereum/forks/tangerine_whistle/blocks.py +++ b/src/ethereum/forks/tangerine_whistle/blocks.py @@ -10,7 +10,7 @@ """ from dataclasses import dataclass -from typing import Tuple +from typing import Tuple, final from ethereum_types.bytes import Bytes, Bytes8, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -23,6 +23,7 @@ from .transactions import Transaction +@final @slotted_freezable @dataclass class Header: @@ -159,6 +160,7 @@ class Header: """ +@final @slotted_freezable @dataclass class Block: @@ -203,6 +205,7 @@ class Block: """ +@final @slotted_freezable @dataclass class Log: @@ -235,6 +238,7 @@ class Log: """ +@final @slotted_freezable @dataclass class Receipt: diff --git a/src/ethereum/forks/tangerine_whistle/fork.py b/src/ethereum/forks/tangerine_whistle/fork.py index 03dc0e80928..8d203bb9d71 100644 --- a/src/ethereum/forks/tangerine_whistle/fork.py +++ b/src/ethereum/forks/tangerine_whistle/fork.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import List, Set, Tuple +from typing import List, Set, Tuple, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes32 @@ -64,6 +64,7 @@ MAX_OMMER_DEPTH = Uint(6) +@final @dataclass class BlockChain: """ diff --git a/src/ethereum/forks/tangerine_whistle/state_tracker.py b/src/ethereum/forks/tangerine_whistle/state_tracker.py index f6702729bc2..24362ecff98 100644 --- a/src/ethereum/forks/tangerine_whistle/state_tracker.py +++ b/src/ethereum/forks/tangerine_whistle/state_tracker.py @@ -19,7 +19,7 @@ """ from dataclasses import dataclass, field -from typing import Callable, Dict, Optional, Set, Tuple +from typing import Callable, Dict, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes32 from ethereum_types.frozen import modify @@ -36,6 +36,7 @@ ) +@final @dataclass class BlockState: """ @@ -59,6 +60,7 @@ class BlockState: storage_clears: Set[Address] = field(default_factory=set) +@final @dataclass class TransactionState: """ diff --git a/src/ethereum/forks/tangerine_whistle/transactions.py b/src/ethereum/forks/tangerine_whistle/transactions.py index 1458316ce5b..f13e81f25b9 100644 --- a/src/ethereum/forks/tangerine_whistle/transactions.py +++ b/src/ethereum/forks/tangerine_whistle/transactions.py @@ -5,6 +5,7 @@ """ from dataclasses import dataclass +from typing import final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes0 @@ -21,6 +22,7 @@ from ethereum.state import Address +@final @slotted_freezable @dataclass class Transaction: diff --git a/src/ethereum/forks/tangerine_whistle/vm/__init__.py b/src/ethereum/forks/tangerine_whistle/vm/__init__.py index 3b5007aa541..9d49935eaaf 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/__init__.py +++ b/src/ethereum/forks/tangerine_whistle/vm/__init__.py @@ -13,7 +13,7 @@ """ from dataclasses import dataclass, field -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, final from ethereum_types.bytes import Bytes, Bytes0 from ethereum_types.numeric import U64, U256, Uint @@ -30,6 +30,7 @@ __all__ = ("Environment", "Evm", "Message") +@final @dataclass class BlockEnvironment: """ @@ -46,6 +47,7 @@ class BlockEnvironment: difficulty: Uint +@final @dataclass class BlockOutput: """ @@ -77,6 +79,7 @@ class BlockOutput: block_logs: Tuple[Log, ...] = field(default_factory=tuple) +@final @dataclass class TransactionEnvironment: """ @@ -91,6 +94,7 @@ class TransactionEnvironment: tx_hash: Optional[Hash32] +@final @dataclass class Message: """ @@ -112,6 +116,7 @@ class Message: parent_evm: Optional["Evm"] +@final @dataclass class Evm: """The internal state of the virtual machine.""" diff --git a/src/ethereum/forks/tangerine_whistle/vm/gas.py b/src/ethereum/forks/tangerine_whistle/vm/gas.py index daa1ef0de63..94901fba3f8 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/gas.py +++ b/src/ethereum/forks/tangerine_whistle/vm/gas.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Final, List, Tuple +from typing import Final, List, Tuple, final from ethereum_types.numeric import U256, Uint, ulen @@ -147,6 +147,7 @@ class GasCosts: OPCODE_CALL_BASE: Final[Uint] = Uint(700) +@final @dataclass class ExtendMemory: """ @@ -162,6 +163,7 @@ class ExtendMemory: expand_by: Uint +@final @dataclass class MessageCallGas: """ diff --git a/src/ethereum/forks/tangerine_whistle/vm/interpreter.py b/src/ethereum/forks/tangerine_whistle/vm/interpreter.py index 669e8eb652a..476a569731c 100644 --- a/src/ethereum/forks/tangerine_whistle/vm/interpreter.py +++ b/src/ethereum/forks/tangerine_whistle/vm/interpreter.py @@ -12,7 +12,7 @@ """ from dataclasses import dataclass -from typing import Optional, Set, Tuple +from typing import Optional, Set, Tuple, final from ethereum_types.bytes import Bytes0 from ethereum_types.numeric import U256, Uint, ulen @@ -57,6 +57,7 @@ STACK_DEPTH_LIMIT = Uint(1024) +@final @dataclass class MessageCallOutput: """ diff --git a/src/ethereum/genesis.py b/src/ethereum/genesis.py index 55eed6aa4d9..5c6adec0150 100644 --- a/src/ethereum/genesis.py +++ b/src/ethereum/genesis.py @@ -16,7 +16,7 @@ import json import pkgutil from dataclasses import dataclass -from typing import Any, Callable, Dict, Generic, Type, TypeVar +from typing import Any, Callable, Dict, Generic, Type, TypeVar, final from ethereum_rlp import rlp from ethereum_types.bytes import Bytes, Bytes8, Bytes32, FixedBytes @@ -34,6 +34,7 @@ ) +@final @slotted_freezable @dataclass class GenesisConfiguration: @@ -133,6 +134,7 @@ def hex_or_base_10_str_to_u256(balance: str) -> U256: BlockT = TypeVar("BlockT") +@final @slotted_freezable @dataclass class GenesisFork( diff --git a/src/ethereum/merkle_patricia_trie.py b/src/ethereum/merkle_patricia_trie.py index b9ae0d9e9b8..f11896a50de 100644 --- a/src/ethereum/merkle_patricia_trie.py +++ b/src/ethereum/merkle_patricia_trie.py @@ -29,6 +29,7 @@ Tuple, TypeVar, cast, + final, ) from ethereum_rlp import Extended, rlp @@ -67,6 +68,7 @@ ) +@final @slotted_freezable @dataclass class LeafNode: @@ -76,6 +78,7 @@ class LeafNode: value: Extended +@final @slotted_freezable @dataclass class ExtensionNode: @@ -105,6 +108,7 @@ class ExtensionNode: ] +@final @slotted_freezable @dataclass class BranchNode: @@ -198,6 +202,7 @@ def encode_node(node: Extended, storage_root: Bytes | None = None) -> Bytes: return rlp.encode(node) +@final @dataclass class Trie(Generic[K, V]): """ diff --git a/src/ethereum/state.py b/src/ethereum/state.py index 0de00ffe85d..5a34472390e 100644 --- a/src/ethereum/state.py +++ b/src/ethereum/state.py @@ -14,7 +14,16 @@ """ from dataclasses import dataclass, field -from typing import AbstractSet, Dict, List, Optional, Protocol, Set, Tuple +from typing import ( + AbstractSet, + Dict, + List, + Optional, + Protocol, + Set, + Tuple, + final, +) from ethereum_types.bytes import Bytes, Bytes20, Bytes32 from ethereum_types.frozen import slotted_freezable @@ -37,6 +46,7 @@ EMPTY_CODE_HASH = keccak256(b"") +@final @slotted_freezable @dataclass class Account: @@ -56,6 +66,7 @@ class Account: ) +@final @dataclass class BlockDiff: """ @@ -141,6 +152,7 @@ def compute_state_root_and_trie_changes( ... +@final @dataclass class State: """ diff --git a/src/ethereum/trace.py b/src/ethereum/trace.py index a2766918099..f40644dcc54 100644 --- a/src/ethereum/trace.py +++ b/src/ethereum/trace.py @@ -18,13 +18,14 @@ import enum from dataclasses import dataclass -from typing import Optional, Protocol +from typing import Optional, Protocol, final from ethereum_types.bytes import Bytes from ethereum.exceptions import EthereumException +@final @dataclass class TransactionStart: """ @@ -32,6 +33,7 @@ class TransactionStart: """ +@final @dataclass class TransactionEnd: """ @@ -60,6 +62,7 @@ class TransactionEnd: """ +@final @dataclass class PrecompileStart: """ @@ -72,6 +75,7 @@ class PrecompileStart: """ +@final @dataclass class PrecompileEnd: """ @@ -79,6 +83,7 @@ class PrecompileEnd: """ +@final @dataclass class OpStart: """ @@ -96,6 +101,7 @@ class OpStart: """ +@final @dataclass class OpEnd: """ @@ -103,6 +109,7 @@ class OpEnd: """ +@final @dataclass class OpException: """ @@ -122,6 +129,7 @@ class OpException: """ +@final @dataclass class EvmStop: """ @@ -139,6 +147,7 @@ class EvmStop: """ +@final @dataclass class GasAndRefund: """