Skip to content

Commit

Permalink
[checkpoints] Remove builder_checkpoint_summary table (MystenLabs#10456)
Browse files Browse the repository at this point in the history
Since we released 0.30 we can now remove the old table
  • Loading branch information
andll authored and wlmyng committed Apr 6, 2023
1 parent 54ad868 commit 58b03e0
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions crates/sui-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ pub struct AuthorityEpochTables {
user_signatures_for_checkpoints: DBMap<TransactionDigest, Vec<GenericSignature>>,

/// Maps sequence number to checkpoint summary, used by CheckpointBuilder to build checkpoint within epoch
builder_checkpoint_summary: DBMap<CheckpointSequenceNumber, CheckpointSummary>,
builder_checkpoint_summary_v2: DBMap<CheckpointSequenceNumber, BuilderCheckpointSummary>,

// Maps checkpoint sequence number to an accumulator with accumulated state
Expand Down Expand Up @@ -1803,31 +1802,24 @@ impl AuthorityPerEpochStore {
pub fn last_built_checkpoint_summary(
&self,
) -> SuiResult<Option<(CheckpointSequenceNumber, CheckpointSummary)>> {
let last_v2 = self
.tables
.builder_checkpoint_summary_v2
.iter()
.skip_to_last()
.next();
if let Some((seq, last_v2)) = last_v2 {
return Ok(Some((seq, last_v2.summary)));
}
Ok(self
.tables
.builder_checkpoint_summary
.builder_checkpoint_summary_v2
.iter()
.skip_to_last()
.next())
.next()
.map(|(seq, s)| (seq, s.summary)))
}

pub fn get_built_checkpoint_summary(
&self,
sequence: CheckpointSequenceNumber,
) -> SuiResult<Option<CheckpointSummary>> {
if let Some(summary) = self.tables.builder_checkpoint_summary_v2.get(&sequence)? {
return Ok(Some(summary.summary));
}
Ok(self.tables.builder_checkpoint_summary.get(&sequence)?)
Ok(self
.tables
.builder_checkpoint_summary_v2
.get(&sequence)?
.map(|s| s.summary))
}

pub fn builder_included_transaction_in_checkpoint(
Expand Down

0 comments on commit 58b03e0

Please sign in to comment.