refactor: reuse calculated fees#1462
Conversation
8ca3036 to
c6e0942
Compare
c6e0942 to
ae5ca7b
Compare
|
Just looking at title it seems effort is similar to Tao's tx meta. |
ae5ca7b to
3ff403c
Compare
|
Cached One version of |
|
Epoch boundaries aren't relevant to this PR refactoring because the fee that this PR is reusing is calculated during transaction loading / execution in the SVM. Epoch boundaries are only relevant when scheduling transactions in banking stage. This PR doesn't change any behavior in the banking stage and so I don't think this will conflict at all with tx meta work that @tao-stones is working on |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1462 +/- ##
=======================================
Coverage 82.7% 82.7%
=======================================
Files 876 876
Lines 371118 371045 -73
=======================================
- Hits 307263 307212 -51
+ Misses 63855 63833 -22 |
3ff403c to
abe1f46
Compare
There was a problem hiding this comment.
Agree caching FeeDetails at LoadedTransaction makes a lot sense in this PR - bank is going to collect exact fee that account_loader calculated and validated against payer account. My early commit is due to the concern that dev could accidentally cache and reuse LoadedTransaction (at banking stage) cross epoch boundary, even it's not intentional. Perhaps that's overly concerned? Other than that, the PR looks great.
Yeah, I don't think it's a valid concern because basically nothing in |
|
automerge label removed due to a CI failure |
…nza-xyz#298, anza-xyz#356, anza-xyz#357) Original version written by Andrew Fitzgerald <apfitzge@gmail.com>. Current version rewritten to match the upstream scheduler code as of commit ef4f90f Author: Faycel Kouteib <faycel.kouteib@anza.xyz> Date: Wed Mar 26 16:29:14 2025 -0700 Run 'fetch-core-bpf.sh' from any directory (anza-xyz#5518) This also brings the invalidator logic closer to the upstream scheduler, as we are now changing the upstream Committer, rather than running our own copy. There is still a lot of code that was copied and modified. Maybe, eventually, we are going to reduce the copy/paste even more. Previous version: commit 8cd231e9c2435119f80d77ffcab164e3dc7e4cd2 Author: Andrew Fitzgerald <apfitzge@gmail.com> Date: Tue Sep 12 14:20:08 2023 -0700 Failed tx fastpath support (anza-xyz#133, anza-xyz#229, anza-xyz#356, anza-xyz#357) Includes: - replay: atomicbool instead of singleton for dropping packets (anza-xyz#224) commit db8607411b7016eb9a1f09dae07d9a9c375cac10 Author: kirill lykov <kirill.lykov@solana.com> Date: Thu Feb 8 10:52:48 2024 +0100 replay: atomicbool instead of singleton for dropping packets (anza-xyz#224) * use atomicbool instead of singleton to drop packets * add use for Ordering Co-authored-by: Illia Bobyr <ilya.bobyr@gmail.com> Signed-off-by: kirill lykov <lykov.kirill@gmail.com> * rename drop_packets --------- Signed-off-by: kirill lykov <lykov.kirill@gmail.com> Co-authored-by: Illia Bobyr <ilya.bobyr@gmail.com> - check_transactions in record_and_commit_batch (anza-xyz#229) - An update to the fee calculation due to commit 2cc540a Author: Justin Starry <justin@anza.xyz> Date: Wed May 29 15:41:47 2024 -0400 refactor: reuse calculated fees (anza-xyz#1462) - remove dead code (anza-xyz#298) commit c791d1c62f02b436d291744c88f122c51d80b4a8 Author: Brennan <brennan.watt@anza.xyz> Date: Fri Mar 22 06:45:29 2024 -0700 remove dead code (anza-xyz#298) - populate fee details (anza-xyz#357) commit 701e2cad0e9afc3911e1cbc06c849eda7b1ee5aa Author: Brennan <brennan.watt@anza.xyz> Date: Thu Jul 4 06:35:01 2024 -0700 populate fee details (anza-xyz#357) - adversary::failed_transaction_hotpath: Count only required singatures (anza-xyz#356) commit 7482b7976e968a645b6c9500d8c753b65b2acec5 Author: Illia Bobyr <illia.bobyr@anza.xyz> Date: Mon Jul 8 17:40:26 2024 -0700 adversary::failed_transaction_hotpath: Count only required singatures (anza-xyz#356) - adversary::failed_transaction_hotpath: Use solana_fee commit 0e9c9ab92909b677c8be6a6453af1dea96f81cc5 Author: Illia Bobyr <illia.bobyr@anza.xyz> Date: Tue Jul 30 03:04:27 2024 -0700 adversary::failed_transaction_hotpath: Use solana_fee Matching changes in commit 5604a4d Author: Andrew Fitzgerald <apfitzge@gmail.com> Date: Fri Jul 26 10:08:47 2024 -0400 Separate fee-calculation from SDK (anza-xyz#2120) anza-xyz#2120 Refactored-by: Illia Bobyr <illia.bobyr@anza.xyz>
Problem
Transaction fees are recalculated quite a few times in the transaction pipeline for no good reason
Summary of Changes
Store calculated fee details in
LoadedTransactionandTransactionExecutionDetailsso that fees don't need to be recalculated downstreamFixes #