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

[Execution] Add TransactionDeduper trait and implementation using (hash, signature) (#8367) #8458

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

bchocho
Copy link
Contributor

@bchocho bchocho commented May 31, 2023

Cherry-pick #8367. Expected to be a noop until onchain config is changed.

…sh, signature) (#8367)

### Description

Adding TransactionDeduper trait and an implementation. The dedup is done within a block, just before transaction shuffle. It's guarded by an onchain config.

The purpose is to not send duplicate transactions to execution. While execution correctness is not affected by duplicates (and other work removed false error logs that fired due to them), it's possible that duplicate transactions could hurt throughput of parallel execution. By deduping ahead of time, we don't have to worry about that.

The implementation finds duplicates by matching (raw txn bcs hash, signature). Because calculating hash can be relatively expensive, it is only done when a shallow match is found of (account, seq_no), and it's done in parallel.

Overhead (as seen on forge):
* When there are no duplicates, the dedup is negligible -- it takes ~2ms per second.
* When there are ~100 duplicates per block, the dedup takes ~10ms per second.

### Test Plan

Added unit tests.
@bchocho bchocho marked this pull request as ready for review May 31, 2023 23:57
@bchocho bchocho requested review from zekun000, davidiw and wrwg as code owners May 31, 2023 23:57
@bchocho bchocho merged commit 1865cc5 into aptos-release-v1.5 Jun 1, 2023
@bchocho bchocho deleted the brian/1.5-8367 branch June 1, 2023 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants