pub struct QuoteGenerator { /* private fields */ }Expand description
Quote generator for creating payment quotes.
Uses the node’s signing capabilities to sign quotes, which clients use to pay for storage on the Arbitrum network.
Implementations§
Source§impl QuoteGenerator
impl QuoteGenerator
Sourcepub fn new(
rewards_address: RewardsAddress,
metrics_tracker: QuotingMetricsTracker,
) -> Self
pub fn new( rewards_address: RewardsAddress, metrics_tracker: QuotingMetricsTracker, ) -> Self
Create a new quote generator without signing capability.
Call set_signer to enable quote signing.
§Arguments
rewards_address- The EVM address for receiving paymentsmetrics_tracker- Tracker for quoting metrics
Sourcepub fn attach_commitment_source(&self, source: Arc<dyn CommitmentSource>)
pub fn attach_commitment_source(&self, source: Arc<dyn CommitmentSource>)
Attach the ADR-0004 commitment source so quotes bind their price to the node’s live storage commitment.
Idempotent: calling twice replaces the handle. Uses interior mutability
so it can be called on an Arc after construction. When attached,
Self::create_quote and Self::create_merkle_candidate_quote price
against the committed responsible key count, pin the current commitment,
and refresh its answerability. When absent, both fall back to baseline
(no-pin) quotes.
Sourcepub fn commitment_blob_for_pin(&self, pin: [u8; 32]) -> Option<Vec<u8>>
pub fn commitment_blob_for_pin(&self, pin: [u8; 32]) -> Option<Vec<u8>>
ADR-0004: the serialized signed commitment for pin, so the quote
response can ship it as a sidecar. None when no commitment source is
attached (baseline / pre-rotation / tests) or the pin is no longer
retained — in which case the response carries no commitment and the
client falls back to gossip/fetch. Lock is dropped before the (heavier)
blob materialisation in the impl.
Sourcepub fn set_signer<F>(&mut self, pub_key: Vec<u8>, sign_fn: F)
pub fn set_signer<F>(&mut self, pub_key: Vec<u8>, sign_fn: F)
Set the signing function for quote generation.
§Arguments
pub_key- The node’s public key bytessign_fn- Function that signs bytes and returns signature
Sourcepub fn probe_signer(&self) -> Result<()>
pub fn probe_signer(&self) -> Result<()>
Probe the signer with test data to verify it produces a non-empty signature.
§Errors
Returns an error if no signer is set or if signing produces an empty signature.
Sourcepub fn create_quote(
&self,
content: XorName,
data_size: usize,
data_type: u32,
) -> Result<PaymentQuote>
pub fn create_quote( &self, content: XorName, data_size: usize, data_type: u32, ) -> Result<PaymentQuote>
Generate a payment quote for storing data.
§Arguments
content- TheXorNameof the content to storedata_size- Size of the data in bytesdata_type- Type index of the data (0 for chunks)
§Returns
A signed PaymentQuote that the client can use to pay on-chain.
§Errors
Returns an error if signing is not configured.
Sourcepub fn rewards_address(&self) -> &RewardsAddress
pub fn rewards_address(&self) -> &RewardsAddress
Get the rewards address.
Sourcepub fn records_stored(&self) -> usize
pub fn records_stored(&self) -> usize
Get the current number of records stored.
Sourcepub fn record_store(&self)
pub fn record_store(&self)
Record data stored (delegates to metrics tracker).
Sourcepub fn resync_records(&self, count: usize)
pub fn resync_records(&self, count: usize)
Resync the quoting metric to an authoritative count of held records.
ADR-0004: records_stored() is NO LONGER a pricing input — the quote
price is a function of the node’s committed key count (see
resolve_quote_pricing), not this counter. This resync just keeps the
accounting/telemetry metric honest against what the node ACTUALLY HOLDS
(from the storage layer), including deletions and pruning, so a monotonic
store counter can’t drift from reality.
Sourcepub fn create_merkle_candidate_quote(
&self,
data_size: usize,
data_type: u32,
merkle_payment_timestamp: u64,
) -> Result<MerklePaymentCandidateNode>
pub fn create_merkle_candidate_quote( &self, data_size: usize, data_type: u32, merkle_payment_timestamp: u64, ) -> Result<MerklePaymentCandidateNode>
Create a merkle candidate quote for batch payment using ML-DSA-65.
Returns a MerklePaymentCandidateNode constructed with the node’s
ML-DSA-65 public key and signature. This uses the same post-quantum
signing stack as regular payment quotes, rather than the ed25519
signing that the upstream ant-evm library assumes.
The pub_key field stores the raw ML-DSA-65 public key bytes,
and signature stores the ML-DSA-65 signature over bytes_to_sign().
Clients verify these using verify_merkle_candidate_signature().
§Errors
Returns an error if signing is not configured.
Auto Trait Implementations§
impl !Freeze for QuoteGenerator
impl !RefUnwindSafe for QuoteGenerator
impl !UnwindSafe for QuoteGenerator
impl Send for QuoteGenerator
impl Sync for QuoteGenerator
impl Unpin for QuoteGenerator
impl UnsafeUnpin for QuoteGenerator
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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