Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consensus data quarantining #19886

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
35 changes: 24 additions & 11 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use move_binary_format::binary_config::BinaryConfig;
use move_binary_format::CompiledModule;
use move_core_types::annotated_value::MoveStructLayout;
use move_core_types::language_storage::ModuleId;
use mysten_common::fatal;
use mysten_metrics::{TX_TYPE_SHARED_OBJ_TX, TX_TYPE_SINGLE_WRITER_TX};
use parking_lot::Mutex;
use prometheus::{
Expand Down Expand Up @@ -1606,6 +1607,8 @@ impl AuthorityState {
.force_reload_system_packages(&BuiltInFramework::all_package_ids());
}

epoch_store.remove_shared_version_assignments(&tx_key);

// commit_certificate finished, the tx is fully committed to the store.
tx_guard.commit_tx();

Expand Down Expand Up @@ -3058,15 +3061,6 @@ impl AuthorityState {
.enqueue_certificates(certs, epoch_store)
}

pub(crate) fn enqueue_with_expected_effects_digest(
&self,
certs: Vec<(VerifiedExecutableTransaction, TransactionEffectsDigest)>,
epoch_store: &AuthorityPerEpochStore,
) {
self.transaction_manager
.enqueue_with_expected_effects_digest(certs, epoch_store)
}

fn create_owner_index_if_empty(
&self,
genesis_objects: &[Object],
Expand Down Expand Up @@ -3153,6 +3147,7 @@ impl AuthorityState {
epoch_start_configuration: EpochStartConfiguration,
accumulator: Arc<StateAccumulator>,
expensive_safety_check_config: &ExpensiveSafetyCheckConfig,
epoch_last_checkpoint: CheckpointSequenceNumber,
) -> SuiResult<Arc<AuthorityPerEpochStore>> {
Self::check_protocol_version(
supported_protocol_versions,
Expand Down Expand Up @@ -3209,6 +3204,7 @@ impl AuthorityState {
new_committee,
epoch_start_configuration,
expensive_safety_check_config,
epoch_last_checkpoint,
)
.await?;
assert_eq!(new_epoch_store.epoch(), new_epoch);
Expand Down Expand Up @@ -3239,6 +3235,12 @@ impl AuthorityState {
self.get_backing_package_store().clone(),
self.get_object_store().clone(),
&self.config.expensive_safety_check_config,
*self
.checkpoint_store
.get_epoch_last_checkpoint(epoch_store.epoch())
.unwrap()
.unwrap()
.sequence_number(),
);
let new_epoch = new_epoch_store.epoch();
self.transaction_manager.reconfigure(new_epoch);
Expand Down Expand Up @@ -5158,6 +5160,7 @@ impl AuthorityState {
new_committee: Committee,
epoch_start_configuration: EpochStartConfiguration,
expensive_safety_check_config: &ExpensiveSafetyCheckConfig,
epoch_last_checkpoint: CheckpointSequenceNumber,
) -> SuiResult<Arc<AuthorityPerEpochStore>> {
let new_epoch = new_committee.epoch;
info!(new_epoch = ?new_epoch, "re-opening AuthorityEpochTables for new epoch");
Expand All @@ -5174,6 +5177,7 @@ impl AuthorityState {
self.get_object_store().clone(),
expensive_safety_check_config,
cur_epoch_store.get_chain_identifier(),
epoch_last_checkpoint,
);
self.epoch_store.store(new_epoch_store.clone());
cur_epoch_store.epoch_terminated().await;
Expand Down Expand Up @@ -5275,6 +5279,15 @@ impl RandomnessRoundReceiver {
let transaction = VerifiedExecutableTransaction::new_system(transaction, epoch);
let digest = *transaction.digest();

// Randomness state updates contain the full bls signature for the random round,
// which cannot necessarily be reconstructed again later. Therefore we must immediately
// persist this transaction. If we crash before its outputs are committed, this
// ensures we will be able to re-execute it.
self.authority_state
.get_cache_commit()
.persist_transaction(&transaction)
.expect("failed to persist randomness state update transaction");

// Send transaction to TransactionManager for execution.
self.authority_state
.transaction_manager()
Expand Down Expand Up @@ -5315,9 +5328,9 @@ impl RandomnessRoundReceiver {
let mut effects = result.unwrap_or_else(|_| panic!("failed to get effects for randomness state update transaction at epoch {epoch}, round {round}"));
let effects = effects.pop().expect("should return effects");
if *effects.status() != ExecutionStatus::Success {
panic!("failed to execute randomness state update transaction at epoch {epoch}, round {round}: {effects:?}");
fatal!("failed to execute randomness state update transaction at epoch {epoch}, round {round}: {effects:?}");
}
debug!("successfully executed randomness state update transaction at epoch {epoch}, round {round}");
debug!("successfully executed randomness state update transaction at epoch {epoch}, round {round}: {effects:?}");
});
}
}
Expand Down
Loading
Loading