Skip to main content

ModuleAnchorVerifier

Trait ModuleAnchorVerifier 

Source
pub trait ModuleAnchorVerifier: Send + Sync {
    // Required method
    fn verify_module_anchor<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        module: &'life1 dyn ModuleReader,
        store_id: &'life2 str,
        root: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = ModuleAnchor> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Binds a fully-staged .dig module to its chain-anchored (store_id, root) — the sole root of trust of the module pull (NC-9). dig-node injects the digstore verifier; this crate ships only the explicitly-opt-in, fail-OPEN [AcceptAnyModuleAnchor] for tests.

Required Methods§

Source

fn verify_module_anchor<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, module: &'life1 dyn ModuleReader, store_id: &'life2 str, root: &'life3 str, ) -> Pin<Box<dyn Future<Output = ModuleAnchor> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Whether the module behind module is the genuine .dig container committed on-chain under (store_id, root) (i.e. its embedded generation root equals the getAnchoredRoot value).

module is a borrowed, read-only view of the staged bytes and is valid only for the duration of this call: it cannot be retained, and it cannot promote or mutate anything. The bytes it yields are chunk-hash-verified and bounded to the already-hash-gated module length, so reading them incrementally is not a weaker check than being handed the whole slice was — it is the same bytes, materialized one window at a time.

An implementation that consults the chain MUST report ModuleAnchor::Unavailable when it could not reach an answer, NEVER ModuleAnchor::NotAnchored. The two are acted on very differently: NotAnchored is EVIDENCE against the holder that supplied the descriptor and earns it a durable demotion, while Unavailable is this node’s own failure and is terminal for the pull. Collapsing them lets a chain-source blip brand every honest holder tried (see ModuleAnchor). A read error from module is likewise the LOCAL node failing to read its own staging area ⇒ Unavailable, not NotAnchored.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§