Enum ErrorCode

Source
#[repr(u32)]
pub enum ErrorCode { TransactionHalt = 1, TransactionValidationFailed = 10, TimestampBackwardsError = 20, GenericError = 0, }
Expand description

Auto-generated discriminant enum variants

Variants§

§

TransactionHalt = 1

§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.

§

TransactionValidationFailed = 10

§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.

§

TimestampBackwardsError = 20

§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.

§

GenericError = 0

Implementations§

Source§

impl AnvilNodeCode

Source

pub const fn from_repr(discriminant: u32) -> Option<AnvilNodeCode>

Try to create Self from the raw representation

Trait Implementations§

Source§

impl AsRef<str> for AnvilNodeCode

Source§

fn as_ref(&self) -> &str

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

impl Clone for AnvilNodeCode

Source§

fn clone(&self) -> AnvilNodeCode

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 Debug for AnvilNodeCode

Source§

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

Formats the value using the given formatter. 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 NamedError for AnvilNodeCode

Source§

impl PartialEq for AnvilNodeCode

Source§

fn eq(&self, other: &AnvilNodeCode) -> 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 Copy for AnvilNodeCode

Source§

impl Eq for AnvilNodeCode

Source§

impl StructuralPartialEq for AnvilNodeCode

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, 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

§

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

§

impl<T> MaybeSendSync for T