Skip to main content

signet_types/signing/
error.rs

1#[cfg(doc)]
2use signet_zenith::RollupOrders::Permit2Batch;
3
4/// An error that can occur when validating a signed order or fill.
5#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
6pub enum SignedPermitError {
7    /// Mismatched permits and outputs.
8    #[error("Permits and Outputs do not match.")]
9    PermitMismatch,
10    /// The deadline for the order has passed.
11    #[error("Deadline has passed: current time is: {current}, deadline was: {deadline}")]
12    DeadlinePassed {
13        /// The current timestamp.
14        current: u64,
15        /// The deadline for the [`Permit2Batch`].
16        deadline: u64,
17    },
18}
19
20/// An error that can occur when signing an Order or a Fill.
21#[derive(Debug, thiserror::Error)]
22pub enum SigningError {
23    /// Missing chain config.
24    #[error(
25        "Target chain id is missing. Populate it by calling with_chain before attempting to sign"
26    )]
27    MissingChainId,
28    /// Missing rollup chain id for a Fill.
29    #[error(
30        "Rollup chain id is missing. Populate it by calling with_chain before attempting to sign"
31    )]
32    #[deprecated(since = "0.14.1", note = "Use MissingChainId instead.")]
33    MissingRollupChainId,
34    /// Missing chain config for a specific chain.
35    #[error("Target Order contract address is missing for chain id {0}. Populate it by calling with_chain before attempting to sign")]
36    MissingOrderContract(u64),
37    /// Error signing the order hash.
38    #[error(transparent)]
39    Signer(#[from] alloy::signers::Error),
40}