-
Notifications
You must be signed in to change notification settings - Fork 35
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
[program] Account for the confidential transfer fee extension when re-allocating during configure account #172
Conversation
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.
It's nice when the change is so simple! Just a couple of comments on the tests
let alice_account_keypair = Keypair::new(); | ||
token | ||
.create_auxiliary_token_account_with_extension_space( | ||
&alice_account_keypair, | ||
&alice.pubkey(), | ||
vec![ExtensionType::ConfidentialTransferAccount], | ||
) | ||
.await | ||
.unwrap(); |
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.
Sorry if I'm being dense, but what is this for?
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.
Sorry, this is a little embarrassing, but I copied the test template from the test function in confidential_transfer.rs
and this logic is a relic from there. This logic is actually not needed even in confidential_transfer.rs
, so I removed this logic in both test files. Thanks for the catch.
let state = token.get_account_info(&alice_token_account).await.unwrap(); | ||
let extension = state | ||
.get_extension::<ConfidentialTransferAccount>() | ||
.unwrap(); | ||
assert!(bool::from(&extension.approved)); | ||
assert!(bool::from(&extension.allow_confidential_credits)); | ||
assert_eq!(extension.elgamal_pubkey, (*elgamal_keypair.pubkey()).into()); |
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.
Can you also check that the TransferFeeAmount
and ConfidentialTransferFeeAmount
extensions are present?
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.
Yes, done!
…` extensions are present
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, thanks!
Problem
When configuring a new confidential transfer account with
ConfigureAccountWithRegistry
, it does not reallocate space for the confidential transfer with fee even when the mint is extended for transfer fees.More details in #129.
Summary of Changes
I added logic that checks whether the account is extended for transfer fees. If it does, then the logic accounts for the confidential transfer fee extension when calculating the needed space the account.
A test for configuring accounts with registry when there are fees was missing, so I added it.
Fixes #129.