pub struct ValidationObserver {
pub active: bool,
pub sender: Address,
pub deploy_frame_index: Option<usize>,
pub current_frame_index: usize,
pub current_frame_mode: u8,
pub expiry_verifier: Address,
pub canonical_paymaster_pay_frame: Option<usize>,
pub last_opcode: u8,
pub touched_sender_slots: Vec<H256>,
pub violation: Option<FrameSimViolation>,
}Expand description
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.
Fields§
§active: boolWhether this observer is active. false disables every hook.
sender: AddressThe frame transaction’s sender. SLOAD/SSTORE are restricted to this address; CALL/EXTCODE targets equal to this address are exempt.
deploy_frame_index: Option<usize>Index (into FrameTransaction.frames) of the deploy frame, if the
prefix has one. SSTORE/CREATE/CREATE2 are allowed only while this
frame is executing.
current_frame_index: usizeIndex of the currently executing prefix frame. Set by the harness before each frame runs.
current_frame_mode: u8Execution mode of the currently executing prefix frame (raw mode byte:
0 = DEFAULT, 1 = VERIFY, 2 = SENDER). Set by the harness before each
frame runs.
expiry_verifier: AddressAddress of the canonical EXPIRY_VERIFIER predeploy (0x…8141). TIMESTAMP
is permitted only when current_call_frame.code_address equals this value,
which allows TIMESTAMP inside a nested call into the predeploy while
correctly banning it in any callee of an expiry frame that routes execution
elsewhere (an under-reject the per-top-frame boolean could not prevent).
canonical_paymaster_pay_frame: Option<usize>Index of the canonical paymaster’s pay frame, if any. Always None
(OQ1, see module docs); the access-restriction skip is wired for the
future canonical-paymaster case.
last_opcode: u8The opcode byte executed on the previous dispatch-loop iteration. Used to
enforce the GAS sequential rule (GAS is allowed only immediately
before a *CALL). Reset each iteration.
touched_sender_slots: Vec<H256>Sender storage slots touched (read or written) during the prefix. Recorded for the admission-time revalidation affected-set (Phase 3).
violation: Option<FrameSimViolation>First violation observed, if any.
Implementations§
Source§impl ValidationObserver
impl ValidationObserver
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
Returns an inactive observer. No allocations; zero overhead on the hot
path (every hook is gated by if active).
Sourcepub fn new(
sender: Address,
deploy_frame_index: Option<usize>,
expiry_verifier: Address,
) -> Self
pub fn new( sender: Address, deploy_frame_index: Option<usize>, expiry_verifier: Address, ) -> Self
Returns an active observer for simulating the validation prefix of a
frame transaction sent by sender, whose deploy frame (if any) is at
deploy_frame_index.
Sourcepub fn record_violation(&mut self, violation: FrameSimViolation)
pub fn record_violation(&mut self, violation: FrameSimViolation)
Records the first violation observed; later violations are ignored (the transaction is already rejected).
Sourcepub fn in_canonical_pay_frame(&self) -> bool
pub fn in_canonical_pay_frame(&self) -> bool
Whether the currently executing frame is the canonical paymaster pay
frame (always false while canonical_paymaster_pay_frame is None).
Sourcepub fn in_deploy_frame(&self) -> bool
pub fn in_deploy_frame(&self) -> bool
Whether the currently executing frame is the deploy frame.
Trait Implementations§
Source§impl Clone for ValidationObserver
impl Clone for ValidationObserver
Auto Trait Implementations§
impl Freeze for ValidationObserver
impl RefUnwindSafe for ValidationObserver
impl Send for ValidationObserver
impl Sync for ValidationObserver
impl Unpin for ValidationObserver
impl UnsafeUnpin for ValidationObserver
impl UnwindSafe for ValidationObserver
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.