pub struct Cumulative {
pub bytes: U256,
pub amount: U256,
}Expand description
A lane’s cumulative voucher state: the absolute totals carried by the most
recent voucher. Both advance monotonically over the lane’s lifetime. There
is no nonce — amount is the sole monotone ordering and replay key (ADR 005
§Voucher wire format).
Fields§
§bytes: U256Cumulative lane bytes paid for.
amount: U256Cumulative lane amount paid (token base units).
Trait Implementations§
Source§impl Clone for Cumulative
impl Clone for Cumulative
impl Copy for Cumulative
Source§impl Debug for Cumulative
impl Debug for Cumulative
Source§impl Default for Cumulative
impl Default for Cumulative
impl Eq for Cumulative
Source§impl From<&WatermarkBundle> for Cumulative
impl From<&WatermarkBundle> for Cumulative
Source§fn from(bundle: &WatermarkBundle) -> Self
fn from(bundle: &WatermarkBundle) -> Self
Decode a wallet-less resume bundle (issue #1481) into the full lane claim
it represents, in the shape PoolLedger tracks.
This folds the chain half. A bundle reports two things: the signed
anchor the node last accepted, and the frontier its chain has proved on
top of that anchor. Decoding only the anchor would throw away
verified_index chunks the node already holds preimages for — and the
resuming signer would then re-sign from the anchor, open a fresh root
beside a frontier the node is still metering, and watch every reveal that
followed fold nothing (the node keeps the old root: a chain with reveals
under it is worth more than the anchor a lagging voucher offers for it).
So the fold is not an optimisation; it is what makes a resume converge.
It is the same fold a rollover performs — amount + verified_index × chunk_price, bytes + verified_index × CHUNK_BYTES — and the node’s
watermark_bundle_for_reject documents it as the signer’s side of the
bargain (ADR 005 §Watermark bundle). A bundle carrying no chain
(verified_index == 0, the sealed or never-metered case) folds nothing
and decodes to the anchor alone.
Infallible: the fold is computed in U256, so the u64 inputs cannot
overflow it and a caller can re-seed from a bundle without a Result.
It is also unauthenticated, and deliberately so — this is arithmetic, not
a trust boundary. verified_index is a number the node writes and no
signature covers, so a bundle reaches this conversion only through
resumable_watermark, which proves the anchor against the client’s own
signature and the frontier against the bundle’s tip before any of it
becomes money. Do not fold a bundle that has not been through that gate.
Source§impl PartialEq for Cumulative
impl PartialEq for Cumulative
impl StructuralPartialEq for Cumulative
Auto Trait Implementations§
impl Freeze for Cumulative
impl RefUnwindSafe for Cumulative
impl Send for Cumulative
impl Sync for Cumulative
impl Unpin for Cumulative
impl UnsafeUnpin for Cumulative
impl UnwindSafe for Cumulative
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more