forked from ethereum/execution-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathir.py
More file actions
158 lines (125 loc) · 3.96 KB
/
ir.py
File metadata and controls
158 lines (125 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
"""Intermediate Representation dataclasses for filler-to-python codegen."""
from __future__ import annotations
from dataclasses import dataclass, field
from execution_testing.base_types import Address
@dataclass
class EnvironmentIR:
"""IR for the test environment."""
coinbase_var: str
number: int
timestamp: int
difficulty: int | None = None
prev_randao: int | None = None
base_fee_per_gas: int | None = None
excess_blob_gas: int | None = None
gas_limit: int = 0
@dataclass
class AccountIR:
"""IR for a pre-state account."""
var_name: str
is_tagged: bool
is_eoa: bool
is_sender: bool
balance: int = 0
nonce: int | None = None
address: Address | None = None
source_comment: str = ""
code_expr: str = ""
storage: dict = field(default_factory=dict)
oversized_code: bool = False
use_dynamic: bool = True
@dataclass
class AccountAssertionIR:
"""IR for a post-state account assertion."""
var_ref: str
storage: dict | None = None
storage_any_keys: list = field(default_factory=list)
code: bytes | None = None
balance: int | None = None
nonce: int | None = None
should_not_exist: bool = False
@dataclass
class ExpectEntryIR:
"""IR for one filler expect section."""
indexes: dict = field(default_factory=dict)
network: list = field(default_factory=list)
result: list = field(default_factory=list)
expect_exception: dict | None = None
@dataclass
class ParameterCaseIR:
"""IR for one (d, g, v) parameter combo."""
d: int = 0
g: int = 0
v: int = 0
has_exception: bool = False
label: str | None = None
id: str = ""
marks: str | None = None
@dataclass
class AccessListEntryIR:
"""IR for a single access list entry."""
address: str = ""
storage_keys: list = field(default_factory=list)
use_dynamic: bool = False
@dataclass
class TransactionIR:
"""IR for the transaction."""
to_var: str | None = None
to_is_none: bool = False
gas_price: int | None = None
max_fee_per_gas: int | None = None
max_priority_fee_per_gas: int | None = None
max_fee_per_blob_gas: int | None = None
blob_versioned_hashes: list | None = None
nonce: int | None = None
access_list: list | None = None
per_data_access_lists: dict | None = None
data_inline: str | None = None
gas_limit: int | None = None
value: int | None = None
@dataclass
class SenderIR:
"""IR for the transaction sender."""
is_tagged: bool = False
key: int | None = None
balance: int = 0
nonce: int | None = None
not_in_pre: bool = False
use_dynamic: bool = True
@dataclass
class ImportsIR:
"""List of import requirements for the test."""
needs_op: bool = False
needs_access_list: bool = False
needs_bytes: bool = False
needs_hash: bool = False
needs_tx_exception: bool = False
needs_compute_create_address: bool = False
@dataclass
class IntermediateTestModel:
"""Complete IR for one test file."""
test_name: str = ""
filler_path: str = ""
filler_comment: str = ""
category: str = ""
valid_from: str = ""
valid_until: str | None = None
is_slow: bool = False
is_multi_case: bool = False
is_fork_dependent: bool = False
needs_mutable_pre: bool = False
environment: EnvironmentIR = field(
default_factory=lambda: EnvironmentIR(
coinbase_var="coinbase", number=0, timestamp=0
)
)
accounts: list = field(default_factory=list)
sender: SenderIR = field(default_factory=SenderIR)
parameters: list = field(default_factory=list)
transaction: TransactionIR = field(default_factory=TransactionIR)
expect_entries: list = field(default_factory=list)
address_constants: list = field(default_factory=list)
tx_data: list = field(default_factory=list)
tx_gas: list = field(default_factory=list)
tx_value: list = field(default_factory=list)
imports: ImportsIR = field(default_factory=ImportsIR)