diff --git a/libs/cosmos-sdk/x/auth/ibc-tx/decoder.go b/libs/cosmos-sdk/x/auth/ibc-tx/decoder.go index 2b7ebf2ee9..b38c1a0b4b 100644 --- a/libs/cosmos-sdk/x/auth/ibc-tx/decoder.go +++ b/libs/cosmos-sdk/x/auth/ibc-tx/decoder.go @@ -2,6 +2,7 @@ package ibc_tx import ( "fmt" + "github.com/okex/exchain/libs/cosmos-sdk/codec" "github.com/okex/exchain/libs/cosmos-sdk/codec/unknownproto" "github.com/okex/exchain/libs/cosmos-sdk/crypto/types" @@ -10,6 +11,7 @@ import ( "github.com/okex/exchain/libs/cosmos-sdk/types/tx/signing" "github.com/okex/exchain/libs/cosmos-sdk/x/auth/ibc-tx/internal/adapter" "google.golang.org/protobuf/encoding/protowire" + //"github.com/okex/exchain/libs/cosmos-sdk/codec/unknownproto" sdk "github.com/okex/exchain/libs/cosmos-sdk/types" @@ -166,11 +168,20 @@ func constructMsgs(ibcTx *tx.Tx) ([]sdk.Msg, []sdk.Msg, error) { } func convertSignature(ibcTx *tx.Tx) []authtypes.StdSignature { - signatures := []authtypes.StdSignature{} + ret := make([]authtypes.StdSignature, len(ibcTx.Signatures)) + for i, s := range ibcTx.Signatures { var pkData types.PubKey if ibcTx.AuthInfo.SignerInfos != nil { var ok bool + if ibcTx.AuthInfo.SignerInfos[i].PublicKey == nil { + // maybe it is a simulate request + ret[i] = authtypes.StdSignature{ + Signature: s, + PubKey: nil, + } + continue + } pkData, ok = ibcTx.AuthInfo.SignerInfos[i].PublicKey.GetCachedValue().(types.PubKey) if !ok { return []authtypes.StdSignature{} @@ -181,14 +192,13 @@ func convertSignature(ibcTx *tx.Tx) []authtypes.StdSignature { return []authtypes.StdSignature{} } - signatures = append(signatures, - authtypes.StdSignature{ - Signature: s, - PubKey: pubKey, - }, - ) + ret[i] = authtypes.StdSignature{ + Signature: s, + PubKey: pubKey, + } } - return signatures + + return ret } func convertFee(authInfo tx.AuthInfo) (authtypes.StdFee, authtypes.IbcFee, string, error) {