-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
earlier fee payer validation #34666
earlier fee payer validation #34666
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #34666 +/- ##
=======================================
Coverage 81.8% 81.8%
=======================================
Files 824 824
Lines 222717 222742 +25
=======================================
+ Hits 182287 182380 +93
+ Misses 40430 40362 -68 |
daf0209
to
6aa6146
Compare
@@ -684,6 +709,39 @@ impl Consumer { | |||
} | |||
} | |||
|
|||
pub fn check_fee_payer_unlocked( |
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.
put this into a separate fn because I actually will be doing same operation in the new scheduler (#34699)
@@ -177,12 +180,31 @@ fn consume_scan_should_process_packet( | |||
return ProcessingDecision::Never; | |||
} | |||
|
|||
if !payload.account_locks.check_locks(message) { |
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.
did a separate check_locks
, then take_locks
so that we will not check fee-payers that we know can't even be in this batch.
@@ -177,6 +180,26 @@ fn consume_scan_should_process_packet( | |||
return ProcessingDecision::Never; | |||
} | |||
|
|||
// Only check fee-payer if we can actually take locks |
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.
renewed hatred for all the edge-cases of MI 😭
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.
r+ @taozhu-chicago's review. ping me if he doesn't get to it before you're unavailable tomorrow and i'll approve
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.
the functions make sense to me, my comments are mainly concerns of execution time, which can be monitored with additional metrics. Ok to merge it now, add metrics later.
let mut error_counters = TransactionErrorMetrics::default(); | ||
let pre_results = vec![Ok(()); txs.len()]; | ||
let check_results = | ||
bank.check_transactions(txs, &pre_results, MAX_PROCESSING_AGE, &mut error_counters); |
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.
It'd potentially submit more transactions to bank for checking, which read-locks status_cache. Might be useful to add elapse metrics for this call, perhaps in separate PR.
core/src/banking_stage/consumer.rs
Outdated
|
||
let check_results = check_results | ||
.into_iter() | ||
.zip(txs) |
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.
is zip(txs)
needed?
process_compute_budget_instructions(message.program_instructions_iter())?.into(); | ||
let fee = bank.fee_structure.calculate_fee( | ||
message, | ||
bank.get_lamports_per_signature(), |
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.
I noted early it should fetch lamports_per_signature
for durable transactions from nonce account. Then @t-nelson just clarified that durable transaction's fee is calculated based on fee rate at execution. So this should be just fine.
@@ -684,6 +709,39 @@ impl Consumer { | |||
} | |||
} | |||
|
|||
pub fn check_fee_payer_unlocked( |
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.
A lot of lifting in this function, the saving is remove bad transactions upfront, and warms up good transactions' payer accounts, the extra time spent here is still a concern, especially if a lot of transactions going through this check. Can we add another metrics to monitor it?
core/src/banking_stage/consumer.rs
Outdated
bank.transfer(5_000, &genesis_config_info.mint_keypair, &keypair.pubkey()) | ||
.unwrap(); | ||
bank.transfer( | ||
100_000, |
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.
why change from 5_000
to 100_000
?
@taozhu-chicago pushed minor fix to undo unintended change on the funding, and remove .zip(txs). Will add metrics in a follow-up PR. |
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.
lgtm
Problem
Summary of Changes
I made a patched bench-tps to spam 60% invalid fee-paying txs. Saw degraded perf on master, much better perf with this change:
bench-tps patch/hack: invalid-transfer-generation.patch
Blocked by #34652
Fixes #