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

[Perf] Greedily verify Executions before block generation #3451

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions node/bft/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ impl<N: Network> Worker<N> {
// All other combinations are clearly invalid.
_ => false,
};
// If the transmission is a deserialized execution, verify it immediately.
// This takes heavy transaction verification out of the hot path during block generation.
if let (TransmissionID::Transaction(tx_id, _), Transmission::Transaction(tx)) = (transmission_id, &transmission)
{
if let Data::Object(Transaction::Execute(..)) = tx {
let self_ = self.clone();
let tx_ = tx.clone();
tokio::spawn(async move {
let _ = self_.ledger.check_transaction_basic(tx_id, tx_).await;
});
}
}
// If the transmission ID and transmission type matches, then insert the transmission into the ready queue.
if is_well_formed && self.ready.insert(transmission_id, transmission) {
trace!(
Expand Down