Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
solana: allow pools to specify writable accounts #419
solana: allow pools to specify writable accounts #419
Changes from 7 commits
f2f0a42
909f665
4f899a4
6087da7
5cea353
08d81c7
45ae033
a591676
b381e85
4eba5bd
874af96
4ffc3e1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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'm not sure I understand this check
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'll add some more comments - but it basically checks that the provided token pool account is (or is not) writable based on what's configured in the token admin registry (based on index)
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.
Nit: if you use
require_eq!
instead ofrequire!
, the logs will have more info in case the check fails.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.
What is this doing? Any of the accounts passed can be writable? Like the regular accounts and the additionals?
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.
correct, since these accounts are token pool specific, we need a way to know how to build the transaction offchain
this way provides an onchain record that admins can use to set which token pool accounts are writable
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.
nit: If we use
Pubkey::default()
it returns the same thing asPubkey::zeroed()
and can make you remove the dependency onbytemuck::Zeroable
hereThere 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.
Any chance you can link that
9
to a constant? It seems like that value is tied to logic in this file and inpools.rs
, so it'd be nice if the compiler can check both places stay consistent in case we ever change one of them.E.g., define a constant, use it here in the check, and use it in an explicit slice type in this line
Said constant could be taken outside of the versioned logic folders if we consider that part of our interface with TokenPools.
Also, if you use
require_gte!
instead ofrequire!
, the logs will print the actual length in case of error, which can help when troubleshooting failed tests for exampleThere 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.
Up to you whether to leave this here for now or not, but in general I'd rather have functions defined in the versioned logic modules instead of here.