pub trait DaService {
    type RuntimeConfig: DeserializeOwned;
    type Spec: DaSpec;
    type FilteredBlock: SlotData<BlockHeader = <Self::Spec as DaSpec>::BlockHeader>;
    type Future<T>: Future<Output = Result<T, Self::Error>>;
    type Error: Send + Sync;

    // Required methods
    fn new(
        config: Self::RuntimeConfig,
        chain_params: <Self::Spec as DaSpec>::ChainParams
    ) -> Self;
    fn get_finalized_at(&self, height: u64) -> Self::Future<Self::FilteredBlock>;
    fn get_block_at(&self, height: u64) -> Self::Future<Self::FilteredBlock>;
    fn extract_relevant_txs(
        &self,
        block: Self::FilteredBlock
    ) -> Vec<<Self::Spec as DaSpec>::BlobTransaction>;
    fn extract_relevant_txs_with_proof(
        &self,
        block: Self::FilteredBlock
    ) -> (Vec<<Self::Spec as DaSpec>::BlobTransaction>, <Self::Spec as DaSpec>::InclusionMultiProof, <Self::Spec as DaSpec>::CompletenessProof);
    fn send_transaction(&self, blob: &[u8]) -> Self::Future<()>;
}
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 RuntimeConfig: DeserializeOwned

A handle to the types used by the DA layer.

source

type Spec: DaSpec

A handle to the types used by the DA layer.

source

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

A DA layer block, possibly excluding some irrelevant information.

source

type Future<T>: Future<Output = Result<T, Self::Error>>

The output of an async call. Used in place of a dependency on async_trait.

source

type Error: Send + Sync

The error type for fallible methods.

Required Methods§

source

fn new( config: Self::RuntimeConfig, chain_params: <Self::Spec as DaSpec>::ChainParams ) -> Self

Create a new instance of the DaService

source

fn get_finalized_at(&self, height: u64) -> Self::Future<Self::FilteredBlock>

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(&self, height: u64) -> Self::Future<Self::FilteredBlock>

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_txs( &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 extract_relevant_txs_with_proof( &self, block: Self::FilteredBlock ) -> (Vec<<Self::Spec as DaSpec>::BlobTransaction>, <Self::Spec as DaSpec>::InclusionMultiProof, <Self::Spec as DaSpec>::CompletenessProof)

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.

source

fn send_transaction(&self, blob: &[u8]) -> Self::Future<()>

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

Implementors§