pub struct RateAboveCeiling { /* private fields */ }Expand description
Typed sentinel for a server that signed an open-stage StreamResponse
(ok == true) quoting a per-MB rate_per_mb above the buyer’s effective
ceiling (#1375). The buyer aborts before paying, so the profitable
“quote low on the probe, quote high on the stream, then deliver” bait-and-switch
never gets paid.
The ceiling is the lower of two bounds the caller supplies: the probe rate the
candidate was selected on (a stream quote may not exceed what the probe
advertised) and an optional absolute buyer config (max_rate_per_mb). Because
the probe-relative bound is always applied by the node pull path, a completed
delivery is by construction priced at or below the probe rate — so it can never
be rate-manipulation (SlashJudge requires stream.ratePerMb > probe.ratePerMb),
and the challengeable case is exactly this abort.
Carries the operator’s own signed response — already verified against
expected_signer by verify_response before construction, so it still
recovers to the delivering node and a caller could replay it (paired with the
same node’s ProbeResponse) to SlashJudge with no re-signing.
Slashability caveat. The evidence is only rate-manipulation evidence when
the probe-relative bound was the one exceeded: SlashJudge requires
stream.ratePerMb > probe.ratePerMb. The ceiling here is
min(probe_rate, config_absolute) (effective_rate_ceiling), so when the
buyer’s absolute config bound is the binding one the quote may sit at or below
the probe rate and be perfectly honest. A challenger must therefore still
confirm quote > probeRate before submitting; this type does not assert it.
Consumption. The signed response is retained on the error so a caller can
act on it, but the node’s pull-failure handler does not itself submit a
challenge — auto-slashing is deferred (the same footing as the daemon never
auto-challenging an UpstreamRefused, whose evidence is exercised only by the
e2e harness today). evidence() is the only accessor; the field is private and
the sole constructor derives it from the verified response, so the
verified-signature invariant cannot be bypassed by a hand-built value.
Implementations§
Source§impl RateAboveCeiling
impl RateAboveCeiling
Sourcepub const fn quoted_rate_per_mb(&self) -> u64
pub const fn quoted_rate_per_mb(&self) -> u64
The per-MB rate the server quoted in the signed StreamResponse.
Sourcepub const fn ceiling_rate_per_mb(&self) -> u64
pub const fn ceiling_rate_per_mb(&self) -> u64
The effective ceiling the quote exceeded (min of probe rate and config).
Sourcepub const fn evidence(&self) -> &StreamResponse
pub const fn evidence(&self) -> &StreamResponse
The operator’s own signed StreamResponse, verified against
expected_signer before this value was built. See the type docs for the
slashability caveat (only quote > probeRate is manipulation).
Trait Implementations§
Source§impl Debug for RateAboveCeiling
impl Debug for RateAboveCeiling
Source§impl Display for RateAboveCeiling
impl Display for RateAboveCeiling
Source§impl Error for RateAboveCeiling
impl Error for RateAboveCeiling
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for RateAboveCeiling
impl RefUnwindSafe for RateAboveCeiling
impl Send for RateAboveCeiling
impl Sync for RateAboveCeiling
impl Unpin for RateAboveCeiling
impl UnsafeUnpin for RateAboveCeiling
impl UnwindSafe for RateAboveCeiling
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.