Skip to content

Commit 2bee9dd

Browse files
committed
chore(specs): add final decorator
1 parent efd53ff commit 2bee9dd

182 files changed

Lines changed: 682 additions & 164 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/ethereum/crypto/blake2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import struct
44
from dataclasses import dataclass
5-
from typing import Final, List, Tuple
5+
from typing import Final, List, Tuple, final
66

77
from ethereum_types.numeric import Uint
88

@@ -248,6 +248,7 @@ def compress(
248248

249249

250250
# Parameters specific to the Blake2b implementation
251+
@final
251252
@dataclass
252253
class Blake2b(Blake2):
253254
"""

src/ethereum/forks/amsterdam/block_access_lists.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"""
1414

1515
from dataclasses import dataclass, field
16-
from typing import Dict, List, Optional, Set, Tuple, TypeAlias
16+
from typing import Dict, List, Optional, Set, Tuple, TypeAlias, final
1717

1818
from ethereum_rlp import rlp
1919
from ethereum_types.bytes import Bytes, Bytes32
@@ -28,6 +28,7 @@
2828
from .state_tracker import BlockState, TransactionState, get_code
2929

3030

31+
@final
3132
@slotted_freezable
3233
@dataclass
3334
class StorageChange:
@@ -54,6 +55,7 @@ class StorageChange:
5455
"""
5556

5657

58+
@final
5759
@slotted_freezable
5860
@dataclass
5961
class BalanceChange:
@@ -80,6 +82,7 @@ class BalanceChange:
8082
"""
8183

8284

85+
@final
8386
@slotted_freezable
8487
@dataclass
8588
class NonceChange:
@@ -106,6 +109,7 @@ class NonceChange:
106109
"""
107110

108111

112+
@final
109113
@slotted_freezable
110114
@dataclass
111115
class CodeChange:
@@ -132,6 +136,7 @@ class CodeChange:
132136
"""
133137

134138

139+
@final
135140
@slotted_freezable
136141
@dataclass
137142
class SlotChanges:
@@ -156,6 +161,7 @@ class SlotChanges:
156161
"""
157162

158163

164+
@final
159165
@slotted_freezable
160166
@dataclass
161167
class AccountChanges:
@@ -233,6 +239,7 @@ class AccountChanges:
233239
"""
234240

235241

242+
@final
236243
@dataclass
237244
class AccountData:
238245
"""
@@ -273,6 +280,7 @@ class AccountData:
273280
"""
274281

275282

283+
@final
276284
@dataclass
277285
class BlockAccessListBuilder:
278286
"""

src/ethereum/forks/amsterdam/blocks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""
1111

1212
from dataclasses import dataclass
13-
from typing import Tuple
13+
from typing import Tuple, final
1414

1515
from ethereum_rlp import rlp
1616
from ethereum_types.bytes import Bytes, Bytes8, Bytes32
@@ -31,6 +31,7 @@
3131
)
3232

3333

34+
@final
3435
@slotted_freezable
3536
@dataclass
3637
class Withdrawal:
@@ -64,6 +65,7 @@ class Withdrawal:
6465
"""
6566

6667

68+
@final
6769
@slotted_freezable
6870
@dataclass
6971
class Header:
@@ -267,6 +269,7 @@ class Header:
267269
"""
268270

269271

272+
@final
270273
@slotted_freezable
271274
@dataclass
272275
class Block:
@@ -320,6 +323,7 @@ class Block:
320323
"""
321324

322325

326+
@final
323327
@slotted_freezable
324328
@dataclass
325329
class Log:
@@ -352,6 +356,7 @@ class Log:
352356
"""
353357

354358

359+
@final
355360
@slotted_freezable
356361
@dataclass
357362
class Receipt:

src/ethereum/forks/amsterdam/fork.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313

1414
from dataclasses import dataclass
15-
from typing import Final, List, Optional, Tuple
15+
from typing import Final, List, Optional, Tuple, final
1616

1717
from ethereum_rlp import rlp
1818
from ethereum_types.bytes import Bytes
@@ -135,6 +135,7 @@
135135
BLOB_COUNT_LIMIT = 6
136136

137137

138+
@final
138139
@slotted_freezable
139140
@dataclass
140141
class ChainContext:
@@ -152,6 +153,7 @@ class ChainContext:
152153
"""Parent header used for header validation and system contracts."""
153154

154155

156+
@final
155157
@dataclass
156158
class BlockChain:
157159
"""

src/ethereum/forks/amsterdam/fork_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"""
1313

1414
from dataclasses import dataclass
15+
from typing import final
1516

1617
from ethereum_rlp import rlp
1718
from ethereum_types.bytes import Bytes, Bytes256
@@ -50,6 +51,7 @@ def encode_account(raw_account_data: Account, storage_root: Bytes) -> Bytes:
5051
)
5152

5253

54+
@final
5355
@slotted_freezable
5456
@dataclass
5557
class Authorization:

src/ethereum/forks/amsterdam/state_tracker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"""
2020

2121
from dataclasses import dataclass, field
22-
from typing import TYPE_CHECKING, Callable, Dict, Optional, Set, Tuple
22+
from typing import TYPE_CHECKING, Callable, Dict, Optional, Set, Tuple, final
2323

2424
from ethereum_types.bytes import Bytes, Bytes32
2525
from ethereum_types.frozen import modify
@@ -39,6 +39,7 @@
3939
from .block_access_lists import BlockAccessListBuilder
4040

4141

42+
@final
4243
@dataclass
4344
class BlockState:
4445
"""
@@ -62,6 +63,7 @@ class BlockState:
6263
code_writes: Dict[Hash32, Bytes] = field(default_factory=dict)
6364

6465

66+
@final
6567
@dataclass
6668
class TransactionState:
6769
"""

src/ethereum/forks/amsterdam/transactions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
from dataclasses import dataclass
8-
from typing import Tuple, TypeGuard
8+
from typing import Tuple, TypeGuard, final
99

1010
from ethereum_rlp import rlp
1111
from ethereum_types.bytes import Bytes, Bytes0, Bytes32
@@ -47,6 +47,7 @@
4747
"""
4848

4949

50+
@final
5051
@slotted_freezable
5152
@dataclass
5253
class LegacyTransaction:
@@ -109,6 +110,7 @@ class LegacyTransaction:
109110
"""
110111

111112

113+
@final
112114
@slotted_freezable
113115
@dataclass
114116
class Access:
@@ -128,6 +130,7 @@ class Access:
128130
"""
129131

130132

133+
@final
131134
@slotted_freezable
132135
@dataclass
133136
class AccessListTransaction:
@@ -200,6 +203,7 @@ class AccessListTransaction:
200203
"""
201204

202205

206+
@final
203207
@slotted_freezable
204208
@dataclass
205209
class FeeMarketTransaction:
@@ -277,6 +281,7 @@ class FeeMarketTransaction:
277281
"""
278282

279283

284+
@final
280285
@slotted_freezable
281286
@dataclass
282287
class BlobTransaction:
@@ -365,6 +370,7 @@ class BlobTransaction:
365370
"""
366371

367372

373+
@final
368374
@slotted_freezable
369375
@dataclass
370376
class SetCodeTransaction:

src/ethereum/forks/amsterdam/vm/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"""
1414

1515
from dataclasses import dataclass, field
16-
from typing import List, Optional, Set, Tuple
16+
from typing import List, Optional, Set, Tuple, final
1717

1818
from ethereum_types.bytes import Bytes, Bytes0, Bytes32
1919
from ethereum_types.numeric import U64, U256, Uint
@@ -39,6 +39,7 @@
3939
CALL_SUCCESS = U256(1)
4040

4141

42+
@final
4243
@dataclass
4344
class BlockEnvironment:
4445
"""
@@ -60,6 +61,7 @@ class BlockEnvironment:
6061
slot_number: U64
6162

6263

64+
@final
6365
@dataclass
6466
class BlockOutput:
6567
"""
@@ -106,6 +108,7 @@ class BlockOutput:
106108
block_access_list: BlockAccessList = field(default_factory=list)
107109

108110

111+
@final
109112
@dataclass
110113
class TransactionEnvironment:
111114
"""
@@ -124,6 +127,7 @@ class TransactionEnvironment:
124127
tx_hash: Optional[Hash32]
125128

126129

130+
@final
127131
@dataclass
128132
class Message:
129133
"""
@@ -149,6 +153,7 @@ class Message:
149153
parent_evm: Optional["Evm"]
150154

151155

156+
@final
152157
@dataclass
153158
class Evm:
154159
"""The internal state of the virtual machine."""

src/ethereum/forks/amsterdam/vm/gas.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313

1414
from dataclasses import dataclass
15-
from typing import Final, List, Tuple
15+
from typing import Final, List, Tuple, final
1616

1717
from ethereum_types.numeric import U64, U256, Uint, ulen
1818

@@ -197,6 +197,7 @@ class GasCosts:
197197
OPCODE_SELFDESTRUCT_NEW_ACCOUNT: Final[Uint] = Uint(25000)
198198

199199

200+
@final
200201
@dataclass
201202
class ExtendMemory:
202203
"""
@@ -212,6 +213,7 @@ class ExtendMemory:
212213
expand_by: Uint
213214

214215

216+
@final
215217
@dataclass
216218
class MessageCallGas:
217219
"""

src/ethereum/forks/amsterdam/vm/interpreter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313

1414
from dataclasses import dataclass
15-
from typing import Optional, Set, Tuple
15+
from typing import Optional, Set, Tuple, final
1616

1717
from ethereum_types.bytes import Bytes, Bytes0
1818
from ethereum_types.numeric import U256, Uint, ulen
@@ -66,6 +66,7 @@
6666
MAX_INIT_CODE_SIZE = 2 * MAX_CODE_SIZE
6767

6868

69+
@final
6970
@dataclass
7071
class MessageCallOutput:
7172
"""

0 commit comments

Comments
 (0)