Skip to content

Conversation

joncinque
Copy link
Contributor

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

#### 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!
@joncinque joncinque requested a review from febo February 26, 2025 15:05
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
Copy link
Contributor

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
Copy link
Contributor

@febo febo Mar 5, 2025

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);

@febo febo mentioned this pull request Mar 5, 2025
@febo febo closed this in #32 Mar 10, 2025
@joncinque joncinque deleted the joncomments branch March 10, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants