Skip to content

Commit a5659d8

Browse files
mmsqeAlex | Interchain Labs
andauthored
fix: unrecognized/unsupported public key type: *secp256k1.PubKey for multisign (#288)
* Revert "Fix keyring options in add command (#196)" This reverts commit 4f9b8c2. * allow unsupported public key type when send from old multisign addr * Revert "Fix keyring options in add command (#196)" This reverts commit 4f9b8c2. * resolve multisign --------- Co-authored-by: Alex | Interchain Labs <[email protected]>
1 parent 8fb90ba commit a5659d8

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

ante/sigverify.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
storetypes "cosmossdk.io/store/types"
1010

1111
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
12+
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
1213
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
1314
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
1415
"github.com/cosmos/cosmos-sdk/types/tx/signing"
@@ -29,6 +30,8 @@ const (
2930
//
3031
// - ethsecp256k1 (Ethereum keys)
3132
//
33+
// - secp256k1 (Cosmos keys)
34+
//
3235
// - ed25519 (Validators)
3336
//
3437
// - multisig (Cosmos SDK multisigs)
@@ -42,6 +45,10 @@ func SigVerificationGasConsumer(
4245
// Ethereum keys
4346
meter.ConsumeGas(Secp256k1VerifyCost, "ante verify: eth_secp256k1")
4447
return nil
48+
case *secp256k1.PubKey:
49+
// Cosmos keys
50+
meter.ConsumeGas(params.SigVerifyCostSecp256k1, "ante verify: secp256k1")
51+
return nil
4552
case *ed25519.PubKey:
4653
// Validator keys
4754
meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519")

ante/sigverify_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestConsumeSignatureVerificationGas(t *testing.T) {
7676
"PubKeySecp256k1",
7777
args{storetypes.NewInfiniteGasMeter(), nil, secp256k1.GenPrivKey().PubKey(), params},
7878
p.SigVerifyCostSecp256k1,
79-
true,
79+
false,
8080
},
8181
{
8282
"PubKeySecp256r1",

client/keys.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
clientkeys "github.com/cosmos/evm/client/keys"
1111
"github.com/cosmos/evm/crypto/hd"
12-
cosmosevmkeyring "github.com/cosmos/evm/crypto/keyring"
1312

1413
"github.com/cosmos/cosmos-sdk/client"
1514
"github.com/cosmos/cosmos-sdk/client/flags"
@@ -92,7 +91,7 @@ The pass backend requires GnuPG: https://gnupg.org/
9291
}
9392

9493
func runAddCmd(cmd *cobra.Command, args []string) error {
95-
clientCtx := client.GetClientContextFromCmd(cmd).WithKeyringOptions(cosmosevmkeyring.Option())
94+
clientCtx := client.GetClientContextFromCmd(cmd).WithKeyringOptions(hd.EthSecp256k1Option())
9695
clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags())
9796
if err != nil {
9897
return err

0 commit comments

Comments
 (0)