-
Notifications
You must be signed in to change notification settings - Fork 293
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
AccountLocks: validate_account_locks #2448
AccountLocks: validate_account_locks #2448
Conversation
See the final benchmark results (modified) below. Benchmark Results
|
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.
Not too sure about duplicating implementation, it might be necessary. These two functions can be in separate module, more like util of account_locks
, so it's easier to change. Not strong about it, up to you or other reviewers. Also, those two functions need test?
@@ -110,6 +114,48 @@ impl AccountLocks { | |||
} | |||
} | |||
|
|||
/// Validate account locks before locking. | |||
pub fn validate_account_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.
now we have duplicated implementations from SDK, not sure what is the best way to keep them synced in the future (in case there's more else if
to add, for example). Maybe add comments on both places?
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.
Now that you mention it - I should just deprecate the SDK one.
I moved it there at some point from bank
.
No reason it needs to be there any more, and I actually would like to guarantee we're not calling it elsewhere!
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.
ah nvm I just seperated the validate fn from get_account_locks
.
I think with the recent changes we don't actually use the get_account_locks
anymore (nor should we as it allocates). May need to deprecate that.
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.
There are several uses of the get_account_locks
and validate_account_locks
from SanitizedTransaction
.
With the code in this PR I can remove / transition those uses to this new code - but there are several uses across different modules, many requiring some changes to fn args - which complicates this PR
wdyt of this plan?
- merge this PR with duplciate logic (after I address your comments)
- create PRs to use new code where needed
- deprecate the
get_account_locks
and related fns (unsure if this has downstream effects)
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.
sounds good, maybe can deprecate sdk version sooner
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 - duplicated implementation in SDK will be deprecated.
Problem
SVMMessage
:SanitizedTransaction
Summary of Changes
account_locks::validate_account_locks
that takesAccountKeys
and limithas_duplicates
:AHashSet
O(n^2)
algorithmFixes #