@@ -44,14 +44,25 @@ def _parse_authorization_list(
44
44
"""Parse authorization list from fuzzer data."""
45
45
auth_tuples = []
46
46
for auth_data in auth_list_data :
47
- # Handle numeric fields which might be in scientific notation
48
- chain_id = HexNumber (int (auth_data .get ("chainId" , 0 )))
49
- nonce = HexNumber (int (auth_data .get ("nonce" , 0 )))
50
-
51
- # Handle v, r, s which might be in scientific notation (floating point)
52
- v = HexNumber (int (float (auth_data .get ("v" , 0 ))))
53
- r = HexNumber (int (float (auth_data .get ("r" , 0 ))))
54
- s = HexNumber (int (float (auth_data .get ("s" , 0 ))))
47
+ # Handle values that could be hex strings or numeric (including scientific notation)
48
+ def parse_value (val : Any , default : Any = 0 ) -> HexNumber :
49
+ if val is None :
50
+ val = default
51
+ if isinstance (val , str ) and val .startswith ("0x" ):
52
+ # Already a hex string, HexNumber will handle it correctly
53
+ return HexNumber (val )
54
+ elif isinstance (val , str ):
55
+ # Scientific notation string like "1.0e+18"
56
+ return HexNumber (int (float (val )))
57
+ else :
58
+ # Direct numeric value
59
+ return HexNumber (int (val ) if not isinstance (val , float ) else int (val ))
60
+
61
+ chain_id = parse_value (auth_data .get ("chainId" ))
62
+ nonce = parse_value (auth_data .get ("nonce" ))
63
+ v = parse_value (auth_data .get ("v" ))
64
+ r = parse_value (auth_data .get ("r" ))
65
+ s = parse_value (auth_data .get ("s" ))
55
66
56
67
auth_tuples .append (
57
68
AuthorizationTuple (
0 commit comments