Skip to main content

MempoolBlockAnchorer

Struct MempoolBlockAnchorer 

Source
pub struct MempoolBlockAnchorer<M: MempoolLookup + MempoolBroadcast + Send + Sync> { /* private fields */ }
Expand description

A BlockAnchorer implementing both sides over a transport that can look up UTXOs (MempoolLookup) and broadcast transactions (MempoolBroadcast). Generic over that transport so a fixture drives it in tests and MempoolHttpClient drives it in production — without changing the logic.

  • verify re-derives the expected taproot address from the anchor’s portable proof (pubkey + state_strings) via bt_address, rejects a forged address, then walks the trail back from the anchor’s outpoint (verify_anchor_report): every mark must exist, carry the key its prefix of states derives and spend the mark before it. No pod trust required, and an anchor stays verifiable after later marks spend it.

This anchorer serves the MRC20 trails a pod has already issued (their marks and states stay as they are); new trails use GitmarkAnchorer.

  • anchor (Phase 4) loads the named trail from storage, appends an MRC20 state notarising state_hash (via anchor_state, broadcasts the anchoring tx, persists the updated trail, and returns the BlockTrailAnchor (txid/vout/address/state_strings/pubkey). It requires a storage handle (set via MempoolBlockAnchorer::with_storage); the verify-only constructor MempoolBlockAnchorer::new leaves it None and anchor() then errors with a clear message.

Implementations§

Source§

impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> MempoolBlockAnchorer<M>

Source

pub fn new(lookup: M) -> Self

Wrap a transport as a verify-capable BlockAnchorer. anchor() is unavailable (no storage) and returns an error explaining that with_storage is required.

Source

pub fn with_storage(lookup: M, storage: Arc<dyn Storage>) -> Self

Wrap a transport + pod storage as a fully-capable BlockAnchorer (both verify and anchor). The storage backs the trail load/save at /.well-known/token/{ticker}.json.

Source

pub fn lookup(&self) -> &M

Borrow the underlying transport (e.g. for a one-off address_utxos).

Source§

impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> MempoolBlockAnchorer<M>

Source

pub async fn verify_report( &self, anchor: &BlockTrailAnchor, ) -> Result<Option<TrailReport>, ProvenanceError>

The per-link report behind BlockAnchorer::verify: None when the anchor carries no portable proof or its recorded address is not the derivation; otherwise every mark, walked back from the anchor’s outpoint, with the TrailVerdict (verified once every mark is confirmed).

Trait Implementations§

Source§

impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> BlockAnchorer for MempoolBlockAnchorer<M>

Source§

fn anchor<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ticker: &'life1 str, state_hash: &'life2 str, network: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<BlockTrailAnchor, ProvenanceError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Append one MRC20 state anchoring state_hash under ticker, build + broadcast the anchoring tx, persist the updated trail, and return the produced BlockTrailAnchor. This is the expensive-tier write the provenance design hinges on (ADR-059 §2.2, master-plan Phase 4).

network is honoured as a guard: it must match the trail’s own network (the trail’s chained-key addresses are network-bound). The returned anchor’s vout is 0 (the anchoring tx pays the next chained-key UTXO at output 0); blockheight is None until the tx confirms.

Source§

fn verify<'life0, 'life1, 'async_trait>( &'life0 self, anchor: &'life1 BlockTrailAnchor, ) -> Pin<Box<dyn Future<Output = Result<bool, ProvenanceError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verify a previously-produced anchor against the chain / fixtures: re-derive the taproot address from the portable proof, then walk the trail back from the anchor’s outpoint, checking that every mark exists, carries the key its states derive and spends the one before it.
Source§

impl<M: Clone + MempoolLookup + MempoolBroadcast + Send + Sync> Clone for MempoolBlockAnchorer<M>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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