Trait sov_rollup_interface::services::da::DaService
source · 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§
sourcetype RuntimeConfig: DeserializeOwned
type RuntimeConfig: DeserializeOwned
A handle to the types used by the DA layer.
sourcetype FilteredBlock: SlotData<BlockHeader = <Self::Spec as DaSpec>::BlockHeader>
type FilteredBlock: SlotData<BlockHeader = <Self::Spec as DaSpec>::BlockHeader>
A DA layer block, possibly excluding some irrelevant information.
Required Methods§
sourcefn new(
config: Self::RuntimeConfig,
chain_params: <Self::Spec as DaSpec>::ChainParams
) -> Self
fn new( config: Self::RuntimeConfig, chain_params: <Self::Spec as DaSpec>::ChainParams ) -> Self
Create a new instance of the DaService
sourcefn get_finalized_at(&self, height: u64) -> Self::Future<Self::FilteredBlock>
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.
sourcefn get_block_at(&self, height: u64) -> Self::Future<Self::FilteredBlock>
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
sourcefn extract_relevant_txs(
&self,
block: Self::FilteredBlock
) -> Vec<<Self::Spec as DaSpec>::BlobTransaction>
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.
sourcefn 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 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.
sourcefn send_transaction(&self, blob: &[u8]) -> Self::Future<()>
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.