Created
July 23, 2024 12:33
-
-
Save assafmo/a5f11630a6ae5b11a903738fc1f120f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestVerifySignature(t *testing.T) { | |
txBytes := []byte{ | |
10, 234, 1, 10, 131, /// ... | |
} | |
cdc := MakeEncodingConfig() | |
var tx sdktx.Tx | |
err := cdc.Codec.Unmarshal(txBytes, &tx) | |
require.NoError(t, err) | |
var pubkey secp256k1.PubKey | |
err = cdc.Codec.Unmarshal(tx.AuthInfo.SignerInfos[0].PublicKey.Value, &pubkey) | |
require.NoError(t, err) | |
authTx := authtx.WrapTx(&tx).GetTx() | |
sigTx, ok := authTx.(authsigning.SigVerifiableTx) | |
require.Equal(t, true, ok) | |
sigs, err := sigTx.GetSignaturesV2() | |
require.NoError(t, err) | |
signerData := authsigning.SignerData{ | |
ChainID: "banana-1", | |
AccountNumber: 123456, | |
Sequence: 69, | |
} | |
err = ante.VerifySignature(&pubkey, signerData, sigs[0].Data, nil, authTx) | |
require.NoError(t, err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment