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

Validate account locks on buffering #34229

Merged

Conversation

apfitzge
Copy link
Contributor

Problem

Prio-graph has an assumption that account locks are not duplicate - see crash #34221
prio-graph crate should be fixed, but these transactions are not valid and should be dropped as soon as reasonably possible.

Summary of Changes

  • Check for too many or duplicate locks during sanitization/buffering.
  • Add metric for number of txs discarded due to locks

Fixes #34221

@apfitzge apfitzge force-pushed the bugfix/scheduler_verify_account_locks branch from 5830094 to 78a66d3 Compare November 27, 2023 17:40
{
saturating_add_assign!(self.count_metrics.num_dropped_on_validate_locks, 1);
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps move this all the way up to ImmutableDeserializedPacket::new() or somewhere during packet receiving to drop bad packets before inserting into storage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done before we insert to storage.
We can't do it in ImmutableDeserializedPacket::new because we haven't resolved look up tables at that point.
This is immediately after we resolve look up tables, which I think is the earliest we can do this.

Potentially, it could/should be done in SanitizedTransaction::try_new but that's changing the definition of a SanitizedTransaction. Not sure we want to do that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I got confused by thread-local-MI and central-scheduler code. So this is somewhat parallel to unprocessed_transactino_storage::consume_scan_should_process_packet() where immmutable_deserialized_packet is sanitized then accounts locks checked, which should be OK then.

Leave SanitizedTransaction to solana-transaction-types crate :D, there maybe can add a type for "sanitized and account locks validated" type

Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

lgtm for now

Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Merging #34229 (78a66d3) into master (da9fad8) will increase coverage by 0.0%.
Report is 2 commits behind head on master.
The diff coverage is 87.5%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #34229   +/-   ##
=======================================
  Coverage    81.9%    81.9%           
=======================================
  Files         819      819           
  Lines      219304   219313    +9     
=======================================
+ Hits       179700   179721   +21     
+ Misses      39604    39592   -12     

@apfitzge apfitzge merged commit 005c825 into solana-labs:master Nov 27, 2023
32 checks passed
@apfitzge apfitzge deleted the bugfix/scheduler_verify_account_locks branch November 27, 2023 19:21
Copy link
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

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

Late to the party but Tao is more familiar with the code so think his review was more critical - thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

solBnkTxSched panic on canary node
3 participants