Trait DaService

Source
pub trait DaService:
    Send
    + Sync
    + 'static {
    type Spec: DaSpec;
    type Verifier: DaVerifier<Spec = Self::Spec>;
    type FilteredBlock: SlotData<BlockHeader = <Self::Spec as DaSpec>::BlockHeader, Cond = <Self::Spec as DaSpec>::ValidityCondition>;
    type Error: Debug + Send + Sync + Display;

    // Required methods
    fn get_finalized_at<'life0, 'async_trait>(
        &'life0 self,
        height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Self::FilteredBlock, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_block_at<'life0, 'async_trait>(
        &'life0 self,
        height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Self::FilteredBlock, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn extract_relevant_blobs(
        &self,
        block: &Self::FilteredBlock,
    ) -> Vec<<Self::Spec as DaSpec>::BlobTransaction>;
    fn get_extraction_proof<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        block: &'life1 Self::FilteredBlock,
        blobs: &'life2 [<Self::Spec as DaSpec>::BlobTransaction],
    ) -> Pin<Box<dyn Future<Output = (<Self::Spec as DaSpec>::InclusionMultiProof, <Self::Spec as DaSpec>::CompletenessProof)> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn send_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        blob: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn extract_relevant_blobs_with_proof<'life0, 'life1, 'async_trait>(
        &'life0 self,
        block: &'life1 Self::FilteredBlock,
    ) -> Pin<Box<dyn Future<Output = (Vec<<Self::Spec as DaSpec>::BlobTransaction>, <Self::Spec as DaSpec>::InclusionMultiProof, <Self::Spec as DaSpec>::CompletenessProof)> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

A DaService is the local side of an RPC connection talking to a node of the DA layer It is not part of the logic that is zk-proven.

The DaService has two responsibilities - fetching data from the DA layer, transforming the data into a representation that can be efficiently verified in circuit.

Required Associated Types§

Source

type Spec: DaSpec

A handle to the types used by the DA layer.

Source

type Verifier: DaVerifier<Spec = Self::Spec>

The verifier for this DA layer.

Source

type FilteredBlock: SlotData<BlockHeader = <Self::Spec as DaSpec>::BlockHeader, Cond = <Self::Spec as DaSpec>::ValidityCondition>

A DA layer block, possibly excluding some irrelevant information.

Source

type Error: Debug + Send + Sync + Display

The error type for fallible methods.

Required Methods§

Source

fn get_finalized_at<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Self::FilteredBlock, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve the data for the given height, waiting for it to be finalized if necessary. The block, once returned, must not be reverted without a consensus violation.

Source

fn get_block_at<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Self::FilteredBlock, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch the block at the given height, waiting for one to be mined if necessary. The returned block may not be final, and can be reverted without a consensus violation

Source

fn extract_relevant_blobs( &self, block: &Self::FilteredBlock, ) -> Vec<<Self::Spec as DaSpec>::BlobTransaction>

Extract the relevant transactions from a block. For example, this method might return all of the blob transactions in rollup’s namespace on Celestia.

Source

fn get_extraction_proof<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, block: &'life1 Self::FilteredBlock, blobs: &'life2 [<Self::Spec as DaSpec>::BlobTransaction], ) -> Pin<Box<dyn Future<Output = (<Self::Spec as DaSpec>::InclusionMultiProof, <Self::Spec as DaSpec>::CompletenessProof)> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generate a proof that the relevant blob transactions have been extracted correctly from the DA layer block.

Source

fn send_transaction<'life0, 'life1, 'async_trait>( &'life0 self, blob: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a transaction directly to the DA layer. blob is the serialized and signed transaction. Returns nothing if the transaction was successfully sent.

Provided Methods§

Source

fn extract_relevant_blobs_with_proof<'life0, 'life1, 'async_trait>( &'life0 self, block: &'life1 Self::FilteredBlock, ) -> Pin<Box<dyn Future<Output = (Vec<<Self::Spec as DaSpec>::BlobTransaction>, <Self::Spec as DaSpec>::InclusionMultiProof, <Self::Spec as DaSpec>::CompletenessProof)> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Extract the relevant transactions from a block, along with a proof that the extraction has been done correctly. For example, this method might return all of the blob transactions in rollup’s namespace on Celestia, together with a range proof against the root of the namespaced-merkle-tree, demonstrating that the entire rollup namespace has been covered.

Implementors§