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
159
160
161
162
163
164
165
//! EIP-8141 mempool validation-trace observer.
//!
//! A lightweight, opt-in observer attached to [`VM`](crate::vm::VM) that enforces
//! the ERC-7562-style validation-trace rules during *mempool* simulation of a
//! frame transaction's validation prefix (the verify/pay/deploy frames that must
//! run before the transaction's payer is established). It is a **local peer
//! policy**, never a consensus rule: it is active ONLY behind
//! [`LEVM::simulate_frame_validation_prefix`](crate::vm::VM) (the mempool entry
//! point) and is constructed with [`ValidationObserver::disabled`] everywhere
//! else, so normal block execution and block building pay a single `if active`
//! branch in the dispatch loop and nothing more (mirrors `LevmOpcodeTracer`).
//!
//! ## OQ4 — SETDELEGATE is vacuous
//! The draft EIP's validation-trace rules reference a `SETDELEGATE` operation
//! used by deploy frames to install an EIP-7702 delegation for the sender. There
//! is no `SETDELEGATE` opcode in `opcodes.rs` (the ethrex LEVM opcode set), so
//! the deploy-frame delegation allowance reduces to what the actual opcode set
//! can express: `CREATE`/`CREATE2` plus `SSTORE` writing to the sender's own
//! storage. The observer therefore permits exactly those state effects inside
//! the deploy frame and bans all other state writes; there is no separate
//! `SETDELEGATE` allowance to model.
//!
//! ## Canonical-pay-frame exemption
//! ERC-7562 exempts the canonical paymaster's pay frame from the storage/call
//! access restrictions (a canonical paymaster is trusted to touch shared
//! reservation state). ethrex cannot resolve the canonical paymaster bytecode
//! (OQ1: not pinned in the draft EIP or any reference implementation), so
//! [`canonical_paymaster_pay_frame`](ValidationObserver::canonical_paymaster_pay_frame)
//! is always `None` here and the exemption never fires. The field and the
//! `current_frame_index == canonical_paymaster_pay_frame` skip are wired up so
//! the exemption flips on for free once the canonical code hash is pinned.
use ;
/// A validation-trace rule violation detected during prefix simulation.
///
/// The first violation observed is recorded; the simulation harness treats any
/// recorded violation as a failed validation (the transaction is rejected from
/// the mempool).
/// EIP-8141 validation-trace observer. Inert (`active == false`) in every VM
/// construction except mempool prefix simulation.
///
/// The dispatch-loop and handler hooks read this only behind
/// `if self.validation_observer.active`, so an inactive observer has zero
/// overhead on the perf-sensitive execution path (one branch), exactly like
/// [`LevmOpcodeTracer`](crate::opcode_tracer::LevmOpcodeTracer).