-
Notifications
You must be signed in to change notification settings - Fork 14
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
Secp256k1 and Ed25519 native programs don't fail when a wrong signature is passed #27
Comments
Currently, I have no way to test that case with Bankrun. I found no workaround at all. |
Could you check if you have the same issue in Rust using solana-program-test? Need to identifiy which part of the stack the problem lives in |
I managed to reproduce this on Here's an example which you can run to see the transaction doesn't fail when it should. Could you confirm this is not working as expected? Logs:
|
Perhaps this is related: Could I be encoding something wrong? I noticed the message I'm signing is not hashed and also longer than a hash of it |
@GuidoDipietro how did you manage to run Ed25519SigVerify inside solana-program-test? which version did you use? upd: nevermind, already found your test case, reproduced it locally too |
For the record, I had to use regular test frameworks (i.e. standard Anchor way) to test this as it was impossible to determine if the sig verify was succeeding or not using Bankrun |
Some tests don't work as expected with Bankrun regarding Secp256k1 and Ed25519 signature verification.
Test case
sigIx
andcustomIx
sigIx
is either a Secp256k1 or Ed25519 instruction that validates a signaturecustomIx
is a custom program instruction that performs instruction introspection on the earlier to check theprogramId
,accounts
anddata
sigIx
; namely, a signatureS
and pubkeyP
, such that the private key associated toP
was NOT the signer of the messageM
, i.e. the signatureS
corresponds to a malicious signerP'
Expected result
customIx
checks thatsigIx
had the same message and pubkey as expected, the signature is invalid. For this reason, we expect thesigIx
to have failed, therefore rejecting the entire transaction.Reproducible result with RPC testing
Error
Transaction precompile verification failure InvalidAccountIndex
is raised.Apparently, this is what we get when the
sigIx
instruction fails.It seems that this is a known issue, but at least the transaction fails.
Reproducible result with Bankrun testing
The transactions succeeds.
See examples in this repository.
The text was updated successfully, but these errors were encountered: