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

feat: add TransactionSigned::recover_signers #4098

Merged
merged 3 commits into from
Aug 8, 2023
Merged

Conversation

joshieDo
Copy link
Collaborator

@joshieDo joshieDo commented Aug 7, 2023

Takes an iterator of TransactionSigned and uses rayon to recover the signers if the list is bigger than 10.

10 was kinda of an arbitrary value. I ran some tests locally using random_signed_tx and I got this on my machine:

5 transactions
[crates/interfaces/src/test_utils/generators.rs:476] stop.as_millis() = 2 # sequential
[crates/interfaces/src/test_utils/generators.rs:477] stop.as_micros() = 2234 # sequential
[crates/interfaces/src/test_utils/generators.rs:485] stop.as_millis() = 1 # rayon
[crates/interfaces/src/test_utils/generators.rs:486] stop.as_micros() = 1381 # rayon

10 transactions
[crates/interfaces/src/test_utils/generators.rs:476] stop.as_millis() = 4 # sequential
[crates/interfaces/src/test_utils/generators.rs:477] stop.as_micros() = 4378 # sequential
[crates/interfaces/src/test_utils/generators.rs:485] stop.as_millis() = 1 # rayon
[crates/interfaces/src/test_utils/generators.rs:486] stop.as_micros() = 1408 # rayon

50 transactions
[crates/interfaces/src/test_utils/generators.rs:476] stop.as_millis() = 21 # sequential
[crates/interfaces/src/test_utils/generators.rs:477] stop.as_micros() = 21463 # sequential
[crates/interfaces/src/test_utils/generators.rs:485] stop.as_millis() = 3 # rayon
[crates/interfaces/src/test_utils/generators.rs:486] stop.as_micros() = 3067 # rayon

100 transactions
[crates/interfaces/src/test_utils/generators.rs:476] stop.as_millis() = 43 # sequential
[crates/interfaces/src/test_utils/generators.rs:477] stop.as_micros() = 43153 # sequential
[crates/interfaces/src/test_utils/generators.rs:485] stop.as_millis() = 4 # rayon
[crates/interfaces/src/test_utils/generators.rs:486] stop.as_micros() = 4928 # rayon

500 transactions
[crates/interfaces/src/test_utils/generators.rs:476] stop.as_millis() = 215 # sequential
[crates/interfaces/src/test_utils/generators.rs:477] stop.as_micros() = 215356 # sequential
[crates/interfaces/src/test_utils/generators.rs:485] stop.as_millis() = 19 # rayon
[crates/interfaces/src/test_utils/generators.rs:486] stop.as_micros() = 19746 # rayon

@joshieDo joshieDo added C-enhancement New feature or request C-benchmark A change that impacts how or what we benchmark labels Aug 7, 2023
@codecov
Copy link

codecov bot commented Aug 7, 2023

Codecov Report

Merging #4098 (6a1e77b) into main (aaf2d2c) will decrease coverage by 0.15%.
Report is 12 commits behind head on main.
The diff coverage is 83.33%.

Impacted file tree graph

Files Changed Coverage Δ
crates/consensus/auto-seal/src/lib.rs 0.00% <0.00%> (ø)
crates/primitives/src/transaction/mod.rs 83.08% <85.71%> (+0.33%) ⬆️
crates/primitives/src/block.rs 77.41% <100.00%> (ø)
crates/revm/src/executor.rs 90.72% <100.00%> (-0.03%) ⬇️
...torage/provider/src/providers/database/provider.rs 79.54% <100.00%> (-0.06%) ⬇️

... and 44 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.50% <0.00%> (+<0.01%) ⬆️
unit-tests 63.89% <83.33%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 25.36% <ø> (-0.15%) ⬇️
blockchain tree 83.04% <ø> (ø)
pipeline 90.07% <ø> (ø)
storage (db) 74.58% <100.00%> (+0.02%) ⬆️
trie 94.71% <ø> (+<0.01%) ⬆️
txpool 47.59% <ø> (-0.78%) ⬇️
networking 77.35% <ø> (-0.09%) ⬇️
rpc 57.49% <ø> (+0.04%) ⬆️
consensus 63.80% <0.00%> (-0.28%) ⬇️
revm 32.21% <100.00%> (-0.33%) ⬇️
payload builder 6.57% <ø> (-0.02%) ⬇️
primitives 87.78% <87.50%> (-0.24%) ⬇️

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, one nit

num_txes: usize,
) -> Option<Vec<Address>> {
// Arbitrary value.
let threshold = 10;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be a const, we can add a note here the we expect a speedup > 10

@mattsse mattsse enabled auto-merge August 8, 2023 09:45
@mattsse mattsse added this pull request to the merge queue Aug 8, 2023
Merged via the queue into main with commit 4b0b637 Aug 8, 2023
25 checks passed
@mattsse mattsse deleted the joshie/par-recovery branch August 8, 2023 10:03
mattsse added a commit that referenced this pull request Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-benchmark A change that impacts how or what we benchmark C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants