#[repr(u32)]pub enum ErrorCode {
TransactionHalt = 1,
TransactionValidationFailed = 10,
TransactionGasEstimationFailed = 11,
TimestampBackwardsError = 20,
SerializationError = 30,
GenericError = 0,
}
Expand description
Auto-generated discriminant enum variants
Variants§
TransactionHalt = 1
§Summary
Transaction execution reverted and gas was burned.
§Description
This error occurs when a transaction execution is reverted due to an error in the anvil-zksync virtual machine execution and all gas is burned. This is a wrapper error that contains a more specific error inside it.
The VM may fail 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 failures 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 failure.
The validation may fail 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.
TransactionGasEstimationFailed = 11
§Summary
Transaction gas estimation failed in anvil-zksync.
§Description
This error occurs when a gas estimation for transaction failed. This is a wrapper error that contains a more specific gas estimation error inside it, which provides details about the cause of failure.
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.
SerializationError = 30
§Summary
Failed to serialize transaction request into a valid transaction.
§Description
This error occurs when anvil-zksync is unable to convert a transaction request into a properly formatted transaction object. This typically happens during transaction creation or gas estimation when the request contains invalid or incompatible parameters.
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