-
Notifications
You must be signed in to change notification settings - Fork 720
Bump spl-token-2022
crate version from 6.0.0 to 7.0.0
#4571
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
Bump spl-token-2022
crate version from 6.0.0 to 7.0.0
#4571
Conversation
603e2c3
to
8cbd108
Compare
I'm not aware of the usages of floating points in scaled-ui. Comparing floating points directly (even if you convert them to strings) is problematic, since floating points carry rounding errors with them. Depending on the context, you can define an epsilon for comparison, provided that you know the range these numbers will assume. Have a look at: https://floating-point-gui.de/errors/comparison/ |
c03ab62
to
609b227
Compare
@LucasSte I believe that the float values are not actually compared as numbers with |
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.
Looks great! Just a question on using a string in instruction data
info: json!({ | ||
"mint": account_keys[account_indexes[0] as usize].to_string(), | ||
"authority": authority.map(|pubkey| pubkey.to_string()), | ||
"multiplier": f64::from(multiplier), |
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.
This is using a string elsewhere -- do you want to follow that same convention here?
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. Updated!
})?; | ||
let mut value = json!({ | ||
"mint": account_keys[account_indexes[0] as usize].to_string(), | ||
"newMultiplier": f64::from(multiplier), |
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.
Same here, string?
That's correct, these numbers are not used for any logic, just for calculating a UI representation of the token amount. I think String makes the most sense |
Is leaving them out of the comparison an option? I'm afraid a comparison may error out for a silly rounding error. |
You mean the checks like this one in the test?
Yeah sure, we could change the check to |
Yeah I think I updated the tests to use I think ideally, we would want the |
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.
Looks good to me, but I'll let @LucasSte give the final approval
Problem
The
spl-token-2022
crate version is still at 6.0.0 while 7.0.0 is out.Summary of Changes
Updated the
spl-token-2022
crate version to 7.0.0. The main logic changes are the following:account-decoder
.f64
multiplier as aString
here sincef64
does not implement theEq
trait. Please let me know if there is an alternate preferred method to handlef64
values.transaction-status
. This should be pretty straightfowrad.transaction-status
tests to account for the updated instruction syntax ([program-2022] Make confidential mint/burn function parameters consistent solana-labs/solana-program-library#7570). This should also be pretty straightforward.account-decoder
to account for the changes in token-2022: Take decimals into account for UI amount solana-labs/solana-program-library#7540.I will need to update the RPC as done in #1549, but this will require additional tests, so I decided to defer to an immediate follow-up PR and just focus on the token version bump here. Let me know if you prefer to add the RPC logic changes in this PR.
Fixes #