Skip to content

Commit

Permalink
storage: write synced transactions to synced-transactions table (Myst…
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill authored Dec 12, 2022
1 parent ac7a568 commit 8e744d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions crates/sui-core/src/authority/authority_store_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub struct AuthorityPerpetualTables {
pub(crate) executed_effects: DBMap<TransactionDigest, SignedTransactionEffects>,

pub(crate) effects: DBMap<TransactionEffectsDigest, TransactionEffects>,
pub(crate) synced_transactions: DBMap<TransactionDigest, TrustedCertificate>,

// Tables used for authority batch structure
// TODO: executed_sequence and batches both conceptually belong in AuthorityEpochTables,
Expand Down
22 changes: 16 additions & 6 deletions crates/sui-core/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,30 @@ impl ReadStore for RocksDbStore {
) -> Result<Option<VerifiedCertificate>, Self::Error> {
if let Some(transaction) = self
.authority_store
.epoch_store()
.get_pending_certificate(digest)?
.perpetual_tables
.certificates
.get(digest)?
{
return Ok(Some(transaction));
return Ok(Some(transaction.into()));
}

if let Some(transaction) = self
.authority_store
.perpetual_tables
.certificates
.synced_transactions
.get(digest)?
{
return Ok(Some(transaction.into()));
}

if let Some(transaction) = self
.authority_store
.epoch_store()
.get_pending_certificate(digest)?
{
return Ok(Some(transaction));
}

Ok(None)
}

Expand Down Expand Up @@ -146,8 +155,9 @@ impl WriteStore for RocksDbStore {

fn insert_transaction(&self, transaction: VerifiedCertificate) -> Result<(), Self::Error> {
self.authority_store
.epoch_store()
.insert_pending_certificates(&[transaction])
.perpetual_tables
.synced_transactions
.insert(transaction.digest(), transaction.serializable_ref())
}

fn insert_transaction_effects(
Expand Down

0 comments on commit 8e744d8

Please sign in to comment.