Skip to content

Commit

Permalink
[LocalExecution] Remove local execution loop from FN
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind committed Aug 20, 2024
1 parent 8a8c6b1 commit 6d9a8a4
Showing 1 changed file with 6 additions and 51 deletions.
57 changes: 6 additions & 51 deletions crates/sui-core/src/transaction_orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,15 @@ where
);

let effects_receiver = quorum_driver_handler.subscribe_to_effects();
let state_clone = validator_state.clone();
let metrics = Arc::new(TransactionOrchestratorMetrics::new(prometheus_registry));
let metrics_clone = metrics.clone();
let pending_tx_log = Arc::new(WritePathPendingTransactionLog::new(
parent_path.join("fullnode_pending_transactions"),
));
let pending_tx_log_clone = pending_tx_log.clone();
let _local_executor_handle = {
spawn_monitored_task!(async move {
Self::loop_execute_finalized_tx_locally(
state_clone,
effects_receiver,
pending_tx_log_clone,
metrics_clone,
)
.await;
Self::loop_execute_finalized_tx_locally(effects_receiver, pending_tx_log_clone)
.await;
})
};
Self::schedule_txes_in_log(pending_tx_log.clone(), quorum_driver_handler.clone());
Expand Down Expand Up @@ -428,57 +421,19 @@ where
}

async fn loop_execute_finalized_tx_locally(
validator_state: Arc<AuthorityState>,
mut effects_receiver: Receiver<QuorumDriverEffectsQueueResult>,
pending_transaction_log: Arc<WritePathPendingTransactionLog>,
metrics: Arc<TransactionOrchestratorMetrics>,
) {
loop {
match effects_receiver.recv().await {
Ok(Ok((transaction, QuorumDriverResponse { effects_cert, .. }))) => {
Ok(Ok((transaction, ..))) => {
let tx_digest = transaction.digest();
if let Err(err) = pending_transaction_log.finish_transaction(tx_digest) {
panic!(
"Failed to finish transaction {tx_digest} in pending transaction log: {err}"
error!(
?tx_digest,
"Failed to finish transaction in pending transaction log: {err}"
);
}

if transaction.contains_shared_object() {
// Do not locally execute transactions with shared objects, as this can
// cause forks until MVCC is merged.
continue;
}

let epoch_store = validator_state.load_epoch_store_one_call_per_task();

// This is a redundant verification, but SignatureVerifier will cache the
// previous result.
let transaction = match epoch_store.verify_transaction(transaction) {
Ok(transaction) => transaction,
Err(err) => {
// This should be impossible, since we verified the transaction
// before sending it to quorum driver.
error!(
?err,
"Transaction signature failed to verify after quorum driver execution."
);
continue;
}
};

let executable_tx = VerifiedExecutableTransaction::new_from_quorum_execution(
transaction,
effects_cert.executed_epoch(),
);

let _ = Self::execute_finalized_tx_locally_with_timeout(
&validator_state,
&epoch_store,
&executable_tx,
&effects_cert,
&metrics,
)
.await;
}
Ok(Err((tx_digest, _err))) => {
if let Err(err) = pending_transaction_log.finish_transaction(&tx_digest) {
Expand Down

0 comments on commit 6d9a8a4

Please sign in to comment.