Enum AnvilNodeError

Source
#[non_exhaustive]
#[repr(u32)]
pub enum AnvilNodeError { TransactionHalt { inner: Box<Halt>, transaction_hash: Box<H256>, }, TransactionValidationFailed { inner: Box<TransactionValidation>, transaction_hash: Box<H256>, }, TimestampBackwardsError { timestamp_requested: U64, timestamp_now: U64, }, GenericError { message: String, }, }
Expand description

Domain: AnvilZKsync

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

TransactionHalt

§Summary

Transaction execution halted in anvil-zksync.

§Description

This error occurs when a transaction execution is halted due to an error in the anvil-zksync virtual machine execution. This is a wrapper error that contains a more specific halt error inside it, which provides details about the cause of the halt.

The VM may halt execution for various reasons including:

  • Account validation failures (signature issues, nonce mismatches)
  • Paymaster-related errors (when testing account abstraction features)
  • Gas limit exceedance
  • Storage access limitations
  • Contract execution failures

When using anvil-zksync for testing, these halts are valuable signals that help you identify issues with your contracts or transactions before deploying to the real ZKSync network.

Fields

§inner: Box<Halt>
§transaction_hash: Box<H256>
§

TransactionValidationFailed

§Summary

Transaction validation failed in anvil-zksync.

§Description

This error occurs when a transaction validation is failed and it is not executed. This is a wrapper error that contains a more specific validation error inside it, which provides details about the cause of the halt.

The validation may for various reasons including:

  • Gas limit exceedance
  • Invalid gas limit value
  • maxFeePerGas exceeding maxPriorityFeePerGas, and so on.

When using anvil-zksync for testing, these errors are valuable signals that help you identify issues with your contracts or transactions before deploying to the real ZKSync network.

Fields

§transaction_hash: Box<H256>
§

TimestampBackwardsError

§Summary

Requested block timestamp is earlier than the current timestamp.

§Description

This error occurs when attempting to set a future block timestamp to a value that is earlier than the timestamp of the most recently mined block.

In anvil-zksync, block timestamps must always increase monotonically. This simulates the behavior of real blockchain networks where time only moves forward. Each new block must have a timestamp greater than its predecessor.

Anvil-zksync provides methods to manipulate time for testing purposes (like evm_increaseTime and evm_setNextBlockTimestamp), but these can only move time forward, never backward.

Block timestamps in anvil-zksync are used by:

  • Smart contracts that rely on block.timestamp for time-dependent logic
  • System contracts that need to track event timing
  • Time-locked functionality in DeFi applications and governance protocols

When testing contracts that have time-dependent logic, it’s important to ensure that any manipulated timestamps move forward in time, not backward.

Fields

§timestamp_requested: U64
§timestamp_now: U64
§

GenericError

Fields

§message: String

Trait Implementations§

Source§

impl AsRef<str> for AnvilNode

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for AnvilNode

Source§

fn clone(&self) -> AnvilNode

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CustomErrorMessage for AnvilNode

Source§

impl Debug for AnvilNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AnvilNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for AnvilNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Documented for AnvilNode

Source§

type Documentation = &'static ErrorDocumentation

Source§

fn get_documentation( &self, ) -> Result<Option<Self::Documentation>, DocumentationError>

Source§

impl Error for AnvilNode

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl<'_enum> From<&'_enum AnvilNode> for AnvilNodeCode

Source§

fn from(val: &'_enum AnvilNode) -> AnvilNodeCode

Converts to this type from the input type.
Source§

impl From<AnvilNode> for AnvilNodeCode

Source§

fn from(val: AnvilNode) -> AnvilNodeCode

Converts to this type from the input type.
Source§

impl From<AnvilNode> for AnvilZksync

Source§

fn from(val: AnvilNode) -> Self

Converts to this type from the input type.
Source§

impl From<AnvilNode> for PackedError<ZksyncError>

Source§

fn from(value: AnvilNode) -> Self

Converts to this type from the input type.
Source§

impl From<AnvilNode> for SerializedError

Source§

fn from(value: AnvilNode) -> Self

Converts to this type from the input type.
Source§

impl From<AnvilNode> for ZksyncError

Source§

fn from(val: AnvilNode) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AnvilNode

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl ICustomError<ZksyncError, ZksyncError> for AnvilNode

Source§

impl NamedError for AnvilNode

Source§

impl PartialEq for AnvilNode

Source§

fn eq(&self, other: &AnvilNode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AnvilNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for AnvilNode

Source§

impl StructuralPartialEq for AnvilNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T