Skip to content

Commit

Permalink
Fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen-stig committed Dec 18, 2023
1 parent 3d4391e commit 8d8b2ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
21 changes: 5 additions & 16 deletions adapters/mock-da/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl MockDaService {
let mut blocks = self.blocks.write().await;

let (previous_block_hash, height) = match blocks.iter().last().map(|b| b.header().clone()) {
None => (MockHash::from([0; 32]), 0),
None => (GENESIS_HEADER.hash(), GENESIS_HEADER.height() + 1),
Some(block_header) => (block_header.hash(), block_header.height + 1),
};

Expand Down Expand Up @@ -122,24 +122,13 @@ impl MockDaService {

// Enough blocks to finalize block
if blocks.len() > self.blocks_to_finality as usize {
let oldest_available_height = blocks[0].header().height();
let last_finalized_height = self.last_finalized_height.load(Ordering::Acquire);
let last_finalized_index = last_finalized_height
.checked_sub(oldest_available_height)
.unwrap();
let next_index_to_finalize = blocks.len() - self.blocks_to_finality as usize - 1;

if last_finalized_index > 0 {
assert_eq!(next_index_to_finalize as u64, last_finalized_index + 1);
}

let next_finalized_header = blocks[next_index_to_finalize].header().clone();
self.last_finalized_height
.store(next_finalized_header.height(), Ordering::Release);
self.finalized_header_sender
.send(blocks[next_index_to_finalize].header().clone())
.send(next_finalized_header)
.unwrap();

let this_finalized_height = oldest_available_height + next_index_to_finalize as u64;
self.last_finalized_height
.store(this_finalized_height, Ordering::Release);
}

Ok(height)
Expand Down
6 changes: 3 additions & 3 deletions rollup-interface/src/node/services/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub trait DaService: Send + Sync + 'static {
/// Returns nothing if the transaction was successfully sent.
async fn send_transaction(&self, blob: &[u8]) -> Result<Self::TransactionId, Self::Error>;

/// Sends am aggrgated zk proof to the DA.
/// Sends am aggregated ZK proofs to the DA layer.
async fn send_aggregated_zk_proof(
&self,
aggregated_proof_data: &[u8],
Expand All @@ -121,8 +121,8 @@ pub trait DaService: Send + Sync + 'static {
}

/// `SlotData` is the subset of a DA layer block which is stored in the rollup's database.
/// At the very least, the rollup needs access to the hashes and headers of all DA layer blocks, but rollups
/// may choose to store partial (or full) block data as well.
/// At the very least, the rollup needs access to the hashes and headers of all DA layer blocks,
/// but rollup may choose to store partial (or full) block data as well.
pub trait SlotData:
Serialize + DeserializeOwned + PartialEq + core::fmt::Debug + Clone + Send + Sync
{
Expand Down

0 comments on commit 8d8b2ce

Please sign in to comment.