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

PrioGraphScheduler::complete_batch remove TransactionAccountLocks allocation #1759

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,18 @@ impl PrioGraphScheduler {
) {
let thread_id = self.in_flight_tracker.complete_batch(batch_id);
for transaction in transactions {
let account_locks = transaction.get_account_locks_unchecked();
self.account_locks.unlock_accounts(
account_locks.writable.into_iter(),
account_locks.readonly.into_iter(),
thread_id,
);
let message = transaction.message();
let account_keys = message.account_keys();
let write_account_locks = account_keys
.iter()
.enumerate()
.filter_map(|(index, key)| message.is_writable(index).then_some(key));
let read_account_locks = account_keys
.iter()
.enumerate()
.filter_map(|(index, key)| (!message.is_writable(index)).then_some(key));
Comment on lines +363 to +370
Copy link
Member

Choose a reason for hiding this comment

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

nit: can these useful method be defined on SanitizedMesssage or SanitizedTransaction?

Copy link
Author

Choose a reason for hiding this comment

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

Thought about it, but I'm generally against adding more stuff into SDK. Could probably define a function in this file.

In my experimental branch I do have this defined as member fn of the generic tx trait.

Copy link
Member

@ryoqun ryoqun Jun 18, 2024

Choose a reason for hiding this comment

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

okay, thanks for explaining. mine isn't strong opinion.

happy to see this pr merged as-is. :)

self.account_locks
.unlock_accounts(write_account_locks, read_account_locks, thread_id);
}
}

Expand Down