pub struct PaymentQuote {
pub content: XorName,
pub timestamp: SystemTime,
pub price: Uint<256, 4>,
pub rewards_address: Address,
pub pub_key: Vec<u8>,
pub signature: Vec<u8>,
pub committed_key_count: u32,
pub commitment_pin: Option<[u8; 32]>,
}Expand description
A payment quote to store data given by a node to a client.
The PaymentQuote is a contract between the node and itself to make sure the clients aren’t mispaying. It is NOT a contract between the client and the node.
Fields§
§content: XorNameThe content paid for
timestamp: SystemTimeThe local node time when the quote was created
price: Uint<256, 4>The node-calculated price for storing this content
rewards_address: AddressThe node’s wallet address
pub_key: Vec<u8>The node’s public key in bytes (ML-DSA-65)
signature: Vec<u8>The node’s signature for the quote (ML-DSA-65)
committed_key_count: u32ADR-0004: the number of keys in the storage commitment this price was
derived from. 0 for a baseline (no-commitment) quote. Covered by the
signature and the quote hash, so it cannot be altered after signing.
Placed at the struct TAIL with #[serde(default)] deliberately: rmp’s
default tuple-struct encoding only supplies defaults for MISSING TRAILING
fields, so appending here is what actually lets an old-format quote
(which lacks these two fields entirely) decode — 0 / None —
rather than misaligning onto pub_key/signature.
This is decode-only compatibility, NOT mixed-fleet acceptance: an old-format quote still decodes, but it then verifies against the new 6-field signed payload and so its signature/hash no longer validate. ADR-0004 is a hard cutover — the whole fleet and clients upgrade together; nothing accepts an old-format signature. The tail-default only keeps deserialization total (no panic on short input), not interoperable.
commitment_pin: Option<[u8; 32]>ADR-0004: the pin (commitment hash) of the storage commitment this price
was derived from. None for a baseline (no-commitment) quote; Some
whenever committed_key_count > 0. Covered by the signature and the
quote hash. A verifier resolves this pin to the signed commitment
(carried as a sidecar, held from gossip, or fetched) to confirm the
price matches real, auditable storage. Tail-placed for the same
old-wire-decode reason as committed_key_count.
Implementations§
Source§impl PaymentQuote
impl PaymentQuote
Sourcepub fn hash(&self) -> FixedBytes<32>
pub fn hash(&self) -> FixedBytes<32>
Compute the hash of this quote.
Sourcepub fn bytes_for_signing(
xorname: XorName,
timestamp: SystemTime,
price: &Uint<256, 4>,
rewards_address: &Address,
committed_key_count: u32,
commitment_pin: &Option<[u8; 32]>,
) -> Vec<u8> ⓘ
pub fn bytes_for_signing( xorname: XorName, timestamp: SystemTime, price: &Uint<256, 4>, rewards_address: &Address, committed_key_count: u32, commitment_pin: &Option<[u8; 32]>, ) -> Vec<u8> ⓘ
Returns the bytes to be signed from the given parameters.
ADR-0004 appends the commitment binding (committed_key_count and
commitment_pin) after the original fields. The pin is encoded with a
one-byte tag (0 = none, 1 = present) so a baseline quote with no pin
can never collide with a quote pinning an all-zero hash. Appending keeps
the original prefix byte-for-byte identical, which matters only for
reasoning about the format’s evolution — the resulting signature and
quote hash still change, exactly the breaking change ADR-0004 plans for.
Sourcepub fn bytes_for_sig(&self) -> Vec<u8> ⓘ
pub fn bytes_for_sig(&self) -> Vec<u8> ⓘ
Returns the bytes to be signed from self.
Trait Implementations§
Source§impl Clone for PaymentQuote
impl Clone for PaymentQuote
Source§fn clone(&self) -> PaymentQuote
fn clone(&self) -> PaymentQuote
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaymentQuote
impl Debug for PaymentQuote
Source§impl<'de> Deserialize<'de> for PaymentQuote
impl<'de> Deserialize<'de> for PaymentQuote
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaymentQuote, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaymentQuote, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for PaymentQuote
Source§impl Ord for PaymentQuote
impl Ord for PaymentQuote
Source§fn cmp(&self, other: &PaymentQuote) -> Ordering
fn cmp(&self, other: &PaymentQuote) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PaymentQuote
impl PartialEq for PaymentQuote
Source§fn eq(&self, other: &PaymentQuote) -> bool
fn eq(&self, other: &PaymentQuote) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PaymentQuote
impl PartialOrd for PaymentQuote
Source§impl Serialize for PaymentQuote
impl Serialize for PaymentQuote
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for PaymentQuote
Auto Trait Implementations§
impl Freeze for PaymentQuote
impl RefUnwindSafe for PaymentQuote
impl Send for PaymentQuote
impl Sync for PaymentQuote
impl Unpin for PaymentQuote
impl UnsafeUnpin for PaymentQuote
impl UnwindSafe for PaymentQuote
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<'de, T> BorrowedRpcObject<'de> for 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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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