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
21 changes: 11 additions & 10 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,9 @@ impl AuthorityState {
transaction: VerifiedTransaction,
epoch_store: &Arc<AuthorityPerEpochStore>,
) -> SuiResult<VerifiedSignedTransaction> {
// Ensure that validator cannot reconfigure while we are signing the tx
let _execution_lock = self.execution_lock_for_signing().await;

let tx_digest = transaction.digest();
let tx_data = transaction.data().transaction_data();

Expand Down Expand Up @@ -941,16 +944,6 @@ impl AuthorityState {
.start_timer();
self.metrics.tx_orders.inc();

// The should_accept_user_certs check here is best effort, because
// between a validator signs a tx and a cert is formed, the validator
// could close the window.
if !epoch_store
.get_reconfig_state_read_lock_guard()
.should_accept_user_certs()
{
return Err(SuiError::ValidatorHaltedAtEpochEnd);
}

let signed = self.handle_transaction_impl(transaction, epoch_store).await;
match signed {
Ok(s) => {
Expand Down Expand Up @@ -2885,6 +2878,14 @@ impl AuthorityState {
}
}

/// Acquires the execution lock for the duration of a transaction signing request.
/// This prevents reconfiguration from starting until we are finished handling the signing request.
/// Otherwise, in-memory lock state could be cleared (by `ObjectLocks::clear_cached_locks`)
/// while we are attempting to acquire locks for the transaction.
pub async fn execution_lock_for_signing(&self) -> ExecutionLockReadGuard {
self.execution_lock.read().await
}

pub async fn execution_lock_for_reconfiguration(&self) -> ExecutionLockWriteGuard {
self.execution_lock.write().await
}
Expand Down
Loading