Proto Tx with Any (#7276)
* WIP on protobuf keys * Use Type() and Bytes() in sr25519 pub key Equals * Add tests * Add few more tests * Update other pub/priv key types Equals * Fix PrivKey's Sign method * Rename variables in tests * Fix infinite recursive calls * Use tm ed25519 keys * Add Sign and VerifySignature tests * Remove ed25519 and sr25519 references * proto linting * Add proto crypto file * Implement some of the new multisig proto type methods * Add tests for MultisigThresholdPubKey * Add tests for pubkey pb/amino conversion functions * Move crypto types.go and register new proto pubkeys * Add missing pointer ref * Address review comments * panic in MultisigThresholdPubKey VerifySignature * Use internal crypto.PubKey in multisig * Add tests for MultisigThresholdPubKey VerifyMultisignature * Only keep LegacyAminoMultisigThresholdPubKey and move to proto keys to v1 * Remove conversion functions and introduce internal PubKey type * Override Amino marshaling for proto pubkeys * Merge master * Make proto-gen * Start removal of old PubKeyMultisigThreshold references * Fix tests * Fix solomachine * Fix ante handler tests * Pull latest go-amino * Remove ed25519 * Remove old secp256k1 PubKey and PrivKey * Uncomment test case * Fix linting issues * More linting * Revert tests keys values * Add Amino overrides to proto keys * Add pubkey test * Fix tests * Use threshold isntead of K * Standardize Type * Revert standardize types commit * Fix build * Fix lint * Fix lint * Add comment * Register crypto.PubKey * Add empty key in BuildSimTx * Simplify proto names * Unpack interfaces for signing desc * Fix IBC tests? * Format proto * Use secp256k1 in ibc * Fixed merge issues * Uncomment tests * Update x/ibc/testing/solomachine.go * UnpackInterfaces for solomachine types * Remove old multisig * Add amino marshal for multisig * Fix lint * Correctly register amino * One test left! * Remove old struct * Fix test * Fix test * Unpack into tmcrypto * Remove old threshold pubkey tests * Fix register amino * Fix lint * Use sdk crypto PubKey in multisig UnpackInterfaces * Potential fix? * Register LegacyAminoPubKey * Register our own PubKey * Register tmcrypto PubKey * Register both PubKeys * Register interfaces in test * Refactor fiels * Add comments * Use anil's suggestion * Add norace back * Check nil * Address comments * FIx lint * Add tests for solomachine unpack interfaces * Fix query tx by hash * Better name in amino register * Display StdTx instead of proto Tx * Remove useless check Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com> Co-authored-by: blushi <marie.gauthier63@gmail.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
This commit is contained in:
parent
535510be1f
commit
7cd25abb87
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client/grpc/reflection"
|
||||
"github.com/cosmos/cosmos-sdk/client/grpc/simulate"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
|
@ -116,10 +115,9 @@ func (qrt *GRPCQueryRouter) SetInterfaceRegistry(interfaceRegistry codectypes.In
|
|||
func (qrt *GRPCQueryRouter) RegisterSimulateService(
|
||||
simulateFn simulate.BaseAppSimulateFn,
|
||||
interfaceRegistry codectypes.InterfaceRegistry,
|
||||
pubkeyCodec cryptotypes.PublicKeyCodec,
|
||||
) {
|
||||
simulate.RegisterSimulateServiceServer(
|
||||
qrt,
|
||||
simulate.NewSimulateServer(simulateFn, interfaceRegistry, pubkeyCodec),
|
||||
simulate.NewSimulateServer(simulateFn, interfaceRegistry),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -4,10 +4,9 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"google.golang.org/grpc/status"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
)
|
||||
|
@ -18,15 +17,13 @@ type BaseAppSimulateFn func(txBytes []byte, txtypes sdk.Tx) (sdk.GasInfo, *sdk.R
|
|||
type simulateServer struct {
|
||||
simulate BaseAppSimulateFn
|
||||
interfaceRegistry codectypes.InterfaceRegistry
|
||||
pubkeyCodec cryptotypes.PublicKeyCodec
|
||||
}
|
||||
|
||||
// NewSimulateServer creates a new SimulateServer.
|
||||
func NewSimulateServer(simulate BaseAppSimulateFn, interfaceRegistry codectypes.InterfaceRegistry, pubkeyCodec cryptotypes.PublicKeyCodec) SimulateServiceServer {
|
||||
func NewSimulateServer(simulate BaseAppSimulateFn, interfaceRegistry codectypes.InterfaceRegistry) SimulateServiceServer {
|
||||
return simulateServer{
|
||||
simulate: simulate,
|
||||
interfaceRegistry: interfaceRegistry,
|
||||
pubkeyCodec: pubkeyCodec,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +39,7 @@ func (s simulateServer) Simulate(ctx context.Context, req *SimulateRequest) (*Si
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
txBuilder := authtx.WrapTx(req.Tx, s.pubkeyCodec)
|
||||
txBuilder := authtx.WrapTx(req.Tx)
|
||||
txBytes, err := req.Tx.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
|
@ -41,11 +40,10 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
|||
|
||||
// Set up TxConfig.
|
||||
encodingConfig := simapp.MakeEncodingConfig()
|
||||
pubKeyCodec := std.DefaultPublicKeyCodec{}
|
||||
clientCtx := client.Context{}.WithTxConfig(encodingConfig.TxConfig)
|
||||
|
||||
// Create new simulation server.
|
||||
srv := simulate.NewSimulateServer(app.BaseApp.Simulate, encodingConfig.InterfaceRegistry, pubKeyCodec)
|
||||
srv := simulate.NewSimulateServer(app.BaseApp.Simulate, encodingConfig.InterfaceRegistry)
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(sdkCtx, app.InterfaceRegistry())
|
||||
simulate.RegisterSimulateServiceServer(queryHelper, srv)
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/simapp/params"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
signing2 "github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
|
@ -60,7 +59,7 @@ type TestSuite struct {
|
|||
func (s *TestSuite) SetupSuite() {
|
||||
encCfg := simapp.MakeEncodingConfig()
|
||||
s.encCfg = encCfg
|
||||
s.protoCfg = tx.NewTxConfig(codec.NewProtoCodec(encCfg.InterfaceRegistry), std.DefaultPublicKeyCodec{}, tx.DefaultSignModes)
|
||||
s.protoCfg = tx.NewTxConfig(codec.NewProtoCodec(encCfg.InterfaceRegistry), tx.DefaultSignModes)
|
||||
s.aminoCfg = types3.StdTxConfig{Cdc: encCfg.Amino}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
sim "github.com/cosmos/cosmos-sdk/client/grpc/simulate"
|
||||
"github.com/cosmos/cosmos-sdk/client/input"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
|
@ -257,6 +258,7 @@ func BuildSimTx(txf Factory, msgs ...sdk.Msg) ([]byte, error) {
|
|||
// Create an empty signature literal as the ante handler will populate with a
|
||||
// sentinel pubkey.
|
||||
sig := signing.SignatureV2{
|
||||
PubKey: &secp256k1.PubKey{},
|
||||
Data: &signing.SingleSignatureData{
|
||||
SignMode: txf.signMode,
|
||||
},
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package codec
|
||||
|
||||
import (
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
)
|
||||
|
||||
// RegisterInterfaces registers the sdk.Tx interface.
|
||||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||
// TODO We now register both Tendermint's PubKey and our own PubKey. In the
|
||||
// long-term, we should move away from Tendermint's PubKey, and delete
|
||||
// these lines
|
||||
registry.RegisterInterface("tendermint.crypto.Pubkey", (*tmcrypto.PubKey)(nil))
|
||||
registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &secp256k1.PubKey{})
|
||||
registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &multisig.LegacyAminoPubKey{})
|
||||
|
||||
registry.RegisterInterface("cosmos.crypto.Pubkey", (*cryptotypes.PubKey)(nil))
|
||||
registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{})
|
||||
registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &multisig.LegacyAminoPubKey{})
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
// PublicKeyCodec defines a type which can encode and decode crypto.PubKey's
|
||||
// to and from protobuf PublicKey's
|
||||
type PublicKeyCodec interface {
|
||||
// Encode encodes the crypto.PubKey as a protobuf PublicKey or returns an error
|
||||
Encode(key crypto.PubKey) (*PublicKey, error)
|
||||
|
||||
// Decode decodes a crypto.PubKey from a protobuf PublicKey or returns an error
|
||||
Decode(key *PublicKey) (crypto.PubKey, error)
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
## Status
|
||||
|
||||
Proposed
|
||||
Accepted
|
||||
|
||||
## Context
|
||||
|
||||
|
@ -103,7 +103,7 @@ message AuthInfo {
|
|||
message SignerInfo {
|
||||
// The public key is optional for accounts that already exist in state. If unset, the
|
||||
// verifier can use the required signer address for this position and lookup the public key.
|
||||
PublicKey public_key = 1;
|
||||
google.protobuf.Any public_key = 1;
|
||||
// ModeInfo describes the signing mode of the signer and is a nested
|
||||
// structure to support nested multisig pubkey's
|
||||
ModeInfo mode_info = 2;
|
||||
|
|
|
@ -2,6 +2,7 @@ syntax = "proto3";
|
|||
package cosmos.tx.signing.v1beta1;
|
||||
|
||||
import "cosmos/base/crypto/v1beta1/crypto.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/types/tx/signing";
|
||||
|
||||
|
@ -33,43 +34,43 @@ message SignatureDescriptors {
|
|||
// signature including the public key of the signer, signing modes and the signature
|
||||
// itself. It is primarily used for coordinating signatures between clients.
|
||||
message SignatureDescriptor {
|
||||
// public_key is the public key of the signer
|
||||
cosmos.base.crypto.v1beta1.PublicKey public_key = 1;
|
||||
// public_key is the public key of the signer
|
||||
google.protobuf.Any public_key = 1;
|
||||
|
||||
Data data = 2;
|
||||
Data data = 2;
|
||||
|
||||
// sequence is the sequence of the account, which describes the
|
||||
// number of committed transactions signed by a given address. It is used to prevent
|
||||
// replay attacks.
|
||||
uint64 sequence = 3;
|
||||
// sequence is the sequence of the account, which describes the
|
||||
// number of committed transactions signed by a given address. It is used to prevent
|
||||
// replay attacks.
|
||||
uint64 sequence = 3;
|
||||
|
||||
// Data represents signature data
|
||||
message Data {
|
||||
// sum is the oneof that specifies whether this represents single or multi-signature data
|
||||
oneof sum {
|
||||
// single represents a single signer
|
||||
Single single = 1;
|
||||
// Data represents signature data
|
||||
message Data {
|
||||
// sum is the oneof that specifies whether this represents single or multi-signature data
|
||||
oneof sum {
|
||||
// single represents a single signer
|
||||
Single single = 1;
|
||||
|
||||
// multi represents a multisig signer
|
||||
Multi multi = 2;
|
||||
// multi represents a multisig signer
|
||||
Multi multi = 2;
|
||||
}
|
||||
|
||||
// Single is the signature data for a single signer
|
||||
message Single {
|
||||
// mode is the signing mode of the single signer
|
||||
SignMode mode = 1;
|
||||
|
||||
// signature is the raw signature bytes
|
||||
bytes signature = 2;
|
||||
}
|
||||
|
||||
// Multi is the signature data for a multisig public key
|
||||
message Multi {
|
||||
// bitarray specifies which keys within the multisig are signing
|
||||
cosmos.base.crypto.v1beta1.CompactBitArray bitarray = 1;
|
||||
|
||||
// signatures is the signatures of the multi-signature
|
||||
repeated Data signatures = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Single is the signature data for a single signer
|
||||
message Single {
|
||||
// mode is the signing mode of the single signer
|
||||
SignMode mode = 1;
|
||||
|
||||
// signature is the raw signature bytes
|
||||
bytes signature = 2;
|
||||
}
|
||||
|
||||
// Multi is the signature data for a multisig public key
|
||||
message Multi {
|
||||
// bitarray specifies which keys within the multisig are signing
|
||||
cosmos.base.crypto.v1beta1.CompactBitArray bitarray = 1;
|
||||
|
||||
// signatures is the signatures of the multi-signature
|
||||
repeated Data signatures = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ message SignerInfo {
|
|||
// public_key is the public key of the signer. It is optional for accounts
|
||||
// that already exist in state. If unset, the verifier can use the required \
|
||||
// signer address for this position and lookup the public key.
|
||||
cosmos.base.crypto.v1beta1.PublicKey public_key = 1;
|
||||
google.protobuf.Any public_key = 1;
|
||||
|
||||
// mode_info describes the signing mode of the signer and is a nested
|
||||
// structure to support nested multisig pubkey's
|
||||
|
|
|
@ -28,7 +28,7 @@ message ClientState {
|
|||
message ConsensusState {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
// public key of the solo machine
|
||||
cosmos.base.crypto.v1beta1.PublicKey public_key = 1 [(gogoproto.moretags) = "yaml:\"public_key\""];
|
||||
google.protobuf.Any public_key = 1 [(gogoproto.moretags) = "yaml:\"public_key\""];
|
||||
// diversifier allows the same public key to be re-used across different solo machine clients
|
||||
// (potentially on different chains) without being considered misbehaviour.
|
||||
string diversifier = 2;
|
||||
|
@ -42,7 +42,7 @@ message Header {
|
|||
uint64 sequence = 1;
|
||||
uint64 timestamp = 2;
|
||||
bytes signature = 3;
|
||||
cosmos.base.crypto.v1beta1.PublicKey new_public_key = 4 [(gogoproto.moretags) = "yaml:\"new_public_key\""];
|
||||
google.protobuf.Any new_public_key = 4 [(gogoproto.moretags) = "yaml:\"new_public_key\""];
|
||||
string new_diversifier = 5 [(gogoproto.moretags) = "yaml:\"new_diversifier\""];
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ message HeaderData {
|
|||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// header public key
|
||||
cosmos.base.crypto.v1beta1.PublicKey new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""];
|
||||
google.protobuf.Any new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""];
|
||||
// header diversifier
|
||||
string new_diversifier = 2 [(gogoproto.moretags) = "yaml:\"new_diversifier\""];
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/server/api"
|
||||
"github.com/cosmos/cosmos-sdk/server/config"
|
||||
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
@ -203,7 +202,7 @@ func NewSimApp(
|
|||
bApp.SetCommitMultiStoreTracer(traceStore)
|
||||
bApp.SetAppVersion(version.Version)
|
||||
bApp.GRPCQueryRouter().SetInterfaceRegistry(interfaceRegistry)
|
||||
bApp.GRPCQueryRouter().RegisterSimulateService(bApp.Simulate, interfaceRegistry, std.DefaultPublicKeyCodec{})
|
||||
bApp.GRPCQueryRouter().RegisterSimulateService(bApp.Simulate, interfaceRegistry)
|
||||
|
||||
keys := sdk.NewKVStoreKeys(
|
||||
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
|
||||
|
|
|
@ -5,7 +5,6 @@ package params
|
|||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
)
|
||||
|
||||
|
@ -14,7 +13,7 @@ func MakeEncodingConfig() EncodingConfig {
|
|||
amino := codec.NewLegacyAmino()
|
||||
interfaceRegistry := types.NewInterfaceRegistry()
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
txCfg := tx.NewTxConfig(marshaler, std.DefaultPublicKeyCodec{}, tx.DefaultSignModes)
|
||||
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)
|
||||
|
||||
return EncodingConfig{
|
||||
InterfaceRegistry: interfaceRegistry,
|
||||
|
|
|
@ -9,15 +9,17 @@ import (
|
|||
vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
|
||||
)
|
||||
|
||||
// RegisterLegacyAminoCodec registers types with the Amino codec.
|
||||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
vesting.RegisterLegacyAminoCodec(cdc)
|
||||
sdk.RegisterLegacyAminoCodec(cdc)
|
||||
cryptocodec.RegisterCrypto(cdc)
|
||||
vesting.RegisterLegacyAminoCodec(cdc)
|
||||
}
|
||||
|
||||
// RegisterInterfaces registers Interfaces from sdk/types and vesting
|
||||
// RegisterInterfaces registers Interfaces from sdk/types, vesting, crypto, tx.
|
||||
func RegisterInterfaces(interfaceRegistry types.InterfaceRegistry) {
|
||||
sdk.RegisterInterfaces(interfaceRegistry)
|
||||
txtypes.RegisterInterfaces(interfaceRegistry)
|
||||
cryptocodec.RegisterInterfaces(interfaceRegistry)
|
||||
vesting.RegisterInterfaces(interfaceRegistry)
|
||||
}
|
||||
|
|
109
std/pubkey.go
109
std/pubkey.go
|
@ -1,109 +0,0 @@
|
|||
package std
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/crypto/sr25519"
|
||||
|
||||
kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
)
|
||||
|
||||
// DefaultPublicKeyCodec implements the standard PublicKeyCodec for the SDK which
|
||||
// supports a standard set of public key types
|
||||
type DefaultPublicKeyCodec struct{}
|
||||
|
||||
var _ types.PublicKeyCodec = DefaultPublicKeyCodec{}
|
||||
|
||||
// Decode implements the PublicKeyCodec.Decode method
|
||||
// TODO To be removed in https://github.com/cosmos/cosmos-sdk/pull/7276
|
||||
func (cdc DefaultPublicKeyCodec) Decode(key *types.PublicKey) (crypto.PubKey, error) {
|
||||
// key being nil is allowed as all fields in proto are optional
|
||||
if key == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if key.Sum == nil {
|
||||
return nil, nil
|
||||
}
|
||||
switch key := key.Sum.(type) {
|
||||
case *types.PublicKey_Secp256K1:
|
||||
n := len(key.Secp256K1)
|
||||
if n != secp256k1.PubKeySize {
|
||||
return nil, fmt.Errorf("wrong length %d for secp256k1 public key", n)
|
||||
}
|
||||
|
||||
res := make([]byte, secp256k1.PubKeySize)
|
||||
copy(res, key.Secp256K1)
|
||||
return &secp256k1.PubKey{Key: res}, nil
|
||||
case *types.PublicKey_Ed25519:
|
||||
n := len(key.Ed25519)
|
||||
if n != ed25519.PubKeySize {
|
||||
return nil, fmt.Errorf("wrong length %d for ed25519 public key", n)
|
||||
}
|
||||
|
||||
res := make(ed25519.PubKey, ed25519.PubKeySize)
|
||||
copy(res, key.Ed25519)
|
||||
return res, nil
|
||||
case *types.PublicKey_Sr25519:
|
||||
n := len(key.Sr25519)
|
||||
if n != sr25519.PubKeySize {
|
||||
return nil, fmt.Errorf("wrong length %d for sr25519 public key", n)
|
||||
}
|
||||
|
||||
res := make(sr25519.PubKey, sr25519.PubKeySize)
|
||||
copy(res, key.Sr25519)
|
||||
|
||||
return res, nil
|
||||
case *types.PublicKey_Multisig:
|
||||
pubKeys := key.Multisig.PubKeys
|
||||
resKeys := make([]crypto.PubKey, len(pubKeys))
|
||||
for i, k := range pubKeys {
|
||||
dk, err := cdc.Decode(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resKeys[i] = dk
|
||||
}
|
||||
|
||||
return kmultisig.NewLegacyAminoPubKey(int(key.Multisig.K), resKeys), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("can't decode PubKey of type %T. Use a custom PublicKeyCodec instead", key)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode implements the PublicKeyCodec.Encode method
|
||||
// TODO To be removed in https://github.com/cosmos/cosmos-sdk/pull/7276
|
||||
|
||||
func (cdc DefaultPublicKeyCodec) Encode(key crypto.PubKey) (*types.PublicKey, error) {
|
||||
if key == nil {
|
||||
return &types.PublicKey{}, nil
|
||||
}
|
||||
switch key := key.(type) {
|
||||
case *secp256k1.PubKey:
|
||||
return &types.PublicKey{Sum: &types.PublicKey_Secp256K1{Secp256K1: key.Key}}, nil
|
||||
case ed25519.PubKey:
|
||||
return &types.PublicKey{Sum: &types.PublicKey_Ed25519{Ed25519: key}}, nil
|
||||
case sr25519.PubKey:
|
||||
return &types.PublicKey{Sum: &types.PublicKey_Sr25519{Sr25519: key}}, nil
|
||||
case *kmultisig.LegacyAminoPubKey:
|
||||
pubKeys := key.PubKeys
|
||||
resKeys := make([]*types.PublicKey, len(pubKeys))
|
||||
for i, any := range pubKeys {
|
||||
k := any.GetCachedValue().(crypto.PubKey)
|
||||
dk, err := cdc.Encode(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resKeys[i] = dk
|
||||
}
|
||||
return &types.PublicKey{Sum: &types.PublicKey_Multisig{Multisig: &types.PubKeyMultisigThreshold{
|
||||
K: key.Threshold,
|
||||
PubKeys: resKeys,
|
||||
}}}, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("can't encode PubKey of type %T. Use a custom PublicKeyCodec instead", key)
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package std_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
)
|
||||
|
||||
func roundTripTest(t *testing.T, pubKey crypto.PubKey) {
|
||||
cdc := std.DefaultPublicKeyCodec{}
|
||||
|
||||
pubKeyEnc, err := cdc.Encode(pubKey)
|
||||
require.NoError(t, err)
|
||||
pubKeyDec, err := cdc.Decode(pubKeyEnc)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, pubKey, pubKeyDec)
|
||||
}
|
||||
|
||||
func TestDefaultPublicKeyCodec(t *testing.T) {
|
||||
roundTripTest(t, nil)
|
||||
|
||||
roundTripTest(t, crypto.PubKey(nil))
|
||||
|
||||
pubKeySecp256k1 := secp256k1.GenPrivKey().PubKey()
|
||||
roundTripTest(t, pubKeySecp256k1)
|
||||
|
||||
pubKeyMultisig := kmultisig.NewLegacyAminoPubKey(2, []crypto.PubKey{
|
||||
pubKeySecp256k1, secp256k1.GenPrivKey().PubKey(), secp256k1.GenPrivKey().PubKey(),
|
||||
})
|
||||
roundTripTest(t, pubKeyMultisig)
|
||||
}
|
|
@ -3,6 +3,7 @@ package signing
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
|
@ -84,3 +85,23 @@ func SignatureDataFromProto(descData *SignatureDescriptor_Data) SignatureData {
|
|||
panic(fmt.Errorf("unexpected case %+v", descData))
|
||||
}
|
||||
}
|
||||
|
||||
var _, _ codectypes.UnpackInterfacesMessage = &SignatureDescriptors{}, &SignatureDescriptor{}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (sds *SignatureDescriptors) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
for _, sig := range sds.Signatures {
|
||||
err := sig.UnpackInterfaces(unpacker)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (sd *SignatureDescriptor) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpacker.UnpackAny(sd.PublicKey, new(crypto.PubKey))
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ package signing
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
types "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
types1 "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
|
@ -113,7 +114,7 @@ func (m *SignatureDescriptors) GetSignatures() []*SignatureDescriptor {
|
|||
// itself. It is primarily used for coordinating signatures between clients.
|
||||
type SignatureDescriptor struct {
|
||||
// public_key is the public key of the signer
|
||||
PublicKey *types.PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||
PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||
Data *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||
// sequence is the sequence of the account, which describes the
|
||||
// number of committed transactions signed by a given address. It is used to prevent
|
||||
|
@ -154,7 +155,7 @@ func (m *SignatureDescriptor) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_SignatureDescriptor proto.InternalMessageInfo
|
||||
|
||||
func (m *SignatureDescriptor) GetPublicKey() *types.PublicKey {
|
||||
func (m *SignatureDescriptor) GetPublicKey() *types.Any {
|
||||
if m != nil {
|
||||
return m.PublicKey
|
||||
}
|
||||
|
@ -321,7 +322,7 @@ func (m *SignatureDescriptor_Data_Single) GetSignature() []byte {
|
|||
// Multi is the signature data for a multisig public key
|
||||
type SignatureDescriptor_Data_Multi struct {
|
||||
// bitarray specifies which keys within the multisig are signing
|
||||
Bitarray *types.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
|
||||
Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
|
||||
// signatures is the signatures of the multi-signature
|
||||
Signatures []*SignatureDescriptor_Data `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"`
|
||||
}
|
||||
|
@ -359,7 +360,7 @@ func (m *SignatureDescriptor_Data_Multi) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_SignatureDescriptor_Data_Multi proto.InternalMessageInfo
|
||||
|
||||
func (m *SignatureDescriptor_Data_Multi) GetBitarray() *types.CompactBitArray {
|
||||
func (m *SignatureDescriptor_Data_Multi) GetBitarray() *types1.CompactBitArray {
|
||||
if m != nil {
|
||||
return m.Bitarray
|
||||
}
|
||||
|
@ -387,40 +388,41 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_9a54958ff3d0b1b9 = []byte{
|
||||
// 525 bytes of a gzipped FileDescriptorProto
|
||||
// 543 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcd, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xc7, 0xed, 0xe6, 0x43, 0xe9, 0x14, 0xa1, 0xb0, 0xb4, 0x52, 0x1a, 0x90, 0x89, 0x8a, 0x10,
|
||||
0x11, 0xa8, 0xb6, 0x9a, 0x1e, 0x10, 0xdc, 0x92, 0xd8, 0xa4, 0x81, 0x26, 0x29, 0x76, 0x2a, 0x01,
|
||||
0x17, 0x6b, 0xed, 0x2c, 0x61, 0xd5, 0xd8, 0x6b, 0xbc, 0x6b, 0xd4, 0x9c, 0x90, 0x78, 0x02, 0x5e,
|
||||
0x82, 0xe7, 0xe0, 0xca, 0xb1, 0x47, 0x8e, 0x28, 0x79, 0x11, 0x14, 0x7f, 0x24, 0x41, 0x2a, 0x20,
|
||||
0x72, 0xb2, 0x67, 0x76, 0xe6, 0xf7, 0xff, 0xaf, 0x66, 0x77, 0xe1, 0xa1, 0xcb, 0xb8, 0xc7, 0xb8,
|
||||
0x26, 0x2e, 0x35, 0x4e, 0xc7, 0x3e, 0xf5, 0xc7, 0xda, 0xc7, 0x23, 0x87, 0x08, 0x7c, 0x94, 0xc5,
|
||||
0x6a, 0x10, 0x32, 0xc1, 0xd0, 0x7e, 0x52, 0xa8, 0x8a, 0x4b, 0x35, 0x5b, 0x48, 0x0b, 0xab, 0x19,
|
||||
0xc3, 0xc1, 0x9c, 0x68, 0x6e, 0x38, 0x0d, 0x04, 0x5b, 0x42, 0x92, 0x30, 0x61, 0x1c, 0xbc, 0x83,
|
||||
0x5d, 0x8b, 0x8e, 0x7d, 0x2c, 0xa2, 0x90, 0xe8, 0x84, 0xbb, 0x21, 0x0d, 0x04, 0x0b, 0x39, 0xea,
|
||||
0x03, 0xf0, 0x2c, 0xcf, 0x2b, 0x72, 0x2d, 0x57, 0xdf, 0x69, 0xa8, 0xea, 0x1f, 0x05, 0xd5, 0x6b,
|
||||
0x20, 0xe6, 0x1a, 0xe1, 0xe0, 0x73, 0x01, 0x6e, 0x5f, 0x53, 0x83, 0x74, 0x80, 0x20, 0x72, 0x26,
|
||||
0xd4, 0xb5, 0x2f, 0xc8, 0xb4, 0x22, 0xd7, 0xe4, 0xfa, 0x4e, 0xe3, 0x41, 0xa6, 0xb3, 0x70, 0xaf,
|
||||
0xa6, 0x76, 0x33, 0xa1, 0xb3, 0xb8, 0xfa, 0x25, 0x99, 0x9a, 0xdb, 0x41, 0xf6, 0x8b, 0x3a, 0x90,
|
||||
0x1f, 0x61, 0x81, 0x2b, 0x5b, 0x71, 0xff, 0xf1, 0xff, 0xf9, 0x54, 0x75, 0x2c, 0xb0, 0x19, 0x03,
|
||||
0x50, 0x15, 0x4a, 0x9c, 0x7c, 0x88, 0x88, 0xef, 0x92, 0x4a, 0xae, 0x26, 0xd7, 0xf3, 0xe6, 0x32,
|
||||
0xae, 0x7e, 0xcb, 0x41, 0x7e, 0x51, 0x8a, 0x86, 0x50, 0xe4, 0xd4, 0x1f, 0x4f, 0x48, 0xea, 0xf7,
|
||||
0xd9, 0x06, 0x7a, 0xaa, 0x15, 0x13, 0x4e, 0x24, 0x33, 0x65, 0xa1, 0x57, 0x50, 0xf0, 0xa2, 0x89,
|
||||
0xa0, 0xe9, 0x26, 0x9e, 0x6e, 0x02, 0xed, 0x2d, 0x00, 0x27, 0x92, 0x99, 0x90, 0xaa, 0x36, 0x14,
|
||||
0x13, 0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, 0xe6,
|
||||
0x8a, 0xf4, 0xf6, 0x70, 0x4c, 0xc5, 0xfb, 0xc8, 0x51, 0x5d, 0xe6, 0x69, 0xe9, 0x7d, 0x4d, 0x3e,
|
||||
0x87, 0x7c, 0x74, 0xa1, 0x89, 0x69, 0x40, 0xd6, 0x1f, 0x01, 0xa7, 0x18, 0xdf, 0xd8, 0xe3, 0x5f,
|
||||
0x01, 0x00, 0x00, 0xff, 0xff, 0x05, 0x81, 0x3c, 0x0b, 0x20, 0x04, 0x00, 0x00,
|
||||
0x10, 0xc7, 0xed, 0x26, 0xad, 0xd2, 0x29, 0x42, 0x61, 0x49, 0xa5, 0xc4, 0x20, 0x13, 0x95, 0x03,
|
||||
0x11, 0xa8, 0x6b, 0x35, 0x39, 0x20, 0xb8, 0xe5, 0xc3, 0xa4, 0x81, 0x26, 0x01, 0x3b, 0x95, 0x80,
|
||||
0x8b, 0x65, 0x3b, 0x5b, 0x63, 0x35, 0xf6, 0x1a, 0xef, 0x1a, 0xd5, 0x27, 0x5e, 0x81, 0x97, 0xe0,
|
||||
0x39, 0xb8, 0x72, 0xec, 0x91, 0x23, 0x4a, 0x9e, 0x80, 0x37, 0x40, 0xf1, 0x47, 0x12, 0xa4, 0x22,
|
||||
0x44, 0x4e, 0xd1, 0xcc, 0xfc, 0xe7, 0x37, 0xff, 0xd5, 0x4c, 0x0c, 0x8f, 0x6c, 0xca, 0x3c, 0xca,
|
||||
0x14, 0x7e, 0xa5, 0x30, 0xd7, 0xf1, 0x5d, 0xdf, 0x51, 0x3e, 0x9d, 0x58, 0x84, 0x9b, 0x27, 0x79,
|
||||
0x8c, 0x83, 0x90, 0x72, 0x8a, 0x6a, 0xa9, 0x10, 0xf3, 0x2b, 0x9c, 0x17, 0x32, 0xa1, 0x94, 0x33,
|
||||
0x2c, 0x93, 0x11, 0xc5, 0x0e, 0xe3, 0x80, 0xd3, 0x15, 0x24, 0x0d, 0x53, 0x86, 0x54, 0x73, 0x28,
|
||||
0x75, 0x66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, 0x90, 0x85,
|
||||
0x1f, 0x0b, 0x59, 0x78, 0x7f, 0xec, 0xb8, 0xfc, 0x43, 0x64, 0x61, 0x9b, 0x7a, 0x4a, 0xf6, 0xcf,
|
||||
0x4d, 0x7f, 0x8e, 0xd9, 0xf4, 0x52, 0xe1, 0x71, 0x40, 0x36, 0x3f, 0x07, 0xd6, 0x5e, 0x72, 0xfd,
|
||||
0xad, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x38, 0x12, 0x3c, 0x2a, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *SignatureDescriptors) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -939,7 +941,7 @@ func (m *SignatureDescriptor) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.PublicKey == nil {
|
||||
m.PublicKey = &types.PublicKey{}
|
||||
m.PublicKey = &types.Any{}
|
||||
}
|
||||
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
@ -1312,7 +1314,7 @@ func (m *SignatureDescriptor_Data_Multi) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Bitarray == nil {
|
||||
m.Bitarray = &types.CompactBitArray{}
|
||||
m.Bitarray = &types1.CompactBitArray{}
|
||||
}
|
||||
if err := m.Bitarray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
|
|
@ -394,7 +394,7 @@ type SignerInfo struct {
|
|||
// public_key is the public key of the signer. It is optional for accounts
|
||||
// that already exist in state. If unset, the verifier can use the required \
|
||||
// signer address for this position and lookup the public key.
|
||||
PublicKey *types1.PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||
PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||
// mode_info describes the signing mode of the signer and is a nested
|
||||
// structure to support nested multisig pubkey's
|
||||
ModeInfo *ModeInfo `protobuf:"bytes,2,opt,name=mode_info,json=modeInfo,proto3" json:"mode_info,omitempty"`
|
||||
|
@ -437,7 +437,7 @@ func (m *SignerInfo) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_SignerInfo proto.InternalMessageInfo
|
||||
|
||||
func (m *SignerInfo) GetPublicKey() *types1.PublicKey {
|
||||
func (m *SignerInfo) GetPublicKey() *types.Any {
|
||||
if m != nil {
|
||||
return m.PublicKey
|
||||
}
|
||||
|
@ -724,59 +724,59 @@ func init() {
|
|||
func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) }
|
||||
|
||||
var fileDescriptor_96d1575ffde80842 = []byte{
|
||||
// 823 bytes of a gzipped FileDescriptorProto
|
||||
// 817 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x6f, 0xdc, 0x44,
|
||||
0x14, 0x5f, 0xef, 0x6e, 0x36, 0xde, 0x97, 0xa4, 0xa5, 0xa3, 0x0a, 0x6d, 0x36, 0xaa, 0x1b, 0x8c,
|
||||
0x02, 0x2b, 0xa1, 0xda, 0x6d, 0x38, 0xf0, 0x47, 0x48, 0x90, 0x6d, 0x29, 0xa9, 0xa0, 0x80, 0x26,
|
||||
0x39, 0xf5, 0x62, 0x8d, 0xbd, 0x13, 0xef, 0xa8, 0xeb, 0x99, 0xc5, 0x33, 0x2e, 0xf6, 0x27, 0xe0,
|
||||
0x02, 0x12, 0x42, 0xe2, 0x3b, 0x20, 0x3e, 0x49, 0x8f, 0x3d, 0x72, 0x40, 0x80, 0x92, 0x0f, 0x02,
|
||||
0x9a, 0xf1, 0xd8, 0x0d, 0x25, 0xda, 0xbd, 0x70, 0xda, 0x79, 0x6f, 0x7e, 0xbf, 0xdf, 0xfb, 0xed,
|
||||
0x7b, 0xf3, 0x0c, 0xe3, 0x44, 0xc8, 0x4c, 0xc8, 0x50, 0x95, 0xe1, 0xb3, 0x7b, 0x31, 0x55, 0xe4,
|
||||
0x5e, 0xa8, 0xca, 0x60, 0x99, 0x0b, 0x25, 0xd0, 0x8d, 0xfa, 0x2e, 0x50, 0x65, 0x60, 0xef, 0xc6,
|
||||
0x37, 0x53, 0x91, 0x0a, 0x73, 0x1b, 0xea, 0x53, 0x0d, 0x1c, 0xbf, 0x6d, 0x45, 0x62, 0x22, 0x69,
|
||||
0x98, 0xe4, 0xd5, 0x52, 0x89, 0x56, 0xad, 0x0e, 0x2d, 0xd0, 0xbb, 0x0c, 0x6c, 0x11, 0x82, 0xf1,
|
||||
0x57, 0x84, 0x54, 0x19, 0x4a, 0x96, 0x72, 0xc6, 0xd3, 0x16, 0x65, 0x63, 0x0b, 0xdc, 0x4d, 0x85,
|
||||
0x48, 0x17, 0x34, 0x34, 0x51, 0x5c, 0x9c, 0x85, 0x84, 0x57, 0xf5, 0x95, 0xff, 0x83, 0x03, 0xdd,
|
||||
0xd3, 0x12, 0xdd, 0x81, 0x7e, 0x2c, 0x66, 0xd5, 0xc8, 0xd9, 0x77, 0x26, 0x5b, 0x87, 0xbb, 0xc1,
|
||||
0x7f, 0xfe, 0x4b, 0x70, 0x5a, 0x4e, 0xc5, 0xac, 0xc2, 0x06, 0x86, 0xde, 0x87, 0x21, 0x29, 0xd4,
|
||||
0x3c, 0x62, 0xfc, 0x4c, 0x8c, 0xba, 0x86, 0xb3, 0x77, 0x05, 0xe7, 0xa8, 0x50, 0xf3, 0x47, 0xfc,
|
||||
0x4c, 0x60, 0x97, 0xd8, 0x13, 0xf2, 0x00, 0xb4, 0x37, 0xa2, 0x8a, 0x9c, 0xca, 0x51, 0x6f, 0xbf,
|
||||
0x37, 0xd9, 0xc6, 0x97, 0x32, 0x3e, 0x87, 0x8d, 0xd3, 0x12, 0x93, 0x6f, 0xd1, 0x2d, 0x00, 0x5d,
|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, 0xb8, 0xf0, 0x3a, 0xbf, 0x5d, 0x78, 0x9d, 0x27, 0x07,
|
||||
0xeb, 0x0b, 0x85, 0xaa, 0x8c, 0x07, 0x66, 0xef, 0xde, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x1d,
|
||||
0xe3, 0xfb, 0xd0, 0xd4, 0x06, 0x00, 0x00,
|
||||
0x14, 0x5f, 0xaf, 0x37, 0x1b, 0xef, 0x4b, 0xd2, 0xd2, 0x51, 0x85, 0x36, 0x1b, 0xd5, 0x0d, 0x46,
|
||||
0x85, 0x95, 0x50, 0xed, 0x36, 0x3d, 0xf0, 0x47, 0x48, 0x90, 0x2d, 0x94, 0x54, 0x50, 0x90, 0x26,
|
||||
0x39, 0xf5, 0x62, 0x8d, 0xbd, 0x13, 0xef, 0xa8, 0xeb, 0x99, 0xc5, 0x33, 0x2e, 0xde, 0x4f, 0xc0,
|
||||
0x05, 0x24, 0x84, 0x84, 0xf8, 0x0e, 0x7c, 0x92, 0x1e, 0x7b, 0xe4, 0x80, 0x00, 0x25, 0x1f, 0x04,
|
||||
0x34, 0xe3, 0xb1, 0x1b, 0xc2, 0x2a, 0x7b, 0xe9, 0xc9, 0xf3, 0xde, 0xfc, 0x7e, 0xbf, 0xf7, 0xfc,
|
||||
0xfe, 0x0c, 0x8c, 0x52, 0x21, 0x73, 0x21, 0x23, 0x55, 0x45, 0xcf, 0xef, 0x27, 0x54, 0x91, 0xfb,
|
||||
0x91, 0xaa, 0xc2, 0x45, 0x21, 0x94, 0x40, 0x37, 0xea, 0xbb, 0x50, 0x55, 0xa1, 0xbd, 0x1b, 0xdd,
|
||||
0xcc, 0x44, 0x26, 0xcc, 0x6d, 0xa4, 0x4f, 0x35, 0x70, 0xf4, 0xae, 0x15, 0x49, 0x88, 0xa4, 0x51,
|
||||
0x5a, 0x2c, 0x17, 0x4a, 0xb4, 0x6a, 0xb5, 0x69, 0x81, 0xfe, 0x45, 0x60, 0x8b, 0x10, 0x8c, 0x5f,
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, 0x5d, 0x57, 0xf2, 0x41, 0x53, 0x72, 0x39, 0xd9,
|
||||
0x00, 0x57, 0x96, 0x79, 0xf0, 0xbd, 0x03, 0xee, 0x23, 0x4a, 0x51, 0x0a, 0x7d, 0x92, 0xeb, 0x05,
|
||||
0xb5, 0x63, 0xb6, 0xfb, 0x9f, 0x8c, 0x5e, 0xa5, 0xc2, 0xf8, 0xe4, 0xde, 0x8b, 0x3f, 0x6f, 0x77,
|
||||
0x7e, 0xfb, 0xeb, 0xf6, 0x38, 0x63, 0x6a, 0x56, 0x26, 0x61, 0x2a, 0xf2, 0xc8, 0xbe, 0xd3, 0xf5,
|
||||
0xe7, 0xae, 0x9c, 0x3e, 0x8b, 0xd4, 0x72, 0x41, 0xa5, 0x21, 0x48, 0x6c, 0xa5, 0xd1, 0x1e, 0x0c,
|
||||
0x32, 0x22, 0xe3, 0x39, 0xcb, 0x99, 0x32, 0x4d, 0xe8, 0x61, 0x2f, 0x23, 0xf2, 0x2b, 0x6d, 0x4f,
|
||||
0x3e, 0x79, 0x71, 0xe6, 0x3b, 0x2f, 0xcf, 0x7c, 0xe7, 0xef, 0x33, 0xdf, 0xf9, 0xe9, 0xdc, 0xef,
|
||||
0xbc, 0x3c, 0xf7, 0x3b, 0xbf, 0x9f, 0xfb, 0x9d, 0xa7, 0x77, 0xd6, 0x07, 0x8a, 0x54, 0x95, 0xf4,
|
||||
0xcd, 0x60, 0x3e, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0x29, 0x4f, 0x1c, 0xdf, 0xc3, 0x06, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
||||
func (m *Tx) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -2420,7 +2420,7 @@ func (m *SignerInfo) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.PublicKey == nil {
|
||||
m.PublicKey = &types1.PublicKey{}
|
||||
m.PublicKey = &types.Any{}
|
||||
}
|
||||
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
|
|
@ -6,12 +6,14 @@ import (
|
|||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
// MaxGasWanted defines the max gas allowed.
|
||||
const MaxGasWanted = uint64((1 << 63) - 1)
|
||||
|
||||
var _, _ codectypes.UnpackInterfacesMessage = &Tx{}, &TxBody{}
|
||||
// Interface implementation checks.
|
||||
var _, _, _, _ codectypes.UnpackInterfacesMessage = &Tx{}, &TxBody{}, &AuthInfo{}, &SignerInfo{}
|
||||
var _ sdk.Tx = &Tx{}
|
||||
|
||||
// GetMsgs implements the GetMsgs method on sdk.Tx.
|
||||
|
@ -100,8 +102,15 @@ func (t *Tx) GetSigners() []sdk.AccAddress {
|
|||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (t *Tx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
if t.Body != nil {
|
||||
return t.Body.UnpackInterfaces(unpacker)
|
||||
if err := t.Body.UnpackInterfaces(unpacker); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if t.AuthInfo != nil {
|
||||
return t.AuthInfo.UnpackInterfaces(unpacker)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -117,6 +126,22 @@ func (m *TxBody) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (m *AuthInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
for _, signerInfo := range m.SignerInfos {
|
||||
err := signerInfo.UnpackInterfaces(unpacker)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (m *SignerInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpacker.UnpackAny(m.PublicKey, new(crypto.PubKey))
|
||||
}
|
||||
|
||||
// RegisterInterfaces registers the sdk.Tx interface.
|
||||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||
registry.RegisterInterface("cosmos.tx.v1beta1.Tx", (*sdk.Tx)(nil))
|
||||
|
|
|
@ -1034,25 +1034,6 @@ func (suite *AnteTestSuite) TestCustomSignatureVerificationGasConsumer() {
|
|||
false,
|
||||
sdkerrors.ErrInvalidPubKey,
|
||||
},
|
||||
{
|
||||
"verify that an ed25519 account gets accepted",
|
||||
func() {
|
||||
priv1 := ed25519.GenPrivKey()
|
||||
pub1 := priv1.PubKey()
|
||||
addr1 := sdk.AccAddress(pub1.Address())
|
||||
acc1 := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr1)
|
||||
|
||||
suite.Require().NoError(suite.app.BankKeeper.SetBalances(suite.ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("atom", 150))))
|
||||
suite.Require().NoError(acc1.SetAccountNumber(1))
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, acc1)
|
||||
msg := testdata.NewTestMsg(addr1)
|
||||
privs, accNums, accSeqs = []crypto.PrivKey{priv1}, []uint64{1}, []uint64{0}
|
||||
msgs = []sdk.Msg{msg}
|
||||
},
|
||||
false,
|
||||
true,
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
|
|
@ -270,7 +270,11 @@ func (suite *AnteTestSuite) TestSigVerification_ExplicitAmino() {
|
|||
|
||||
func (suite *AnteTestSuite) TestSigIntegration() {
|
||||
// generate private keys
|
||||
privs := []crypto.PrivKey{secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), secp256k1.GenPrivKey()}
|
||||
privs := []crypto.PrivKey{
|
||||
secp256k1.GenPrivKey(),
|
||||
secp256k1.GenPrivKey(),
|
||||
secp256k1.GenPrivKey(),
|
||||
}
|
||||
|
||||
params := types.DefaultParams()
|
||||
initialSigCost := params.SigVerifyCostSecp256k1
|
||||
|
|
|
@ -47,19 +47,8 @@ func DecodeTxRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
txI, err := clientCtx.TxConfig.TxDecoder()(txBytes)
|
||||
if rest.CheckBadRequestError(w, err) {
|
||||
return
|
||||
}
|
||||
|
||||
tx, ok := txI.(signing.Tx)
|
||||
stdTx, ok := convertToStdTx(w, clientCtx, txBytes)
|
||||
if !ok {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("%+v is not backwards compatible with %T", tx, authtypes.StdTx{}))
|
||||
return
|
||||
}
|
||||
|
||||
stdTx, err := clienttx.ConvertTxToStdTx(clientCtx.LegacyAmino, tx)
|
||||
if rest.CheckBadRequestError(w, err) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -68,3 +57,26 @@ func DecodeTxRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
|
|||
rest.PostProcessResponse(w, clientCtx, response)
|
||||
}
|
||||
}
|
||||
|
||||
// convertToStdTx converts tx proto binary bytes retrieved from Tendermint into
|
||||
// a StdTx. Returns the StdTx, as well as a flag denoting if the function
|
||||
// successfully converted or not.
|
||||
func convertToStdTx(w http.ResponseWriter, clientCtx client.Context, txBytes []byte) (authtypes.StdTx, bool) {
|
||||
txI, err := clientCtx.TxConfig.TxDecoder()(txBytes)
|
||||
if rest.CheckBadRequestError(w, err) {
|
||||
return authtypes.StdTx{}, false
|
||||
}
|
||||
|
||||
tx, ok := txI.(signing.Tx)
|
||||
if !ok {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("%+v is not backwards compatible with %T", tx, authtypes.StdTx{}))
|
||||
return authtypes.StdTx{}, false
|
||||
}
|
||||
|
||||
stdTx, err := clienttx.ConvertTxToStdTx(clientCtx.LegacyAmino, tx)
|
||||
if rest.CheckBadRequestError(w, err) {
|
||||
return authtypes.StdTx{}, false
|
||||
}
|
||||
|
||||
return stdTx, true
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ func QueryAccountRequestHandlerFn(storeName string, clientCtx client.Context) ht
|
|||
}
|
||||
}
|
||||
|
||||
// QueryTxsHandlerFn implements a REST handler that searches for transactions.
|
||||
// QueryTxsRequestHandlerFn implements a REST handler that searches for transactions.
|
||||
// Genesis transactions are returned if the height parameter is set to zero,
|
||||
// otherwise the transactions are searched for by events.
|
||||
func QueryTxsRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
|
||||
|
@ -128,11 +128,19 @@ func QueryTxRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
// We just unmarshalled from Tendermint, we take the proto Tx's raw
|
||||
// bytes, and convert them into a StdTx to be displayed.
|
||||
txBytes := output.Tx.Value
|
||||
stdTx, ok := convertToStdTx(w, clientCtx, txBytes)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if output.Empty() {
|
||||
rest.WriteErrorResponse(w, http.StatusNotFound, fmt.Sprintf("no transaction found with hash %s", hashHexStr))
|
||||
}
|
||||
|
||||
rest.PostProcessResponseBare(w, clientCtx, output)
|
||||
rest.PostProcessResponseBare(w, clientCtx, stdTx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
// +build norace
|
||||
|
||||
package rest_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
rest2 "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/network"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
|
||||
rest2 "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
type IntegrationTestSuite struct {
|
||||
|
@ -33,7 +30,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
|||
s.T().Log("setting up integration test suite")
|
||||
|
||||
cfg := network.DefaultConfig()
|
||||
cfg.NumValidators = 1
|
||||
cfg.NumValidators = 2
|
||||
|
||||
s.cfg = cfg
|
||||
s.network = network.New(s.T(), cfg)
|
||||
|
@ -109,11 +106,31 @@ func (s *IntegrationTestSuite) TestBroadcastTxRequest() {
|
|||
s.Require().NotEmpty(txRes.TxHash)
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestMultipleSyncBroadcastTxRequests() {
|
||||
|
||||
func (s *IntegrationTestSuite) TestQueryTxByHash() {
|
||||
val0 := s.network.Validators[0]
|
||||
txConfig := authtypes.StdTxConfig{Cdc: s.cfg.LegacyAmino}
|
||||
|
||||
// Create and broadcast a tx.
|
||||
stdTx := s.createTestStdTx(val0, 1) // Validator's sequence starts at 1.
|
||||
res, err := s.broadcastReq(stdTx, "block")
|
||||
s.Require().NoError(err)
|
||||
var txRes sdk.TxResponse
|
||||
// NOTE: this uses amino explicitly, don't migrate it!
|
||||
s.Require().NoError(s.cfg.LegacyAmino.UnmarshalJSON(res, &txRes))
|
||||
// we just check for a non-empty TxHash here, the actual hash will depend on the underlying tx configuration
|
||||
s.Require().NotEmpty(txRes.TxHash)
|
||||
|
||||
s.network.WaitForNextBlock()
|
||||
|
||||
// We now fetch the tx by has on the `/tx/{hash}` route.
|
||||
txJSON, err := rest.GetRequest(fmt.Sprintf("%s/txs/%s", val0.APIAddress, txRes.TxHash))
|
||||
s.Require().NoError(err)
|
||||
|
||||
// txJSON should contain the whole tx, we just make sure that our custom
|
||||
// memo is there.
|
||||
s.Require().True(strings.Contains(string(txJSON), stdTx.Memo))
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestMultipleSyncBroadcastTxRequests() {
|
||||
// First test transaction from validator should have sequence=1 (non-genesis tx)
|
||||
testCases := []struct {
|
||||
desc string
|
||||
|
@ -139,35 +156,8 @@ func (s *IntegrationTestSuite) TestMultipleSyncBroadcastTxRequests() {
|
|||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.desc), func() {
|
||||
|
||||
msg := &types.MsgSend{
|
||||
val0.Address,
|
||||
val0.Address,
|
||||
sdk.Coins{sdk.NewInt64Coin("foo", 100)},
|
||||
}
|
||||
|
||||
// prepare txBuilder with msg
|
||||
txBuilder := txConfig.NewTxBuilder()
|
||||
feeAmount := sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)}
|
||||
gasLimit := testdata.NewTestGasLimit()
|
||||
txBuilder.SetMsgs(msg)
|
||||
txBuilder.SetFeeAmount(feeAmount)
|
||||
txBuilder.SetGasLimit(gasLimit)
|
||||
|
||||
// setup txFactory
|
||||
txFactory := tx.Factory{}
|
||||
txFactory = txFactory.
|
||||
WithChainID(val0.ClientCtx.ChainID).
|
||||
WithKeybase(val0.ClientCtx.Keyring).
|
||||
WithTxConfig(txConfig).
|
||||
WithSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON).
|
||||
WithSequence(tc.sequence)
|
||||
|
||||
// sign Tx (offline mode so we can manually set sequence number)
|
||||
err := authclient.SignTx(txFactory, val0.ClientCtx, val0.Moniker, txBuilder, true)
|
||||
s.Require().NoError(err)
|
||||
|
||||
// broadcast test with sync mode, as we want to run CheckTx to verify account sequence is correct
|
||||
stdTx := txBuilder.GetTx().(authtypes.StdTx)
|
||||
stdTx := s.createTestStdTx(s.network.Validators[0], tc.sequence)
|
||||
res, err := s.broadcastReq(stdTx, "sync")
|
||||
s.Require().NoError(err)
|
||||
|
||||
|
@ -190,7 +180,41 @@ func (s *IntegrationTestSuite) TestMultipleSyncBroadcastTxRequests() {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) createTestStdTx(val *network.Validator, sequence uint64) authtypes.StdTx {
|
||||
txConfig := authtypes.StdTxConfig{Cdc: s.cfg.LegacyAmino}
|
||||
|
||||
msg := &types.MsgSend{
|
||||
FromAddress: val.Address,
|
||||
ToAddress: val.Address,
|
||||
Amount: sdk.Coins{sdk.NewInt64Coin(fmt.Sprintf("%stoken", val.Moniker), 100)},
|
||||
}
|
||||
|
||||
// prepare txBuilder with msg
|
||||
txBuilder := txConfig.NewTxBuilder()
|
||||
feeAmount := sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)}
|
||||
gasLimit := testdata.NewTestGasLimit()
|
||||
txBuilder.SetMsgs(msg)
|
||||
txBuilder.SetFeeAmount(feeAmount)
|
||||
txBuilder.SetGasLimit(gasLimit)
|
||||
txBuilder.SetMemo("foobar")
|
||||
|
||||
// setup txFactory
|
||||
txFactory := tx.Factory{}.
|
||||
WithChainID(val.ClientCtx.ChainID).
|
||||
WithKeybase(val.ClientCtx.Keyring).
|
||||
WithTxConfig(txConfig).
|
||||
WithSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON).
|
||||
WithSequence(sequence)
|
||||
|
||||
// sign Tx (offline mode so we can manually set sequence number)
|
||||
err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, true)
|
||||
s.Require().NoError(err)
|
||||
|
||||
stdTx := txBuilder.GetTx().(authtypes.StdTx)
|
||||
|
||||
return stdTx
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) broadcastReq(stdTx authtypes.StdTx, mode string) ([]byte, error) {
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package tx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/ante"
|
||||
|
@ -27,12 +29,6 @@ type wrapper struct {
|
|||
// from the client using TxRaw if the tx was decoded from the wire
|
||||
authInfoBz []byte
|
||||
|
||||
// pubKeys represents the cached crypto.PubKey's that were set either from tx decoding
|
||||
// or decoded from AuthInfo when GetPubKey's was called
|
||||
pubKeys []crypto.PubKey
|
||||
|
||||
pubkeyCodec types.PublicKeyCodec
|
||||
|
||||
txBodyHasUnknownNonCriticals bool
|
||||
}
|
||||
|
||||
|
@ -52,7 +48,7 @@ type ExtensionOptionsTxBuilder interface {
|
|||
SetNonCriticalExtensionOptions(...*codectypes.Any)
|
||||
}
|
||||
|
||||
func newBuilder(pubkeyCodec types.PublicKeyCodec) *wrapper {
|
||||
func newBuilder() *wrapper {
|
||||
return &wrapper{
|
||||
tx: &tx.Tx{
|
||||
Body: &tx.TxBody{},
|
||||
|
@ -60,7 +56,6 @@ func newBuilder(pubkeyCodec types.PublicKeyCodec) *wrapper {
|
|||
Fee: &tx.Fee{},
|
||||
},
|
||||
},
|
||||
pubkeyCodec: pubkeyCodec,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,25 +104,23 @@ func (w *wrapper) GetSigners() []sdk.AccAddress {
|
|||
}
|
||||
|
||||
func (w *wrapper) GetPubKeys() []crypto.PubKey {
|
||||
if w.pubKeys == nil {
|
||||
signerInfos := w.tx.AuthInfo.SignerInfos
|
||||
pubKeys := make([]crypto.PubKey, len(signerInfos))
|
||||
signerInfos := w.tx.AuthInfo.SignerInfos
|
||||
pks := make([]crypto.PubKey, len(signerInfos))
|
||||
|
||||
for i, si := range signerInfos {
|
||||
var err error
|
||||
pk := si.PublicKey
|
||||
if pk != nil {
|
||||
pubKeys[i], err = w.pubkeyCodec.Decode(si.PublicKey)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
for i, si := range signerInfos {
|
||||
// NOTE: it is okay to leave this nil if there is no PubKey in the SignerInfo.
|
||||
// PubKey's can be left unset in SignerInfo.
|
||||
if si.PublicKey == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
w.pubKeys = pubKeys
|
||||
pk, ok := si.PublicKey.GetCachedValue().(crypto.PubKey)
|
||||
if ok {
|
||||
pks[i] = pk
|
||||
}
|
||||
}
|
||||
|
||||
return w.pubKeys
|
||||
return pks
|
||||
}
|
||||
|
||||
func (w *wrapper) GetGas() uint64 {
|
||||
|
@ -250,12 +243,12 @@ func (w *wrapper) SetSignatures(signatures ...signing.SignatureV2) error {
|
|||
for i, sig := range signatures {
|
||||
var modeInfo *tx.ModeInfo
|
||||
modeInfo, rawSigs[i] = SignatureDataToModeInfoAndSig(sig.Data)
|
||||
pk, err := w.pubkeyCodec.Encode(sig.PubKey)
|
||||
any, err := PubKeyToAny(sig.PubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
signerInfos[i] = &tx.SignerInfo{
|
||||
PublicKey: pk,
|
||||
PublicKey: any,
|
||||
ModeInfo: modeInfo,
|
||||
Sequence: sig.Sequence,
|
||||
}
|
||||
|
@ -271,8 +264,6 @@ func (w *wrapper) setSignerInfos(infos []*tx.SignerInfo) {
|
|||
w.tx.AuthInfo.SignerInfos = infos
|
||||
// set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo
|
||||
w.authInfoBz = nil
|
||||
// set cached pubKeys to nil because they no longer match tx.AuthInfo
|
||||
w.pubKeys = nil
|
||||
}
|
||||
|
||||
func (w *wrapper) setSignatures(sigs [][]byte) {
|
||||
|
@ -291,10 +282,9 @@ func (w *wrapper) AsAny() *codectypes.Any {
|
|||
}
|
||||
|
||||
// WrapTx creates a TxBuilder wrapper around a tx.Tx proto message.
|
||||
func WrapTx(protoTx *tx.Tx, pubkeyCodec types.PublicKeyCodec) client.TxBuilder {
|
||||
func WrapTx(protoTx *tx.Tx) client.TxBuilder {
|
||||
return &wrapper{
|
||||
tx: protoTx,
|
||||
pubkeyCodec: pubkeyCodec,
|
||||
tx: protoTx,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,3 +305,12 @@ func (w *wrapper) SetNonCriticalExtensionOptions(extOpts ...*codectypes.Any) {
|
|||
w.tx.Body.NonCriticalExtensionOptions = extOpts
|
||||
w.bodyBz = nil
|
||||
}
|
||||
|
||||
// PubKeyToAny converts a crypto.PubKey to a proto Any.
|
||||
func PubKeyToAny(key crypto.PubKey) (*codectypes.Any, error) {
|
||||
protoMsg, ok := key.(proto.Message)
|
||||
if !ok {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidPubKey, fmt.Sprintf("can't proto encode %T", protoMsg))
|
||||
}
|
||||
return codectypes.NewAnyWithValue(protoMsg)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
|
@ -20,20 +19,18 @@ func TestTxBuilder(t *testing.T) {
|
|||
_, pubkey, addr := testdata.KeyTestPubAddr()
|
||||
|
||||
marshaler := codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
|
||||
txBuilder := newBuilder(std.DefaultPublicKeyCodec{})
|
||||
|
||||
cdc := std.DefaultPublicKeyCodec{}
|
||||
txBuilder := newBuilder()
|
||||
|
||||
memo := "sometestmemo"
|
||||
msgs := []sdk.Msg{testdata.NewTestMsg(addr)}
|
||||
accSeq := uint64(2) // Arbitrary account sequence
|
||||
|
||||
pk, err := cdc.Encode(pubkey)
|
||||
any, err := PubKeyToAny(pubkey)
|
||||
require.NoError(t, err)
|
||||
|
||||
var signerInfo []*txtypes.SignerInfo
|
||||
signerInfo = append(signerInfo, &txtypes.SignerInfo{
|
||||
PublicKey: pk,
|
||||
PublicKey: any,
|
||||
ModeInfo: &txtypes.ModeInfo{
|
||||
Sum: &txtypes.ModeInfo_Single_{
|
||||
Single: &txtypes.ModeInfo_Single{
|
||||
|
@ -111,7 +108,7 @@ func TestTxBuilder(t *testing.T) {
|
|||
require.Equal(t, 1, len(txBuilder.GetPubKeys()))
|
||||
require.Equal(t, legacy.Cdc.MustMarshalBinaryBare(pubkey), legacy.Cdc.MustMarshalBinaryBare(txBuilder.GetPubKeys()[0]))
|
||||
|
||||
any, err := codectypes.NewAnyWithValue(testdata.NewTestMsg())
|
||||
any, err = codectypes.NewAnyWithValue(testdata.NewTestMsg())
|
||||
require.NoError(t, err)
|
||||
txBuilder.SetExtensionOptions(any)
|
||||
require.Equal(t, []*codectypes.Any{any}, txBuilder.GetExtensionOptions())
|
||||
|
@ -137,7 +134,7 @@ func TestBuilderValidateBasic(t *testing.T) {
|
|||
// require to fail validation upon invalid fee
|
||||
badFeeAmount := testdata.NewTestFeeAmount()
|
||||
badFeeAmount[0].Amount = sdk.NewInt(-5)
|
||||
txBuilder := newBuilder(std.DefaultPublicKeyCodec{})
|
||||
txBuilder := newBuilder()
|
||||
|
||||
var sig1, sig2 signing.SignatureV2
|
||||
sig1 = signing.SignatureV2{
|
||||
|
|
|
@ -8,13 +8,11 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
)
|
||||
|
||||
type config struct {
|
||||
pubkeyCodec types.PublicKeyCodec
|
||||
handler signing.SignModeHandler
|
||||
decoder sdk.TxDecoder
|
||||
encoder sdk.TxEncoder
|
||||
|
@ -23,22 +21,21 @@ type config struct {
|
|||
protoCodec *codec.ProtoCodec
|
||||
}
|
||||
|
||||
// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec, PublicKeyCodec and sign modes. The
|
||||
// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The
|
||||
// first enabled sign mode will become the default sign mode.
|
||||
func NewTxConfig(protoCodec *codec.ProtoCodec, pubkeyCodec types.PublicKeyCodec, enabledSignModes []signingtypes.SignMode) client.TxConfig {
|
||||
func NewTxConfig(protoCodec *codec.ProtoCodec, enabledSignModes []signingtypes.SignMode) client.TxConfig {
|
||||
return &config{
|
||||
pubkeyCodec: pubkeyCodec,
|
||||
handler: makeSignModeHandler(enabledSignModes),
|
||||
decoder: DefaultTxDecoder(protoCodec, pubkeyCodec),
|
||||
decoder: DefaultTxDecoder(protoCodec),
|
||||
encoder: DefaultTxEncoder(),
|
||||
jsonDecoder: DefaultJSONTxDecoder(protoCodec, pubkeyCodec),
|
||||
jsonDecoder: DefaultJSONTxDecoder(protoCodec),
|
||||
jsonEncoder: DefaultJSONTxEncoder(),
|
||||
protoCodec: protoCodec,
|
||||
}
|
||||
}
|
||||
|
||||
func (g config) NewTxBuilder() client.TxBuilder {
|
||||
return newBuilder(g.pubkeyCodec)
|
||||
return newBuilder()
|
||||
}
|
||||
|
||||
// WrapTxBuilder returns a builder from provided transaction
|
||||
|
|
|
@ -3,22 +3,20 @@ package tx
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/testutil"
|
||||
)
|
||||
|
||||
func TestGenerator(t *testing.T) {
|
||||
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
||||
std.RegisterInterfaces(interfaceRegistry)
|
||||
interfaceRegistry.RegisterImplementations((*sdk.Msg)(nil), &testdata.TestMsg{})
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
pubKeyCodec := std.DefaultPublicKeyCodec{}
|
||||
suite.Run(t, testutil.NewTxConfigTestSuite(NewTxConfig(marshaler, pubKeyCodec, DefaultSignModes)))
|
||||
protoCodec := codec.NewProtoCodec(interfaceRegistry)
|
||||
suite.Run(t, testutil.NewTxConfigTestSuite(NewTxConfig(protoCodec, DefaultSignModes)))
|
||||
}
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package tx
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/unknownproto"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx"
|
||||
)
|
||||
|
||||
// DefaultTxDecoder returns a default protobuf TxDecoder using the provided Marshaler and PublicKeyCodec
|
||||
func DefaultTxDecoder(cdc *codec.ProtoCodec, keyCodec cryptotypes.PublicKeyCodec) sdk.TxDecoder {
|
||||
// DefaultTxDecoder returns a default protobuf TxDecoder using the provided Marshaler.
|
||||
func DefaultTxDecoder(cdc *codec.ProtoCodec) sdk.TxDecoder {
|
||||
return func(txBytes []byte) (sdk.Tx, error) {
|
||||
var raw tx.TxRaw
|
||||
|
||||
|
@ -59,24 +56,17 @@ func DefaultTxDecoder(cdc *codec.ProtoCodec, keyCodec cryptotypes.PublicKeyCodec
|
|||
Signatures: raw.Signatures,
|
||||
}
|
||||
|
||||
pks, err := extractPubKeys(theTx, keyCodec)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, err.Error())
|
||||
}
|
||||
|
||||
return &wrapper{
|
||||
tx: theTx,
|
||||
bodyBz: raw.BodyBytes,
|
||||
authInfoBz: raw.AuthInfoBytes,
|
||||
pubKeys: pks,
|
||||
pubkeyCodec: keyCodec,
|
||||
txBodyHasUnknownNonCriticals: txBodyHasUnknownNonCriticals,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultTxDecoder returns a default protobuf JSON TxDecoder using the provided Marshaler and PublicKeyCodec
|
||||
func DefaultJSONTxDecoder(cdc *codec.ProtoCodec, keyCodec cryptotypes.PublicKeyCodec) sdk.TxDecoder {
|
||||
// DefaultJSONTxDecoder returns a default protobuf JSON TxDecoder using the provided Marshaler.
|
||||
func DefaultJSONTxDecoder(cdc *codec.ProtoCodec) sdk.TxDecoder {
|
||||
return func(txBytes []byte) (sdk.Tx, error) {
|
||||
var theTx tx.Tx
|
||||
err := cdc.UnmarshalJSON(txBytes, &theTx)
|
||||
|
@ -84,32 +74,8 @@ func DefaultJSONTxDecoder(cdc *codec.ProtoCodec, keyCodec cryptotypes.PublicKeyC
|
|||
return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, err.Error())
|
||||
}
|
||||
|
||||
pks, err := extractPubKeys(&theTx, keyCodec)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, err.Error())
|
||||
}
|
||||
|
||||
return &wrapper{
|
||||
tx: &theTx,
|
||||
pubKeys: pks,
|
||||
pubkeyCodec: keyCodec,
|
||||
tx: &theTx,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func extractPubKeys(tx *tx.Tx, keyCodec cryptotypes.PublicKeyCodec) ([]crypto.PubKey, error) {
|
||||
if tx.AuthInfo == nil {
|
||||
return []crypto.PubKey{}, nil
|
||||
}
|
||||
|
||||
signerInfos := tx.AuthInfo.SignerInfos
|
||||
pks := make([]crypto.PubKey, len(signerInfos))
|
||||
for i, si := range signerInfos {
|
||||
pk, err := keyCodec.Decode(si.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pks[i] = pk
|
||||
}
|
||||
return pks, nil
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
|
@ -21,21 +20,20 @@ func TestDirectModeHandler(t *testing.T) {
|
|||
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
||||
interfaceRegistry.RegisterImplementations((*sdk.Msg)(nil), &testdata.TestMsg{})
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
pubKeyCdc := std.DefaultPublicKeyCodec{}
|
||||
|
||||
txConfig := NewTxConfig(marshaler, pubKeyCdc, []signingtypes.SignMode{signingtypes.SignMode_SIGN_MODE_DIRECT})
|
||||
txConfig := NewTxConfig(marshaler, []signingtypes.SignMode{signingtypes.SignMode_SIGN_MODE_DIRECT})
|
||||
txBuilder := txConfig.NewTxBuilder()
|
||||
|
||||
memo := "sometestmemo"
|
||||
msgs := []sdk.Msg{testdata.NewTestMsg(addr)}
|
||||
accSeq := uint64(2) // Arbitrary account sequence
|
||||
|
||||
pk, err := pubKeyCdc.Encode(pubkey)
|
||||
any, err := PubKeyToAny(pubkey)
|
||||
require.NoError(t, err)
|
||||
|
||||
var signerInfo []*txtypes.SignerInfo
|
||||
signerInfo = append(signerInfo, &txtypes.SignerInfo{
|
||||
PublicKey: pk,
|
||||
PublicKey: any,
|
||||
ModeInfo: &txtypes.ModeInfo{
|
||||
Sum: &txtypes.ModeInfo_Single_{
|
||||
Single: &txtypes.ModeInfo_Single{
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
@ -22,11 +21,10 @@ import (
|
|||
func TestDefaultTxDecoderError(t *testing.T) {
|
||||
registry := codectypes.NewInterfaceRegistry()
|
||||
cdc := codec.NewProtoCodec(registry)
|
||||
pubKeyCdc := std.DefaultPublicKeyCodec{}
|
||||
encoder := DefaultTxEncoder()
|
||||
decoder := DefaultTxDecoder(cdc, pubKeyCdc)
|
||||
decoder := DefaultTxDecoder(cdc)
|
||||
|
||||
builder := newBuilder(pubKeyCdc)
|
||||
builder := newBuilder()
|
||||
err := builder.SetMsgs(testdata.NewTestMsg())
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -44,8 +42,7 @@ func TestDefaultTxDecoderError(t *testing.T) {
|
|||
func TestUnknownFields(t *testing.T) {
|
||||
registry := codectypes.NewInterfaceRegistry()
|
||||
cdc := codec.NewProtoCodec(registry)
|
||||
pubKeyCdc := std.DefaultPublicKeyCodec{}
|
||||
decoder := DefaultTxDecoder(cdc, pubKeyCdc)
|
||||
decoder := DefaultTxDecoder(cdc)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -128,7 +125,7 @@ func TestUnknownFields(t *testing.T) {
|
|||
|
||||
if tt.shouldAminoErr != "" {
|
||||
handler := signModeLegacyAminoJSONHandler{}
|
||||
decoder := DefaultTxDecoder(codec.NewProtoCodec(codectypes.NewInterfaceRegistry()), std.DefaultPublicKeyCodec{})
|
||||
decoder := DefaultTxDecoder(codec.NewProtoCodec(codectypes.NewInterfaceRegistry()))
|
||||
theTx, err := decoder(txBz)
|
||||
require.NoError(t, err)
|
||||
_, err = handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signing.SignerData{}, theTx)
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
|
@ -34,7 +33,7 @@ func buildTx(t *testing.T, bldr *wrapper) {
|
|||
}
|
||||
|
||||
func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
|
||||
bldr := newBuilder(std.DefaultPublicKeyCodec{})
|
||||
bldr := newBuilder()
|
||||
buildTx(t, bldr)
|
||||
tx := bldr.GetTx()
|
||||
|
||||
|
@ -65,7 +64,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
|
||||
// expect error with extension options
|
||||
bldr = newBuilder(std.DefaultPublicKeyCodec{})
|
||||
bldr = newBuilder()
|
||||
buildTx(t, bldr)
|
||||
any, err := cdctypes.NewAnyWithValue(testdata.NewTestMsg())
|
||||
require.NoError(t, err)
|
||||
|
@ -75,7 +74,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
|
||||
// expect error with non-critical extension options
|
||||
bldr = newBuilder(std.DefaultPublicKeyCodec{})
|
||||
bldr = newBuilder()
|
||||
buildTx(t, bldr)
|
||||
bldr.tx.Body.NonCriticalExtensionOptions = []*cdctypes.Any{any}
|
||||
tx = bldr.GetTx()
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx"
|
||||
|
@ -109,15 +110,15 @@ func (g config) MarshalSignatureJSON(sigs []signing.SignatureV2) ([]byte, error)
|
|||
descs := make([]*signing.SignatureDescriptor, len(sigs))
|
||||
|
||||
for i, sig := range sigs {
|
||||
publicKey, err := g.pubkeyCodec.Encode(sig.PubKey)
|
||||
descData := signing.SignatureDataToProto(sig.Data)
|
||||
|
||||
any, err := PubKeyToAny(sig.PubKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
descData := signing.SignatureDataToProto(sig.Data)
|
||||
|
||||
descs[i] = &signing.SignatureDescriptor{
|
||||
PublicKey: publicKey,
|
||||
PublicKey: any,
|
||||
Data: descData,
|
||||
}
|
||||
}
|
||||
|
@ -136,10 +137,7 @@ func (g config) UnmarshalSignatureJSON(bz []byte) ([]signing.SignatureV2, error)
|
|||
|
||||
sigs := make([]signing.SignatureV2, len(sigDescs.Signatures))
|
||||
for i, desc := range sigDescs.Signatures {
|
||||
pubKey, err := g.pubkeyCodec.Decode(desc.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pubKey, _ := desc.PublicKey.GetCachedValue().(crypto.PubKey)
|
||||
|
||||
data := signing.SignatureDataFromProto(desc.Data)
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||
|
@ -30,9 +29,9 @@ func (cs ConsensusState) GetRoot() exported.Root {
|
|||
|
||||
// GetPubKey unmarshals the public key into a tmcrypto.PubKey type.
|
||||
func (cs ConsensusState) GetPubKey() tmcrypto.PubKey {
|
||||
publicKey, err := std.DefaultPublicKeyCodec{}.Decode(cs.PublicKey)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
publicKey, ok := cs.PublicKey.GetCachedValue().(tmcrypto.PubKey)
|
||||
if !ok {
|
||||
panic("ConsensusState PublicKey is not crypto.PubKey")
|
||||
}
|
||||
|
||||
return publicKey
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||
|
@ -27,9 +26,9 @@ func (h Header) GetHeight() exported.Height {
|
|||
|
||||
// GetPubKey unmarshals the new public key into a tmcrypto.PubKey type.
|
||||
func (h Header) GetPubKey() tmcrypto.PubKey {
|
||||
publicKey, err := std.DefaultPublicKeyCodec{}.Decode(h.NewPublicKey)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
publicKey, ok := h.NewPublicKey.GetCachedValue().(tmcrypto.PubKey)
|
||||
if !ok {
|
||||
panic("Header NewPublicKey is not crypto.PubKey")
|
||||
}
|
||||
|
||||
return publicKey
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
)
|
||||
|
||||
// Interface implementation checks.
|
||||
var _, _, _, _ codectypes.UnpackInterfacesMessage = &ClientState{}, &ConsensusState{}, &Header{}, &HeaderData{}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (cs ClientState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return cs.ConsensusState.UnpackInterfaces(unpacker)
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (cs ConsensusState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpacker.UnpackAny(cs.PublicKey, new(crypto.PubKey))
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (h Header) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpacker.UnpackAny(h.NewPublicKey, new(crypto.PubKey))
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
|
||||
func (hd HeaderData) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpacker.UnpackAny(hd.NewPubKey, new(crypto.PubKey))
|
||||
}
|
|
@ -5,10 +5,10 @@ package types
|
|||
|
||||
import (
|
||||
fmt "fmt"
|
||||
types1 "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
types "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
types2 "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||
types3 "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
_ "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
types1 "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||
types2 "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
|
@ -77,7 +77,7 @@ var xxx_messageInfo_ClientState proto.InternalMessageInfo
|
|||
// is contained in the "height" key used in storing the consensus state.
|
||||
type ConsensusState struct {
|
||||
// public key of the solo machine
|
||||
PublicKey *types.PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty" yaml:"public_key"`
|
||||
PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty" yaml:"public_key"`
|
||||
// diversifier allows the same public key to be re-used across different solo machine clients
|
||||
// (potentially on different chains) without being considered misbehaviour.
|
||||
Diversifier string `protobuf:"bytes,2,opt,name=diversifier,proto3" json:"diversifier,omitempty"`
|
||||
|
@ -120,11 +120,11 @@ var xxx_messageInfo_ConsensusState proto.InternalMessageInfo
|
|||
// Header defines a solo machine consensus header
|
||||
type Header struct {
|
||||
// sequence to update solo machine public key at
|
||||
Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"`
|
||||
Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
|
||||
NewPublicKey *types.PublicKey `protobuf:"bytes,4,opt,name=new_public_key,json=newPublicKey,proto3" json:"new_public_key,omitempty" yaml:"new_public_key"`
|
||||
NewDiversifier string `protobuf:"bytes,5,opt,name=new_diversifier,json=newDiversifier,proto3" json:"new_diversifier,omitempty" yaml:"new_diversifier"`
|
||||
Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"`
|
||||
Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
|
||||
NewPublicKey *types.Any `protobuf:"bytes,4,opt,name=new_public_key,json=newPublicKey,proto3" json:"new_public_key,omitempty" yaml:"new_public_key"`
|
||||
NewDiversifier string `protobuf:"bytes,5,opt,name=new_diversifier,json=newDiversifier,proto3" json:"new_diversifier,omitempty" yaml:"new_diversifier"`
|
||||
}
|
||||
|
||||
func (m *Header) Reset() { *m = Header{} }
|
||||
|
@ -326,7 +326,7 @@ var xxx_messageInfo_SignBytes proto.InternalMessageInfo
|
|||
// HeaderData returns the SignBytes data for misbehaviour verification.
|
||||
type HeaderData struct {
|
||||
// header public key
|
||||
NewPubKey *types.PublicKey `protobuf:"bytes,1,opt,name=new_pub_key,json=newPubKey,proto3" json:"new_pub_key,omitempty" yaml:"new_pub_key"`
|
||||
NewPubKey *types.Any `protobuf:"bytes,1,opt,name=new_pub_key,json=newPubKey,proto3" json:"new_pub_key,omitempty" yaml:"new_pub_key"`
|
||||
// header diversifier
|
||||
NewDiversifier string `protobuf:"bytes,2,opt,name=new_diversifier,json=newDiversifier,proto3" json:"new_diversifier,omitempty" yaml:"new_diversifier"`
|
||||
}
|
||||
|
@ -366,8 +366,8 @@ var xxx_messageInfo_HeaderData proto.InternalMessageInfo
|
|||
|
||||
// ClientStateData returns the SignBytes data for client state verification.
|
||||
type ClientStateData struct {
|
||||
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
ClientState *types1.Any `protobuf:"bytes,2,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
|
||||
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
ClientState *types.Any `protobuf:"bytes,2,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty" yaml:"client_state"`
|
||||
}
|
||||
|
||||
func (m *ClientStateData) Reset() { *m = ClientStateData{} }
|
||||
|
@ -405,8 +405,8 @@ var xxx_messageInfo_ClientStateData proto.InternalMessageInfo
|
|||
|
||||
// ConsensusStateSignBytes returns the SignBytes data for consensus state verification.
|
||||
type ConsensusStateData struct {
|
||||
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
ConsensusState *types1.Any `protobuf:"bytes,2,opt,name=consensus_state,json=consensusState,proto3" json:"consensus_state,omitempty" yaml:"consensus_state"`
|
||||
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
ConsensusState *types.Any `protobuf:"bytes,2,opt,name=consensus_state,json=consensusState,proto3" json:"consensus_state,omitempty" yaml:"consensus_state"`
|
||||
}
|
||||
|
||||
func (m *ConsensusStateData) Reset() { *m = ConsensusStateData{} }
|
||||
|
@ -445,7 +445,7 @@ var xxx_messageInfo_ConsensusStateData proto.InternalMessageInfo
|
|||
// ConnectionStateSignBytes returns the SignBytes data for connection state verification.
|
||||
type ConnectionStateData struct {
|
||||
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Connection *types2.ConnectionEnd `protobuf:"bytes,2,opt,name=connection,proto3" json:"connection,omitempty"`
|
||||
Connection *types1.ConnectionEnd `protobuf:"bytes,2,opt,name=connection,proto3" json:"connection,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ConnectionStateData) Reset() { *m = ConnectionStateData{} }
|
||||
|
@ -484,7 +484,7 @@ var xxx_messageInfo_ConnectionStateData proto.InternalMessageInfo
|
|||
// ChannelStateSignBytes returns the SignBytes data for channel state verification.
|
||||
type ChannelStateData struct {
|
||||
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Channel *types3.Channel `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`
|
||||
Channel *types2.Channel `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ChannelStateData) Reset() { *m = ChannelStateData{} }
|
||||
|
@ -750,72 +750,71 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_6cc2ee18f7f86d4e = []byte{
|
||||
// 1030 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6f, 0xe3, 0x44,
|
||||
0x14, 0xae, 0xb3, 0x61, 0x69, 0x5e, 0xb2, 0x6d, 0xf1, 0x66, 0x97, 0xb4, 0x40, 0x1c, 0x59, 0x02,
|
||||
0x7a, 0x59, 0x5b, 0x59, 0x24, 0x0e, 0x15, 0x1c, 0x92, 0x2c, 0x12, 0x2c, 0x02, 0x2a, 0x77, 0x91,
|
||||
0x58, 0x58, 0x64, 0x8d, 0xed, 0x49, 0x62, 0xd5, 0x99, 0x31, 0xf6, 0x24, 0x69, 0x90, 0x38, 0x70,
|
||||
0x83, 0x1b, 0x12, 0x17, 0x8e, 0xfc, 0x07, 0x24, 0x7e, 0x03, 0x12, 0x97, 0xe5, 0xc6, 0x29, 0x42,
|
||||
0xed, 0x3f, 0xc8, 0x2f, 0x40, 0x9e, 0x19, 0x27, 0xb6, 0xdb, 0xa4, 0x2a, 0xec, 0xc9, 0xe3, 0x99,
|
||||
0x6f, 0xbe, 0xf7, 0xe6, 0x9b, 0xf7, 0xe6, 0x3d, 0x68, 0xfb, 0x8e, 0x6b, 0x06, 0xfe, 0x60, 0xc8,
|
||||
0xdc, 0xc0, 0xc7, 0x84, 0xc5, 0x66, 0x4c, 0x03, 0x3a, 0x42, 0xee, 0xd0, 0x27, 0xd8, 0x9c, 0xb4,
|
||||
0xb3, 0xbf, 0x46, 0x18, 0x51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 0xd6, 0x6a, 0x42, 0xed, 0xc3, 0x0e, 0xc1, 0x53, 0x3b, 0xa3, 0x44, 0xf9, 0x26, 0x4a, 0xec,
|
||||
0x2f, 0xe6, 0xda, 0x3d, 0xa1, 0x44, 0x9e, 0x46, 0xb7, 0x6a, 0x04, 0x4f, 0x97, 0xc0, 0x24, 0x50,
|
||||
0x13, 0x40, 0x56, 0x94, 0x97, 0x12, 0x51, 0xb2, 0x21, 0x53, 0x00, 0xe8, 0x56, 0xe2, 0xda, 0xa3,
|
||||
0xd5, 0x84, 0x54, 0xe5, 0xcf, 0x12, 0xd4, 0x3e, 0xf1, 0x63, 0x07, 0x0f, 0xd1, 0xc4, 0xa7, 0xe3,
|
||||
0x48, 0x6d, 0x43, 0x45, 0x84, 0xa7, 0xed, 0x7b, 0x5c, 0x9c, 0x4a, 0xb7, 0xbe, 0x98, 0x6b, 0x7b,
|
||||
0x32, 0x10, 0xd3, 0x25, 0xdd, 0xda, 0x16, 0xe3, 0x8f, 0xbc, 0x9c, 0x9c, 0xa5, 0x82, 0x9c, 0x21,
|
||||
0xdc, 0x59, 0xea, 0x63, 0x53, 0x92, 0x26, 0x43, 0xfb, 0xda, 0x64, 0x38, 0x49, 0x77, 0x75, 0x88,
|
||||
0xf7, 0x08, 0x31, 0xd4, 0x6d, 0x2c, 0xe6, 0x5a, 0x5d, 0x78, 0x91, 0x63, 0xd4, 0xad, 0xda, 0xf2,
|
||||
0xff, 0x33, 0x52, 0xb0, 0xc8, 0xa6, 0x54, 0xde, 0xc1, 0x8b, 0xb2, 0xc8, 0xa6, 0x34, 0x6b, 0xf1,
|
||||
0xc9, 0x94, 0x1e, 0x6d, 0x27, 0x4a, 0xfe, 0x92, 0xa8, 0xf9, 0x18, 0xf6, 0x8a, 0x2c, 0xf9, 0x90,
|
||||
0x51, 0x8a, 0x21, 0xa3, 0x42, 0xd9, 0x43, 0x0c, 0x71, 0xdd, 0x6a, 0x16, 0x1f, 0xcb, 0x9b, 0xf9,
|
||||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0x2d, 0x65,
|
||||
0xb3, 0x10, 0xc7, 0xce, 0x6d, 0x1e, 0xb4, 0xef, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x29,
|
||||
0x18, 0x98, 0xc3, 0x0a, 0x00, 0x00,
|
||||
// 1012 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xe3, 0x44,
|
||||
0x14, 0xaf, 0xb3, 0x61, 0x69, 0x5e, 0xb2, 0x6d, 0xf1, 0x66, 0x97, 0xb4, 0x40, 0x1c, 0xf9, 0x00,
|
||||
0xbd, 0xac, 0xad, 0x2c, 0x12, 0x87, 0x0a, 0x0e, 0x49, 0x16, 0x09, 0xca, 0xbf, 0xca, 0xdd, 0x95,
|
||||
0x58, 0xb4, 0x92, 0x35, 0xb6, 0xa7, 0x89, 0x55, 0x67, 0xc6, 0xd8, 0x93, 0xa4, 0x41, 0xe2, 0x00,
|
||||
0x27, 0xb8, 0x71, 0xe4, 0x88, 0x90, 0xf8, 0x2e, 0x48, 0x5c, 0x96, 0x1b, 0xa7, 0x08, 0xb5, 0xdf,
|
||||
0x20, 0x9f, 0x00, 0x79, 0x66, 0x9c, 0xd8, 0xee, 0xc6, 0x15, 0xb0, 0xa7, 0xf9, 0xf3, 0xde, 0xfc,
|
||||
0xde, 0x7b, 0xbf, 0x79, 0x6f, 0xe6, 0x41, 0xd7, 0x77, 0x5c, 0x33, 0xf0, 0x87, 0x23, 0xe6, 0x06,
|
||||
0x3e, 0x26, 0x2c, 0x36, 0x63, 0x1a, 0xd0, 0x31, 0x72, 0x47, 0x3e, 0xc1, 0xe6, 0xb4, 0x9b, 0x5d,
|
||||
0x1a, 0x61, 0x44, 0x19, 0x55, 0x35, 0xdf, 0x71, 0x8d, 0xec, 0x11, 0x23, 0xab, 0x33, 0xed, 0x1e,
|
||||
0xbc, 0xe3, 0xd2, 0x78, 0x4c, 0x63, 0xd3, 0x41, 0x31, 0x36, 0xdd, 0x68, 0x1e, 0x32, 0x6a, 0x4e,
|
||||
0xbb, 0x0e, 0x66, 0xa8, 0x2b, 0x97, 0x02, 0xe9, 0x20, 0x41, 0x32, 0x5d, 0x4a, 0x08, 0x76, 0x99,
|
||||
0x4f, 0x49, 0x66, 0x2a, 0x15, 0xf6, 0xb9, 0xc2, 0x08, 0x11, 0x82, 0x83, 0x74, 0x94, 0xa2, 0xe6,
|
||||
0x90, 0x0e, 0x29, 0x9f, 0x9a, 0xc9, 0x2c, 0x3d, 0x30, 0xa4, 0x74, 0x18, 0x60, 0x93, 0xaf, 0x9c,
|
||||
0xc9, 0x99, 0x89, 0xc8, 0x5c, 0x88, 0xf4, 0x3f, 0x2b, 0x50, 0x1f, 0x70, 0x87, 0x4f, 0x19, 0x62,
|
||||
0x58, 0x3d, 0x80, 0xed, 0x18, 0x7f, 0x3d, 0xc1, 0xc4, 0xc5, 0x2d, 0xa5, 0xa3, 0x1c, 0x56, 0xad,
|
||||
0xd5, 0x5a, 0x1d, 0xc0, 0xee, 0x59, 0x44, 0xbf, 0xc1, 0xc4, 0x5e, 0xa9, 0x54, 0x12, 0x95, 0xfe,
|
||||
0xc1, 0x72, 0xa1, 0xdd, 0x9f, 0xa3, 0x71, 0x70, 0xa4, 0x17, 0x14, 0x74, 0x6b, 0x47, 0xec, 0x9c,
|
||||
0xa6, 0x20, 0x0c, 0x76, 0x5d, 0x4a, 0x62, 0x4c, 0xe2, 0x49, 0x6c, 0xc7, 0x89, 0xcd, 0xd6, 0xad,
|
||||
0x8e, 0x72, 0x58, 0x7f, 0x68, 0x1a, 0x37, 0x30, 0x68, 0x0c, 0xd2, 0x73, 0xdc, 0xd5, 0xac, 0xd5,
|
||||
0x02, 0xa2, 0x6e, 0xed, 0xb8, 0x39, 0x5d, 0x15, 0xc3, 0x1b, 0x28, 0x08, 0xe8, 0xcc, 0x9e, 0x84,
|
||||
0x1e, 0x62, 0xd8, 0x46, 0x67, 0x0c, 0x47, 0x76, 0x18, 0xd1, 0x90, 0xc6, 0x28, 0x68, 0x55, 0x3b,
|
||||
0xca, 0xe1, 0x76, 0xff, 0xed, 0xe5, 0x42, 0xd3, 0x05, 0x60, 0x89, 0xb2, 0x6e, 0xb5, 0xb8, 0xf4,
|
||||
0x09, 0x17, 0xf6, 0x12, 0xd9, 0x89, 0x14, 0x1d, 0x55, 0x7f, 0xf8, 0x45, 0xdb, 0xd2, 0x7f, 0x55,
|
||||
0x60, 0x27, 0xef, 0xab, 0x7a, 0x0c, 0x10, 0x4e, 0x9c, 0xc0, 0x77, 0xed, 0x73, 0x3c, 0xe7, 0xc4,
|
||||
0xd6, 0x1f, 0x36, 0x0d, 0x71, 0x2d, 0x46, 0x7a, 0x2d, 0x46, 0x8f, 0xcc, 0xfb, 0xf7, 0x96, 0x0b,
|
||||
0xed, 0x35, 0xe1, 0xc4, 0xfa, 0x84, 0x6e, 0xd5, 0xc4, 0xe2, 0x13, 0x3c, 0x57, 0x3b, 0x50, 0xf7,
|
||||
0xfc, 0x29, 0x8e, 0x62, 0xff, 0xcc, 0xc7, 0x11, 0xbf, 0x82, 0x9a, 0x95, 0xdd, 0x52, 0xdf, 0x84,
|
||||
0x1a, 0xf3, 0xc7, 0x38, 0x66, 0x68, 0x1c, 0x72, 0x76, 0xab, 0xd6, 0x7a, 0x43, 0x3a, 0xf9, 0x7d,
|
||||
0x05, 0x6e, 0x7f, 0x84, 0x91, 0x87, 0xa3, 0xd2, 0x3b, 0xcf, 0x41, 0x55, 0x0a, 0x50, 0x89, 0x34,
|
||||
0xf6, 0x87, 0x04, 0xb1, 0x49, 0x24, 0xae, 0xb1, 0x61, 0xad, 0x37, 0xd4, 0x27, 0xb0, 0x43, 0xf0,
|
||||
0xcc, 0xce, 0x04, 0x5e, 0x2d, 0x09, 0x7c, 0x7f, 0xb9, 0xd0, 0xee, 0x89, 0xc0, 0xf3, 0xa7, 0x74,
|
||||
0xab, 0x41,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 0x67, 0x63,
|
||||
0x4c, 0xd8, 0x46, 0x0b, 0xed, 0x24, 0x9c, 0x54, 0x4b, 0x96, 0x6a, 0x66, 0x47, 0x7f, 0x0a, 0xfb,
|
||||
0x02, 0xab, 0xe7, 0x9e, 0x13, 0x3a, 0x0b, 0xb0, 0x37, 0xc4, 0xa5, 0x80, 0x87, 0xb0, 0x8b, 0xf2,
|
||||
0xaa, 0x12, 0xb5, 0xb8, 0xad, 0xbf, 0x07, 0x9d, 0x17, 0x42, 0xf7, 0x9c, 0xe4, 0x82, 0x36, 0x92,
|
||||
0xa2, 0x8f, 0xa0, 0xf9, 0x39, 0xbe, 0x60, 0x69, 0xd3, 0x61, 0x61, 0x77, 0xba, 0xd1, 0x9b, 0xf7,
|
||||
0xe1, 0x0e, 0xc1, 0x17, 0x2c, 0x69, 0x59, 0xec, 0x08, 0xbb, 0x53, 0xd9, 0xd3, 0x64, 0x9e, 0xbf,
|
||||
0x9c, 0x58, 0xb7, 0xea, 0x44, 0x40, 0x27, 0xa8, 0xfd, 0x67, 0xbf, 0x5f, 0xb6, 0x95, 0xe7, 0x97,
|
||||
0x6d, 0xe5, 0xef, 0xcb, 0xb6, 0xf2, 0xd3, 0x55, 0x7b, 0xeb, 0xf9, 0x55, 0x7b, 0xeb, 0xaf, 0xab,
|
||||
0xf6, 0xd6, 0x57, 0xfd, 0xa1, 0xcf, 0x46, 0x13, 0xc7, 0x70, 0xe9, 0xd8, 0x94, 0xad, 0x9f, 0x18,
|
||||
0x1e, 0xc4, 0xde, 0xb9, 0x79, 0x61, 0xae, 0x5a, 0xcc, 0x07, 0x2f, 0xea, 0x31, 0xd9, 0x3c, 0xc4,
|
||||
0xb1, 0x73, 0x9b, 0x27, 0xed, 0xbb, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x34, 0x99, 0x52,
|
||||
0x90, 0x0a, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *ClientState) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -2026,7 +2025,7 @@ func (m *ConsensusState) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.PublicKey == nil {
|
||||
m.PublicKey = &types.PublicKey{}
|
||||
m.PublicKey = &types.Any{}
|
||||
}
|
||||
if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
@ -2238,7 +2237,7 @@ func (m *Header) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.NewPublicKey == nil {
|
||||
m.NewPublicKey = &types.PublicKey{}
|
||||
m.NewPublicKey = &types.Any{}
|
||||
}
|
||||
if err := m.NewPublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
@ -2919,7 +2918,7 @@ func (m *HeaderData) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.NewPubKey == nil {
|
||||
m.NewPubKey = &types.PublicKey{}
|
||||
m.NewPubKey = &types.Any{}
|
||||
}
|
||||
if err := m.NewPubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
@ -3074,7 +3073,7 @@ func (m *ClientStateData) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.ClientState == nil {
|
||||
m.ClientState = &types1.Any{}
|
||||
m.ClientState = &types.Any{}
|
||||
}
|
||||
if err := m.ClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
@ -3197,7 +3196,7 @@ func (m *ConsensusStateData) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.ConsensusState == nil {
|
||||
m.ConsensusState = &types1.Any{}
|
||||
m.ConsensusState = &types.Any{}
|
||||
}
|
||||
if err := m.ConsensusState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
@ -3320,7 +3319,7 @@ func (m *ConnectionStateData) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Connection == nil {
|
||||
m.Connection = &types2.ConnectionEnd{}
|
||||
m.Connection = &types1.ConnectionEnd{}
|
||||
}
|
||||
if err := m.Connection.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
@ -3443,7 +3442,7 @@ func (m *ChannelStateData) Unmarshal(dAtA []byte) error {
|
|||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Channel == nil {
|
||||
m.Channel = &types3.Channel{}
|
||||
m.Channel = &types2.Channel{}
|
||||
}
|
||||
if err := m.Channel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
|
|
@ -3,9 +3,15 @@ package types_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||
|
@ -59,3 +65,51 @@ func (suite *SoloMachineTestSuite) GetInvalidProof() []byte {
|
|||
|
||||
return invalidProof
|
||||
}
|
||||
|
||||
func TestUnpackInterfaces_Header(t *testing.T) {
|
||||
registry := testdata.NewTestInterfaceRegistry()
|
||||
cryptocodec.RegisterInterfaces(registry)
|
||||
|
||||
pk := secp256k1.GenPrivKey().PubKey().(cryptotypes.PubKey)
|
||||
any, err := codectypes.NewAnyWithValue(pk)
|
||||
require.NoError(t, err)
|
||||
|
||||
header := types.Header{
|
||||
NewPublicKey: any,
|
||||
}
|
||||
bz, err := header.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
var header2 types.Header
|
||||
err = header2.Unmarshal(bz)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = codectypes.UnpackInterfaces(header2, registry)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, pk, header2.NewPublicKey.GetCachedValue())
|
||||
}
|
||||
|
||||
func TestUnpackInterfaces_HeaderData(t *testing.T) {
|
||||
registry := testdata.NewTestInterfaceRegistry()
|
||||
cryptocodec.RegisterInterfaces(registry)
|
||||
|
||||
pk := secp256k1.GenPrivKey().PubKey().(cryptotypes.PubKey)
|
||||
any, err := codectypes.NewAnyWithValue(pk)
|
||||
require.NoError(t, err)
|
||||
|
||||
hd := types.HeaderData{
|
||||
NewPubKey: any,
|
||||
}
|
||||
bz, err := hd.Marshal()
|
||||
require.NoError(t, err)
|
||||
|
||||
var hd2 types.HeaderData
|
||||
err = hd2.Unmarshal(bz)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = codectypes.UnpackInterfaces(hd2, registry)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, pk, hd2.NewPubKey.GetCachedValue())
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package types_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||
|
@ -70,7 +70,7 @@ func (suite *SoloMachineTestSuite) TestCheckHeaderAndUpdateState() {
|
|||
cs := suite.solomachine.ClientState()
|
||||
h := suite.solomachine.CreateHeader()
|
||||
|
||||
publicKey, err := std.DefaultPublicKeyCodec{}.Encode(suite.solomachine.PublicKey)
|
||||
publicKey, err := tx.PubKeyToAny(suite.solomachine.PublicKey)
|
||||
suite.NoError(err)
|
||||
|
||||
data := &types.HeaderData{
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/std"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/tx"
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/exported"
|
||||
solomachinetypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/solomachine/types"
|
||||
|
@ -31,7 +31,7 @@ type Solomachine struct {
|
|||
// NewSolomachine returns a new solomachine instance with a generated private/public
|
||||
// key pair and a sequence starting at 1.
|
||||
func NewSolomachine(t *testing.T, cdc codec.BinaryMarshaler, clientID, diversifier string) *Solomachine {
|
||||
privKey := ed25519.GenPrivKey()
|
||||
privKey := secp256k1.GenPrivKey()
|
||||
|
||||
return &Solomachine{
|
||||
t: t,
|
||||
|
@ -53,7 +53,7 @@ func (solo *Solomachine) ClientState() *solomachinetypes.ClientState {
|
|||
|
||||
// ConsensusState returns a new solo machine ConsensusState instance
|
||||
func (solo *Solomachine) ConsensusState() *solomachinetypes.ConsensusState {
|
||||
publicKey, err := std.DefaultPublicKeyCodec{}.Encode(solo.PublicKey)
|
||||
publicKey, err := tx.PubKeyToAny(solo.PublicKey)
|
||||
require.NoError(solo.t, err)
|
||||
|
||||
return &solomachinetypes.ConsensusState{
|
||||
|
@ -72,9 +72,9 @@ func (solo *Solomachine) GetHeight() exported.Height {
|
|||
// necessary signature to construct a valid solo machine header.
|
||||
func (solo *Solomachine) CreateHeader() *solomachinetypes.Header {
|
||||
// generate new private key and signature for header
|
||||
newPrivKey := ed25519.GenPrivKey()
|
||||
newPrivKey := secp256k1.GenPrivKey()
|
||||
|
||||
publicKey, err := std.DefaultPublicKeyCodec{}.Encode(newPrivKey.PubKey())
|
||||
publicKey, err := tx.PubKeyToAny(newPrivKey.PubKey())
|
||||
require.NoError(solo.t, err)
|
||||
|
||||
data := &solomachinetypes.HeaderData{
|
||||
|
|
Loading…
Reference in New Issue