pub struct PriceFloorConfig {
pub enforce: bool,
pub tolerance_percent: u64,
}Expand description
Receiver-side price floor for single-node store admissions.
ADR-0004 gives every quote a price CEILING (price == calculate_price(committed_key_count)), but a ceiling is not a revenue
floor: a modified client can fetch quotes from the whole neighbourhood and
settle only the cheapest valid one in a 1-quote proof. This policy is the
floor half: the settled amount must also clear the close group’s MEDIAN
commitment-bound price, scaled by a tolerance.
The reference is the group’s median rather than this receiver’s own price.
A client pays 3x the median of the quotes it collected, so comparing that
to a single node’s price compares a median to one draw from a distribution
spanning ~4x — which in production rejected honest stores on the fullest
nodes while admitting underpayment at the emptiest. The reference is built
only from this node’s own commitment and its neighbours’ TTL-fresh gossiped
ones, never from the payment bundle.
Rollout is shadow-first: with enforce == false (the default) the floor
is evaluated and logged on every single-node store admission but never
rejects. Enforcement is enabled per node via PRICE_FLOOR_ENFORCE_ENV
for canary rollout. A floor rejection is an economic admission decision
only — it must never feed trust/misbehaviour scoring.
Fields§
§enforce: boolWhen true, a below-floor settled payment is rejected. When false (default), the verifier only logs would-reject telemetry.
tolerance_percent: u64Floor as a percentage of the close group’s median commitment-bound
price (0..=100).
Implementations§
Source§impl PriceFloorConfig
impl PriceFloorConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build from the environment (see PRICE_FLOOR_ENFORCE_ENV and
PRICE_FLOOR_TOLERANCE_ENV). Never panics.
An unset tolerance uses the default. A tolerance that is present but
invalid (unparseable or > 100) is an operator error: rather than
silently enforce at the default, this fails closed to shadow mode
(enforce = false) and logs a prominent error, so a fat-fingered
tolerance can never enforce an unintended floor against real payments.
Trait Implementations§
Source§impl Clone for PriceFloorConfig
impl Clone for PriceFloorConfig
Source§fn clone(&self) -> PriceFloorConfig
fn clone(&self) -> PriceFloorConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PriceFloorConfig
Source§impl Debug for PriceFloorConfig
impl Debug for PriceFloorConfig
Source§impl Default for PriceFloorConfig
impl Default for PriceFloorConfig
impl Eq for PriceFloorConfig
Source§impl PartialEq for PriceFloorConfig
impl PartialEq for PriceFloorConfig
impl StructuralPartialEq for PriceFloorConfig
Auto Trait Implementations§
impl Freeze for PriceFloorConfig
impl RefUnwindSafe for PriceFloorConfig
impl Send for PriceFloorConfig
impl Sync for PriceFloorConfig
impl Unpin for PriceFloorConfig
impl UnsafeUnpin for PriceFloorConfig
impl UnwindSafe for PriceFloorConfig
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