Skip to content

Commit

Permalink
Only store cert signatures for certs handled by AuthorityServer (Myst…
Browse files Browse the repository at this point in the history
…enLabs#18417)

The main behavior change caused here is that we will no longer store
signatures of certificates that arrive via consensus. However, once a
certificate has been committed in consensus, there is little need for
quorum driver to be able to obtain a certificate via the `transaction`
API
  • Loading branch information
mystenmark authored and tx-tomcat committed Jul 29, 2024
1 parent 3ecaaa6 commit b04ea1e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 1 addition & 2 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1433,10 +1433,9 @@ impl AuthorityState {

// The insertion to epoch_store is not atomic with the insertion to the perpetual store. This is OK because
// we insert to the epoch store first. And during lookups we always look up in the perpetual store first.
epoch_store.insert_tx_cert_and_effects_signature(
epoch_store.insert_tx_key_and_effects_signature(
&tx_key,
tx_digest,
certificate.certificate_sig(),
effects_sig.as_ref(),
)?;

Expand Down
18 changes: 13 additions & 5 deletions crates/sui-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,18 +1152,26 @@ impl AuthorityPerEpochStore {
}

#[instrument(level = "trace", skip_all)]
pub fn insert_tx_cert_and_effects_signature(
pub fn insert_tx_cert_sig(
&self,
tx_digest: &TransactionDigest,
cert_sig: &AuthorityStrongQuorumSignInfo,
) -> SuiResult {
let tables = self.tables()?;
Ok(tables
.transaction_cert_signatures
.insert(tx_digest, cert_sig)?)
}

#[instrument(level = "trace", skip_all)]
pub fn insert_tx_key_and_effects_signature(
&self,
tx_key: &TransactionKey,
tx_digest: &TransactionDigest,
cert_sig: Option<&AuthorityStrongQuorumSignInfo>,
effects_signature: Option<&AuthoritySignInfo>,
) -> SuiResult {
let tables = self.tables()?;
let mut batch = self.tables()?.effects_signatures.batch();
if let Some(cert_sig) = cert_sig {
batch.insert_batch(&tables.transaction_cert_signatures, [(tx_digest, cert_sig)])?;
}

if self.executed_in_epoch_table_enabled() {
batch.insert_batch(&tables.executed_in_epoch, [(tx_digest, ())])?;
Expand Down
1 change: 1 addition & 0 deletions crates/sui-core/src/authority_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ impl ValidatorService {
.and_then(Result::ok);

let signed_effects = self.state.sign_effects(effects, epoch_store)?;
epoch_store.insert_tx_cert_sig(certificate.digest(), certificate.auth_sig())?;

Ok::<_, SuiError>(HandleCertificateResponseV3 {
effects: signed_effects.into_inner(),
Expand Down
3 changes: 1 addition & 2 deletions crates/sui-core/src/checkpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2762,10 +2762,9 @@ mod tests {
let effects = e(digest, dependencies, gas_used);
store.insert(digest, effects.clone());
epoch_store
.insert_tx_cert_and_effects_signature(
.insert_tx_key_and_effects_signature(
&TransactionKey::Digest(digest),
&digest,
None,
Some(&AuthoritySignInfo::new(
epoch_store.epoch(),
&effects,
Expand Down

0 comments on commit b04ea1e

Please sign in to comment.