Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions crates/sui-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2930,7 +2930,6 @@ impl AuthorityPerEpochStore {
};
let make_checkpoint = should_accept_tx || final_round;
if make_checkpoint {
// Generate pending checkpoint for regular user tx.
let checkpoint_height = if self.randomness_state_enabled() {
consensus_commit_info.round * 2
} else {
Expand All @@ -2951,29 +2950,34 @@ impl AuthorityPerEpochStore {
}
}
checkpoint_roots.extend(roots.into_iter());

if let Some(randomness_round) = randomness_round {
randomness_roots.insert(TransactionKey::RandomnessRound(
self.epoch(),
randomness_round,
));
}

// Determine whether to write pending checkpoint for user tx with randomness.
// - If randomness is not generated for this commit, we will skip the
// checkpoint with the associated height. Therefore checkpoint heights may
// not be contiguous.
// - Exception: if DKG fails, we always need to write out a PendingCheckpoint
// for randomness tx that are canceled.
let should_write_random_checkpoint =
randomness_round.is_some() || (dkg_failed && !randomness_roots.is_empty());

let pending_checkpoint = PendingCheckpointV2::V2(PendingCheckpointV2Contents {
roots: checkpoint_roots,
details: PendingCheckpointInfo {
timestamp_ms: consensus_commit_info.timestamp,
last_of_epoch: final_round && randomness_round.is_none(),
last_of_epoch: final_round && !should_write_random_checkpoint,
checkpoint_height,
},
});
self.write_pending_checkpoint(&mut output, &pending_checkpoint)?;

// Generate pending checkpoint for user tx with randomness.
// - If randomness is not generated for this commit, we will skip the
// checkpoint with the associated height. Therefore checkpoint heights may
// not be contiguous.
// - Exception: if DKG fails, we always need to write out a PendingCheckpoint
// for randomness tx that are canceled.
if let Some(randomness_round) = randomness_round {
randomness_roots.insert(TransactionKey::RandomnessRound(
self.epoch(),
randomness_round,
));
}
if randomness_round.is_some() || (dkg_failed && !randomness_roots.is_empty()) {
if should_write_random_checkpoint {
let pending_checkpoint = PendingCheckpointV2::V2(PendingCheckpointV2Contents {
roots: randomness_roots.into_iter().collect(),
details: PendingCheckpointInfo {
Expand Down
Loading