#[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
impl AnvilNodeCode
Trait Implementations§
Source§impl AsRef<str> for AnvilNodeCode
impl AsRef<str> for AnvilNodeCode
Source§impl Clone for AnvilNodeCode
impl Clone for AnvilNodeCode
Source§fn clone(&self) -> AnvilNodeCode
fn clone(&self) -> AnvilNodeCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more