-
Notifications
You must be signed in to change notification settings - Fork 52
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
test: More tests for approve
method of token program
#979
Conversation
Successful tests: - Delegating `u64::MAX`. Failing tests: 1. Invalid delegated compressed account Merkle tree. 2. Invalid change compressed account Merkle tree. 3. Invalid proof. 4. Invalid mint.
@@ -432,6 +435,226 @@ async fn test_delegation() { | |||
kill_prover(); | |||
} | |||
|
|||
#[tokio::test] | |||
#[ignore] |
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.
why ignore shouldn't this succeed?
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 actually doesn't suceed, trying to investigate why.
This assertion fails
assert_eq!(
transfer_recipient_token_compressed_account
.token_data
.delegate,
delegates[i]
);
To be precise, token_data.delegate
is None
. I'm trying to check if there is something in the instruction which prevents applying of the correct token_data
when the amount is zero.
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.
nvm, fixed here cc5dcda
proof: proof_rpc_result.proof.clone(), | ||
}; | ||
// NOTE(vadorovsky): Not sure what to do here! | ||
// For now, this instruction returns `ProofVerificationFailed`, which |
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.
mint pubkey is part of the token data hash.
The token data hash is part of the compressed account hash which is a public input for proof verification.
-> makes sense that the proof fails
why does it feel wrong?
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.
Right, we talked about it on 1on1. I was previously thinking that it'd be nice to have a dedicated error variant for that, but that'd be an overkill.
Removed the commend and added the assert.
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.
Yeah, it's not ideal that we don't have a dedicated error. To throw a dedicated error we would need to send more data unfortunately. We do that in the system program because instruction data is less of a constraint in cpis.
Search for the output token with precise `delegate` in `assert_compressed_token_accounts`. Otherwise, when multiple outputs have the same amount, it always picks the first one, even if the `delegate` doesn't match.
Successful tests:
u64::MAX
.Failing tests: