pub struct LaneChain {
pub chain_root: B256,
pub chunk_price: U256,
pub verified_index: u8,
pub tip: B256,
}Expand description
One metering epoch’s hash-chain state on a lane (ADR 003 §Hash-chain
metering (PayWord)).
chain_root is the head the payer signed into the epoch’s voucher, and
(verified_index, tip) is the deepest preimage the node has verified under
it — the frontier that turns into money at redemption. tip is the preimage
bytes, not just the depth: only the payer can produce a value at a given
depth, so a node that kept the index alone would hold an unprovable claim
after a restart, in exactly the abandonment case the chain exists to cover.
A sealed epoch (chain_root == B256::ZERO) meters nothing: chunk_price is
zero, verified_index stays 0, and tip is zero. Nothing hashes to zero,
so no index above 0 can ever be verified against it.
Fields§
§chain_root: B256Head of this epoch’s chain; zero seals the epoch at its anchor amount.
chunk_price: U256What one chunk adds over the anchor, in token base units. Zero on a sealed epoch.
verified_index: u8Deepest chain index verified under chain_root; 0 until the first
preimage lands.
tip: B256The preimage bytes at verified_index, or chain_root itself at index
0 — which is what makes the walk uniform with no branch.
Implementations§
Source§impl LaneChain
impl LaneChain
Sourcepub const NONE: Self
pub const NONE: Self
The empty chain: no root, no price, nothing verified. What a lane holds before its first voucher, and what a sealed voucher installs.
Sourcepub const fn opened(chain_root: B256, chunk_price: U256) -> Self
pub const fn opened(chain_root: B256, chunk_price: U256) -> Self
A fresh epoch at index 0: the root is its own tip, so a claim settling at exactly the anchor amount submits a value the payer already holds and walks nothing.
Sourcepub fn accrued(&self) -> U256
pub fn accrued(&self) -> U256
What the verified frontier adds over its anchor:
verified_index × chunk_price.
Sourcepub fn accrued_bytes(&self) -> U256
pub fn accrued_bytes(&self) -> U256
What the verified frontier adds over its anchor on the byte axis:
verified_index × CHUNK_BYTES.
Trait Implementations§
impl Copy for LaneChain
impl Eq for LaneChain
impl StructuralPartialEq for LaneChain
Auto Trait Implementations§
impl Freeze for LaneChain
impl RefUnwindSafe for LaneChain
impl Send for LaneChain
impl Sync for LaneChain
impl Unpin for LaneChain
impl UnsafeUnpin for LaneChain
impl UnwindSafe for LaneChain
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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