-
Notifications
You must be signed in to change notification settings - Fork 59
Add comments from Jon #28
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
Conversation
#### Problem P-token is getting ready to be used everywhere, but it hasn't been reviewed! #### Summary of changes Nothing show-stopping, mostly nits and cleanup ideas. Great work!
source_account.set_amount(updated_source_amount); | ||
|
||
// JC nit: I think we could safely unwrap this, but I'm not sure if | ||
// we get any real performance benefits |
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.
In that case, we could remove the checked
math, right?
// JC nit: up to you, but since you've already checked that | ||
// `lamports() < minimum_balance` earlier, you don't actually need | ||
// checked math. If it shaves CUs, go for it! But definitely add a | ||
// comment explaining why |
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.
Good point! Also we don't need to do the borrow_lamports_unchecked
, since we are not updating its value.
// `new_account_info` lamports are already checked to be greater than or equal
// to the minimum balance.
account.set_amount(new_account_info.lamports() - minimum_balance);
Problem
P-token is getting ready to be used everywhere, but it hasn't been reviewed!
Summary of changes
Nothing show-stopping, mostly nits and cleanup ideas. Great work! I also used some local crates so I could do some testing, so feel free to ignore all of that