Skip to main content

WatermarkBundle

Struct WatermarkBundle 

Source
pub struct WatermarkBundle {
    pub amount: u64,
    pub bytes_delivered: u64,
    pub chain_root: [u8; 32],
    pub verified_index: u8,
    pub tip: [u8; 32],
    pub chunk_price: u64,
    pub last_signature: Vec<u8>,
}
Expand description

The node’s true watermark for a pool capability, echoed back on a gated StreamError::VoucherRejected so a wallet-less client can self-heal (issue #1481). amount/bytes_delivered mirror the seller-side PoolState::last_* fields as u64 cumulative totals, for the same reason as Voucher — matching the contract’s on-chain uint64 storage. last_signature is the node’s stored last-accepted client signature (r‖s‖v, exactly VOUCHER_SIG_LEN) — not a node signature over this bundle — so the client can confirm which of its own vouchers the node holds.

Fields§

§amount: u64

Cumulative amount of the node’s last-accepted voucher.

§bytes_delivered: u64

Cumulative bytes delivered as of the node’s last-accepted voucher.

§chain_root: [u8; 32]

Root the lane is currently metering against; all-zero when the lane holds no live chain.

§verified_index: u8

Deepest chain index the node has verified under chain_root.

§tip: [u8; 32]

The preimage bytes at verified_index; all-zero when the node has verified none. Echoed so a re-seeding signer folds verified_index × chunk_price back into the amount it re-signs rather than dropping the frontier (ADR 005 §Watermark bundle).

§chunk_price: u64

The chunk_price the node’s last-accepted voucher was signed at.

§last_signature: Vec<u8>

The client’s own signature (r‖s‖v, exactly VOUCHER_SIG_LEN) on the node’s last-accepted voucher. Vec<u8> rather than a fixed array, mirroring Voucher::signature — postcard/serde signature fields on this wire are length-prefixed Vec<u8>, not [u8; N] (serde’s array impls top out at N=32).

Implementations§

Source§

impl WatermarkBundle

Source

pub const fn validate(&self) -> Result<(), MessageValidationError>

Validate the wire-level last_signature length (VOUCHER_SIG_LEN) — the same client-voucher-signature length Voucher::validate checks, since this IS a client voucher signature (issue #1481). A caller MUST call this before trusting a bundle enough to reseed a ledger from it: the bundle rides inside an application-level StreamError, not signed itself, so this is a shape check, not an authentication check — it stops a malformed/truncated bundle from reaching a fixed-length conversion downstream, nothing more.

Trait Implementations§

Source§

impl Clone for WatermarkBundle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WatermarkBundle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for WatermarkBundle

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for WatermarkBundle

Source§

impl PartialEq for WatermarkBundle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for WatermarkBundle

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for WatermarkBundle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.