Skip to content

Commit

Permalink
fix: relax liveness check slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
niklaslong committed Sep 20, 2023
1 parent 5016ad0 commit 4599420
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions node/narwhal/src/helpers/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,7 @@ impl<N: Network> Storage<N> {
}

// Check the timestamp for liveness.
check_timestamp_for_liveness(
batch_header.timestamp(),
self.median_timestamp_for_round(self.current_round() - 1),
)?;
check_timestamp_for_liveness(batch_header.timestamp(), self.median_timestamp_for_round(round - 1))?;

// Initialize a list for the missing transmissions from storage.
let mut missing_transmissions = HashMap::new();
Expand Down Expand Up @@ -419,7 +416,7 @@ impl<N: Network> Storage<N> {
// Iterate over the timestamps.
for timestamp in certificate.timestamps() {
// Check the timestamp for liveness.
check_timestamp_for_liveness(timestamp, self.median_timestamp_for_round(self.current_round() - 1))?;
check_timestamp_for_liveness(timestamp, self.median_timestamp_for_round(round - 1))?;
}

// Retrieve the committee for the batch round.
Expand Down
2 changes: 1 addition & 1 deletion node/narwhal/src/helpers/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn check_timestamp_for_liveness(timestamp: i64, previous_timestamp: i64) ->
}

// Ensure the timestamp is after the previous timestamp.
if timestamp <= previous_timestamp {
if timestamp < previous_timestamp {
bail!(
"Timestamp {timestamp} for the proposed batch must be after the previous round timestamp {previous_timestamp}"
)
Expand Down

0 comments on commit 4599420

Please sign in to comment.