-
Notifications
You must be signed in to change notification settings - Fork 678
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
runtime: validate transactions in parallel #12654
Conversation
74e1957
to
1062a13
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12654 +/- ##
==========================================
- Coverage 70.72% 70.72% -0.01%
==========================================
Files 848 848
Lines 174212 174303 +91
Branches 174212 174303 +91
==========================================
+ Hits 123219 123278 +59
- Misses 45850 45880 +30
- Partials 5143 5145 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
1062a13
to
17300fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an additional note, I think it might make sense to re-introduce a helper function that combines the validate_transaction
and verify_and_charge_transaction
so that the tests and the code that doesn't care about parallel validation of transactions doesn't need to change as much as it did.
All that said, all of this looks quite nice, I didn't see any fundamental issues with the approach taken here. Thank you for working on this :)
Transaction validation and cost computation have been decoupled from the verification process, streamlining optimizations. The new flow introduces `parallel_validate_transactions`, which validates transactions (without using the state) and calculates costs concurrently. The results are then passed to `verify_and_charge_transaction`, which now accepts a precomputed `TransactionCost` instead of recalculating it.
17300fa
to
222dda7
Compare
222dda7
to
453eaf2
Compare
In the old flow, validation (including signature checks) happened inside
verify_and_charge_transaction()
. In the new flow, we first runparallel_validate_transactions()
to validate and compute the transaction cost (including signature checks) in parallel. Only after a transaction passes validation do we callverify_and_charge_transaction()
with the knowncost
.(blue = running in parallel)
Testing
The change brings ~20% throughput improvement on
n2d-standard-16
1006/1006 blocks applied in 2m at a rate of 7.5129/s. 0s remaining. Skipped 0 blocks. Over last 100 blocks to height 1073: 0 empty blocks, averaging 413.00 Tgas per non-empty block
1007/1007 blocks applied in 2m at a rate of 8.9972/s. 0s remaining. Skipped 0 blocks. Over last 100 blocks to height 1073: 0 empty blocks, averaging 413.00 Tgas per non-empty block
Additionally, profiles before and after the change are available: before, after