Skip to main content

ResolvingPoolView

Struct ResolvingPoolView 

Source
pub struct ResolvingPoolView<P: Provider + Clone> { /* private fields */ }
Expand description

A PoolView that confirms a pool on-chain before a serve is admitted.

The serve gates read {owner, remaining} from the event-fed PoolProjection the settlement watcher folds, so the common case costs no eth_call. A pool the projection has not observed is the hard case: a pool opened before this node’s ColdStart::Head anchor never appears in the forward-only PoolOpened scan, so its owner is absent from the projection even though the pool is live. Rather than fail open on that gap, status does ONE getPool at admission — a read the admission path tolerates (it may block) — folds a servable pool into the projection, and refuses an absent, closed, or faulted pool. Every admit-path chain read (getPool and the signer’s getAuthorization) runs under chain_events::timed’s default bound, so a hung read times out and takes the fault path instead of stalling admission. The client re-sends its capability on its next request (the documented lane recovery path), and by then the folded owner registers the lane.

The mid-stream re-check calls cached_status, which reads the projection ONLY and never blocks on a getPool — a chain read at a voucher boundary would stall delivery.

A short-TTL negative cache suppresses a repeat getPool for a pool just found not-servable (RESOLVE_VERDICT_TTL) or whose read faulted (the far shorter RESOLVE_FAULT_TTL), so a client re-requesting the same dead pool every request cannot drive one getPool per request, and one failed read does not refuse a live pool for the full verdict window. Reads are coalesced per pool: a request that finds a getPool in flight for its pool waits for it and takes its answer.

The signer confirm reads getAuthorization once per (pool, signer) and keeps a Registered answer for good (see AuthRead); only an Unregistered answer is re-read. Those reads are coalesced per pair the same way.

Implementations§

Source§

impl<P: Provider + Clone> ResolvingPoolView<P>

Source

pub fn new( contract: PaymentPoolInstance<P>, projection: PoolProjection, metrics: Arc<Metrics>, ) -> Self

Wrap the event-fed projection with admit-path getPool and getAuthorization fallbacks against contract.

Trait Implementations§

Source§

impl<P: Provider + Clone> Debug for ResolvingPoolView<P>

Source§

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

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

impl<P: Provider + Clone + 'static> PoolView for ResolvingPoolView<P>

Source§

fn status<'life0, 'async_trait>( &'life0 self, pool_id: B256, ) -> Pin<Box<dyn Future<Output = Option<PoolStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The pool’s status, or None if the pool cannot be confirmed. The stream-admission read: a caller here may tolerate a blocking source, so an implementation MAY do slow work. The bare PoolProjection reads from memory and returns None for a pool it has not folded; the production wrapper (crate::payment_settlement::ResolvingPoolView) confirms such a pool with one getPool before returning, so the admit gate refuses a pool it still cannot confirm rather than failing open.
Source§

fn cached_status<'life0, 'async_trait>( &'life0 self, pool_id: B256, ) -> Pin<Box<dyn Future<Output = Option<PoolStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A read that MUST NOT block: it returns None rather than doing any slow or remote work. The mid-stream serve re-check calls it at each voucher boundary, where a blocking read would stall delivery. The default delegates to Self::status for in-memory test doubles; PoolProjection serves both from the same in-memory map, so neither ever touches the network.
Source§

fn signer_spent_cached<'life0, 'async_trait>( &'life0 self, pool_id: B256, signer: Address, ) -> Pin<Box<dyn Future<Output = Option<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The mid-stream signer-drain read: a signer’s total on-chain spent across every provider in pool_id, from the event-fed projection ONLY — never a chain call. The serve loop pairs it with the cap the node already holds on the lane to test held_cap − spent headroom at the POOL_RECHECK_INTERVAL cadence, so a signer draining its shared cap at another node mid-stream stops this stream before it over-delivers unredeemable bytes (ADR 003 §Pool solvency). Read more
Source§

fn signer_authorization<'life0, 'async_trait>( &'life0 self, pool_id: B256, signer: Address, ) -> Pin<Box<dyn Future<Output = Option<SignerAuthorization>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The admit-path signer confirm: the request’s voucher signer on-chain authorization in pool_id (ADR 003 §Capability delegation, §Pool solvency). A signer’s cap is shared across every provider, so a signer that has drawn its full cap at other nodes is uncashable here. Its registered cap and expiry are write-once, so they bound every voucher whatever capability the client presents. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more