Skip to content

Commit

Permalink
[LocalExecution] Remove local execution loop from FN (#19032)
Browse files Browse the repository at this point in the history
## Description 

We are about to deprecate local execution. This PR gets rid of the loop
that subscribes effects from quorum driver and execute them locally.
This was an optimization and it should be safe to remove at this point.
Removing this also allows us to see clear metrics on the number of local
execution requests received from the network.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
lxfind authored and suiwombat committed Sep 16, 2024
1 parent 8f7c4b2 commit a610e93
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 a610e93

Please sign in to comment.