Skip to content

Commit f1d842b

Browse files
committed
[wip]: more pydantic fixes
1 parent 5bb3f2c commit f1d842b

File tree

71 files changed

+754
-623
lines changed

Some content is hidden

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

71 files changed

+754
-623
lines changed

scripts/convert_addresses.py

Lines changed: 87 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
2. Replace all occurrences with tags
77
"""
88

9-
import re
109
import argparse
11-
from typing import Dict, Set, Optional, List
12-
from pathlib import Path
10+
import re
1311
from enum import Enum, auto
12+
from pathlib import Path
13+
from typing import Dict, List, Optional, Set
14+
1415
from ethereum_test_forks import Prague
1516

1617

@@ -66,7 +67,8 @@ class Context(Enum):
6667
INCOMPATIBLE_PATH_PATTERNS = {
6768
# Exact filenames (existing)
6869
"push0Filler.yml",
69-
"push0Gas2Filler.yml"
70+
"push0Gas2Filler.yml",
71+
"ContractCreationSpamFiller.json",
7072
"create2InitCodeSizeLimitFiller.yml",
7173
"createInitCodeSizeLimitFiller.yml",
7274
"creationTxInitCodeSizeLimitFiller.yml",
@@ -108,6 +110,10 @@ class Context(Enum):
108110
"delegatecallInInitcodeToExistingContractOOGFiller.json",
109111
"delegatecodeDynamicCode2SelfCallFiller.json",
110112
"delegatecodeDynamicCodeFiller.json",
113+
"RawCreateFailGasValueTransferFiller.json",
114+
"RawCreateFailGasValueTransfer2Filler.json",
115+
"ExtCodeCopyTestsParisFiller.json",
116+
"EXTCODESIZE_toNonExistentFiller.json",
111117
"CreateAndGasInsideCreateFiller.json",
112118
"RawCreateGasFiller.json",
113119
"RawCreateGasMemoryFiller.json",
@@ -127,6 +133,12 @@ class Context(Enum):
127133
"storageCostsFiller.yml",
128134
"variedContextFiller.yml",
129135
"vitalikTransactionTestParisFiller.json",
136+
137+
# stExample
138+
"add11_ymlFiller.yml",
139+
"add11Filler.json",
140+
141+
# stExtCodeHash
130142
"extcodehashEmpty_ParisFiller.yml",
131143
"extCodeHashSelfInInitFiller.json",
132144
"extCodeHashSubcallSuicideCancunFiller.yml",
@@ -143,18 +155,41 @@ class Context(Enum):
143155
"extCodeHashSubcallSuicideFiller.yml",
144156
"CreateAndGasInsideCreateWithMemExpandingCallsFiller.json",
145157
"codeCopyZero_ParisFiller.yml",
146-
"createEmptyThenExtcodehashFiller.json",
147158
"extCodeHashInInitCodeFiller.json",
148159
"extCodeHashSelfFiller.json",
160+
"extCodeHashNonExistingAccountFiller.yml",
161+
"extCodeHashSubcallOOGFiller.yml",
162+
"extCodeHashPrecompilesFiller.yml",
163+
"contractCreationOOGdontLeaveEmptyContractFiller.json",
164+
"extCodeHashCreatedAndDeletedAccountCallFiller.json",
165+
"createEmptyThenExtcodehashFiller.json",
149166
"contractCreationOOGdontLeaveEmptyContractViaTransactionFiller.json",
167+
168+
# Really only `ReturnTestFiller` and `ReturnTest2Filler` are compatible inside `stInitCodeTest`
150169
"CallContractToCreateContractAndCallItOOGFiller.json",
151170
"CallContractToCreateContractOOGBonusGasFiller.json",
152171
"CallContractToCreateContractWhichWouldCreateContractIfCalledFiller.json",
153172
"CallContractToCreateContractWhichWouldCreateContractInInitCodeFiller.json",
173+
"CallRecursiveContractFiller.json",
174+
"StackUnderFlowContractCreationFiller.json",
175+
"TransactionCreateRandomInitCodeFiller.json",
176+
"TransactionCreateAutoSuicideContractFiller.json",
177+
"TransactionCreateSuicideInInitcodeFiller.json",
154178
"CallTheContractToCreateEmptyContractFiller.json",
155179
"OutOfGasContractCreationFiller.json",
156180
"OutOfGasPrefundedContractCreationFiller.json",
157181
"TransactionCreateStopInInitcodeFiller.json",
182+
183+
184+
# stInitCodeTest
185+
"ReturnTestFiller.json",
186+
"ReturnTest2Filler.json",
187+
"CREATE_Bounds2Filler.json",
188+
"CREATE_Bounds3Filler.json",
189+
"CREATE_BoundsFiller.json",
190+
"NonZeroValue_CALLCODEFiller.json",
191+
"NonZeroValue_DELEGATECALLFiller.json",
192+
158193
"bufferFiller.yml",
159194
"bufferSrcOffsetFiller.yml",
160195
"callDataCopyOffsetFiller.json",
@@ -207,6 +242,22 @@ class Context(Enum):
207242
"randomStatetest545Filler.json",
208243
"randomStatetest537Filler.json",
209244
"randomStatetest564Filler.json",
245+
"randomStatetest307Filler.json",
246+
"randomStatetest646Filler.json",
247+
"Call50000_sha256Filler.json",
248+
"Create1000ByzantiumFiller.json",
249+
"Create1000Filler.json",
250+
251+
# stRecursiveCreate
252+
"RecursiveCreateContractsCreate4ContractsFiller.json",
253+
"RecursiveCreateContractsFiller.json",
254+
255+
# stStackTests
256+
"shallowStackFiller.json",
257+
"stackOverflowFiller.json",
258+
"stackOverflowDUPFiller.json",
259+
"stackOverflowPUSHFiller.json",
260+
210261
"revertRetDataSizeFiller.yml",
211262
"returndatacopy_0_0_following_successful_createFiller.json",
212263
"RevertPrefoundFiller.json",
@@ -216,6 +267,9 @@ class Context(Enum):
216267
"LoopCallsDepthThenRevert2Filler.json",
217268
"LoopCallsDepthThenRevert3Filler.json",
218269
"CreateContractFromMethodFiller.json",
270+
"RevertOpcodeCreateFiller.json",
271+
"RevertOpcodeInInitFiller.json",
272+
"RevertOpcodeWithBigOutputInInitFiller.json",
219273
"ByZeroFiller.json",
220274
"RecursiveCreateContractsCreate4ContractsFiller.json",
221275
"RecursiveCreateContractsFiller.json",
@@ -232,6 +286,11 @@ class Context(Enum):
232286
"stackOverflowSWAPFiller.json",
233287
"stacksanitySWAPFiller.json",
234288
# TODO: See if any of these can be turned on with fine tuning
289+
"static_ABAcallsSuicide1Filler.json",
290+
"static_CREATE_ContractSuicideDuringInitFiller.json",
291+
"static_CREATE_ContractSuicideDuringInit_ThenStoreThenReturnFiller.json",
292+
"static_CREATE_ContractSuicideDuringInit_WithValueFiller.json",
293+
"static_ZeroValue_CALL_OOGRevertFiller.json",
235294
"static_CREATE_EmptyContractAndCallIt_0weiFiller.json",
236295
"static_CREATE_EmptyContractWithStorageAndCallIt_0weiFiller.json",
237296
"static_RawCallGasAskFiller.json",
@@ -317,13 +376,27 @@ class Context(Enum):
317376
"SuicidesAndInternalCallSuicidesSuccessFiller.json",
318377
"StoreGasOnCreateFiller.json",
319378
"TransactionSendingToEmptyFiller.json",
320-
# Directory patterns (examples - add as needed)
379+
"ZeroValue_DELEGATECALLFiller.json",
380+
"ZeroValue_SUICIDEFiller.json",
381+
"ZeroValue_TransactionCALLFiller.json",
382+
"ZeroValue_CALLCODE_OOGRevertFiller.json",
383+
"ZeroValue_TransactionCALLwithDataFiller.json",
384+
"ZeroValue_CALL_OOGRevertFiller.json",
385+
"ZeroValue_DELEGATECALL_OOGRevertFiller.json",
386+
"ZeroValue_CALLCODEFiller.json",
387+
"ZeroValue_CALLFiller.json",
388+
"createNameRegistratorValueTooHighFiller.json",
389+
"suicideCallerAddresTooBigLeftFiller.json",
390+
"ABAcallsSuicide1Filler.json",
391+
392+
321393
"/stCreate2/",
322394
"/stCreateTest/",
323395
"/stRecursiveCreate/",
324396
"/stWalletTest/",
325397
"/stZeroKnowledge/",
326398
"/stZeroKnowledge2/",
399+
327400
# TODO: See if these can be turned on with fine tuning
328401
"/stTimeConsuming/",
329402
}
@@ -555,20 +628,22 @@ def detect_context_change(self, line: str) -> Optional[Context]:
555628
return None # Don't change context for empty storage
556629
return Context.STORAGE
557630
# Known fields that indicate we're back in NORMAL context
558-
elif any(kw in stripped for kw in {"balance:", "nonce:", "secretKey:", "gasLimit:",
631+
elif any(kw in stripped for kw in {"balance:", "nonce:", "secretKey:", "gasLimit:",
559632
"gasPrice:", "value:", "to:", "from:", "address:",
560633
"shouldnotexist:", "indexes:", "network:", "result:"}):
561634
return Context.NORMAL
562635
return None
563636

564637
def create_short_name(self, addr: str) -> Optional[str]:
565-
"""Create a short name from an address by stripping leading/trailing zeros.
638+
"""
639+
Create a short name from an address by stripping leading/trailing zeros.
566640
567641
Args:
568642
addr: Normalized address (40 chars, lowercase, no 0x prefix)
569643
570644
Returns:
571645
Short name with 0x prefix, or None if the address is all zeros or too short
646+
572647
"""
573648
if not addr or len(addr) != 40:
574649
return None
@@ -779,10 +854,8 @@ def build_tags(self) -> None:
779854
continue
780855

781856
if addr == KNOWN_SENDER_ADDRESS:
782-
if addr in self.addresses_with_code:
783-
self.address_mappings[addr] = f"<contract:sender:0x{addr}>"
784-
else:
785-
self.address_mappings[addr] = f"<eoa:sender:0x{addr}>"
857+
# Always use eoa tag for sender - the pre-state will add code if needed
858+
self.address_mappings[addr] = f"<eoa:sender:0x{addr}>"
786859
elif addr in self.creation_addresses:
787860
self.address_mappings[addr] = f"<contract:creation:0x{addr}>"
788861
elif addr == self.coinbase_addr and addr not in self.pre_addresses:
@@ -803,15 +876,15 @@ def build_tags(self) -> None:
803876
self.short_name_mappings[short_name] = tag
804877

805878
def convert_line(self, line: str, section: Section, context: Context) -> str:
806-
"""Second pass: convert addresses to tags.
879+
"""
880+
Second pass: convert addresses to tags.
807881
808882
IMPORTANT: This method should ONLY replace raw addresses with their tags.
809883
It should NEVER re-tag already tagged addresses to prevent double-tagging
810884
like <tag:<tag:0xaddr>>. The first pass identifies addresses and assigns
811885
tags. This second pass finds those raw addresses in the content and
812886
replaces them with their assigned tags.
813887
"""
814-
815888
# Special handling for CALL to address 0 when we have 0x0000...0000 in pre-state
816889
if context == Context.CODE:
817890
zero_addr = "0" * 40

0 commit comments

Comments
 (0)