pub enum PoolError {
WrongPool {
expected: B256,
got: B256,
},
WrongProvider {
expected: Address,
got: Address,
},
AmountRegression {
last: U256,
got: U256,
},
UnderFold {
axis: FoldAxis,
owed: U256,
got: U256,
},
BytesRegression {
last: U256,
got: U256,
},
CapExceeded {
cap: U256,
got: U256,
},
BadPreimage {
index: u8,
verified: u8,
},
Signature(VoucherError),
Store(StoreError),
}Expand description
Failure modes for LaneState::apply_voucher.
Most in-memory variants map to an on-chain PaymentPool.redeem revert;
off-chain we surface them before they cost gas. The ordering and fold
guards (PoolError::AmountRegression, PoolError::BytesRegression,
PoolError::UnderFold) have no revert — redemption is cumulative — and
keep the node’s own ledger consistent. PoolError::Store is the
off-chain-only variant for persistent-store failures (issue #527).
PartialEq/Eq are intentionally not derived: StoreError::Io wraps
std::io::Error, which is not PartialEq. Tests pattern-match on variants
via the matches! macro instead of comparing for equality.
Variants§
WrongPool
voucher.pool_id does not match the pool this lane draws from — also
the “unknown pool” case surfaced by the caller.
WrongProvider
voucher.provider names a node other than this one — a capability
voucher scoped to one provider redeemed against another.
AmountRegression
Cumulative amount is at or below the lane’s signed watermark — a stale
or replayed voucher, or one a concurrent same-lane sibling already
settled. amount is the sole ordering key (there is no nonce).
Fields
UnderFold
A voucher under a different chain_root retires the live epoch but
does not fold the frontier the live chain proved: its amount or its
bytes_delivered falls short of the signed anchor plus verified_index
chunks (ADR 003 §Chain length and rollover). It is at or above the
signed watermark under a root no sibling names — at exactly the anchor,
a root that opens a chain, never a sealed one — so no sibling settled
it; the payer under-signs chunks the node holds preimages for. The node
refuses it and sends the resume bundle that states the fold the payer
owes. A payer short only on bytes_delivered cannot fold from the
bundle, because the bundle does not advance its amount.
Fields
BytesRegression
Cumulative bytes delivered went down.
CapExceeded
Voucher amount exceeds the capability’s spending cap — the contract would revert at redemption.
BadPreimage
A released hash-chain preimage does not reach the tracked tip in
index − verified steps (ADR 003 §Concurrent Streams, Rule 2).
Terminal, and deliberately not watermark-gated on the wire: a
preimage carries no signature of its own, so a payment watermark cannot
repair a hash-chain mismatch. On-chain the same mismatch reverts
BadPreimage, which is caller error rather than transient state.
Fields
Signature(VoucherError)
Signature is malformed or signed by the wrong address.
Store(StoreError)
Lane-store write failed; in-memory state is unchanged. See StoreError
for the underlying cause. This is surfaced to the caller so the client
resends the same voucher instead of proceeding on state the store never
took (#527, ADR 003 §Off-chain voucher state persistence).
PROTOCOL NOTE: this is the only PoolError variant for which the client
SHOULD retry the same voucher unchanged. The validation variants mean the
voucher is permanently invalid for this lane state and retrying is a
client bug.
Trait Implementations§
Source§impl Error for PoolError
impl Error for PoolError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<StoreError> for PoolError
impl From<StoreError> for PoolError
Source§fn from(source: StoreError) -> Self
fn from(source: StoreError) -> Self
Source§impl From<VoucherError> for PoolError
impl From<VoucherError> for PoolError
Source§fn from(source: VoucherError) -> Self
fn from(source: VoucherError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for PoolError
impl !UnwindSafe for PoolError
impl Freeze for PoolError
impl Send for PoolError
impl Sync for PoolError
impl Unpin for PoolError
impl UnsafeUnpin for PoolError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.