Skip to content

Commit

Permalink
feat: add transaction id to DaService (Sovereign-Labs#1188)
Browse files Browse the repository at this point in the history
This commit introduces an associated type `TransactionId` to
`DaService`.

It will unlock the ability to track a submitted transaction after when
it is sent to the DA, and before it is included on a block.
  • Loading branch information
vlopes11 authored Nov 28, 2023
1 parent 535dde6 commit cec0920
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions adapters/avail/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ impl DaService for DaProvider {

type FilteredBlock = AvailBlock;
type HeaderStream = AvailBlockHeaderStream;
type TransactionId = ();

type Error = anyhow::Error;

Expand Down
1 change: 1 addition & 0 deletions adapters/celestia/src/da_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl DaService for CelestiaService {

type FilteredBlock = FilteredCelestiaBlock;
type HeaderStream = CelestiaBlockHeaderSubscription;
type TransactionId = ();

type Error = BoxError;

Expand Down
1 change: 1 addition & 0 deletions adapters/mock-da/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl DaService for MockDaService {
type Verifier = MockDaVerifier;
type FilteredBlock = MockBlock;
type HeaderStream = MockDaBlockHeaderStream;
type TransactionId = ();
type Error = anyhow::Error;

/// Gets block at given height
Expand Down
5 changes: 4 additions & 1 deletion rollup-interface/src/node/services/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ pub trait DaService: Send + Sync + 'static {
Item = Result<<Self::Spec as DaSpec>::BlockHeader, Self::Error>,
>;

/// A transaction ID, used to identify the transaction in the DA layer.
type TransactionId: PartialEq + Eq + PartialOrd + Ord + core::hash::Hash;

/// The error type for fallible methods.
type Error: core::fmt::Debug + Send + Sync + core::fmt::Display;

Expand Down Expand Up @@ -105,7 +108,7 @@ pub trait DaService: Send + Sync + 'static {
/// Send a transaction directly to the DA layer.
/// blob is the serialized and signed transaction.
/// Returns nothing if the transaction was successfully sent.
async fn send_transaction(&self, blob: &[u8]) -> Result<(), Self::Error>;
async fn send_transaction(&self, blob: &[u8]) -> Result<Self::TransactionId, Self::Error>;
}

/// `SlotData` is the subset of a DA layer block which is stored in the rollup's database.
Expand Down
1 change: 1 addition & 0 deletions utils/rng-da-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl DaService for RngDaService {
type Verifier = RngDaVerifier;
type FilteredBlock = MockBlock;
type HeaderStream = RngHeaderStream;
type TransactionId = ();
type Error = anyhow::Error;

async fn get_block_at(&self, height: u64) -> Result<Self::FilteredBlock, Self::Error> {
Expand Down

0 comments on commit cec0920

Please sign in to comment.