Merge branch 'master' into adr_gov_split_vote
This commit is contained in:
commit
17ba10f02c
@ -65,6 +65,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* `server/types.AppExporter` requires extra argument: `AppOptions`.
|
||||
* `server.AddCommands` requires extra argument: `addStartFlags types.ModuleInitFlags`
|
||||
* `x/crisis.NewAppModule` has a new attribute: `skipGenesisInvariants`. [PR](https://github.com/cosmos/cosmos-sdk/pull/7764)
|
||||
* [#7918](https://github.com/cosmos/cosmos-sdk/pull/7918) Add x/capability safety checks:
|
||||
* All outward facing APIs will now check that capability is not nil and name is not empty before performing any state-machine changes
|
||||
* `SetIndex` has been renamed to `InitializeIndex`
|
||||
|
||||
### Features
|
||||
|
||||
|
||||
5
Makefile
5
Makefile
@ -361,6 +361,11 @@ proto-all: proto-tools proto-gen proto-lint proto-check-breaking proto-swagger-g
|
||||
proto-gen:
|
||||
@./scripts/protocgen.sh
|
||||
|
||||
proto-gen-docker:
|
||||
@echo "Generating Protobuf files"
|
||||
docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh
|
||||
.PHONY: proto-gen-docker
|
||||
|
||||
proto-format:
|
||||
@echo "Formatting Protobuf files"
|
||||
docker run -v $(shell pwd):/workspace \
|
||||
|
||||
@ -6,8 +6,7 @@ DESTDIR=${DESTDIR:-}
|
||||
PREFIX=${PREFIX:-/usr/local}
|
||||
UNAME_S="$(uname -s 2>/dev/null)"
|
||||
UNAME_M="$(uname -m 2>/dev/null)"
|
||||
BUF_VERSION=0.11.0
|
||||
PROTOC_VERSION=3.13.0
|
||||
BUF_VERSION=0.30.0
|
||||
PROTOC_GRPC_GATEWAY_VERSION=1.14.7
|
||||
|
||||
f_abort() {
|
||||
@ -61,19 +60,6 @@ f_needs_install() {
|
||||
return 0
|
||||
}
|
||||
|
||||
f_install_protoc() {
|
||||
f_print_installing_with_padding proto_c
|
||||
f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc" || return 0
|
||||
|
||||
pushd "${TEMPDIR}" >/dev/null
|
||||
curl -o "${PROTOC_ZIP}" -sSL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"
|
||||
unzip -q -o ${PROTOC_ZIP} -d ${DESTDIR}/${PREFIX} bin/protoc; \
|
||||
unzip -q -o ${PROTOC_ZIP} -d ${DESTDIR}/${PREFIX} 'include/*'; \
|
||||
rm -f ${PROTOC_ZIP}
|
||||
popd >/dev/null
|
||||
f_print_done
|
||||
}
|
||||
|
||||
f_install_buf() {
|
||||
f_print_installing_with_padding buf
|
||||
f_needs_install "${DESTDIR}/${PREFIX}/bin/buf" || return 0
|
||||
@ -83,18 +69,6 @@ f_install_buf() {
|
||||
f_print_done
|
||||
}
|
||||
|
||||
f_install_protoc_gen_gocosmos() {
|
||||
f_print_installing_with_padding protoc-gen-gocosmos
|
||||
|
||||
if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then
|
||||
echo -e "\tPlease run this command from somewhere inside the cosmos-sdk folder."
|
||||
return 1
|
||||
fi
|
||||
|
||||
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null
|
||||
f_print_done
|
||||
}
|
||||
|
||||
f_install_protoc_gen_grpc_gateway() {
|
||||
f_print_installing_with_padding protoc-gen-grpc-gateway
|
||||
f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc-gen-grpc-gateway" || return 0
|
||||
@ -121,7 +95,6 @@ f_install_protoc_gen_swagger() {
|
||||
|
||||
f_ensure_tools
|
||||
f_ensure_dirs
|
||||
f_install_protoc
|
||||
f_install_buf
|
||||
f_install_protoc_gen_gocosmos
|
||||
f_install_protoc_gen_grpc_gateway
|
||||
|
||||
@ -4,9 +4,13 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// LaunchProcess runs a subprocess and returns when the subprocess exits,
|
||||
@ -39,6 +43,15 @@ func LaunchProcess(cfg *Config, args []string, stdout, stderr io.Writer) (bool,
|
||||
return false, fmt.Errorf("launching process %s %s: %w", bin, strings.Join(args, " "), err)
|
||||
}
|
||||
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGQUIT, syscall.SIGTERM)
|
||||
go func() {
|
||||
sig := <-sigs
|
||||
if err := cmd.Process.Signal(sig); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}()
|
||||
|
||||
// three ways to exit - command ends, find regexp in scanOut, find regexp in scanErr
|
||||
upgradeInfo, err := WaitForUpgradeOrExit(cmd, scanOut, scanErr)
|
||||
if err != nil {
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
@ -17,6 +18,10 @@ func FromTmProtoPublicKey(protoPk tmprotocrypto.PublicKey) (cryptotypes.PubKey,
|
||||
return &ed25519.PubKey{
|
||||
Key: protoPk.Ed25519,
|
||||
}, nil
|
||||
case *tmprotocrypto.PublicKey_Secp256K1:
|
||||
return &secp256k1.PubKey{
|
||||
Key: protoPk.Secp256K1,
|
||||
}, nil
|
||||
default:
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "cannot convert %v from Tendermint public key", protoPk)
|
||||
}
|
||||
@ -31,6 +36,12 @@ func ToTmProtoPublicKey(pk cryptotypes.PubKey) (tmprotocrypto.PublicKey, error)
|
||||
Ed25519: pk.Key,
|
||||
},
|
||||
}, nil
|
||||
case *secp256k1.PubKey:
|
||||
return tmprotocrypto.PublicKey{
|
||||
Sum: &tmprotocrypto.PublicKey_Secp256K1{
|
||||
Secp256K1: pk.Key,
|
||||
},
|
||||
}, nil
|
||||
default:
|
||||
return tmprotocrypto.PublicKey{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "cannot convert %v to Tendermint public key", pk)
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
tmsecp256k1 "github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
@ -267,3 +268,56 @@ func TestMarshalAmino(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalAmino_BackwardsCompatibility(t *testing.T) {
|
||||
aminoCdc := codec.NewLegacyAmino()
|
||||
// Create Tendermint keys.
|
||||
tmPrivKey := tmsecp256k1.GenPrivKey()
|
||||
tmPubKey := tmPrivKey.PubKey()
|
||||
// Create our own keys, with the same private key as Tendermint's.
|
||||
privKey := &secp256k1.PrivKey{Key: []byte(tmPrivKey)}
|
||||
pubKey := privKey.PubKey().(*secp256k1.PubKey)
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
tmKey interface{}
|
||||
ourKey interface{}
|
||||
marshalFn func(o interface{}) ([]byte, error)
|
||||
}{
|
||||
{
|
||||
"secp256k1 private key, binary",
|
||||
tmPrivKey,
|
||||
privKey,
|
||||
aminoCdc.MarshalBinaryBare,
|
||||
},
|
||||
{
|
||||
"secp256k1 private key, JSON",
|
||||
tmPrivKey,
|
||||
privKey,
|
||||
aminoCdc.MarshalJSON,
|
||||
},
|
||||
{
|
||||
"secp256k1 public key, binary",
|
||||
tmPubKey,
|
||||
pubKey,
|
||||
aminoCdc.MarshalBinaryBare,
|
||||
},
|
||||
{
|
||||
"secp256k1 public key, JSON",
|
||||
tmPubKey,
|
||||
pubKey,
|
||||
aminoCdc.MarshalJSON,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
// Make sure Amino encoding override is not breaking backwards compatibility.
|
||||
bz1, err := tc.marshalFn(tc.tmKey)
|
||||
require.NoError(t, err)
|
||||
bz2, err := tc.marshalFn(tc.ourKey)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, bz1, bz2)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ package cosmos.tx.v1beta1;
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/base/abci/v1beta1/abci.proto";
|
||||
import "cosmos/tx/v1beta1/tx.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/types/tx";
|
||||
|
||||
@ -17,6 +18,31 @@ service Service {
|
||||
rpc GetTx(GetTxRequest) returns (GetTxResponse) {
|
||||
option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}";
|
||||
}
|
||||
|
||||
// GetTxsEvent fetches txs by event.
|
||||
rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) {
|
||||
option (google.api.http).get = "/cosmos/tx/v1beta1/txs";
|
||||
}
|
||||
}
|
||||
|
||||
// GetTxsEventRequest is the request type for the Service.TxsByEvents
|
||||
// RPC method.
|
||||
message GetTxsEventRequest {
|
||||
// event is the transaction event type.
|
||||
string event = 1;
|
||||
// pagination defines an pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// GetTxsEventResponse is the response type for the Service.TxsByEvents
|
||||
// RPC method.
|
||||
message GetTxsEventResponse {
|
||||
// txs is the list of queried transactions.
|
||||
repeated cosmos.tx.v1beta1.Tx txs = 1;
|
||||
// tx_responses is the list of queried TxResponses.
|
||||
repeated cosmos.base.abci.v1beta1.TxResponse tx_responses = 2;
|
||||
// pagination defines an pagination for the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 3;
|
||||
}
|
||||
|
||||
// SimulateRequest is the request type for the Service.Simulate
|
||||
@ -35,15 +61,17 @@ message SimulateResponse {
|
||||
cosmos.base.abci.v1beta1.Result result = 2;
|
||||
}
|
||||
|
||||
// GetTx is the request type for the Service.GetTx
|
||||
// GetTxRequest is the request type for the Service.GetTx
|
||||
// RPC method.
|
||||
message GetTxRequest {
|
||||
// hash is the tx hash to query, encoded as a hex string.
|
||||
string hash = 1;
|
||||
}
|
||||
|
||||
|
||||
// GetTxResponse is the response type for the Service.GetTx method.
|
||||
message GetTxResponse {
|
||||
// tx is the queried transaction.
|
||||
cosmos.tx.v1beta1.Tx tx = 1;
|
||||
}
|
||||
// tx_response is the queried TxResponses.
|
||||
cosmos.base.abci.v1beta1.TxResponse tx_response = 2;
|
||||
}
|
||||
@ -148,7 +148,7 @@ message MsgRecvPacket {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof = 2;
|
||||
bytes proof_commitment = 2 [(gogoproto.moretags) = "yaml:\"proof_commitment\""];
|
||||
ibc.core.client.v1.Height proof_height = 3
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
string signer = 4;
|
||||
@ -163,7 +163,7 @@ message MsgTimeout {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof = 2;
|
||||
bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""];
|
||||
ibc.core.client.v1.Height proof_height = 3
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
uint64 next_sequence_recv = 4 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""];
|
||||
@ -179,7 +179,7 @@ message MsgTimeoutOnClose {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes proof = 2;
|
||||
bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""];
|
||||
bytes proof_close = 3 [(gogoproto.moretags) = "yaml:\"proof_close\""];
|
||||
ibc.core.client.v1.Height proof_height = 4
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
@ -197,7 +197,7 @@ message MsgAcknowledgement {
|
||||
|
||||
Packet packet = 1 [(gogoproto.nullable) = false];
|
||||
bytes acknowledgement = 2;
|
||||
bytes proof = 3;
|
||||
bytes proof_acked = 3 [(gogoproto.moretags) = "yaml:\"proof_acked\""];
|
||||
ibc.core.client.v1.Height proof_height = 4
|
||||
[(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false];
|
||||
string signer = 5;
|
||||
|
||||
@ -49,7 +49,6 @@ message Header {
|
||||
// of a sequence and two signatures over different messages at that sequence.
|
||||
message Misbehaviour {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
uint64 sequence = 2;
|
||||
SignatureAndData signature_one = 3 [(gogoproto.moretags) = "yaml:\"signature_one\""];
|
||||
|
||||
@ -5,7 +5,6 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tenderm
|
||||
|
||||
import "tendermint/types/validator.proto";
|
||||
import "tendermint/types/types.proto";
|
||||
import "tendermint/abci/types.proto";
|
||||
import "confio/proofs.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
@ -40,21 +39,18 @@ message ClientState {
|
||||
ibc.core.client.v1.Height latest_height = 7
|
||||
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"latest_height\""];
|
||||
|
||||
// Consensus params of the chain
|
||||
.tendermint.abci.ConsensusParams consensus_params = 8 [(gogoproto.moretags) = "yaml:\"consensus_params\""];
|
||||
|
||||
// Proof specifications used in verifying counterparty state
|
||||
repeated ics23.ProofSpec proof_specs = 9 [(gogoproto.moretags) = "yaml:\"proof_specs\""];
|
||||
repeated ics23.ProofSpec proof_specs = 8 [(gogoproto.moretags) = "yaml:\"proof_specs\""];
|
||||
|
||||
// Path at which next upgraded client will be committed
|
||||
string upgrade_path = 10 [(gogoproto.moretags) = "yaml:\"upgrade_path\""];
|
||||
string upgrade_path = 9 [(gogoproto.moretags) = "yaml:\"upgrade_path\""];
|
||||
|
||||
// This flag, when set to true, will allow governance to recover a client
|
||||
// which has expired
|
||||
bool allow_update_after_expiry = 11 [(gogoproto.moretags) = "yaml:\"allow_update_after_expiry\""];
|
||||
bool allow_update_after_expiry = 10 [(gogoproto.moretags) = "yaml:\"allow_update_after_expiry\""];
|
||||
// This flag, when set to true, will allow governance to unfreeze a client
|
||||
// whose chain has experienced a misbehaviour event
|
||||
bool allow_update_after_misbehaviour = 12 [(gogoproto.moretags) = "yaml:\"allow_update_after_misbehaviour\""];
|
||||
bool allow_update_after_misbehaviour = 11 [(gogoproto.moretags) = "yaml:\"allow_update_after_misbehaviour\""];
|
||||
}
|
||||
|
||||
// ConsensusState defines the consensus state from Tendermint.
|
||||
@ -76,12 +72,10 @@ message ConsensusState {
|
||||
// that implements Misbehaviour interface expected by ICS-02
|
||||
message Misbehaviour {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
string chain_id = 2 [(gogoproto.moretags) = "yaml:\"chain_id\""];
|
||||
Header header_1 = 3 [(gogoproto.customname) = "Header1", (gogoproto.moretags) = "yaml:\"header_1\""];
|
||||
Header header_2 = 4 [(gogoproto.customname) = "Header2", (gogoproto.moretags) = "yaml:\"header_2\""];
|
||||
Header header_1 = 2 [(gogoproto.customname) = "Header1", (gogoproto.moretags) = "yaml:\"header_1\""];
|
||||
Header header_2 = 3 [(gogoproto.customname) = "Header2", (gogoproto.moretags) = "yaml:\"header_2\""];
|
||||
}
|
||||
|
||||
// Header defines the Tendermint client consensus Header.
|
||||
|
||||
@ -8,7 +8,7 @@ set -eo pipefail
|
||||
|
||||
go install github.com/gogo/protobuf/protoc-gen-gogotypes
|
||||
|
||||
protoc -I. --gogotypes_out=./codec/types third_party/proto/google/protobuf/any.proto
|
||||
buf protoc -I. --gogotypes_out=./codec/types third_party/proto/google/protobuf/any.proto
|
||||
mv codec/types/third_party/proto/google/protobuf/any.pb.go codec/types
|
||||
rm -rf codec/types/third_party
|
||||
|
||||
|
||||
@ -2,9 +2,20 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
protoc_gen_gocosmos() {
|
||||
if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then
|
||||
echo -e "\tPlease run this command from somewhere inside the cosmos-sdk folder."
|
||||
return 1
|
||||
fi
|
||||
|
||||
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null
|
||||
}
|
||||
|
||||
protoc_gen_gocosmos
|
||||
|
||||
proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
|
||||
for dir in $proto_dirs; do
|
||||
protoc \
|
||||
buf protoc \
|
||||
-I "proto" \
|
||||
-I "third_party/proto" \
|
||||
--gocosmos_out=plugins=interfacetype+grpc,\
|
||||
@ -12,7 +23,7 @@ Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
|
||||
$(find "${dir}" -maxdepth 1 -name '*.proto')
|
||||
|
||||
# command to generate gRPC gateway (*.pb.gw.go in respective modules) files
|
||||
protoc \
|
||||
buf protoc \
|
||||
-I "proto" \
|
||||
-I "third_party/proto" \
|
||||
--grpc-gateway_out=logtostderr=true:. \
|
||||
@ -21,7 +32,7 @@ Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
|
||||
done
|
||||
|
||||
# generate codec/testdata proto code
|
||||
protoc -I "proto" -I "third_party/proto" -I "testutil/testdata" --gocosmos_out=plugins=interfacetype+grpc,\
|
||||
buf protoc -I "proto" -I "third_party/proto" -I "testutil/testdata" --gocosmos_out=plugins=interfacetype+grpc,\
|
||||
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. ./testutil/testdata/*.proto
|
||||
|
||||
# move proto files to the right places
|
||||
|
||||
@ -113,7 +113,7 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com
|
||||
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
|
||||
cmd.Flags().Int64(FlagHeight, -1, "Export state from a particular height (-1 means latest height)")
|
||||
cmd.Flags().Bool(FlagForZeroHeight, false, "Export state to start at height zero (perform preproccessing)")
|
||||
cmd.Flags().StringSlice(FlagJailAllowedAddrs, []string{}, "List of validators to not jail state export")
|
||||
cmd.Flags().StringSlice(FlagJailAllowedAddrs, []string{}, "Comma-separated list of operator addresses of jailed validators to unjail")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@ -315,7 +315,9 @@ func (rs *Store) TracingEnabled() bool {
|
||||
// LastCommitID implements Committer/CommitStore.
|
||||
func (rs *Store) LastCommitID() types.CommitID {
|
||||
if rs.lastCommitInfo == nil {
|
||||
return types.CommitID{}
|
||||
return types.CommitID{
|
||||
Version: getLatestVersion(rs.db),
|
||||
}
|
||||
}
|
||||
|
||||
return rs.lastCommitInfo.CommitID()
|
||||
|
||||
@ -35,7 +35,7 @@ func FilteredPaginate(
|
||||
}
|
||||
|
||||
if limit == 0 {
|
||||
limit = defaultLimit
|
||||
limit = DefaultLimit
|
||||
|
||||
// count total results when the limit is zero/not supplied
|
||||
countTotal = true
|
||||
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/store/types"
|
||||
)
|
||||
|
||||
// defaultLimit is the default `limit` for queries
|
||||
// if the `limit` is not supplied, paginate will use `defaultLimit`
|
||||
const defaultLimit = 100
|
||||
// DefaultLimit is the default `limit` for queries
|
||||
// if the `limit` is not supplied, paginate will use `DefaultLimit`
|
||||
const DefaultLimit = 100
|
||||
|
||||
// Paginate does pagination of all the results in the PrefixStore based on the
|
||||
// provided PageRequest. onResult should be used to do actual unmarshaling.
|
||||
@ -33,7 +33,7 @@ func Paginate(
|
||||
}
|
||||
|
||||
if limit == 0 {
|
||||
limit = defaultLimit
|
||||
limit = DefaultLimit
|
||||
|
||||
// count total results when the limit is zero/not supplied
|
||||
countTotal = true
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
query "github.com/cosmos/cosmos-sdk/types/query"
|
||||
grpc1 "github.com/gogo/protobuf/grpc"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
@ -29,6 +30,127 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// GetTxsEventRequest is the request type for the Service.TxsByEvents
|
||||
// RPC method.
|
||||
type GetTxsEventRequest struct {
|
||||
// event is the transaction event type.
|
||||
Event string `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
|
||||
// pagination defines an pagination for the request.
|
||||
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GetTxsEventRequest) Reset() { *m = GetTxsEventRequest{} }
|
||||
func (m *GetTxsEventRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetTxsEventRequest) ProtoMessage() {}
|
||||
func (*GetTxsEventRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e0b00a618705eca7, []int{0}
|
||||
}
|
||||
func (m *GetTxsEventRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *GetTxsEventRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_GetTxsEventRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *GetTxsEventRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetTxsEventRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetTxsEventRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *GetTxsEventRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetTxsEventRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetTxsEventRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetTxsEventRequest) GetEvent() string {
|
||||
if m != nil {
|
||||
return m.Event
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *GetTxsEventRequest) GetPagination() *query.PageRequest {
|
||||
if m != nil {
|
||||
return m.Pagination
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetTxsEventResponse is the response type for the Service.TxsByEvents
|
||||
// RPC method.
|
||||
type GetTxsEventResponse struct {
|
||||
// txs is the list of queried transactions.
|
||||
Txs []*Tx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"`
|
||||
// tx_responses is the list of queried TxResponses.
|
||||
TxResponses []*types.TxResponse `protobuf:"bytes,2,rep,name=tx_responses,json=txResponses,proto3" json:"tx_responses,omitempty"`
|
||||
// pagination defines an pagination for the response.
|
||||
Pagination *query.PageResponse `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GetTxsEventResponse) Reset() { *m = GetTxsEventResponse{} }
|
||||
func (m *GetTxsEventResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetTxsEventResponse) ProtoMessage() {}
|
||||
func (*GetTxsEventResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e0b00a618705eca7, []int{1}
|
||||
}
|
||||
func (m *GetTxsEventResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *GetTxsEventResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_GetTxsEventResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *GetTxsEventResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetTxsEventResponse.Merge(m, src)
|
||||
}
|
||||
func (m *GetTxsEventResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *GetTxsEventResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetTxsEventResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetTxsEventResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *GetTxsEventResponse) GetTxs() []*Tx {
|
||||
if m != nil {
|
||||
return m.Txs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetTxsEventResponse) GetTxResponses() []*types.TxResponse {
|
||||
if m != nil {
|
||||
return m.TxResponses
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetTxsEventResponse) GetPagination() *query.PageResponse {
|
||||
if m != nil {
|
||||
return m.Pagination
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SimulateRequest is the request type for the Service.Simulate
|
||||
// RPC method.
|
||||
type SimulateRequest struct {
|
||||
@ -40,7 +162,7 @@ func (m *SimulateRequest) Reset() { *m = SimulateRequest{} }
|
||||
func (m *SimulateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimulateRequest) ProtoMessage() {}
|
||||
func (*SimulateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e0b00a618705eca7, []int{0}
|
||||
return fileDescriptor_e0b00a618705eca7, []int{2}
|
||||
}
|
||||
func (m *SimulateRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -89,7 +211,7 @@ func (m *SimulateResponse) Reset() { *m = SimulateResponse{} }
|
||||
func (m *SimulateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimulateResponse) ProtoMessage() {}
|
||||
func (*SimulateResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e0b00a618705eca7, []int{1}
|
||||
return fileDescriptor_e0b00a618705eca7, []int{3}
|
||||
}
|
||||
func (m *SimulateResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -132,7 +254,7 @@ func (m *SimulateResponse) GetResult() *types.Result {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetTx is the request type for the Service.GetTx
|
||||
// GetTxRequest is the request type for the Service.GetTx
|
||||
// RPC method.
|
||||
type GetTxRequest struct {
|
||||
// hash is the tx hash to query, encoded as a hex string.
|
||||
@ -143,7 +265,7 @@ func (m *GetTxRequest) Reset() { *m = GetTxRequest{} }
|
||||
func (m *GetTxRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetTxRequest) ProtoMessage() {}
|
||||
func (*GetTxRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e0b00a618705eca7, []int{2}
|
||||
return fileDescriptor_e0b00a618705eca7, []int{4}
|
||||
}
|
||||
func (m *GetTxRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -183,13 +305,15 @@ func (m *GetTxRequest) GetHash() string {
|
||||
type GetTxResponse struct {
|
||||
// tx is the queried transaction.
|
||||
Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
|
||||
// tx_response is the queried TxResponses.
|
||||
TxResponse *types.TxResponse `protobuf:"bytes,2,opt,name=tx_response,json=txResponse,proto3" json:"tx_response,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GetTxResponse) Reset() { *m = GetTxResponse{} }
|
||||
func (m *GetTxResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetTxResponse) ProtoMessage() {}
|
||||
func (*GetTxResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e0b00a618705eca7, []int{3}
|
||||
return fileDescriptor_e0b00a618705eca7, []int{5}
|
||||
}
|
||||
func (m *GetTxResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@ -225,7 +349,16 @@ func (m *GetTxResponse) GetTx() *Tx {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetTxResponse) GetTxResponse() *types.TxResponse {
|
||||
if m != nil {
|
||||
return m.TxResponse
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GetTxsEventRequest)(nil), "cosmos.tx.v1beta1.GetTxsEventRequest")
|
||||
proto.RegisterType((*GetTxsEventResponse)(nil), "cosmos.tx.v1beta1.GetTxsEventResponse")
|
||||
proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest")
|
||||
proto.RegisterType((*SimulateResponse)(nil), "cosmos.tx.v1beta1.SimulateResponse")
|
||||
proto.RegisterType((*GetTxRequest)(nil), "cosmos.tx.v1beta1.GetTxRequest")
|
||||
@ -235,33 +368,43 @@ func init() {
|
||||
func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) }
|
||||
|
||||
var fileDescriptor_e0b00a618705eca7 = []byte{
|
||||
// 404 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x6b, 0xdb, 0x40,
|
||||
0x1c, 0xc5, 0x2d, 0xd1, 0xda, 0xee, 0xb5, 0xa5, 0xed, 0x41, 0xc1, 0xa8, 0xae, 0xec, 0x9e, 0x6b,
|
||||
0xe8, 0x52, 0x1d, 0x76, 0xa1, 0x78, 0x08, 0x04, 0xb2, 0x98, 0xac, 0xb2, 0xa7, 0x2c, 0xe1, 0xa4,
|
||||
0x9c, 0x65, 0x11, 0x5b, 0xa7, 0xf8, 0x4e, 0xe6, 0x42, 0xc8, 0x92, 0x31, 0x53, 0x20, 0x5f, 0x2a,
|
||||
0xa3, 0x21, 0x4b, 0xc6, 0x60, 0xe7, 0x2b, 0x64, 0x0f, 0x3a, 0x9d, 0x92, 0x10, 0xcb, 0x21, 0x93,
|
||||
0x4e, 0xe8, 0xbd, 0xdf, 0xff, 0xbd, 0xd3, 0x1f, 0x34, 0x7c, 0xc6, 0xa7, 0x8c, 0x63, 0x21, 0xf1,
|
||||
0xbc, 0xe3, 0x51, 0x41, 0x3a, 0x98, 0xd3, 0xd9, 0x3c, 0xf4, 0xa9, 0x13, 0xcf, 0x98, 0x60, 0xf0,
|
||||
0x5b, 0x26, 0x70, 0x84, 0x74, 0xb4, 0xc0, 0xaa, 0x07, 0x8c, 0x05, 0x13, 0x8a, 0x49, 0x1c, 0x62,
|
||||
0x12, 0x45, 0x4c, 0x10, 0x11, 0xb2, 0x88, 0x67, 0x06, 0xab, 0xa5, 0x89, 0x1e, 0xe1, 0x14, 0x13,
|
||||
0xcf, 0x0f, 0x1f, 0xc1, 0xe9, 0x8b, 0x16, 0x59, 0xeb, 0x63, 0x85, 0xcc, 0xbe, 0xa1, 0x1e, 0xf8,
|
||||
0x32, 0x08, 0xa7, 0xc9, 0x84, 0x08, 0xea, 0xd2, 0xa3, 0x84, 0x72, 0x01, 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0xd2, 0x36, 0x16, 0x4b, 0xdb, 0xb8, 0x5d,
|
||||
0xda, 0xc6, 0xc5, 0xca, 0x2e, 0x2d, 0x56, 0x76, 0xe9, 0x66, 0x65, 0x97, 0xf6, 0xda, 0x41, 0x28,
|
||||
0xc6, 0x89, 0xe7, 0xf8, 0x6c, 0x9a, 0x13, 0xb2, 0xc7, 0x5f, 0x7e, 0x70, 0x88, 0xc5, 0x71, 0x4c,
|
||||
0x53, 0xa4, 0x57, 0x56, 0x2b, 0xf6, 0xef, 0x21, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x4c, 0x40, 0xff,
|
||||
0xf7, 0x02, 0x00, 0x00,
|
||||
// 563 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xae, 0x1d, 0xfa, 0xc3, 0xa4, 0x08, 0x58, 0x7e, 0x14, 0x99, 0xe2, 0x06, 0xa7, 0x69, 0x23,
|
||||
0x24, 0xbc, 0x6a, 0xb8, 0xf4, 0x80, 0x84, 0x84, 0x54, 0x22, 0x6e, 0xc8, 0xed, 0x89, 0x4b, 0xb5,
|
||||
0x09, 0x5b, 0xc7, 0x22, 0xf1, 0xba, 0xde, 0x4d, 0xb4, 0x15, 0xf4, 0xc2, 0x91, 0x13, 0x12, 0x2f,
|
||||
0xc5, 0x31, 0x12, 0x17, 0x8e, 0x28, 0xe1, 0x0d, 0x78, 0x01, 0xe4, 0xf5, 0x3a, 0x71, 0xa8, 0x4d,
|
||||
0x7b, 0xf2, 0xae, 0xfc, 0xfd, 0xcc, 0x37, 0xe3, 0x31, 0x6c, 0xf7, 0x18, 0x1f, 0x32, 0x8e, 0x85,
|
||||
0xc4, 0xe3, 0xfd, 0x2e, 0x15, 0x64, 0x1f, 0x73, 0x1a, 0x8f, 0x83, 0x1e, 0x75, 0xa3, 0x98, 0x09,
|
||||
0x86, 0xee, 0xa6, 0x00, 0x57, 0x48, 0x57, 0x03, 0xac, 0x2d, 0x9f, 0x31, 0x7f, 0x40, 0x31, 0x89,
|
||||
0x02, 0x4c, 0xc2, 0x90, 0x09, 0x22, 0x02, 0x16, 0xf2, 0x94, 0x60, 0x35, 0xb4, 0x62, 0x97, 0x70,
|
||||
0x8a, 0x49, 0xb7, 0x17, 0xcc, 0x85, 0x93, 0x8b, 0x06, 0x59, 0x97, 0x6d, 0x85, 0xd4, 0xef, 0x9e,
|
||||
0xe6, 0x05, 0xce, 0x46, 0x34, 0x3e, 0x9f, 0x63, 0x22, 0xe2, 0x07, 0xa1, 0x72, 0x4b, 0xb1, 0x4e,
|
||||
0x0c, 0xa8, 0x43, 0xc5, 0xb1, 0xe4, 0x87, 0x63, 0x1a, 0x0a, 0x8f, 0x9e, 0x8d, 0x28, 0x17, 0xe8,
|
||||
0x3e, 0xac, 0xd2, 0xe4, 0x5e, 0x33, 0xea, 0x46, 0xeb, 0xa6, 0x97, 0x5e, 0xd0, 0x6b, 0x80, 0x05,
|
||||
0xbf, 0x66, 0xd6, 0x8d, 0x56, 0xb5, 0xbd, 0xeb, 0xea, 0x78, 0x89, 0x99, 0xab, 0xcc, 0xb2, 0x98,
|
||||
0xee, 0x5b, 0xe2, 0x53, 0xad, 0xe8, 0xe5, 0x98, 0xce, 0xc4, 0x80, 0x7b, 0x4b, 0xa6, 0x3c, 0x62,
|
||||
0x21, 0xa7, 0x68, 0x0f, 0x2a, 0x42, 0xf2, 0x9a, 0x51, 0xaf, 0xb4, 0xaa, 0xed, 0x07, 0xee, 0xa5,
|
||||
0xbe, 0xb9, 0xc7, 0xd2, 0x4b, 0x10, 0xa8, 0x03, 0x9b, 0x42, 0x9e, 0xc4, 0x9a, 0xc7, 0x6b, 0xa6,
|
||||
0x62, 0xec, 0x2c, 0x95, 0xa2, 0x7a, 0x95, 0x23, 0x6a, 0xb0, 0x57, 0x15, 0xf3, 0x73, 0x22, 0x94,
|
||||
0x4f, 0x54, 0x51, 0x89, 0xf6, 0xae, 0x4c, 0xa4, 0x95, 0xf2, 0x91, 0x0e, 0xe0, 0xf6, 0x51, 0x30,
|
||||
0x1c, 0x0d, 0x88, 0xc8, 0x12, 0xa3, 0x26, 0x98, 0x42, 0xaa, 0x06, 0x96, 0x86, 0x31, 0x85, 0x74,
|
||||
0xbe, 0x18, 0x70, 0x67, 0x41, 0xd5, 0x9d, 0x78, 0x01, 0x1b, 0x3e, 0xe1, 0x27, 0x41, 0x78, 0xca,
|
||||
0xb4, 0xc2, 0x93, 0xf2, 0x70, 0x1d, 0xc2, 0xdf, 0x84, 0xa7, 0xcc, 0x5b, 0xf7, 0xd3, 0x03, 0x3a,
|
||||
0x80, 0xb5, 0x98, 0xf2, 0xd1, 0x40, 0xe8, 0x19, 0xd5, 0xcb, 0xb9, 0x9e, 0xc2, 0x79, 0x1a, 0xef,
|
||||
0x38, 0xb0, 0xa9, 0x06, 0x93, 0x65, 0x40, 0x70, 0xa3, 0x4f, 0x78, 0x5f, 0x7f, 0x06, 0xea, 0xec,
|
||||
0x5c, 0xc0, 0x2d, 0x8d, 0xd1, 0xc5, 0x5e, 0x2f, 0x28, 0x3a, 0x84, 0x6a, 0x6e, 0x68, 0xba, 0xb4,
|
||||
0xeb, 0xcd, 0x0c, 0x16, 0x33, 0x6b, 0xff, 0x31, 0x61, 0xfd, 0x28, 0x5d, 0x30, 0x24, 0x61, 0x23,
|
||||
0x6b, 0x1d, 0x72, 0x0a, 0x9c, 0xff, 0x19, 0x89, 0xd5, 0xf8, 0x2f, 0x26, 0x35, 0x70, 0x1a, 0x9f,
|
||||
0x7f, 0xfc, 0xfe, 0x66, 0x3e, 0x76, 0x1e, 0xe1, 0x82, 0xcd, 0xce, 0xdc, 0x22, 0x58, 0x55, 0x4d,
|
||||
0x40, 0xdb, 0x05, 0x92, 0xf9, 0x16, 0x5a, 0xf5, 0x72, 0x80, 0x36, 0xdc, 0x51, 0x86, 0x36, 0xda,
|
||||
0xc2, 0x45, 0x3b, 0x8d, 0x3f, 0x26, 0x5d, 0xbf, 0x40, 0x9f, 0xa0, 0x9a, 0xdb, 0x19, 0xd4, 0x2c,
|
||||
0x93, 0x5d, 0x5a, 0x64, 0x6b, 0xf7, 0x2a, 0x98, 0xae, 0xc1, 0x56, 0x35, 0xd4, 0xd0, 0xc3, 0xc2,
|
||||
0x1a, 0xf8, 0xab, 0x97, 0xdf, 0xa7, 0xb6, 0x31, 0x99, 0xda, 0xc6, 0xaf, 0xa9, 0x6d, 0x7c, 0x9d,
|
||||
0xd9, 0x2b, 0x93, 0x99, 0xbd, 0xf2, 0x73, 0x66, 0xaf, 0xbc, 0x6b, 0xfa, 0x81, 0xe8, 0x8f, 0xba,
|
||||
0x6e, 0x8f, 0x0d, 0x33, 0x6e, 0xfa, 0x78, 0xc6, 0xdf, 0x7f, 0xc0, 0xe2, 0x3c, 0xa2, 0x89, 0x58,
|
||||
0x77, 0x4d, 0xfd, 0x6e, 0x9e, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xae, 0x63, 0xf9, 0x38, 0x2f,
|
||||
0x05, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -280,6 +423,8 @@ type ServiceClient interface {
|
||||
Simulate(ctx context.Context, in *SimulateRequest, opts ...grpc.CallOption) (*SimulateResponse, error)
|
||||
// GetTx fetches a tx by hash.
|
||||
GetTx(ctx context.Context, in *GetTxRequest, opts ...grpc.CallOption) (*GetTxResponse, error)
|
||||
// GetTxsEvent fetches txs by event.
|
||||
GetTxsEvent(ctx context.Context, in *GetTxsEventRequest, opts ...grpc.CallOption) (*GetTxsEventResponse, error)
|
||||
}
|
||||
|
||||
type serviceClient struct {
|
||||
@ -308,12 +453,23 @@ func (c *serviceClient) GetTx(ctx context.Context, in *GetTxRequest, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serviceClient) GetTxsEvent(ctx context.Context, in *GetTxsEventRequest, opts ...grpc.CallOption) (*GetTxsEventResponse, error) {
|
||||
out := new(GetTxsEventResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/GetTxsEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ServiceServer is the server API for Service service.
|
||||
type ServiceServer interface {
|
||||
// Simulate simulates executing a transaction for estimating gas usage.
|
||||
Simulate(context.Context, *SimulateRequest) (*SimulateResponse, error)
|
||||
// GetTx fetches a tx by hash.
|
||||
GetTx(context.Context, *GetTxRequest) (*GetTxResponse, error)
|
||||
// GetTxsEvent fetches txs by event.
|
||||
GetTxsEvent(context.Context, *GetTxsEventRequest) (*GetTxsEventResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
|
||||
@ -326,6 +482,9 @@ func (*UnimplementedServiceServer) Simulate(ctx context.Context, req *SimulateRe
|
||||
func (*UnimplementedServiceServer) GetTx(ctx context.Context, req *GetTxRequest) (*GetTxResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetTx not implemented")
|
||||
}
|
||||
func (*UnimplementedServiceServer) GetTxsEvent(ctx context.Context, req *GetTxsEventRequest) (*GetTxsEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetTxsEvent not implemented")
|
||||
}
|
||||
|
||||
func RegisterServiceServer(s grpc1.Server, srv ServiceServer) {
|
||||
s.RegisterService(&_Service_serviceDesc, srv)
|
||||
@ -367,6 +526,24 @@ func _Service_GetTx_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Service_GetTxsEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetTxsEventRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServiceServer).GetTxsEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.tx.v1beta1.Service/GetTxsEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServiceServer).GetTxsEvent(ctx, req.(*GetTxsEventRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Service_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cosmos.tx.v1beta1.Service",
|
||||
HandlerType: (*ServiceServer)(nil),
|
||||
@ -379,11 +556,120 @@ var _Service_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GetTx",
|
||||
Handler: _Service_GetTx_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetTxsEvent",
|
||||
Handler: _Service_GetTxsEvent_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/tx/v1beta1/service.proto",
|
||||
}
|
||||
|
||||
func (m *GetTxsEventRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *GetTxsEventRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *GetTxsEventRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Pagination != nil {
|
||||
{
|
||||
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Event) > 0 {
|
||||
i -= len(m.Event)
|
||||
copy(dAtA[i:], m.Event)
|
||||
i = encodeVarintService(dAtA, i, uint64(len(m.Event)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *GetTxsEventResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *GetTxsEventResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *GetTxsEventResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Pagination != nil {
|
||||
{
|
||||
size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.TxResponses) > 0 {
|
||||
for iNdEx := len(m.TxResponses) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.TxResponses[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
}
|
||||
if len(m.Txs) > 0 {
|
||||
for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Txs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *SimulateRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@ -516,6 +802,18 @@ func (m *GetTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.TxResponse != nil {
|
||||
{
|
||||
size, err := m.TxResponse.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintService(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if m.Tx != nil {
|
||||
{
|
||||
size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i])
|
||||
@ -542,6 +840,48 @@ func encodeVarintService(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *GetTxsEventRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Event)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovService(uint64(l))
|
||||
}
|
||||
if m.Pagination != nil {
|
||||
l = m.Pagination.Size()
|
||||
n += 1 + l + sovService(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *GetTxsEventResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Txs) > 0 {
|
||||
for _, e := range m.Txs {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovService(uint64(l))
|
||||
}
|
||||
}
|
||||
if len(m.TxResponses) > 0 {
|
||||
for _, e := range m.TxResponses {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovService(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.Pagination != nil {
|
||||
l = m.Pagination.Size()
|
||||
n += 1 + l + sovService(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *SimulateRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@ -595,6 +935,10 @@ func (m *GetTxResponse) Size() (n int) {
|
||||
l = m.Tx.Size()
|
||||
n += 1 + l + sovService(uint64(l))
|
||||
}
|
||||
if m.TxResponse != nil {
|
||||
l = m.TxResponse.Size()
|
||||
n += 1 + l + sovService(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@ -604,6 +948,284 @@ func sovService(x uint64) (n int) {
|
||||
func sozService(x uint64) (n int) {
|
||||
return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: GetTxsEventRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: GetTxsEventRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Event", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Event = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Pagination == nil {
|
||||
m.Pagination = &query.PageRequest{}
|
||||
}
|
||||
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: GetTxsEventResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: GetTxsEventResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Txs = append(m.Txs, &Tx{})
|
||||
if err := m.Txs[len(m.Txs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TxResponses", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.TxResponses = append(m.TxResponses, &types.TxResponse{})
|
||||
if err := m.TxResponses[len(m.TxResponses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Pagination == nil {
|
||||
m.Pagination = &query.PageResponse{}
|
||||
}
|
||||
if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipService(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *SimulateRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
@ -968,6 +1590,42 @@ func (m *GetTxResponse) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TxResponse", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowService
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthService
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.TxResponse == nil {
|
||||
m.TxResponse = &types.TxResponse{}
|
||||
}
|
||||
if err := m.TxResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipService(dAtA[iNdEx:])
|
||||
|
||||
@ -121,6 +121,42 @@ func local_request_Service_GetTx_0(ctx context.Context, marshaler runtime.Marsha
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Service_GetTxsEvent_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetTxsEventRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_GetTxsEvent_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetTxsEvent(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetTxsEventRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_GetTxsEvent_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetTxsEvent(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterServiceHandlerServer registers the http handlers for service Service to "mux".
|
||||
// UnaryRPC :call ServiceServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
@ -167,6 +203,26 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Service_GetTxsEvent_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Service_GetTxsEvent_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Service_GetTxsEvent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -248,6 +304,26 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Service_GetTxsEvent_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Service_GetTxsEvent_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Service_GetTxsEvent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -255,10 +331,14 @@ var (
|
||||
pattern_Service_Simulate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "simulate"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Service_GetTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "tx", "v1beta1", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Service_GetTxsEvent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Service_Simulate_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Service_GetTx_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Service_GetTxsEvent_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
||||
@ -3,16 +3,22 @@ package tx
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
gogogrpc "github.com/gogo/protobuf/grpc"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
pagination "github.com/cosmos/cosmos-sdk/types/query"
|
||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
)
|
||||
|
||||
@ -37,6 +43,89 @@ func NewTxServer(clientCtx client.Context, simulate baseAppSimulateFn, interface
|
||||
|
||||
var _ txtypes.ServiceServer = txServer{}
|
||||
|
||||
const (
|
||||
eventFormat = "{eventType}.{eventAttribute}={value}"
|
||||
)
|
||||
|
||||
// TxsByEvents implements the ServiceServer.TxsByEvents RPC method.
|
||||
func (s txServer) GetTxsEvent(ctx context.Context, req *txtypes.GetTxsEventRequest) (*txtypes.GetTxsEventResponse, error) {
|
||||
offset := int(req.Pagination.Offset)
|
||||
limit := int(req.Pagination.Limit)
|
||||
if offset < 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "offset must greater than 0")
|
||||
}
|
||||
if len(req.Event) == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "must declare at least one event to search")
|
||||
}
|
||||
|
||||
if limit < 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "limit must greater than 0")
|
||||
} else if limit == 0 {
|
||||
limit = pagination.DefaultLimit
|
||||
}
|
||||
|
||||
page := offset/limit + 1
|
||||
|
||||
var events []string
|
||||
|
||||
if strings.Contains(req.Event, "&") {
|
||||
events = strings.Split(req.Event, "&")
|
||||
} else {
|
||||
events = append(events, req.Event)
|
||||
}
|
||||
tmEvents := make([]string, len(events))
|
||||
for i, event := range events {
|
||||
if !strings.Contains(event, "=") {
|
||||
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid event; event %s should be of the format: %s", event, eventFormat))
|
||||
} else if strings.Count(event, "=") > 1 {
|
||||
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid event; event %s should be of the format: %s", event, eventFormat))
|
||||
}
|
||||
|
||||
tokens := strings.Split(event, "=")
|
||||
if tokens[0] == tmtypes.TxHeightKey {
|
||||
event = fmt.Sprintf("%s=%s", tokens[0], tokens[1])
|
||||
} else {
|
||||
event = fmt.Sprintf("%s='%s'", tokens[0], tokens[1])
|
||||
}
|
||||
|
||||
tmEvents[i] = event
|
||||
}
|
||||
|
||||
query := strings.Join(tmEvents, " AND ")
|
||||
|
||||
result, err := s.clientCtx.Client.TxSearch(ctx, query, false, &page, &limit, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Create a proto codec, we need it to unmarshal the tx bytes.
|
||||
cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry)
|
||||
txRespList := make([]*sdk.TxResponse, len(result.Txs))
|
||||
txsList := make([]*txtypes.Tx, len(result.Txs))
|
||||
|
||||
for i, tx := range result.Txs {
|
||||
txResp := txResultToTxResponse(&tx.TxResult)
|
||||
txResp.Height = tx.Height
|
||||
txResp.TxHash = tx.Hash.String()
|
||||
txRespList[i] = txResp
|
||||
|
||||
var protoTx txtypes.Tx
|
||||
if err := cdc.UnmarshalBinaryBare(tx.Tx, &protoTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
txsList[i] = &protoTx
|
||||
}
|
||||
|
||||
return &txtypes.GetTxsEventResponse{
|
||||
Txs: txsList,
|
||||
TxResponses: txRespList,
|
||||
Pagination: &pagination.PageResponse{
|
||||
Total: uint64(result.TotalCount),
|
||||
},
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
// Simulate implements the ServiceServer.Simulate RPC method.
|
||||
func (s txServer) Simulate(ctx context.Context, req *txtypes.SimulateRequest) (*txtypes.SimulateResponse, error) {
|
||||
if req.Tx == nil {
|
||||
@ -80,14 +169,19 @@ func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtype
|
||||
|
||||
// Create a proto codec, we need it to unmarshal the tx bytes.
|
||||
cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry)
|
||||
var protoTx txtypes.Tx
|
||||
|
||||
var protoTx txtypes.Tx
|
||||
if err := cdc.UnmarshalBinaryBare(result.Tx, &protoTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
txResp := txResultToTxResponse(&result.TxResult)
|
||||
txResp.Height = result.Height
|
||||
txResp.TxHash = result.Hash.String()
|
||||
|
||||
return &txtypes.GetTxResponse{
|
||||
Tx: &protoTx,
|
||||
Tx: &protoTx,
|
||||
TxResponse: txResp,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -109,3 +203,15 @@ func RegisterTxService(
|
||||
func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux) {
|
||||
txtypes.RegisterServiceHandlerClient(context.Background(), mux, txtypes.NewServiceClient(clientConn))
|
||||
}
|
||||
|
||||
func txResultToTxResponse(respTx *abci.ResponseDeliverTx) *sdk.TxResponse {
|
||||
logs, _ := sdk.ParseABCILogs(respTx.Log)
|
||||
return &sdk.TxResponse{
|
||||
Code: respTx.Code,
|
||||
Codespace: respTx.Codespace,
|
||||
GasUsed: respTx.GasUsed,
|
||||
GasWanted: respTx.GasWanted,
|
||||
Info: respTx.Info,
|
||||
Logs: logs,
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
query "github.com/cosmos/cosmos-sdk/types/query"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
@ -99,6 +100,55 @@ func (s IntegrationTestSuite) TestSimulate() {
|
||||
s.Require().True(res.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty.
|
||||
}
|
||||
|
||||
func (s IntegrationTestSuite) TestGetTxEvents() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
// Create a new MsgSend tx from val to itself.
|
||||
out, err := bankcli.MsgSendExec(
|
||||
val.ClientCtx,
|
||||
val.Address,
|
||||
val.Address,
|
||||
sdk.NewCoins(
|
||||
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)),
|
||||
),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
fmt.Sprintf("--gas=%d", flags.DefaultGasLimit),
|
||||
fmt.Sprintf("--%s=foobar", flags.FlagMemo),
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
var txRes sdk.TxResponse
|
||||
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &txRes))
|
||||
s.Require().Equal(uint32(0), txRes.Code)
|
||||
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
// Query the tx via gRPC.
|
||||
grpcRes, err := s.queryClient.GetTxsEvent(
|
||||
context.Background(),
|
||||
&tx.GetTxsEventRequest{Event: "message.action=send",
|
||||
Pagination: &query.PageRequest{
|
||||
CountTotal: false,
|
||||
Offset: 0,
|
||||
Limit: 1,
|
||||
},
|
||||
},
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(len(grpcRes.Txs), 1)
|
||||
s.Require().Equal("foobar", grpcRes.Txs[0].Body.Memo)
|
||||
|
||||
// Query the tx via grpc-gateway.
|
||||
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?event=%s&pagination.offset=%d&pagination.limit=%d", val.APIAddress, "message.action=send", 0, 1))
|
||||
s.Require().NoError(err)
|
||||
var getTxRes tx.GetTxsEventResponse
|
||||
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &getTxRes))
|
||||
s.Require().Equal(len(grpcRes.Txs), 1)
|
||||
s.Require().Equal("foobar", getTxRes.Txs[0].Body.Memo)
|
||||
s.Require().NotZero(grpcRes.TxResponses[0].Height)
|
||||
}
|
||||
|
||||
func (s IntegrationTestSuite) TestGetTx() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
@ -130,13 +180,15 @@ func (s IntegrationTestSuite) TestGetTx() {
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal("foobar", grpcRes.Tx.Body.Memo)
|
||||
s.Require().NotZero(grpcRes.TxResponse.Height)
|
||||
|
||||
// Query the tx via grpc-gateway.
|
||||
restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, txRes.TxHash))
|
||||
s.Require().NoError(err)
|
||||
var getTxRes tx.GetTxResponse
|
||||
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &getTxRes))
|
||||
s.Require().Equal("foobar", getTxRes.Tx.Body.Memo)
|
||||
s.Require().Equal("foobar", grpcRes.Tx.Body.Memo)
|
||||
s.Require().NotZero(grpcRes.TxResponse.Height)
|
||||
}
|
||||
|
||||
func TestIntegrationTestSuite(t *testing.T) {
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
// InitGenesis initializes the capability module's state from a provided genesis
|
||||
// state.
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
|
||||
if err := k.SetIndex(ctx, genState.Index); err != nil {
|
||||
if err := k.InitializeIndex(ctx, genState.Index); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
@ -49,6 +50,8 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// NewKeeper constructs a new CapabilityKeeper instance and initializes maps
|
||||
// for capability map and scopedModules map.
|
||||
func NewKeeper(cdc codec.BinaryMarshaler, storeKey, memKey sdk.StoreKey) *Keeper {
|
||||
return &Keeper{
|
||||
cdc: cdc,
|
||||
@ -67,6 +70,9 @@ func (k *Keeper) ScopeToModule(moduleName string) ScopedKeeper {
|
||||
if k.sealed {
|
||||
panic("cannot scope to module via a sealed capability keeper")
|
||||
}
|
||||
if strings.TrimSpace(moduleName) == "" {
|
||||
panic("cannot scope to an empty module name")
|
||||
}
|
||||
|
||||
if _, ok := k.scopedModules[moduleName]; ok {
|
||||
panic(fmt.Sprintf("cannot create multiple scoped keepers for the same module name: %s", moduleName))
|
||||
@ -117,10 +123,10 @@ func (k *Keeper) InitializeAndSeal(ctx sdk.Context) {
|
||||
k.sealed = true
|
||||
}
|
||||
|
||||
// SetIndex sets the index to one (or greater) in InitChain according
|
||||
// InitializeIndex sets the index to one (or greater) in InitChain according
|
||||
// to the GenesisState. It must only be called once.
|
||||
// It will panic if the provided index is 0, or if the index is already set.
|
||||
func (k Keeper) SetIndex(ctx sdk.Context, index uint64) error {
|
||||
func (k Keeper) InitializeIndex(ctx sdk.Context, index uint64) error {
|
||||
if index == 0 {
|
||||
panic("SetIndex requires index > 0")
|
||||
}
|
||||
@ -200,6 +206,9 @@ func (k Keeper) InitializeCapability(ctx sdk.Context, index uint64, owners types
|
||||
// Note, namespacing is completely local, which is safe since records are prefixed
|
||||
// with the module name and no two ScopedKeeper can have the same module name.
|
||||
func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capability, error) {
|
||||
if strings.TrimSpace(name) == "" {
|
||||
return nil, sdkerrors.Wrap(types.ErrInvalidCapabilityName, "capability name cannot be empty")
|
||||
}
|
||||
store := ctx.KVStore(sk.storeKey)
|
||||
|
||||
if _, ok := sk.GetCapability(ctx, name); ok {
|
||||
@ -247,6 +256,9 @@ func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capab
|
||||
// Note, the capability's forward mapping is indexed by a string which should
|
||||
// contain its unique memory reference.
|
||||
func (sk ScopedKeeper) AuthenticateCapability(ctx sdk.Context, cap *types.Capability, name string) bool {
|
||||
if strings.TrimSpace(name) == "" || cap == nil {
|
||||
return false
|
||||
}
|
||||
return sk.GetCapabilityName(ctx, cap) == name
|
||||
}
|
||||
|
||||
@ -256,6 +268,12 @@ func (sk ScopedKeeper) AuthenticateCapability(ctx sdk.Context, cap *types.Capabi
|
||||
// index. If the owner already exists, it will return an error. Otherwise, it will
|
||||
// also set a forward and reverse index for the capability and capability name.
|
||||
func (sk ScopedKeeper) ClaimCapability(ctx sdk.Context, cap *types.Capability, name string) error {
|
||||
if cap == nil {
|
||||
return sdkerrors.Wrap(types.ErrNilCapability, "cannot claim nil capability")
|
||||
}
|
||||
if strings.TrimSpace(name) == "" {
|
||||
return sdkerrors.Wrap(types.ErrInvalidCapabilityName, "capability name cannot be empty")
|
||||
}
|
||||
// update capability owner set
|
||||
if err := sk.addOwner(ctx, cap, name); err != nil {
|
||||
return err
|
||||
@ -282,6 +300,9 @@ func (sk ScopedKeeper) ClaimCapability(ctx sdk.Context, cap *types.Capability, n
|
||||
// previously claimed or created. After releasing the capability, if no more
|
||||
// owners exist, the capability will be globally removed.
|
||||
func (sk ScopedKeeper) ReleaseCapability(ctx sdk.Context, cap *types.Capability) error {
|
||||
if cap == nil {
|
||||
return sdkerrors.Wrap(types.ErrNilCapability, "cannot release nil capability")
|
||||
}
|
||||
name := sk.GetCapabilityName(ctx, cap)
|
||||
if len(name) == 0 {
|
||||
return sdkerrors.Wrap(types.ErrCapabilityNotOwned, sk.module)
|
||||
@ -321,6 +342,9 @@ func (sk ScopedKeeper) ReleaseCapability(ctx sdk.Context, cap *types.Capability)
|
||||
// by name. The module is not allowed to retrieve capabilities which it does not
|
||||
// own.
|
||||
func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capability, bool) {
|
||||
if strings.TrimSpace(name) == "" {
|
||||
return nil, false
|
||||
}
|
||||
memStore := ctx.KVStore(sk.memKey)
|
||||
|
||||
key := types.RevCapabilityKey(sk.module, name)
|
||||
@ -332,15 +356,14 @@ func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capab
|
||||
// to still have the capability in the go map since changes to
|
||||
// go map do not automatically get reverted on tx failure,
|
||||
// so we delete here to remove unnecessary values in map
|
||||
delete(sk.capMap, index)
|
||||
// TODO: Delete index correctly from capMap by storing some reverse lookup
|
||||
// in-memory map. Issue: https://github.com/cosmos/cosmos-sdk/issues/7805
|
||||
return nil, false
|
||||
}
|
||||
|
||||
cap := sk.capMap[index]
|
||||
if cap == nil {
|
||||
// delete key from store to remove unnecessary mapping
|
||||
memStore.Delete(key)
|
||||
return nil, false
|
||||
panic("capability found in memstore is missing from map")
|
||||
}
|
||||
|
||||
return cap, true
|
||||
@ -349,14 +372,20 @@ func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capab
|
||||
// GetCapabilityName allows a module to retrieve the name under which it stored a given
|
||||
// capability given the capability
|
||||
func (sk ScopedKeeper) GetCapabilityName(ctx sdk.Context, cap *types.Capability) string {
|
||||
if cap == nil {
|
||||
return ""
|
||||
}
|
||||
memStore := ctx.KVStore(sk.memKey)
|
||||
|
||||
return string(memStore.Get(types.FwdCapabilityKey(sk.module, cap)))
|
||||
}
|
||||
|
||||
// Get all the Owners that own the capability associated with the name this ScopedKeeper uses
|
||||
// GetOwners all the Owners that own the capability associated with the name this ScopedKeeper uses
|
||||
// to refer to the capability
|
||||
func (sk ScopedKeeper) GetOwners(ctx sdk.Context, name string) (*types.CapabilityOwners, bool) {
|
||||
if strings.TrimSpace(name) == "" {
|
||||
return nil, false
|
||||
}
|
||||
cap, ok := sk.GetCapability(ctx, name)
|
||||
if !ok {
|
||||
return nil, false
|
||||
@ -382,6 +411,9 @@ func (sk ScopedKeeper) GetOwners(ctx sdk.Context, name string) (*types.Capabilit
|
||||
// The method returns an error if either the capability or the owners cannot be
|
||||
// retreived from the memstore.
|
||||
func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *types.Capability, error) {
|
||||
if strings.TrimSpace(name) == "" {
|
||||
return nil, nil, sdkerrors.Wrap(types.ErrInvalidCapabilityName, "cannot lookup modules with empty capability name")
|
||||
}
|
||||
cap, ok := sk.GetCapability(ctx, name)
|
||||
if !ok {
|
||||
return nil, nil, sdkerrors.Wrap(types.ErrCapabilityNotFound, name)
|
||||
|
||||
@ -38,6 +38,9 @@ func (suite *KeeperTestSuite) SetupTest() {
|
||||
|
||||
func (suite *KeeperTestSuite) TestInitializeAndSeal() {
|
||||
sk := suite.keeper.ScopeToModule(banktypes.ModuleName)
|
||||
suite.Require().Panics(func() {
|
||||
suite.keeper.ScopeToModule(" ")
|
||||
})
|
||||
|
||||
caps := make([]*types.Capability, 5)
|
||||
// Get Latest Index before creating new ones to sychronize indices correctly
|
||||
@ -105,6 +108,10 @@ func (suite *KeeperTestSuite) TestNewCapability() {
|
||||
suite.Require().True(ok)
|
||||
suite.Require().Equal(cap, got)
|
||||
suite.Require().True(cap == got, "expected memory addresses to be equal")
|
||||
|
||||
cap, err = sk.NewCapability(suite.ctx, " ")
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Nil(cap)
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestOriginalCapabilityKeeper() {
|
||||
@ -151,11 +158,15 @@ func (suite *KeeperTestSuite) TestAuthenticateCapability() {
|
||||
badCap := types.NewCapability(100)
|
||||
suite.Require().False(sk1.AuthenticateCapability(suite.ctx, badCap, "transfer"))
|
||||
suite.Require().False(sk2.AuthenticateCapability(suite.ctx, badCap, "bond"))
|
||||
|
||||
suite.Require().False(sk1.AuthenticateCapability(suite.ctx, cap1, " "))
|
||||
suite.Require().False(sk1.AuthenticateCapability(suite.ctx, nil, "transfer"))
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestClaimCapability() {
|
||||
sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName)
|
||||
sk2 := suite.keeper.ScopeToModule(stakingtypes.ModuleName)
|
||||
sk3 := suite.keeper.ScopeToModule("foo")
|
||||
|
||||
cap, err := sk1.NewCapability(suite.ctx, "transfer")
|
||||
suite.Require().NoError(err)
|
||||
@ -171,6 +182,9 @@ func (suite *KeeperTestSuite) TestClaimCapability() {
|
||||
got, ok = sk2.GetCapability(suite.ctx, "transfer")
|
||||
suite.Require().True(ok)
|
||||
suite.Require().Equal(cap, got)
|
||||
|
||||
suite.Require().Error(sk3.ClaimCapability(suite.ctx, cap, " "))
|
||||
suite.Require().Error(sk3.ClaimCapability(suite.ctx, nil, "transfer"))
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGetOwners() {
|
||||
@ -237,6 +251,8 @@ func (suite *KeeperTestSuite) TestGetOwners() {
|
||||
}
|
||||
}
|
||||
|
||||
_, ok := sk1.GetOwners(suite.ctx, " ")
|
||||
suite.Require().False(ok, "got owners from empty capability name")
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestReleaseCapability() {
|
||||
@ -264,6 +280,8 @@ func (suite *KeeperTestSuite) TestReleaseCapability() {
|
||||
got, ok = sk1.GetCapability(suite.ctx, "transfer")
|
||||
suite.Require().False(ok)
|
||||
suite.Require().Nil(got)
|
||||
|
||||
suite.Require().Error(sk1.ReleaseCapability(suite.ctx, nil))
|
||||
}
|
||||
|
||||
func (suite KeeperTestSuite) TestRevertCapability() {
|
||||
|
||||
@ -8,9 +8,11 @@ import (
|
||||
|
||||
// x/capability module sentinel errors
|
||||
var (
|
||||
ErrCapabilityTaken = sdkerrors.Register(ModuleName, 2, "capability name already taken")
|
||||
ErrOwnerClaimed = sdkerrors.Register(ModuleName, 3, "given owner already claimed capability")
|
||||
ErrCapabilityNotOwned = sdkerrors.Register(ModuleName, 4, "capability not owned by module")
|
||||
ErrCapabilityNotFound = sdkerrors.Register(ModuleName, 5, "capability not found")
|
||||
ErrCapabilityOwnersNotFound = sdkerrors.Register(ModuleName, 6, "owners not found for capability")
|
||||
ErrInvalidCapabilityName = sdkerrors.Register(ModuleName, 2, "capability name not valid")
|
||||
ErrNilCapability = sdkerrors.Register(ModuleName, 3, "provided capability is nil")
|
||||
ErrCapabilityTaken = sdkerrors.Register(ModuleName, 4, "capability name already taken")
|
||||
ErrOwnerClaimed = sdkerrors.Register(ModuleName, 5, "given owner already claimed capability")
|
||||
ErrCapabilityNotOwned = sdkerrors.Register(ModuleName, 6, "capability not owned by module")
|
||||
ErrCapabilityNotFound = sdkerrors.Register(ModuleName, 7, "capability not found")
|
||||
ErrCapabilityOwnersNotFound = sdkerrors.Register(ModuleName, 8, "owners not found for capability")
|
||||
)
|
||||
|
||||
@ -361,7 +361,9 @@ func (k Keeper) refundPacketToken(ctx sdk.Context, packet channeltypes.Packet, d
|
||||
// DenomPathFromHash returns the full denomination path prefix from an ibc denom with a hash
|
||||
// component.
|
||||
func (k Keeper) DenomPathFromHash(ctx sdk.Context, denom string) (string, error) {
|
||||
hexHash := denom[4:]
|
||||
// trim the denomination prefix, by default "ibc/"
|
||||
hexHash := denom[len(types.DenomPrefix+"/"):]
|
||||
|
||||
hash, err := types.ParseHexHash(hexHash)
|
||||
if err != nil {
|
||||
return "", sdkerrors.Wrap(types.ErrInvalidDenomForTransfer, err.Error())
|
||||
|
||||
@ -109,3 +109,9 @@ Cosmos Hub for the `uatom`). Sending a token back to the same chain across a dif
|
||||
**not** move the token back across its timeline. If a channel in the chain history closes before the
|
||||
token can be sent back across that channel, then the token will not be returnable to its original
|
||||
form.
|
||||
|
||||
|
||||
## Security Considerations
|
||||
|
||||
For safety, no other module must be capable of minting tokens with the `ibc/` prefix. The IBC
|
||||
transfer module needs a subset of the denomination space that only it can create tokens in.
|
||||
|
||||
@ -25,6 +25,9 @@ const (
|
||||
|
||||
// QuerierRoute is the querier route for IBC transfer
|
||||
QuerierRoute = ModuleName
|
||||
|
||||
// DenomPrefix is the prefix used for internal SDK coin representation.
|
||||
DenomPrefix = "ibc"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -54,7 +54,7 @@ func (dt DenomTrace) GetPrefix() string {
|
||||
// 'ibc/{hash(tracePath + baseDenom)}'. If the trace is empty, it will return the base denomination.
|
||||
func (dt DenomTrace) IBCDenom() string {
|
||||
if dt.Path != "" {
|
||||
return fmt.Sprintf("ibc/%s", dt.Hash())
|
||||
return fmt.Sprintf("%s/%s", DenomPrefix, dt.Hash())
|
||||
}
|
||||
return dt.BaseDenom
|
||||
}
|
||||
@ -164,16 +164,20 @@ func ValidatePrefixedDenom(denom string) error {
|
||||
// - A valid base denomination (eg: 'uatom')
|
||||
// - A valid fungible token representation (i.e 'ibc/{hash}') per ADR 001 https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-001-coin-source-tracing.md
|
||||
func ValidateIBCDenom(denom string) error {
|
||||
if err := sdk.ValidateDenom(denom); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
denomSplit := strings.SplitN(denom, "/", 2)
|
||||
|
||||
switch {
|
||||
case strings.TrimSpace(denom) == "",
|
||||
len(denomSplit) == 1 && denomSplit[0] == "ibc",
|
||||
len(denomSplit) == 2 && (denomSplit[0] != "ibc" || strings.TrimSpace(denomSplit[1]) == ""):
|
||||
len(denomSplit) == 1 && denomSplit[0] == DenomPrefix,
|
||||
len(denomSplit) == 2 && (denomSplit[0] != DenomPrefix || strings.TrimSpace(denomSplit[1]) == ""):
|
||||
return sdkerrors.Wrapf(ErrInvalidDenomForTransfer, "denomination should be prefixed with the format 'ibc/{hash(trace + \"/\" + %s)}'", denom)
|
||||
|
||||
case denomSplit[0] == denom && strings.TrimSpace(denom) != "":
|
||||
return sdk.ValidateDenom(denom)
|
||||
return nil
|
||||
}
|
||||
|
||||
if _, err := ParseHexHash(denomSplit[1]); err != nil {
|
||||
|
||||
@ -118,21 +118,22 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e
|
||||
return sdkerrors.Wrapf(types.ErrClientFrozen, "cannot update client with ID %s", clientID)
|
||||
}
|
||||
|
||||
err := clientState.VerifyUpgrade(ctx, k.cdc, k.ClientStore(ctx, clientID), upgradedClient, upgradeHeight, proofUpgrade)
|
||||
updatedClientState, updatedConsensusState, err := clientState.VerifyUpgradeAndUpdateState(ctx, k.cdc, k.ClientStore(ctx, clientID), upgradedClient, upgradeHeight, proofUpgrade)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(err, "cannot upgrade client with ID %s", clientID)
|
||||
}
|
||||
|
||||
k.SetClientState(ctx, clientID, upgradedClient)
|
||||
k.SetClientState(ctx, clientID, updatedClientState)
|
||||
k.SetClientConsensusState(ctx, clientID, updatedClientState.GetLatestHeight(), updatedConsensusState)
|
||||
|
||||
k.Logger(ctx).Info("client state upgraded", "client-id", clientID, "height", upgradedClient.GetLatestHeight().String())
|
||||
k.Logger(ctx).Info("client state upgraded", "client-id", clientID, "height", updatedClientState.GetLatestHeight().String())
|
||||
|
||||
defer func() {
|
||||
telemetry.IncrCounterWithLabels(
|
||||
[]string{"ibc", "client", "upgrade"},
|
||||
1,
|
||||
[]metrics.Label{
|
||||
telemetry.NewLabel("client-type", clientState.ClientType()),
|
||||
telemetry.NewLabel("client-type", updatedClientState.ClientType()),
|
||||
telemetry.NewLabel("client-id", clientID),
|
||||
},
|
||||
)
|
||||
@ -143,8 +144,8 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e
|
||||
sdk.NewEvent(
|
||||
types.EventTypeUpgradeClient,
|
||||
sdk.NewAttribute(types.AttributeKeyClientID, clientID),
|
||||
sdk.NewAttribute(types.AttributeKeyClientType, clientState.ClientType()),
|
||||
sdk.NewAttribute(types.AttributeKeyConsensusHeight, upgradedClient.GetLatestHeight().String()),
|
||||
sdk.NewAttribute(types.AttributeKeyClientType, updatedClientState.ClientType()),
|
||||
sdk.NewAttribute(types.AttributeKeyConsensusHeight, updatedClientState.GetLatestHeight().String()),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@ -33,11 +33,11 @@ func (suite *KeeperTestSuite) TestCreateClient() {
|
||||
i := i
|
||||
if tc.expPanic {
|
||||
suite.Require().Panics(func() {
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
suite.keeper.CreateClient(suite.ctx, tc.clientID, clientState, suite.consensusState)
|
||||
}, "Msg %d didn't panic: %s", i, tc.msg)
|
||||
} else {
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
if tc.expPass {
|
||||
suite.Require().NotNil(clientState, "valid test case %d failed: %s", i, tc.msg)
|
||||
}
|
||||
@ -80,7 +80,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
expPass bool
|
||||
}{
|
||||
{"valid update", func() error {
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
|
||||
// store intermediate consensus state to check that trustedHeight does not need to be highest consensus state before header height
|
||||
@ -98,7 +98,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
return err
|
||||
}, true},
|
||||
{"valid past update", func() error {
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -131,7 +131,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
return nil
|
||||
}, false},
|
||||
{"consensus state not found", func() error {
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
|
||||
updateHeader = createFutureUpdateFn(suite)
|
||||
|
||||
@ -145,7 +145,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
return nil
|
||||
}, false},
|
||||
{"valid past update before client was frozen", func() error {
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState.FrozenHeight = types.NewHeight(0, testClientHeight.VersionHeight-1)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
suite.Require().NoError(err)
|
||||
@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
return nil
|
||||
}, true},
|
||||
{"invalid header", func() error {
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
suite.Require().NoError(err)
|
||||
updateHeader = createPastUpdateFn(suite)
|
||||
@ -250,7 +250,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
name: "successful upgrade",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -275,7 +275,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
name: "client state not found",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -302,7 +302,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
name: "client state frozen",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -333,7 +333,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
name: "tendermint client VerifyUpgrade fails",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -342,7 +342,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = ibctmtypes.NewClientState("wrongchainID", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, true, true)
|
||||
upgradedClient = ibctmtypes.NewClientState("wrongchainID", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, true, true)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
@ -413,12 +413,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: testChainID,
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
suite.consensusState.NextValidatorsHash = bothValsHash
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
|
||||
return err
|
||||
@ -430,12 +429,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
ChainId: testChainID,
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
suite.consensusState.NextValidatorsHash = valsHash
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
|
||||
// store intermediate consensus state to check that trustedHeight does not need to be highest consensus state before header height
|
||||
@ -457,12 +455,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: testChainID,
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
suite.consensusState.NextValidatorsHash = valsHash
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
|
||||
// store trusted consensus state for Header2
|
||||
@ -484,12 +481,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), heightPlus3, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
ChainId: testChainID,
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
suite.consensusState.NextValidatorsHash = valsHash
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
// intermediate consensus state at height + 3 is not created
|
||||
return err
|
||||
@ -501,12 +497,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.VersionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: testChainID,
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
suite.consensusState.NextValidatorsHash = valsHash
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
// intermediate consensus state at height + 3 is not created
|
||||
return err
|
||||
@ -524,12 +519,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: testChainID,
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
suite.consensusState.NextValidatorsHash = bothValsHash
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
|
||||
clientState.FrozenHeight = types.NewHeight(0, 1)
|
||||
@ -544,11 +538,10 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&ibctmtypes.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeight, suite.ctx.BlockTime(), altValSet, bothValSet, altSigners),
|
||||
ChainId: testChainID,
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ func (suite *KeeperTestSuite) TestQueryClientState() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
|
||||
|
||||
var err error
|
||||
@ -204,7 +204,7 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() {
|
||||
{
|
||||
"success latest height",
|
||||
func() {
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
cs := ibctmtypes.NewConsensusState(
|
||||
suite.consensusState.Timestamp, commitmenttypes.NewMerkleRoot([]byte("hash1")), nil,
|
||||
)
|
||||
|
||||
@ -225,13 +225,6 @@ func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientS
|
||||
tmClient.LatestHeight, ctx.BlockHeight())
|
||||
}
|
||||
|
||||
// consensus params must match consensus params on executing chain
|
||||
expectedConsensusParams := ctx.ConsensusParams()
|
||||
if !reflect.DeepEqual(expectedConsensusParams, tmClient.ConsensusParams) {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client has invalid consensus params, expected: %v got: %v",
|
||||
expectedConsensusParams, tmClient.ConsensusParams)
|
||||
}
|
||||
|
||||
expectedProofSpecs := commitmenttypes.GetSDKSpecs()
|
||||
if !reflect.DeepEqual(expectedProofSpecs, tmClient.ProofSpecs) {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client has invalid proof specs. expected: %v got: %v",
|
||||
|
||||
@ -132,7 +132,7 @@ func TestKeeperTestSuite(t *testing.T) {
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestSetClientState() {
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
|
||||
|
||||
retrievedState, found := suite.keeper.GetClientState(suite.ctx, testClientID)
|
||||
@ -152,8 +152,6 @@ func (suite *KeeperTestSuite) TestSetClientConsensusState() {
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
invalidConsensusParams := suite.chainA.GetContext().ConsensusParams()
|
||||
invalidConsensusParams.Evidence.MaxAgeDuration++
|
||||
testClientHeight := types.NewHeight(0, uint64(suite.chainA.GetContext().BlockHeight()))
|
||||
|
||||
testCases := []struct {
|
||||
@ -163,12 +161,12 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
}{
|
||||
{
|
||||
"success",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
true,
|
||||
},
|
||||
{
|
||||
"success with nil UpgradePath",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), "", false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), "", false, false),
|
||||
true,
|
||||
},
|
||||
{
|
||||
@ -178,57 +176,47 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
},
|
||||
{
|
||||
"frozen client",
|
||||
&ibctmtypes.ClientState{suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false},
|
||||
&ibctmtypes.ClientState{suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"incorrect chainID",
|
||||
ibctmtypes.NewClientState("gaiatestnet", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState("gaiatestnet", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid client height",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.NewHeight(0, testClientHeight.VersionHeight+10), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.NewHeight(0, testClientHeight.VersionHeight+10), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid client version",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeightVersion1, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeightVersion1, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid proof specs",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, nil, ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, nil, ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid trust level",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.Fraction{0, 1}, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.Fraction{0, 1}, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid unbonding period",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+10, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod+10, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid trusting period",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ubdPeriod+10, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ubdPeriod+10, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid upgrade path",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), "bad/upgrade/path", false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid consensus params",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, invalidConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"nil consensus params",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, nil, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), "bad/upgrade/path", false, false),
|
||||
false,
|
||||
},
|
||||
}
|
||||
@ -248,9 +236,9 @@ func (suite KeeperTestSuite) TestGetAllGenesisClients() {
|
||||
testClientID2, testClientID3, testClientID,
|
||||
}
|
||||
expClients := []exported.ClientState{
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
}
|
||||
|
||||
expGenClients := make(types.IdentifiedClientStates, len(expClients))
|
||||
@ -298,7 +286,7 @@ func (suite KeeperTestSuite) TestGetConsensusState() {
|
||||
|
||||
func (suite KeeperTestSuite) TestConsensusStateHelpers() {
|
||||
// initial setup
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
|
||||
suite.keeper.SetClientState(suite.ctx, testClientID, clientState)
|
||||
suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight, suite.consensusState)
|
||||
|
||||
@ -30,7 +30,7 @@ func (suite *TypesTestSuite) TestPackClientState() {
|
||||
},
|
||||
{
|
||||
"tendermint client",
|
||||
ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
true,
|
||||
},
|
||||
{
|
||||
@ -175,7 +175,7 @@ func (suite *TypesTestSuite) TestPackMisbehaviour() {
|
||||
},
|
||||
{
|
||||
"tendermint misbehaviour",
|
||||
ibctmtypes.NewMisbehaviour("tendermint", suite.chainA.ChainID, suite.chainA.LastHeader, suite.chainA.LastHeader),
|
||||
ibctmtypes.NewMisbehaviour("tendermint", suite.chainA.LastHeader, suite.chainA.LastHeader),
|
||||
true,
|
||||
},
|
||||
{
|
||||
|
||||
@ -69,7 +69,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
@ -98,7 +98,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
"/~@$*", ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
"/~@$*", ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
@ -127,7 +127,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(exported.Localhost, localhosttypes.NewClientState("chaindID", types.ZeroHeight())),
|
||||
},
|
||||
@ -142,7 +142,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||
@ -171,7 +171,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||
@ -200,7 +200,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||
@ -229,7 +229,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
@ -258,7 +258,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
@ -287,7 +287,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
|
||||
@ -56,7 +56,7 @@ func (suite *TypesTestSuite) TestMarshalMsgCreateClient() {
|
||||
},
|
||||
{
|
||||
"tendermint client", func() {
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
msg, err = types.NewMsgCreateClient("tendermint", tendermintClient, suite.chainA.CurrentTMClientHeader().ConsensusState(), suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
@ -108,7 +108,7 @@ func (suite *TypesTestSuite) TestMsgCreateClient_ValidateBasic() {
|
||||
{
|
||||
"valid - tendermint client",
|
||||
func() {
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
msg, err = types.NewMsgCreateClient("tendermint", tendermintClient, suite.chainA.CurrentTMClientHeader().ConsensusState(), suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
@ -132,7 +132,7 @@ func (suite *TypesTestSuite) TestMsgCreateClient_ValidateBasic() {
|
||||
{
|
||||
"failed to unpack consensus state",
|
||||
func() {
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
msg, err = types.NewMsgCreateClient("tendermint", tendermintClient, suite.chainA.CurrentTMClientHeader().ConsensusState(), suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
msg.ConsensusState = nil
|
||||
@ -348,7 +348,7 @@ func (suite *TypesTestSuite) TestMarshalMsgUpgradeClient() {
|
||||
{
|
||||
"client upgrades to new tendermint client",
|
||||
func() {
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
tendermintClient := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
msg, err = types.NewMsgUpgradeClient("clientid", tendermintClient, newClientHeight, []byte("proofUpgrade"), suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
@ -462,7 +462,7 @@ func (suite *TypesTestSuite) TestMsgUpgradeClient_ValidateBasic() {
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
|
||||
clientState := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState := ibctmtypes.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
newClientHeight := types.NewHeight(1, 1)
|
||||
msg, _ := types.NewMsgUpgradeClient("testclientid", clientState, newClientHeight, []byte("proofUpgrade"), suite.chainA.SenderAccount.GetAddress())
|
||||
|
||||
@ -503,7 +503,7 @@ func (suite *TypesTestSuite) TestMarshalMsgSubmitMisbehaviour() {
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", suite.chainA.ChainID, header1, header2)
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2)
|
||||
msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -561,7 +561,7 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() {
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.VersionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", suite.chainA.ChainID, header1, header2)
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2)
|
||||
msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress())
|
||||
suite.Require().NoError(err)
|
||||
},
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
|
||||
// TestConnOpenInit - chainA initializes (INIT state) a connection with
|
||||
@ -273,7 +272,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
suite.Require().True(found)
|
||||
|
||||
connection.State = types.INIT
|
||||
connection.Versions = []*types.Version{&types.Version{}}
|
||||
connection.Versions = []*types.Version{{}}
|
||||
|
||||
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
||||
|
||||
@ -772,60 +771,3 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure consensus params are correctly validated by executing messages. Consensus params are
|
||||
// set in context by baseapp so test should deliver messages and not call the functions directly.
|
||||
// Only invalid cases are tested since successful instances are by default tested by the testing
|
||||
// package.
|
||||
func (suite *KeeperTestSuite) TestConsensusParamsValidation() {
|
||||
// invalid client state in ConnOpenTry
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// set incorrect consensus params on counterparty client on chainA
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
tmClient, ok := clientState.(*ibctmtypes.ClientState)
|
||||
suite.Require().True(ok)
|
||||
tmClient.ConsensusParams.Evidence.MaxAgeDuration++
|
||||
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientA, tmClient)
|
||||
|
||||
// should fail on validate self client
|
||||
ibctesting.ExpSimPassSend = false
|
||||
ibctesting.ExpPassSend = false
|
||||
err = suite.coordinator.ConnOpenTry(suite.chainB, suite.chainA, connB, connA)
|
||||
suite.Require().Error(err)
|
||||
|
||||
// reset values
|
||||
ibctesting.ExpSimPassSend = true
|
||||
ibctesting.ExpPassSend = true
|
||||
|
||||
suite.SetupTest() // reset
|
||||
|
||||
// invalid client state in ConnOpenAck
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.ConnOpenTry(suite.chainB, suite.chainA, connB, connA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// set incorrect consensus params on counterparty client on chainB
|
||||
clientState = suite.chainB.GetClientState(clientB)
|
||||
tmClient, ok = clientState.(*ibctmtypes.ClientState)
|
||||
suite.Require().True(ok)
|
||||
tmClient.ConsensusParams.Evidence.MaxAgeDuration++
|
||||
|
||||
suite.chainB.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainB.GetContext(), clientB, tmClient)
|
||||
|
||||
// should fail on validate self client
|
||||
ibctesting.ExpSimPassSend = false
|
||||
ibctesting.ExpPassSend = false
|
||||
err = suite.coordinator.ConnOpenAck(suite.chainA, suite.chainB, connA, connB)
|
||||
suite.Require().Error(err)
|
||||
|
||||
// reset values
|
||||
ibctesting.ExpSimPassSend = true
|
||||
ibctesting.ExpPassSend = true
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ func TestConnectionValidateBasic(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"invalid version",
|
||||
types.ConnectionEnd{clientID, []*types.Version{&types.Version{}}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}},
|
||||
types.ConnectionEnd{clientID, []*types.Version{{}}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}},
|
||||
false,
|
||||
},
|
||||
{
|
||||
|
||||
@ -112,7 +112,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
|
||||
signer, _ := sdk.AccAddressFromBech32("cosmos1ckgw5d7jfj7wwxjzs9fdrdev9vc8dzcw3n2lht")
|
||||
|
||||
clientState := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
|
||||
// Pack consensus state into any to test unpacking error
|
||||
@ -124,7 +124,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
|
||||
|
||||
// invalidClientState fails validateBasic
|
||||
invalidClient := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
provedID := ""
|
||||
|
||||
@ -150,7 +150,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
|
||||
{"invalid consensusHeight", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clienttypes.ZeroHeight(), signer), false},
|
||||
{"empty singer", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, nil), false},
|
||||
{"success", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), true},
|
||||
{"invalid version", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{&types.Version{}}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
{"invalid version", types.NewMsgConnectionOpenTry("ibcconntest", provedID, "clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{{}}, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
@ -166,7 +166,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() {
|
||||
func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() {
|
||||
signer, _ := sdk.AccAddressFromBech32("cosmos1ckgw5d7jfj7wwxjzs9fdrdev9vc8dzcw3n2lht")
|
||||
clientState := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
|
||||
// Pack consensus state into any to test unpacking error
|
||||
@ -177,7 +177,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() {
|
||||
|
||||
// invalidClientState fails validateBasic
|
||||
invalidClient := ibctmtypes.NewClientState(
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false,
|
||||
)
|
||||
connectionID := "ibcconntest"
|
||||
|
||||
|
||||
@ -405,14 +405,14 @@ var _ sdk.Msg = &MsgRecvPacket{}
|
||||
// NewMsgRecvPacket constructs new MsgRecvPacket
|
||||
// nolint:interfacer
|
||||
func NewMsgRecvPacket(
|
||||
packet Packet, proof []byte, proofHeight clienttypes.Height,
|
||||
packet Packet, proofCommitment []byte, proofHeight clienttypes.Height,
|
||||
signer sdk.AccAddress,
|
||||
) *MsgRecvPacket {
|
||||
return &MsgRecvPacket{
|
||||
Packet: packet,
|
||||
Proof: proof,
|
||||
ProofHeight: proofHeight,
|
||||
Signer: signer.String(),
|
||||
Packet: packet,
|
||||
ProofCommitment: proofCommitment,
|
||||
ProofHeight: proofHeight,
|
||||
Signer: signer.String(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ func (msg MsgRecvPacket) Route() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgRecvPacket) ValidateBasic() error {
|
||||
if len(msg.Proof) == 0 {
|
||||
if len(msg.ProofCommitment) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof")
|
||||
}
|
||||
if msg.ProofHeight.IsZero() {
|
||||
@ -468,13 +468,13 @@ var _ sdk.Msg = &MsgTimeout{}
|
||||
// NewMsgTimeout constructs new MsgTimeout
|
||||
// nolint:interfacer
|
||||
func NewMsgTimeout(
|
||||
packet Packet, nextSequenceRecv uint64, proof []byte,
|
||||
packet Packet, nextSequenceRecv uint64, proofUnreceived []byte,
|
||||
proofHeight clienttypes.Height, signer sdk.AccAddress,
|
||||
) *MsgTimeout {
|
||||
return &MsgTimeout{
|
||||
Packet: packet,
|
||||
NextSequenceRecv: nextSequenceRecv,
|
||||
Proof: proof,
|
||||
ProofUnreceived: proofUnreceived,
|
||||
ProofHeight: proofHeight,
|
||||
Signer: signer.String(),
|
||||
}
|
||||
@ -487,12 +487,15 @@ func (msg MsgTimeout) Route() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgTimeout) ValidateBasic() error {
|
||||
if len(msg.Proof) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof")
|
||||
if len(msg.ProofUnreceived) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty unreceived proof")
|
||||
}
|
||||
if msg.ProofHeight.IsZero() {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
|
||||
}
|
||||
if msg.NextSequenceRecv == 0 {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidSequence, "next sequence receive cannot be 0")
|
||||
}
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err)
|
||||
@ -524,13 +527,13 @@ func (msg MsgTimeout) Type() string {
|
||||
// nolint:interfacer
|
||||
func NewMsgTimeoutOnClose(
|
||||
packet Packet, nextSequenceRecv uint64,
|
||||
proof, proofClose []byte,
|
||||
proofUnreceived, proofClose []byte,
|
||||
proofHeight clienttypes.Height, signer sdk.AccAddress,
|
||||
) *MsgTimeoutOnClose {
|
||||
return &MsgTimeoutOnClose{
|
||||
Packet: packet,
|
||||
NextSequenceRecv: nextSequenceRecv,
|
||||
Proof: proof,
|
||||
ProofUnreceived: proofUnreceived,
|
||||
ProofClose: proofClose,
|
||||
ProofHeight: proofHeight,
|
||||
Signer: signer.String(),
|
||||
@ -544,7 +547,10 @@ func (msg MsgTimeoutOnClose) Route() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgTimeoutOnClose) ValidateBasic() error {
|
||||
if len(msg.Proof) == 0 {
|
||||
if msg.NextSequenceRecv == 0 {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidSequence, "next sequence receive cannot be 0")
|
||||
}
|
||||
if len(msg.ProofUnreceived) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof")
|
||||
}
|
||||
if len(msg.ProofClose) == 0 {
|
||||
@ -585,11 +591,15 @@ var _ sdk.Msg = &MsgAcknowledgement{}
|
||||
// NewMsgAcknowledgement constructs a new MsgAcknowledgement
|
||||
// nolint:interfacer
|
||||
func NewMsgAcknowledgement(
|
||||
packet Packet, ack []byte, proof []byte, proofHeight clienttypes.Height, signer sdk.AccAddress) *MsgAcknowledgement {
|
||||
packet Packet,
|
||||
ack, proofAcked []byte,
|
||||
proofHeight clienttypes.Height,
|
||||
signer sdk.AccAddress,
|
||||
) *MsgAcknowledgement {
|
||||
return &MsgAcknowledgement{
|
||||
Packet: packet,
|
||||
Acknowledgement: ack,
|
||||
Proof: proof,
|
||||
ProofAcked: proofAcked,
|
||||
ProofHeight: proofHeight,
|
||||
Signer: signer.String(),
|
||||
}
|
||||
@ -602,12 +612,15 @@ func (msg MsgAcknowledgement) Route() string {
|
||||
|
||||
// ValidateBasic implements sdk.Msg
|
||||
func (msg MsgAcknowledgement) ValidateBasic() error {
|
||||
if len(msg.Proof) == 0 {
|
||||
if len(msg.ProofAcked) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof")
|
||||
}
|
||||
if msg.ProofHeight.IsZero() {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidHeight, "proof height must be non-zero")
|
||||
}
|
||||
if len(msg.Acknowledgement) == 0 {
|
||||
return sdkerrors.Wrap(ErrInvalidAcknowledgement, "ack bytes cannot be empty")
|
||||
}
|
||||
_, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err)
|
||||
|
||||
@ -333,7 +333,7 @@ func (suite *TypesTestSuite) TestMsgRecvPacketValidateBasic() {
|
||||
msg *types.MsgRecvPacket
|
||||
expPass bool
|
||||
}{
|
||||
{"", types.NewMsgRecvPacket(packet, suite.proof, height, addr), true},
|
||||
{"success", types.NewMsgRecvPacket(packet, suite.proof, height, addr), true},
|
||||
{"proof height is zero", types.NewMsgRecvPacket(packet, suite.proof, clienttypes.ZeroHeight(), addr), false},
|
||||
{"proof contain empty proof", types.NewMsgRecvPacket(packet, emptyProof, height, addr), false},
|
||||
{"missing signer address", types.NewMsgRecvPacket(packet, suite.proof, height, emptyAddr), false},
|
||||
@ -369,8 +369,9 @@ func (suite *TypesTestSuite) TestMsgTimeoutValidateBasic() {
|
||||
msg *types.MsgTimeout
|
||||
expPass bool
|
||||
}{
|
||||
{"", types.NewMsgTimeout(packet, 1, suite.proof, height, addr), true},
|
||||
{"success", types.NewMsgTimeout(packet, 1, suite.proof, height, addr), true},
|
||||
{"proof height must be > 0", types.NewMsgTimeout(packet, 1, suite.proof, clienttypes.ZeroHeight(), addr), false},
|
||||
{"seq 0", types.NewMsgTimeout(packet, 0, suite.proof, height, addr), false},
|
||||
{"missing signer address", types.NewMsgTimeout(packet, 1, suite.proof, height, emptyAddr), false},
|
||||
{"cannot submit an empty proof", types.NewMsgTimeout(packet, 1, emptyProof, height, addr), false},
|
||||
{"invalid packet", types.NewMsgTimeout(invalidPacket, 1, suite.proof, height, addr), false},
|
||||
@ -398,6 +399,7 @@ func (suite *TypesTestSuite) TestMsgTimeoutOnCloseValidateBasic() {
|
||||
expPass bool
|
||||
}{
|
||||
{"success", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, height, addr), true},
|
||||
{"seq 0", types.NewMsgTimeoutOnClose(packet, 0, suite.proof, suite.proof, height, addr), false},
|
||||
{"empty proof", types.NewMsgTimeoutOnClose(packet, 1, emptyProof, suite.proof, height, addr), false},
|
||||
{"empty proof close", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, emptyProof, height, addr), false},
|
||||
{"proof height is zero", types.NewMsgTimeoutOnClose(packet, 1, suite.proof, suite.proof, clienttypes.ZeroHeight(), addr), false},
|
||||
@ -426,8 +428,9 @@ func (suite *TypesTestSuite) TestMsgAcknowledgementValidateBasic() {
|
||||
msg *types.MsgAcknowledgement
|
||||
expPass bool
|
||||
}{
|
||||
{"", types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, height, addr), true},
|
||||
{"success", types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, height, addr), true},
|
||||
{"proof height must be > 0", types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, clienttypes.ZeroHeight(), addr), false},
|
||||
{"empty ack", types.NewMsgAcknowledgement(packet, nil, suite.proof, height, addr), false},
|
||||
{"missing signer address", types.NewMsgAcknowledgement(packet, packet.GetData(), suite.proof, height, emptyAddr), false},
|
||||
{"cannot submit an empty proof", types.NewMsgAcknowledgement(packet, packet.GetData(), emptyProof, height, addr), false},
|
||||
{"invalid packet", types.NewMsgAcknowledgement(invalidPacket, packet.GetData(), suite.proof, height, addr), false},
|
||||
|
||||
@ -513,10 +513,10 @@ var xxx_messageInfo_MsgChannelCloseConfirmResponse proto.InternalMessageInfo
|
||||
|
||||
// MsgRecvPacket receives incoming IBC packet
|
||||
type MsgRecvPacket struct {
|
||||
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
|
||||
Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"`
|
||||
ProofHeight types.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
|
||||
Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
|
||||
ProofCommitment []byte `protobuf:"bytes,2,opt,name=proof_commitment,json=proofCommitment,proto3" json:"proof_commitment,omitempty" yaml:"proof_commitment"`
|
||||
ProofHeight types.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
|
||||
Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgRecvPacket) Reset() { *m = MsgRecvPacket{} }
|
||||
@ -592,7 +592,7 @@ var xxx_messageInfo_MsgRecvPacketResponse proto.InternalMessageInfo
|
||||
// MsgTimeout receives timed-out packet
|
||||
type MsgTimeout struct {
|
||||
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
|
||||
Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"`
|
||||
ProofUnreceived []byte `protobuf:"bytes,2,opt,name=proof_unreceived,json=proofUnreceived,proto3" json:"proof_unreceived,omitempty" yaml:"proof_unreceived"`
|
||||
ProofHeight types.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
|
||||
NextSequenceRecv uint64 `protobuf:"varint,4,opt,name=next_sequence_recv,json=nextSequenceRecv,proto3" json:"next_sequence_recv,omitempty" yaml:"next_sequence_recv"`
|
||||
Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
@ -671,7 +671,7 @@ var xxx_messageInfo_MsgTimeoutResponse proto.InternalMessageInfo
|
||||
// MsgTimeoutOnClose timed-out packet upon counterparty channel closure.
|
||||
type MsgTimeoutOnClose struct {
|
||||
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
|
||||
Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"`
|
||||
ProofUnreceived []byte `protobuf:"bytes,2,opt,name=proof_unreceived,json=proofUnreceived,proto3" json:"proof_unreceived,omitempty" yaml:"proof_unreceived"`
|
||||
ProofClose []byte `protobuf:"bytes,3,opt,name=proof_close,json=proofClose,proto3" json:"proof_close,omitempty" yaml:"proof_close"`
|
||||
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
|
||||
NextSequenceRecv uint64 `protobuf:"varint,5,opt,name=next_sequence_recv,json=nextSequenceRecv,proto3" json:"next_sequence_recv,omitempty" yaml:"next_sequence_recv"`
|
||||
@ -752,7 +752,7 @@ var xxx_messageInfo_MsgTimeoutOnCloseResponse proto.InternalMessageInfo
|
||||
type MsgAcknowledgement struct {
|
||||
Packet Packet `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"`
|
||||
Acknowledgement []byte `protobuf:"bytes,2,opt,name=acknowledgement,proto3" json:"acknowledgement,omitempty"`
|
||||
Proof []byte `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"`
|
||||
ProofAcked []byte `protobuf:"bytes,3,opt,name=proof_acked,json=proofAcked,proto3" json:"proof_acked,omitempty" yaml:"proof_acked"`
|
||||
ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height" yaml:"proof_height"`
|
||||
Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||
}
|
||||
@ -853,77 +853,80 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/channel/v1/tx.proto", fileDescriptor_bc4637e0ac3fc7b7) }
|
||||
|
||||
var fileDescriptor_bc4637e0ac3fc7b7 = []byte{
|
||||
// 1110 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x3f, 0x6f, 0xdb, 0x46,
|
||||
0x14, 0x17, 0x25, 0x59, 0xb6, 0x9f, 0xdd, 0xc4, 0xa1, 0x64, 0x47, 0xa1, 0x6c, 0xd1, 0x25, 0xd0,
|
||||
0x44, 0x4d, 0x11, 0x29, 0x76, 0x02, 0xb4, 0x0d, 0xba, 0x58, 0x5a, 0x6a, 0x04, 0x46, 0x0a, 0xc6,
|
||||
0xe8, 0x60, 0x14, 0x10, 0xe4, 0xd3, 0x85, 0x22, 0x24, 0xdd, 0xa9, 0x24, 0xad, 0x58, 0xdf, 0xa0,
|
||||
0x4b, 0x81, 0xce, 0x9d, 0x32, 0x16, 0xe8, 0x90, 0x0f, 0xd1, 0x25, 0x63, 0xb6, 0x74, 0x22, 0x0a,
|
||||
0x7b, 0xc9, 0xac, 0x4f, 0x50, 0xf0, 0x78, 0x22, 0x29, 0x8a, 0xb4, 0xe9, 0xba, 0x16, 0x90, 0x49,
|
||||
0x77, 0xf7, 0x7e, 0xf7, 0xee, 0xbd, 0xdf, 0xfb, 0xdd, 0x1f, 0x0a, 0x36, 0xf5, 0x63, 0x54, 0x43,
|
||||
0xd4, 0xc0, 0x35, 0xd4, 0x69, 0x11, 0x82, 0x7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8, 0xd7, 0x9d, 0xad, 0xa8, 0x2b, 0xac, 0xeb, 0x22, 0x03, 0x1a, 0x5b, 0x8a, 0xd1, 0x58,
|
||||
0x09, 0xee, 0xcd, 0x88, 0xc8, 0x93, 0xd8, 0x87, 0x4c, 0x58, 0x62, 0x7b, 0xa8, 0x3b, 0x8f, 0x9d,
|
||||
0x75, 0x04, 0x77, 0x43, 0xda, 0x08, 0x89, 0x48, 0x19, 0xdb, 0x72, 0x39, 0x52, 0x44, 0xbe, 0xbf,
|
||||
0xf5, 0x69, 0xf5, 0x4c, 0x7c, 0xc7, 0x55, 0x3e, 0x7b, 0x8d, 0xca, 0xef, 0x80, 0x5b, 0xd0, 0xa6,
|
||||
0x65, 0x8c, 0x98, 0x84, 0x56, 0xeb, 0x85, 0xb1, 0x2d, 0xaf, 0x05, 0x0b, 0x64, 0x19, 0x23, 0x45,
|
||||
0x5d, 0x62, 0x6d, 0x67, 0xa3, 0x86, 0xcb, 0x9e, 0xbb, 0x91, 0xb2, 0x2f, 0x26, 0x2d, 0xfb, 0x1e,
|
||||
0xea, 0x7a, 0x65, 0xff, 0x33, 0x0d, 0xeb, 0xd3, 0xd6, 0x06, 0x25, 0xaf, 0x74, 0xa3, 0x3f, 0x8f,
|
||||
0xd2, 0x7b, 0x54, 0xb6, 0x50, 0x97, 0x15, 0x3b, 0x82, 0xca, 0x16, 0xea, 0x4e, 0xa8, 0x74, 0x04,
|
||||
0x19, 0xa6, 0x32, 0x7b, 0x23, 0x54, 0x2e, 0xc4, 0x50, 0x29, 0xc3, 0x56, 0x24, 0x59, 0x1e, 0x9d,
|
||||
0xbf, 0x0b, 0x90, 0xf7, 0x11, 0x8d, 0x1e, 0x35, 0xf1, 0xbc, 0x6e, 0x28, 0x3f, 0xfa, 0x4c, 0x4c,
|
||||
0xf4, 0x5b, 0x50, 0x8a, 0x88, 0xcd, 0x8b, 0xfd, 0x6d, 0x1a, 0x36, 0x42, 0xf6, 0x39, 0x6a, 0x61,
|
||||
0xf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 0x93, 0xe3,
|
||||
0xa6, 0x71, 0x80, 0xf4, 0xe0, 0x12, 0x40, 0x50, 0x7b, 0xa1, 0xcb, 0xe0, 0xfe, 0x25, 0x53, 0x39,
|
||||
0x2e, 0x5e, 0x7b, 0xd1, 0x47, 0x9e, 0xb3, 0x79, 0xc3, 0xc7, 0x5d, 0x6c, 0x94, 0x21, 0x60, 0xfc,
|
||||
0xe6, 0x8d, 0x39, 0x31, 0xea, 0xea, 0xbb, 0xb3, 0xb2, 0xf0, 0xfe, 0xac, 0x2c, 0xfc, 0x73, 0x56,
|
||||
0x16, 0x7e, 0x3b, 0x2f, 0xa7, 0xde, 0x9f, 0x97, 0x53, 0x7f, 0x9f, 0x97, 0x53, 0x47, 0xdf, 0x68,
|
||||
0xba, 0xd5, 0x39, 0x39, 0xae, 0x22, 0xda, 0xaf, 0x21, 0x6a, 0xf6, 0xa9, 0xc9, 0x7f, 0x1e, 0x99,
|
||||
0xed, 0x6e, 0xed, 0xb4, 0xe6, 0xfd, 0x5f, 0xf4, 0xf8, 0xe9, 0xa3, 0xc9, 0x5f, 0x46, 0xd6, 0x68,
|
||||
0x80, 0xcd, 0xe3, 0x1c, 0xfb, 0xbb, 0xe8, 0xc9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x86,
|
||||
0x17, 0x79, 0xbd, 0x12, 0x00, 0x00,
|
||||
// 1158 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6e, 0xdb, 0x46,
|
||||
0x10, 0xd6, 0x9f, 0x65, 0x7b, 0xec, 0xc6, 0x0e, 0xfd, 0xa7, 0x50, 0xb6, 0xe8, 0x12, 0x68, 0xe2,
|
||||
0xa6, 0x88, 0x14, 0x3b, 0x01, 0xda, 0x06, 0xbd, 0x58, 0x02, 0x8a, 0x1a, 0x81, 0x91, 0x82, 0x71,
|
||||
0x7b, 0x30, 0x0a, 0x08, 0xf2, 0x6a, 0x43, 0x11, 0xb2, 0x76, 0x55, 0x92, 0x56, 0xac, 0x37, 0xe8,
|
||||
0x31, 0xe7, 0x9e, 0x72, 0xef, 0x21, 0x7d, 0x87, 0x5e, 0x72, 0xcc, 0x2d, 0x45, 0x0f, 0x44, 0x61,
|
||||
0x5f, 0x7a, 0xe6, 0x13, 0x14, 0x5c, 0x2e, 0x7f, 0x44, 0x91, 0x31, 0x5d, 0x57, 0x6a, 0x4f, 0x22,
|
||||
0x67, 0xbe, 0x9d, 0x9d, 0xfd, 0xe6, 0xdb, 0xd9, 0xa5, 0x60, 0x53, 0x3b, 0x41, 0x35, 0x44, 0x75,
|
||||
0x5c, 0x43, 0x9d, 0x16, 0x21, 0xf8, 0xb4, 0x36, 0xd8, 0xad, 0x99, 0xe7, 0xd5, 0xbe, 0x4e, 0x4d,
|
||||
0x2a, 0xac, 0x68, 0x27, 0xa8, 0xea, 0x78, 0xab, 0xdc, 0x5b, 0x1d, 0xec, 0x8a, 0xab, 0x2a, 0x55,
|
||||
0x29, 0xf3, 0xd7, 0x9c, 0x27, 0x17, 0x2a, 0x4a, 0x41, 0xa0, 0x53, 0x0d, 0x13, 0xd3, 0x89, 0xe3,
|
||||
0x3e, 0x71, 0xc0, 0xc7, 0x71, 0x33, 0x79, 0x61, 0x19, 0x44, 0x7e, 0x9f, 0x05, 0xe1, 0xd0, 0x50,
|
||||
0x1b, 0xae, 0xf1, 0x59, 0x1f, 0x93, 0x03, 0xa2, 0x99, 0xc2, 0x67, 0x30, 0xdb, 0xa7, 0xba, 0xd9,
|
||||
0xd4, 0xda, 0xa5, 0xec, 0x76, 0x76, 0x67, 0xbe, 0x2e, 0xd8, 0x96, 0x74, 0x6b, 0xd8, 0xea, 0x9d,
|
||||
0x3e, 0x91, 0xb9, 0x43, 0x56, 0x8a, 0xce, 0xd3, 0x41, 0x5b, 0x78, 0x0c, 0xc0, 0x83, 0x3a, 0xf8,
|
||||
0x1c, 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x3d, 0xfb, 0x77, 0x88, 0x3a, 0x23,
|
||||
0x3a, 0x46, 0x58, 0x1b, 0xe0, 0x76, 0x12, 0x51, 0x01, 0xc2, 0x23, 0xea, 0x3b, 0xdf, 0x32, 0x51,
|
||||
0xa2, 0x9e, 0x82, 0x40, 0xf0, 0xb9, 0xd9, 0x34, 0xf0, 0x8f, 0x67, 0x98, 0x20, 0xdc, 0xd4, 0x31,
|
||||
0x1a, 0x30, 0xd2, 0x0a, 0xe1, 0xfb, 0xd8, 0x38, 0x46, 0x56, 0x96, 0x1d, 0xe3, 0x73, 0x6e, 0x73,
|
||||
0x88, 0x4c, 0x21, 0xd5, 0x55, 0x76, 0x71, 0xe6, 0xdc, 0x06, 0xed, 0xca, 0x3d, 0xf4, 0xb9, 0xf9,
|
||||
0x19, 0x61, 0x1a, 0xfe, 0x3f, 0x30, 0xff, 0x39, 0x2c, 0x70, 0x21, 0x3b, 0x19, 0xf1, 0x76, 0xb0,
|
||||
0x6e, 0x5b, 0x92, 0x30, 0xa2, 0x72, 0xc7, 0x29, 0x2b, 0x6e, 0xe3, 0x70, 0x73, 0x9f, 0x64, 0x43,
|
||||
0x88, 0x2f, 0xd9, 0xcc, 0x4d, 0x4b, 0x56, 0xfc, 0xe0, 0xb9, 0x3d, 0x5a, 0x1b, 0xbf, 0x72, 0xbf,
|
||||
0xe6, 0x58, 0x41, 0xf7, 0x51, 0x97, 0xd0, 0x97, 0xa7, 0xb8, 0xad, 0x62, 0xb6, 0xb5, 0x6f, 0x50,
|
||||
0xba, 0x1d, 0x58, 0x6a, 0x8d, 0x46, 0x73, 0x2b, 0xa7, 0x44, 0xcd, 0x41, 0x71, 0x9c, 0x81, 0xed,
|
||||
0xa4, 0xe2, 0x30, 0xa7, 0x57, 0x9c, 0x7d, 0xe7, 0xe5, 0x3f, 0xee, 0xd6, 0xee, 0x27, 0x56, 0x84,
|
||||
0x31, 0x8f, 0xd0, 0xbd, 0x37, 0x73, 0x90, 0x3f, 0x34, 0x54, 0xa1, 0x0b, 0x4b, 0xd1, 0xcf, 0xcb,
|
||||
0x7b, 0xb1, 0x24, 0x8e, 0x7f, 0xae, 0x89, 0xb5, 0x94, 0x40, 0x6f, 0x52, 0xa1, 0x03, 0xb7, 0x22,
|
||||
0xdf, 0x74, 0x77, 0x53, 0x84, 0x38, 0xd2, 0x87, 0x62, 0x35, 0x1d, 0x2e, 0x61, 0x26, 0xe7, 0x26,
|
||||
0x95, 0x66, 0xa6, 0x7d, 0xd4, 0x4d, 0x35, 0x53, 0xe8, 0x46, 0x29, 0x98, 0x20, 0xc4, 0xdc, 0x26,
|
||||
0xef, 0xa7, 0x88, 0xc2, 0xb1, 0xe2, 0x5e, 0x7a, 0xac, 0x3f, 0x2b, 0x81, 0xe5, 0xb1, 0x4b, 0xd7,
|
||||
0xce, 0x15, 0x71, 0x7c, 0xa4, 0xf8, 0x30, 0x2d, 0xd2, 0x9f, 0xef, 0x25, 0xac, 0xc4, 0x5e, 0x94,
|
||||
0xd2, 0x04, 0xf2, 0xd6, 0xf9, 0xe8, 0x1a, 0x60, 0x7f, 0xe2, 0x1f, 0x00, 0x42, 0xb7, 0x09, 0x39,
|
||||
0x29, 0x44, 0x80, 0x11, 0xef, 0x5f, 0x8d, 0xf1, 0xa3, 0x3f, 0x87, 0x59, 0xef, 0xfc, 0x95, 0x92,
|
||||
0x86, 0x71, 0x80, 0x78, 0xef, 0x0a, 0x40, 0x58, 0x7b, 0x91, 0x13, 0xe6, 0xee, 0x15, 0x43, 0x39,
|
||||
0x2e, 0x59, 0x7b, 0xf1, 0x5d, 0xd1, 0xd9, 0xbc, 0xd1, 0x8e, 0x98, 0x98, 0x65, 0x04, 0x98, 0xbc,
|
||||
0x79, 0x13, 0x3a, 0x46, 0x5d, 0x79, 0x7b, 0x51, 0xc9, 0xbe, 0xbb, 0xa8, 0x64, 0xff, 0xbc, 0xa8,
|
||||
0x64, 0x5f, 0x5d, 0x56, 0x32, 0xef, 0x2e, 0x2b, 0x99, 0xdf, 0x2f, 0x2b, 0x99, 0xe3, 0x2f, 0x54,
|
||||
0xcd, 0xec, 0x9c, 0x9d, 0x54, 0x11, 0xed, 0xd5, 0x10, 0x35, 0x7a, 0xd4, 0xe0, 0x3f, 0x0f, 0x8c,
|
||||
0x76, 0xb7, 0x76, 0x5e, 0xf3, 0xff, 0xe8, 0x7a, 0xf8, 0xf8, 0x81, 0xf7, 0x5f, 0x97, 0x39, 0xec,
|
||||
0x63, 0xe3, 0xa4, 0xc8, 0xfe, 0xe7, 0x7a, 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x07,
|
||||
0x48, 0xeb, 0x76, 0x13, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -1905,10 +1908,10 @@ func (m *MsgRecvPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
if len(m.Proof) > 0 {
|
||||
i -= len(m.Proof)
|
||||
copy(dAtA[i:], m.Proof)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Proof)))
|
||||
if len(m.ProofCommitment) > 0 {
|
||||
i -= len(m.ProofCommitment)
|
||||
copy(dAtA[i:], m.ProofCommitment)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofCommitment)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -1990,10 +1993,10 @@ func (m *MsgTimeout) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
if len(m.Proof) > 0 {
|
||||
i -= len(m.Proof)
|
||||
copy(dAtA[i:], m.Proof)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Proof)))
|
||||
if len(m.ProofUnreceived) > 0 {
|
||||
i -= len(m.ProofUnreceived)
|
||||
copy(dAtA[i:], m.ProofUnreceived)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUnreceived)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -2082,10 +2085,10 @@ func (m *MsgTimeoutOnClose) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.Proof) > 0 {
|
||||
i -= len(m.Proof)
|
||||
copy(dAtA[i:], m.Proof)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Proof)))
|
||||
if len(m.ProofUnreceived) > 0 {
|
||||
i -= len(m.ProofUnreceived)
|
||||
copy(dAtA[i:], m.ProofUnreceived)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUnreceived)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -2162,10 +2165,10 @@ func (m *MsgAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
if len(m.Proof) > 0 {
|
||||
i -= len(m.Proof)
|
||||
copy(dAtA[i:], m.Proof)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Proof)))
|
||||
if len(m.ProofAcked) > 0 {
|
||||
i -= len(m.ProofAcked)
|
||||
copy(dAtA[i:], m.ProofAcked)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.ProofAcked)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
@ -2455,7 +2458,7 @@ func (m *MsgRecvPacket) Size() (n int) {
|
||||
_ = l
|
||||
l = m.Packet.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
l = len(m.Proof)
|
||||
l = len(m.ProofCommitment)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
@ -2485,7 +2488,7 @@ func (m *MsgTimeout) Size() (n int) {
|
||||
_ = l
|
||||
l = m.Packet.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
l = len(m.Proof)
|
||||
l = len(m.ProofUnreceived)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
@ -2518,7 +2521,7 @@ func (m *MsgTimeoutOnClose) Size() (n int) {
|
||||
_ = l
|
||||
l = m.Packet.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
l = len(m.Proof)
|
||||
l = len(m.ProofUnreceived)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
@ -2559,7 +2562,7 @@ func (m *MsgAcknowledgement) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Proof)
|
||||
l = len(m.ProofAcked)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
@ -4325,7 +4328,7 @@ func (m *MsgRecvPacket) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofCommitment", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -4352,9 +4355,9 @@ func (m *MsgRecvPacket) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Proof == nil {
|
||||
m.Proof = []byte{}
|
||||
m.ProofCommitment = append(m.ProofCommitment[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ProofCommitment == nil {
|
||||
m.ProofCommitment = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
@ -4563,7 +4566,7 @@ func (m *MsgTimeout) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofUnreceived", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -4590,9 +4593,9 @@ func (m *MsgTimeout) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Proof == nil {
|
||||
m.Proof = []byte{}
|
||||
m.ProofUnreceived = append(m.ProofUnreceived[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ProofUnreceived == nil {
|
||||
m.ProofUnreceived = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
@ -4820,7 +4823,7 @@ func (m *MsgTimeoutOnClose) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofUnreceived", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -4847,9 +4850,9 @@ func (m *MsgTimeoutOnClose) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Proof == nil {
|
||||
m.Proof = []byte{}
|
||||
m.ProofUnreceived = append(m.ProofUnreceived[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ProofUnreceived == nil {
|
||||
m.ProofUnreceived = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
@ -5145,7 +5148,7 @@ func (m *MsgAcknowledgement) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofAcked", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -5172,9 +5175,9 @@ func (m *MsgAcknowledgement) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Proof == nil {
|
||||
m.Proof = []byte{}
|
||||
m.ProofAcked = append(m.ProofAcked[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.ProofAcked == nil {
|
||||
m.ProofAcked = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
|
||||
@ -56,36 +56,37 @@ func defaultIdentifierValidator(id string, min, max int) error { //nolint:unpara
|
||||
}
|
||||
|
||||
// ClientIdentifierValidator is the default validator function for Client identifiers.
|
||||
// A valid Identifier must be between 9-64 characters and only contain lowercase
|
||||
// alphabetic characters.
|
||||
// A valid Identifier must be between 9-64 characters and only contain alphanumeric and some allowed
|
||||
// special characters (see IsValidID).
|
||||
func ClientIdentifierValidator(id string) error {
|
||||
return defaultIdentifierValidator(id, 9, DefaultMaxCharacterLength)
|
||||
}
|
||||
|
||||
// ConnectionIdentifierValidator is the default validator function for Connection identifiers.
|
||||
// A valid Identifier must be between 10-64 characters and only contain lowercase
|
||||
// alphabetic characters.
|
||||
// A valid Identifier must be between 10-64 characters and only contain alphanumeric and some allowed
|
||||
// special characters (see IsValidID).
|
||||
func ConnectionIdentifierValidator(id string) error {
|
||||
return defaultIdentifierValidator(id, 10, DefaultMaxCharacterLength)
|
||||
}
|
||||
|
||||
// ChannelIdentifierValidator is the default validator function for Channel identifiers.
|
||||
// A valid Identifier must be between 10-64 characters and only contain lowercase
|
||||
// alphabetic characters.
|
||||
// A valid Identifier must be between 10-64 characters and only contain alphanumeric and some allowed
|
||||
// special characters (see IsValidID).
|
||||
func ChannelIdentifierValidator(id string) error {
|
||||
return defaultIdentifierValidator(id, 10, DefaultMaxCharacterLength)
|
||||
}
|
||||
|
||||
// PortIdentifierValidator is the default validator function for Port identifiers.
|
||||
// A valid Identifier must be between 2-64 characters and only contain lowercase
|
||||
// alphabetic characters.
|
||||
// A valid Identifier must be between 2-64 characters and only contain alphanumeric and some allowed
|
||||
// special characters (see IsValidID).
|
||||
func PortIdentifierValidator(id string) error {
|
||||
return defaultIdentifierValidator(id, 2, DefaultMaxCharacterLength)
|
||||
}
|
||||
|
||||
// NewPathValidator takes in a Identifier Validator function and returns
|
||||
// a Path Validator function which requires path only has valid identifiers
|
||||
// alphanumeric character strings, and "/" separators
|
||||
// a Path Validator function which requires path to consist of `/`-separated valid identifiers,
|
||||
// where a valid identifier is between 1-64 characters, contains only alphanumeric and some allowed
|
||||
// special characters (see IsValidID), and satisfies the custom `idValidator` function.
|
||||
func NewPathValidator(idValidator ValidateFn) ValidateFn {
|
||||
return func(path string) error {
|
||||
pathArr := strings.Split(path, "/")
|
||||
@ -112,25 +113,13 @@ func NewPathValidator(idValidator ValidateFn) ValidateFn {
|
||||
}
|
||||
}
|
||||
|
||||
// PathValidator takes in path string and validates with default identifier rules.
|
||||
// This is optimized by simply checking that all path elements are alphanumeric.
|
||||
// PathValidator takes in path string and validates with default identifier rules:
|
||||
// path consists of `/`-separated valid identifiers,
|
||||
// each identifier is between 1-64 characters and contains only alphanumeric and some allowed
|
||||
// special characters (see IsValidID).
|
||||
func PathValidator(path string) error {
|
||||
pathArr := strings.Split(path, "/")
|
||||
if len(pathArr) > 0 && pathArr[0] == path {
|
||||
return sdkerrors.Wrapf(ErrInvalidPath, "path %s doesn't contain any separator '/'", path)
|
||||
}
|
||||
|
||||
for _, p := range pathArr {
|
||||
// a path beginning or ending in a separator returns empty string elements.
|
||||
if p == "" {
|
||||
return sdkerrors.Wrapf(ErrInvalidPath, "path %s cannot begin or end with '/'", path)
|
||||
}
|
||||
|
||||
// Each path element must be a valid identifier or constant number
|
||||
if err := defaultIdentifierValidator(p, 1, DefaultMaxCharacterLength); err != nil {
|
||||
return sdkerrors.Wrapf(err, "path %s contains an invalid identifier: '%s'", path, p)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
f := NewPathValidator(func(path string) error {
|
||||
return nil
|
||||
})
|
||||
return f(path)
|
||||
}
|
||||
|
||||
@ -39,14 +39,14 @@ type ClientState interface {
|
||||
CheckProposedHeaderAndUpdateState(sdk.Context, codec.BinaryMarshaler, sdk.KVStore, Header) (ClientState, ConsensusState, error)
|
||||
|
||||
// Upgrade functions
|
||||
VerifyUpgrade(
|
||||
VerifyUpgradeAndUpdateState(
|
||||
ctx sdk.Context,
|
||||
cdc codec.BinaryMarshaler,
|
||||
store sdk.KVStore,
|
||||
newClient ClientState,
|
||||
upgradeHeight Height,
|
||||
proofUpgrade []byte,
|
||||
) error
|
||||
) (ClientState, ConsensusState, error)
|
||||
// Utility function that zeroes out any client customizable fields in client state
|
||||
// Ledger enforced fields are maintained while all custom fields are zero values
|
||||
// Used to verify upgrades
|
||||
@ -154,7 +154,6 @@ type ConsensusState interface {
|
||||
type Misbehaviour interface {
|
||||
ClientType() string
|
||||
GetClientID() string
|
||||
String() string
|
||||
ValidateBasic() error
|
||||
|
||||
// Height at which the infraction occurred
|
||||
|
||||
@ -77,7 +77,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||
ClientGenesis: clienttypes.NewGenesisState(
|
||||
[]clienttypes.IdentifiedClientState{
|
||||
clienttypes.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
clienttypes.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||
@ -144,7 +144,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||
ClientGenesis: clienttypes.NewGenesisState(
|
||||
[]clienttypes.IdentifiedClientState{
|
||||
clienttypes.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
clienttypes.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("(chaindID)", clienttypes.ZeroHeight()),
|
||||
@ -216,7 +216,7 @@ func (suite *IBCTestSuite) TestInitGenesis() {
|
||||
ClientGenesis: clienttypes.NewGenesisState(
|
||||
[]clienttypes.IdentifiedClientState{
|
||||
clienttypes.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
clientID, ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
clienttypes.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||
|
||||
@ -431,7 +431,7 @@ func (k Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPacke
|
||||
}
|
||||
|
||||
// Perform TAO verification
|
||||
if err := k.ChannelKeeper.RecvPacket(ctx, cap, msg.Packet, msg.Proof, msg.ProofHeight); err != nil {
|
||||
if err := k.ChannelKeeper.RecvPacket(ctx, cap, msg.Packet, msg.ProofCommitment, msg.ProofHeight); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "receive packet verification failed")
|
||||
}
|
||||
|
||||
@ -482,7 +482,7 @@ func (k Keeper) Timeout(goCtx context.Context, msg *channeltypes.MsgTimeout) (*c
|
||||
}
|
||||
|
||||
// Perform TAO verification
|
||||
if err := k.ChannelKeeper.TimeoutPacket(ctx, msg.Packet, msg.Proof, msg.ProofHeight, msg.NextSequenceRecv); err != nil {
|
||||
if err := k.ChannelKeeper.TimeoutPacket(ctx, msg.Packet, msg.ProofUnreceived, msg.ProofHeight, msg.NextSequenceRecv); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "timeout packet verification failed")
|
||||
}
|
||||
|
||||
@ -531,7 +531,7 @@ func (k Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTimeo
|
||||
}
|
||||
|
||||
// Perform TAO verification
|
||||
if err := k.ChannelKeeper.TimeoutOnClose(ctx, cap, msg.Packet, msg.Proof, msg.ProofClose, msg.ProofHeight, msg.NextSequenceRecv); err != nil {
|
||||
if err := k.ChannelKeeper.TimeoutOnClose(ctx, cap, msg.Packet, msg.ProofUnreceived, msg.ProofClose, msg.ProofHeight, msg.NextSequenceRecv); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "timeout on close packet verification failed")
|
||||
}
|
||||
|
||||
@ -582,7 +582,7 @@ func (k Keeper) Acknowledgement(goCtx context.Context, msg *channeltypes.MsgAckn
|
||||
}
|
||||
|
||||
// Perform TAO verification
|
||||
if err := k.ChannelKeeper.AcknowledgePacket(ctx, cap, msg.Packet, msg.Acknowledgement, msg.Proof, msg.ProofHeight); err != nil {
|
||||
if err := k.ChannelKeeper.AcknowledgePacket(ctx, cap, msg.Packet, msg.Acknowledgement, msg.ProofAcked, msg.ProofHeight); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "acknowledge packet verification failed")
|
||||
}
|
||||
|
||||
|
||||
@ -628,7 +628,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
name: "successful upgrade",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod+ibctesting.TrustingPeriod, ibctesting.MaxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod+ibctesting.TrustingPeriod, ibctesting.MaxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -678,7 +678,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
name: "VerifyUpgrade fails",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod+ibctesting.TrustingPeriod, ibctesting.MaxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
upgradedClient = ibctmtypes.NewClientState("newChainId", ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod+ibctesting.TrustingPeriod, ibctesting.MaxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
@ -154,6 +154,9 @@ If the misbehaviour is successfully processed:
|
||||
|
||||
- the client is frozen by setting the frozen sequence to the misbehaviour sequence
|
||||
|
||||
NOTE: Misbehaviour processing is data processing order dependent. A misbehaving solo machine
|
||||
could update to a new public key to prevent being frozen before misbehaviour is submitted.
|
||||
|
||||
## Upgrades
|
||||
|
||||
Upgrades to solo machine light clients are not supported since an entirely different type of
|
||||
|
||||
@ -74,12 +74,12 @@ func (cs ClientState) ZeroCustomFields() exported.ClientState {
|
||||
)
|
||||
}
|
||||
|
||||
// VerifyUpgrade returns an error since solomachine client does not support upgrades
|
||||
func (cs ClientState) VerifyUpgrade(
|
||||
// VerifyUpgradeAndUpdateState returns an error since solomachine client does not support upgrades
|
||||
func (cs ClientState) VerifyUpgradeAndUpdateState(
|
||||
_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore,
|
||||
_ exported.ClientState, _ exported.Height, _ []byte,
|
||||
) error {
|
||||
return sdkerrors.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade solomachine client")
|
||||
) (exported.ClientState, exported.ConsensusState, error) {
|
||||
return nil, nil, sdkerrors.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade solomachine client")
|
||||
}
|
||||
|
||||
// VerifyClientState verifies a proof of the client state of the running chain
|
||||
|
||||
@ -3,8 +3,6 @@ package types
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
|
||||
@ -30,12 +28,6 @@ func (misbehaviour Misbehaviour) Type() string {
|
||||
return exported.TypeClientMisbehaviour
|
||||
}
|
||||
|
||||
// String implements Evidence interface.
|
||||
func (misbehaviour Misbehaviour) String() string {
|
||||
out, _ := yaml.Marshal(misbehaviour)
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// GetHeight returns the sequence at which misbehaviour occurred.
|
||||
// Return exported.Height to satisfy interface
|
||||
// Version number is always 0 for a solo-machine
|
||||
|
||||
@ -11,6 +11,9 @@ import (
|
||||
// CheckMisbehaviourAndUpdateState determines whether or not the currently registered
|
||||
// public key signed over two different messages with the same sequence. If this is true
|
||||
// the client state is updated to a frozen status.
|
||||
// NOTE: Misbehaviour is not tracked for previous public keys, a solo machine may update to
|
||||
// a new public key before the misbehaviour is processed. Therefore, misbehaviour is data
|
||||
// order processing dependent.
|
||||
func (cs ClientState) CheckMisbehaviourAndUpdateState(
|
||||
ctx sdk.Context,
|
||||
cdc codec.BinaryMarshaler,
|
||||
@ -49,14 +52,10 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
|
||||
|
||||
// verifySignatureAndData verifies that the currently registered public key has signed
|
||||
// over the provided data and that the data is valid. The data is valid if it can be
|
||||
// unmarshaled into the specified data type or the timestamp of the signature is less
|
||||
// than the consensus state timestamp.
|
||||
// unmarshaled into the specified data type.
|
||||
func verifySignatureAndData(cdc codec.BinaryMarshaler, clientState ClientState, misbehaviour *Misbehaviour, sigAndData *SignatureAndData) error {
|
||||
// timestamp less than consensus state would always fail and not succeed in fooling the
|
||||
// light client
|
||||
if sigAndData.Timestamp < clientState.ConsensusState.Timestamp {
|
||||
return sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour, "timestamp is less than consensus state timestamp (%d < %d)", sigAndData.Timestamp, clientState.ConsensusState.Timestamp)
|
||||
}
|
||||
|
||||
// do not check misbehaviour timestamp since we want to allow processing of past misbehaviour
|
||||
|
||||
// ensure data can be unmarshaled to the specified data type
|
||||
if _, err := UnmarshalDataByType(cdc, sigAndData.DataType, sigAndData.Data); err != nil {
|
||||
|
||||
@ -29,6 +29,14 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"old misbehaviour is successful (timestamp is less than current consensus state)",
|
||||
func() {
|
||||
clientState = solomachine.ClientState()
|
||||
solomachine.Time = solomachine.Time - 5
|
||||
misbehaviour = solomachine.CreateMisbehaviour()
|
||||
}, true,
|
||||
},
|
||||
{
|
||||
"client is frozen",
|
||||
func() {
|
||||
@ -95,14 +103,6 @@ func (suite *SoloMachineTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
misbehaviour = m
|
||||
}, false,
|
||||
},
|
||||
{
|
||||
"timestamp is less than consensus state timestamp",
|
||||
func() {
|
||||
clientState = solomachine.ClientState()
|
||||
solomachine.Time = solomachine.Time - 5
|
||||
misbehaviour = solomachine.CreateMisbehaviour()
|
||||
}, false,
|
||||
},
|
||||
{
|
||||
"invalid first signature data",
|
||||
func() {
|
||||
|
||||
@ -229,8 +229,9 @@ type Misbehaviour struct {
|
||||
SignatureTwo *SignatureAndData `protobuf:"bytes,4,opt,name=signature_two,json=signatureTwo,proto3" json:"signature_two,omitempty" yaml:"signature_two"`
|
||||
}
|
||||
|
||||
func (m *Misbehaviour) Reset() { *m = Misbehaviour{} }
|
||||
func (*Misbehaviour) ProtoMessage() {}
|
||||
func (m *Misbehaviour) Reset() { *m = Misbehaviour{} }
|
||||
func (m *Misbehaviour) String() string { return proto.CompactTextString(m) }
|
||||
func (*Misbehaviour) ProtoMessage() {}
|
||||
func (*Misbehaviour) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6cc2ee18f7f86d4e, []int{3}
|
||||
}
|
||||
@ -820,93 +821,92 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_6cc2ee18f7f86d4e = []byte{
|
||||
// 1368 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdf, 0x8f, 0xdb, 0xc4,
|
||||
0x13, 0x3f, 0xa7, 0xe9, 0xf5, 0x32, 0xb9, 0xe6, 0xf2, 0x75, 0xd3, 0x36, 0xe7, 0x56, 0x89, 0xbf,
|
||||
0x46, 0x94, 0x03, 0xd1, 0x84, 0x2b, 0xa2, 0x42, 0x15, 0x02, 0x1c, 0xc7, 0xd0, 0xb4, 0x77, 0xbe,
|
||||
0xe0, 0xf8, 0x80, 0x56, 0x48, 0x96, 0xe3, 0xec, 0x25, 0xd6, 0x25, 0x76, 0x88, 0x9d, 0xa4, 0x41,
|
||||
0x42, 0x42, 0x3c, 0x95, 0x88, 0x07, 0x1e, 0x79, 0x89, 0x84, 0x40, 0xfc, 0x2b, 0x08, 0x89, 0x97,
|
||||
0xf2, 0xc6, 0x53, 0x40, 0xed, 0x7f, 0x90, 0xbf, 0x00, 0xad, 0x77, 0x13, 0xdb, 0xb9, 0x5e, 0x4e,
|
||||
0xfc, 0x7a, 0xca, 0xee, 0xcc, 0x67, 0x3e, 0x33, 0x3b, 0x33, 0x99, 0x5d, 0xc3, 0xae, 0x55, 0x37,
|
||||
0x8b, 0x6d, 0xab, 0xd9, 0xf2, 0xcc, 0xb6, 0x85, 0x6c, 0xcf, 0x2d, 0xba, 0x4e, 0xdb, 0xe9, 0x18,
|
||||
0x66, 0xcb, 0xb2, 0x51, 0x71, 0xb0, 0x1b, 0xde, 0x16, 0xba, 0x3d, 0xc7, 0x73, 0xd8, 0xbc, 0x55,
|
||||
0x37, 0x0b, 0x61, 0x93, 0x42, 0x18, 0x33, 0xd8, 0xe5, 0x5e, 0xc2, 0x9c, 0xa6, 0xd3, 0x43, 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xce, 0xc6, 0x79, 0x66,
|
||||
0x67, 0xa3, 0x74, 0x63, 0x36, 0xcd, 0x0b, 0x84, 0x70, 0x05, 0x58, 0x50, 0xb3, 0xbe, 0xf6, 0xd0,
|
||||
0x57, 0x8a, 0x58, 0x57, 0xa5, 0xaa, 0x3b, 0xf1, 0xc7, 0xdf, 0xe5, 0xd7, 0x84, 0xef, 0x19, 0x48,
|
||||
0x45, 0x63, 0x65, 0xef, 0x01, 0x74, 0xfb, 0xf5, 0xb6, 0x65, 0xea, 0xc7, 0x68, 0xe4, 0x27, 0x36,
|
||||
0x79, 0x2b, 0x53, 0x20, 0x65, 0x29, 0xcc, 0xcb, 0x52, 0x10, 0xed, 0x51, 0xe9, 0xf2, 0x6c, 0x9a,
|
||||
0xff, 0x1f, 0x09, 0x22, 0xb0, 0x10, 0xd4, 0x04, 0xd9, 0xdc, 0x47, 0x23, 0x96, 0x87, 0x64, 0xc3,
|
||||
0x1a, 0xa0, 0x9e, 0x6b, 0x1d, 0x59, 0xa8, 0xe7, 0x97, 0x20, 0xa1, 0x86, 0x45, 0xec, 0x75, 0x48,
|
||||
0x78, 0x56, 0x07, 0xb9, 0x9e, 0xd1, 0xe9, 0xfa, 0xd9, 0x8d, 0xab, 0x81, 0x80, 0x06, 0xf9, 0x65,
|
||||
0x0c, 0xd6, 0xef, 0x22, 0xa3, 0x81, 0x7a, 0x2b, 0x6b, 0x1e, 0xa1, 0x8a, 0x2d, 0x51, 0x61, 0xad,
|
||||
0x6b, 0x35, 0x6d, 0xc3, 0xeb, 0xf7, 0x48, 0x19, 0x37, 0xd5, 0x40, 0xc0, 0x1e, 0x42, 0xca, 0x46,
|
||||
0x43, 0x3d, 0x74, 0xf0, 0xf8, 0x8a, 0x83, 0x6f, 0xcf, 0xa6, 0xf9, 0xcb, 0xe4, 0xe0, 0x51, 0x2b,
|
||||
0x41, 0xdd, 0xb4, 0xd1, 0xb0, 0xba, 0x38, 0xbf, 0x04, 0x5b, 0x18, 0x10, 0xce, 0xc1, 0x79, 0x9c,
|
||||
0x83, 0x70, 0x43, 0x2c, 0x01, 0x04, 0x15, 0x47, 0x52, 0x0e, 0x04, 0x34, 0x09, 0xbf, 0xc4, 0x60,
|
||||
0x73, 0xdf, 0x72, 0xeb, 0xa8, 0x65, 0x0c, 0x2c, 0xa7, 0xdf, 0x63, 0x77, 0x21, 0x41, 0x9a, 0x4f,
|
||||
0xb7, 0x1a, 0x7e, 0x2e, 0x12, 0xa5, 0xcc, 0x6c, 0x9a, 0x4f, 0xd3, 0x36, 0x9b, 0xab, 0x04, 0x75,
|
||||
0x83, 0xac, 0x2b, 0x8d, 0x48, 0xf6, 0x62, 0x4b, 0xd9, 0xeb, 0xc2, 0xc5, 0x45, 0x3a, 0x74, 0xc7,
|
||||
0x9e, 0xb7, 0xfa, 0xee, 0x99, 0xad, 0x5e, 0x9b, 0x5b, 0x89, 0x76, 0xa3, 0x6c, 0x78, 0x46, 0x29,
|
||||
0x3b, 0x9b, 0xe6, 0x33, 0x24, 0x8a, 0x08, 0xa3, 0xa0, 0x6e, 0x2e, 0xf6, 0x07, 0xf6, 0x92, 0x47,
|
||||
0x6f, 0xe8, 0xd0, 0x94, 0xff, 0x5b, 0x1e, 0xbd, 0xa1, 0x13, 0xf6, 0xa8, 0x0d, 0x9d, 0x3b, 0x1b,
|
||||
0x38, 0x93, 0xdf, 0xe2, 0x6c, 0xfe, 0xc4, 0x40, 0x7a, 0x99, 0x26, 0xda, 0x22, 0xcc, 0x72, 0x8b,
|
||||
0x7c, 0x02, 0x89, 0x86, 0xe1, 0x19, 0xba, 0x37, 0xea, 0x92, 0xec, 0xa5, 0x6e, 0xbd, 0x7c, 0x66,
|
||||
0xa8, 0x98, 0x57, 0x1b, 0x75, 0x51, 0xb8, 0x34, 0x0b, 0x16, 0x41, 0xdd, 0x68, 0x50, 0x3d, 0xcb,
|
||||
0x42, 0x1c, 0xaf, 0x69, 0x67, 0xfa, 0xeb, 0x68, 0x43, 0xc7, 0x9f, 0xff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, 0xf7, 0x0b, 0x0d, 0xe3, 0x45, 0xbf,
|
||||
0xad, 0xf0, 0x03, 0xa6, 0x10, 0x7a, 0xdb, 0x90, 0x8b, 0x9d, 0xee, 0x64, 0xbb, 0xa1, 0x86, 0x0c,
|
||||
0xa9, 0xdf, 0x06, 0xa4, 0x25, 0xf2, 0xcc, 0x59, 0xed, 0xf4, 0x36, 0x5c, 0xa0, 0xcf, 0x21, 0xea,
|
||||
0xf1, 0x7a, 0xc8, 0x23, 0x7d, 0x27, 0x61, 0x77, 0x64, 0xa9, 0xce, 0xc1, 0xd4, 0xcb, 0x3d, 0xc8,
|
||||
0x54, 0x0d, 0xf3, 0x18, 0x79, 0x92, 0xd3, 0xe9, 0x58, 0x5e, 0x07, 0xd9, 0xde, 0xa9, 0x9e, 0x72,
|
||||
0xf8, 0x78, 0x73, 0x94, 0xef, 0x6c, 0x53, 0x0d, 0x49, 0x84, 0x07, 0xb0, 0x4d, 0xb8, 0x44, 0xf3,
|
||||
0xd8, 0x76, 0x86, 0x6d, 0xd4, 0x68, 0xa2, 0x95, 0x84, 0x3b, 0xb0, 0x65, 0x44, 0xa1, 0x94, 0x75,
|
||||
0x59, 0x2c, 0x14, 0x20, 0x4b, 0xa8, 0x55, 0x64, 0x22, 0xab, 0xeb, 0x89, 0x75, 0x17, 0xcf, 0x81,
|
||||
0xd3, 0x98, 0x85, 0x16, 0x64, 0x14, 0xf4, 0xc8, 0x9b, 0x3f, 0xc0, 0x54, 0x64, 0x0e, 0x4e, 0x8d,
|
||||
0xe2, 0x2d, 0xb8, 0x68, 0xa3, 0x47, 0x1e, 0x7e, 0xbe, 0xe9, 0x3d, 0x64, 0x0e, 0xe8, 0xfb, 0x2e,
|
||||
0x74, 0x15, 0x44, 0xd4, 0x82, 0x9a, 0xb4, 0x09, 0x35, 0x66, 0x7d, 0xe5, 0xeb, 0x38, 0x6c, 0xcc,
|
||||
0x07, 0x03, 0xfb, 0x26, 0xbc, 0x50, 0x16, 0x35, 0x51, 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, 0xbe, 0xfd, 0x1c, 0x02, 0x55, 0x96, 0xe4, 0x4a,
|
||||
0x55, 0xd3, 0xc5, 0x52, 0x4d, 0x56, 0x24, 0x39, 0x7d, 0x81, 0xcb, 0x8e, 0x27, 0x7c, 0x86, 0x68,
|
||||
0xa9, 0x92, 0xea, 0xd8, 0xdb, 0x70, 0x3d, 0xb0, 0x57, 0xe4, 0x8f, 0x35, 0xbd, 0x26, 0x7f, 0x70,
|
||||
0x88, 0x55, 0x98, 0xe6, 0xc3, 0xf4, 0x06, 0x09, 0x1c, 0x6b, 0xe6, 0x0a, 0x2c, 0x67, 0x79, 0x48,
|
||||
0x07, 0x76, 0x77, 0x65, 0xb1, 0x2c, 0xab, 0xe9, 0x04, 0xa9, 0x0c, 0xd9, 0x71, 0xf1, 0xc7, 0x3f,
|
||||
0xe4, 0xd6, 0x4a, 0xfa, 0xcf, 0x4f, 0x73, 0xcc, 0x93, 0xa7, 0x39, 0xe6, 0x8f, 0xa7, 0x39, 0xe6,
|
||||
0x9b, 0x67, 0xb9, 0xb5, 0x27, 0xcf, 0x72, 0x6b, 0xbf, 0x3d, 0xcb, 0xad, 0x3d, 0x94, 0x9b, 0x96,
|
||||
0xd7, 0xea, 0xd7, 0x0b, 0xa6, 0xd3, 0x29, 0x9a, 0x8e, 0xdb, 0x71, 0x5c, 0xfa, 0x73, 0xd3, 0x6d,
|
||||
0x1c, 0x17, 0x1f, 0x15, 0x17, 0x1f, 0x59, 0x37, 0xe7, 0x5f, 0x59, 0xaf, 0xdd, 0xbe, 0x19, 0xfe,
|
||||
0xd0, 0xc2, 0xb7, 0x8c, 0x5b, 0x5f, 0xf7, 0xc7, 0xd9, 0xeb, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff,
|
||||
0x20, 0x84, 0x51, 0xf7, 0x95, 0x0d, 0x00, 0x00,
|
||||
// 1359 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x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0xf5, 0xc0, 0x5e, 0x91,
|
||||
0x3f, 0xd5, 0xf4, 0x9a, 0xfc, 0xd1, 0xa1, 0xa7, 0xf2, 0x68, 0x3e, 0x4e, 0x6f, 0x90, 0xc0, 0x3d,
|
||||
0xcd, 0x5c, 0xe1, 0xc9, 0x59, 0x1e, 0xd2, 0x81, 0xdd, 0x5d, 0x59, 0x2c, 0xcb, 0x6a, 0x3a, 0x41,
|
||||
0x2a, 0x43, 0x76, 0x5c, 0xfc, 0xf1, 0x8f, 0xb9, 0xb5, 0x92, 0xfe, 0xeb, 0xd3, 0x1c, 0xf3, 0xe4,
|
||||
0x69, 0x8e, 0xf9, 0xf3, 0x69, 0x8e, 0xf9, 0xee, 0x59, 0x6e, 0xed, 0xc9, 0xb3, 0xdc, 0xda, 0xef,
|
||||
0xcf, 0x72, 0x6b, 0x0f, 0xe5, 0xa6, 0x85, 0x5b, 0xfd, 0x7a, 0xc1, 0x74, 0x3a, 0x45, 0xd3, 0x71,
|
||||
0x3b, 0x8e, 0x4b, 0x7f, 0x6e, 0xba, 0x8d, 0xe3, 0xe2, 0xa3, 0xe2, 0xe2, 0x03, 0xeb, 0xe6, 0xfc,
|
||||
0x0b, 0xeb, 0x8d, 0xdb, 0x37, 0xc3, 0x1f, 0x59, 0xde, 0x2d, 0xe3, 0xd6, 0xd7, 0xfd, 0x71, 0xf6,
|
||||
0xe6, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x80, 0xd3, 0x79, 0xb6, 0x91, 0x0d, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *ClientState) Marshal() (dAtA []byte, err error) {
|
||||
|
||||
@ -10,7 +10,6 @@ import (
|
||||
ics23 "github.com/confio/ics23/go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/light"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
@ -25,7 +24,6 @@ import (
|
||||
|
||||
const (
|
||||
flagTrustLevel = "trust-level"
|
||||
flagConsensusParams = "consensus-params"
|
||||
flagProofSpecs = "proof-specs"
|
||||
flagUpgradePath = "upgrade-path"
|
||||
flagAllowUpdateAfterExpiry = "allow_update_after_expiry"
|
||||
@ -40,7 +38,6 @@ func NewCreateClientCmd() *cobra.Command {
|
||||
Short: "create new tendermint client",
|
||||
Long: `Create a new tendermint IBC client.
|
||||
- 'trust-level' flag can be a fraction (eg: '1/3') or 'default'
|
||||
- 'consensus-params' flag can be a JSON input, a path to a .json file. The params must match the consensus parameters of the chain this light client represents.
|
||||
- 'proof-specs' flag can be JSON input, a path to a .json file or 'default'
|
||||
- 'upgrade-path' flag is a string specifying the upgrade path for this chain where a future upgraded client will be stored. The path represents a keypath for the store with each key separated by a '/'. Any slash within a key must be escaped.
|
||||
e.g. 'upgrade/upgradedClient'`,
|
||||
@ -71,9 +68,8 @@ func NewCreateClientCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
var (
|
||||
trustLevel types.Fraction
|
||||
consensusParams *abci.ConsensusParams
|
||||
specs []*ics23.ProofSpec
|
||||
trustLevel types.Fraction
|
||||
specs []*ics23.ProofSpec
|
||||
)
|
||||
|
||||
lvl, _ := cmd.Flags().GetString(flagTrustLevel)
|
||||
@ -102,22 +98,6 @@ func NewCreateClientCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
cp, _ := cmd.Flags().GetString(flagConsensusParams)
|
||||
if cp != "" {
|
||||
if err := legacyAmino.UnmarshalJSON([]byte(cp), &consensusParams); err != nil {
|
||||
// check for file path if JSON input not provided
|
||||
contents, err := ioutil.ReadFile(cp)
|
||||
if err != nil {
|
||||
return errors.New("neither JSON input nor path to .json file was provided for consensus params flag")
|
||||
}
|
||||
// TODO migrate to use JSONMarshaler (implement MarshalJSONArray
|
||||
// or wrap lists of proto.Message in some other message)
|
||||
if err := legacyAmino.UnmarshalJSON(contents, &consensusParams); err != nil {
|
||||
return errors.Wrap(err, "error unmarshalling consensus params file")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spc, _ := cmd.Flags().GetString(flagProofSpecs)
|
||||
if spc == "default" {
|
||||
specs = commitmenttypes.GetSDKSpecs()
|
||||
@ -150,7 +130,7 @@ func NewCreateClientCmd() *cobra.Command {
|
||||
|
||||
clientState := types.NewClientState(
|
||||
header.GetHeader().GetChainID(), trustLevel, trustingPeriod, ubdPeriod, maxClockDrift,
|
||||
height, consensusParams, specs, upgradePath, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour,
|
||||
height, specs, upgradePath, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour,
|
||||
)
|
||||
|
||||
consensusState := header.ConsensusState()
|
||||
|
||||
@ -5,10 +5,8 @@ import (
|
||||
"time"
|
||||
|
||||
ics23 "github.com/confio/ics23/go"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/light"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
@ -26,7 +24,7 @@ var _ exported.ClientState = (*ClientState)(nil)
|
||||
func NewClientState(
|
||||
chainID string, trustLevel Fraction,
|
||||
trustingPeriod, ubdPeriod, maxClockDrift time.Duration,
|
||||
latestHeight clienttypes.Height, consensusParams *abci.ConsensusParams, specs []*ics23.ProofSpec,
|
||||
latestHeight clienttypes.Height, specs []*ics23.ProofSpec,
|
||||
upgradePath string, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour bool,
|
||||
) *ClientState {
|
||||
return &ClientState{
|
||||
@ -37,7 +35,6 @@ func NewClientState(
|
||||
MaxClockDrift: maxClockDrift,
|
||||
LatestHeight: latestHeight,
|
||||
FrozenHeight: clienttypes.ZeroHeight(),
|
||||
ConsensusParams: consensusParams,
|
||||
ProofSpecs: specs,
|
||||
UpgradePath: upgradePath,
|
||||
AllowUpdateAfterExpiry: allowUpdateAfterExpiry,
|
||||
@ -105,21 +102,6 @@ func (cs ClientState) Validate() error {
|
||||
)
|
||||
}
|
||||
|
||||
// validate consensus params
|
||||
if cs.ConsensusParams == nil || cs.ConsensusParams.Evidence == nil ||
|
||||
cs.ConsensusParams.Block == nil || cs.ConsensusParams.Validator == nil {
|
||||
return sdkerrors.Wrap(ErrInvalidConsensusParams, "consensus params including block, evidence, and validator params cannot be empty")
|
||||
}
|
||||
if err := baseapp.ValidateBlockParams(*cs.ConsensusParams.Block); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid block params")
|
||||
}
|
||||
if err := baseapp.ValidateEvidenceParams(*cs.ConsensusParams.Evidence); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid evidence params")
|
||||
}
|
||||
if err := baseapp.ValidateValidatorParams(*cs.ConsensusParams.Validator); err != nil {
|
||||
return sdkerrors.Wrap(err, "invalid validator params")
|
||||
}
|
||||
|
||||
if cs.ProofSpecs == nil {
|
||||
return sdkerrors.Wrap(ErrInvalidProofSpecs, "proof specs cannot be nil for tm client")
|
||||
}
|
||||
@ -155,7 +137,6 @@ func (cs ClientState) ZeroCustomFields() exported.ClientState {
|
||||
ChainId: cs.ChainId,
|
||||
UnbondingPeriod: cs.UnbondingPeriod,
|
||||
LatestHeight: cs.LatestHeight,
|
||||
ConsensusParams: cs.ConsensusParams,
|
||||
ProofSpecs: cs.ProofSpecs,
|
||||
UpgradePath: cs.UpgradePath,
|
||||
}
|
||||
|
||||
@ -33,57 +33,57 @@ func (suite *TendermintTestSuite) TestValidate() {
|
||||
}{
|
||||
{
|
||||
name: "valid client",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: true,
|
||||
},
|
||||
{
|
||||
name: "valid client with nil upgrade path",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), "", false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), "", false, false),
|
||||
expPass: true,
|
||||
},
|
||||
{
|
||||
name: "invalid chainID",
|
||||
clientState: types.NewClientState(" ", types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(" ", types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid trust level",
|
||||
clientState: types.NewClientState(chainID, types.Fraction{Numerator: 0, Denominator: 1}, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.Fraction{Numerator: 0, Denominator: 1}, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid trusting period",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, 0, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, 0, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid unbonding period",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, 0, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, 0, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid max clock drift",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, 0, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, 0, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid height",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "trusting period not less than unbonding period",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "proof specs is nil",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, nil, upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, nil, upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "proof specs contains nil",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, []*ics23.ProofSpec{ics23.TendermintSpec, nil}, upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, []*ics23.ProofSpec{ics23.TendermintSpec, nil}, upgradePath, false, false),
|
||||
expPass: false,
|
||||
},
|
||||
}
|
||||
@ -110,7 +110,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() {
|
||||
// FIXME: uncomment
|
||||
// {
|
||||
// name: "successful verification",
|
||||
// clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs()),
|
||||
// clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()),
|
||||
// consensusState: types.ConsensusState{
|
||||
// Root: commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()),
|
||||
// },
|
||||
@ -119,7 +119,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() {
|
||||
// },
|
||||
{
|
||||
name: "ApplyPrefix failed",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
consensusState: types.ConsensusState{
|
||||
Root: commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()),
|
||||
},
|
||||
@ -128,7 +128,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() {
|
||||
},
|
||||
{
|
||||
name: "latest client height < height",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
consensusState: types.ConsensusState{
|
||||
Root: commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()),
|
||||
},
|
||||
@ -146,7 +146,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() {
|
||||
},
|
||||
{
|
||||
name: "proof verification failed",
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
clientState: types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
consensusState: types.ConsensusState{
|
||||
Root: commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()),
|
||||
NextValidatorsHash: suite.valsHash,
|
||||
|
||||
@ -24,8 +24,4 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||
(*exported.Misbehaviour)(nil),
|
||||
&Misbehaviour{},
|
||||
)
|
||||
registry.RegisterImplementations(
|
||||
(*exported.Header)(nil),
|
||||
&Header{},
|
||||
)
|
||||
}
|
||||
|
||||
@ -20,5 +20,4 @@ var (
|
||||
ErrUnbondingPeriodExpired = sdkerrors.Register(SubModuleName, 9, "time since latest trusted state has passed the unbonding period")
|
||||
ErrInvalidProofSpecs = sdkerrors.Register(SubModuleName, 10, "invalid proof specs")
|
||||
ErrInvalidValidatorSet = sdkerrors.Register(SubModuleName, 11, "invalid validator set")
|
||||
ErrInvalidConsensusParams = sdkerrors.Register(SubModuleName, 12, "invalid consensus params")
|
||||
)
|
||||
|
||||
@ -30,20 +30,16 @@ func (h Header) ClientType() string {
|
||||
|
||||
// GetHeight returns the current height. It returns 0 if the tendermint
|
||||
// header is nil.
|
||||
// NOTE: the header.Header is checked to be non nil in ValidateBasic.
|
||||
func (h Header) GetHeight() exported.Height {
|
||||
if h.Header == nil {
|
||||
return clienttypes.ZeroHeight()
|
||||
}
|
||||
version := clienttypes.ParseChainID(h.Header.ChainID)
|
||||
return clienttypes.NewHeight(version, uint64(h.Header.Height))
|
||||
}
|
||||
|
||||
// GetTime returns the current block timestamp. It returns a zero time if
|
||||
// the tendermint header is nil.
|
||||
// NOTE: the header.Header is checked to be non nil in ValidateBasic.
|
||||
func (h Header) GetTime() time.Time {
|
||||
if h.Header == nil {
|
||||
return time.Time{}
|
||||
}
|
||||
return h.Header.Time
|
||||
}
|
||||
|
||||
|
||||
@ -13,17 +13,11 @@ import (
|
||||
func (suite *TendermintTestSuite) TestGetHeight() {
|
||||
header := suite.chainA.LastHeader
|
||||
suite.Require().NotEqual(uint64(0), header.GetHeight())
|
||||
|
||||
header.Header = nil
|
||||
suite.Require().Equal(clienttypes.ZeroHeight(), header.GetHeight())
|
||||
}
|
||||
|
||||
func (suite *TendermintTestSuite) TestGetTime() {
|
||||
header := suite.chainA.LastHeader
|
||||
suite.Require().NotEqual(time.Time{}, header.GetTime())
|
||||
|
||||
header.Header = nil
|
||||
suite.Require().Equal(time.Time{}, header.GetTime())
|
||||
}
|
||||
|
||||
func (suite *TendermintTestSuite) TestHeaderValidateBasic() {
|
||||
|
||||
@ -4,8 +4,6 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
@ -20,10 +18,9 @@ var (
|
||||
)
|
||||
|
||||
// NewMisbehaviour creates a new Misbehaviour instance.
|
||||
func NewMisbehaviour(clientID, chainID string, header1, header2 *Header) *Misbehaviour {
|
||||
func NewMisbehaviour(clientID string, header1, header2 *Header) *Misbehaviour {
|
||||
return &Misbehaviour{
|
||||
ClientId: clientID,
|
||||
ChainId: chainID,
|
||||
Header1: header1,
|
||||
Header2: header2,
|
||||
}
|
||||
@ -39,16 +36,6 @@ func (misbehaviour Misbehaviour) GetClientID() string {
|
||||
return misbehaviour.ClientId
|
||||
}
|
||||
|
||||
// String implements Misbehaviour interface
|
||||
func (misbehaviour Misbehaviour) String() string {
|
||||
// FIXME: implement custom marshaller
|
||||
bz, err := yaml.Marshal(misbehaviour)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return string(bz)
|
||||
}
|
||||
|
||||
// GetHeight returns the height at which misbehaviour occurred
|
||||
//
|
||||
// NOTE: assumes that misbehaviour headers have the same height
|
||||
@ -84,6 +71,9 @@ func (misbehaviour Misbehaviour) ValidateBasic() error {
|
||||
if misbehaviour.Header2.TrustedValidators == nil {
|
||||
return sdkerrors.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty")
|
||||
}
|
||||
if misbehaviour.Header1.Header.ChainID != misbehaviour.Header2.Header.ChainID {
|
||||
return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers must have identical chainIDs")
|
||||
}
|
||||
|
||||
if err := host.ClientIdentifierValidator(misbehaviour.ClientId); err != nil {
|
||||
return sdkerrors.Wrap(err, "misbehaviour client ID is invalid")
|
||||
@ -120,10 +110,10 @@ func (misbehaviour Misbehaviour) ValidateBasic() error {
|
||||
if blockID1.Equals(*blockID2) {
|
||||
return sdkerrors.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers blockIDs are equal")
|
||||
}
|
||||
if err := ValidCommit(misbehaviour.ChainId, misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil {
|
||||
if err := ValidCommit(misbehaviour.Header1.Header.ChainID, misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ValidCommit(misbehaviour.ChainId, misbehaviour.Header2.Commit, misbehaviour.Header2.ValidatorSet); err != nil {
|
||||
if err := ValidCommit(misbehaviour.Header2.Header.ChainID, misbehaviour.Header2.Commit, misbehaviour.Header2.ValidatorSet); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@ -51,35 +51,6 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState(
|
||||
return nil, sdkerrors.Wrapf(err, "could not get trusted consensus state from clientStore for Header2 at TrustedHeight: %s", tmMisbehaviour.Header2)
|
||||
}
|
||||
|
||||
// calculate the age of the misbehaviour
|
||||
infractionTime := tmMisbehaviour.GetTime()
|
||||
ageDuration := ctx.BlockTime().Sub(infractionTime)
|
||||
|
||||
var ageBlocks int64
|
||||
if tmMisbehaviour.GetHeight().GetVersionNumber() == cs.LatestHeight.VersionNumber {
|
||||
// if the misbehaviour is in the same version as the client then
|
||||
// perform expiry check using block height in addition to time
|
||||
infractionHeight := tmMisbehaviour.GetHeight().GetVersionHeight()
|
||||
ageBlocks = int64(cs.LatestHeight.VersionHeight - infractionHeight)
|
||||
} else {
|
||||
// if the misbehaviour is from a different version, then the version-height
|
||||
// of misbehaviour has no correlation with the current version-height
|
||||
// so we disable the block check by setting ageBlocks to 0 and only
|
||||
// rely on the time expiry check with ageDuration
|
||||
ageBlocks = 0
|
||||
}
|
||||
|
||||
// Reject misbehaviour if the age is too old. Misbehaviour is considered stale
|
||||
// if the difference in time and number of blocks is greater than the allowed
|
||||
// parameters defined.
|
||||
if ageDuration > cs.ConsensusParams.Evidence.MaxAgeDuration ||
|
||||
ageBlocks > cs.ConsensusParams.Evidence.MaxAgeNumBlocks {
|
||||
return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidMisbehaviour,
|
||||
"age duration (%s) and age blocks (%d) are greater than max consensus params for duration (%s) and block (%d)",
|
||||
ageDuration, ageBlocks, cs.ConsensusParams.Evidence.MaxAgeDuration, cs.ConsensusParams.Evidence.MaxAgeNumBlocks,
|
||||
)
|
||||
}
|
||||
|
||||
// Check the validity of the two conflicting headers against their respective
|
||||
// trusted consensus states
|
||||
// NOTE: header height and commitment root assertions are checked in
|
||||
@ -137,7 +108,7 @@ func checkMisbehaviourHeader(
|
||||
chainID, _ = clienttypes.SetVersionNumber(chainID, header.GetHeight().GetVersionNumber())
|
||||
}
|
||||
|
||||
// - ValidatorSet must have 2/3 similarity with trusted FromValidatorSet
|
||||
// - ValidatorSet must have TrustLevel similarity with trusted FromValidatorSet
|
||||
// - ValidatorSets on both headers are valid given the last trusted ValidatorSet
|
||||
if err := tmTrustedValset.VerifyCommitLightTrusting(
|
||||
chainID, tmCommit, clientState.TrustLevel.ToTendermint(),
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
@ -36,7 +35,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
|
||||
altSigners := []tmtypes.PrivValidator{altPrivVal}
|
||||
|
||||
versionHeight := int64(height.VersionHeight)
|
||||
heightMinus1 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight-1)
|
||||
heightMinus3 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight-3)
|
||||
|
||||
@ -53,7 +51,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
}{
|
||||
{
|
||||
"valid misbehavior misbehaviour",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -61,7 +59,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -69,7 +66,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"valid misbehavior at height greater than last consensusState",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -77,7 +74,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -85,7 +81,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"valid misbehaviour with different trusted heights",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
@ -93,7 +89,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -101,7 +96,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"valid misbehaviour at a previous version",
|
||||
types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
@ -109,7 +104,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainIDVersion0, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainIDVersion0, int64(height.VersionHeight), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainIDVersion0,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -117,7 +111,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"valid misbehaviour at a future version",
|
||||
types.NewClientState(chainIDVersion0, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainIDVersion0, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
@ -125,7 +119,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainIDVersion0, 3, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainIDVersion0, 3, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainIDVersion0,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -133,7 +126,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"valid misbehaviour with trusted heights at a previous version",
|
||||
types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
@ -141,7 +134,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainIDVersion1, 1, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainIDVersion1, 1, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainIDVersion1,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -149,7 +141,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"consensus state's valset hash different from misbehaviour should still pass",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
@ -157,7 +149,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -165,7 +156,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"invalid misbehavior misbehaviour from different chain",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -173,7 +164,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader("ethermint", int64(height.VersionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: "ethermint",
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -181,7 +171,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"invalid misbehavior misbehaviour with trusted height different from trusted consensus state",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
@ -189,7 +179,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -197,7 +186,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"invalid misbehavior misbehaviour with trusted validators different from trusted consensus state",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
@ -205,7 +194,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus3, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -221,7 +209,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -229,7 +216,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"trusted consensus state does not exist",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
nil, // consensus state for trusted height - 1 does not exist in store
|
||||
clienttypes.Height{},
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -237,7 +224,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -245,7 +231,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"invalid tendermint misbehaviour",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -254,41 +240,9 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
suite.now,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"rejected misbehaviour due to expired age duration",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now.Add(2 * time.Minute).Add(simapp.DefaultConsensusParams.Evidence.MaxAgeDuration),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"rejected misbehaviour due to expired block duration",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(0, uint64(versionHeight+simapp.DefaultConsensusParams.Evidence.MaxAgeNumBlocks+1)), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now.Add(time.Hour),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"provided height > header height",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -296,7 +250,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -304,7 +257,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"unbonding period expired",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(time.Time{}, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -312,7 +265,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now.Add(ubdPeriod),
|
||||
@ -320,7 +272,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"trusted validators is incorrect for given consensus state",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -328,7 +280,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -336,7 +287,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"first valset has too much change",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -344,7 +295,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, altValSet, bothValSet, altSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -352,7 +302,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"second valset has too much change",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -360,7 +310,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
@ -368,7 +317,7 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
},
|
||||
{
|
||||
"both valsets have too much change",
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
@ -376,7 +325,6 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now, altValSet, bothValSet, altSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
||||
@ -21,7 +21,6 @@ func (suite *TendermintTestSuite) TestMisbehaviour() {
|
||||
misbehaviour := &types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
}
|
||||
|
||||
@ -65,7 +64,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -73,13 +71,13 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
},
|
||||
{
|
||||
"misbehaviour Header1 is nil",
|
||||
types.NewMisbehaviour(clientID, chainID, nil, suite.header),
|
||||
types.NewMisbehaviour(clientID, nil, suite.header),
|
||||
func(m *types.Misbehaviour) error { return nil },
|
||||
false,
|
||||
},
|
||||
{
|
||||
"misbehaviour Header2 is nil",
|
||||
types.NewMisbehaviour(clientID, chainID, suite.header, nil),
|
||||
types.NewMisbehaviour(clientID, suite.header, nil),
|
||||
func(m *types.Misbehaviour) error { return nil },
|
||||
false,
|
||||
},
|
||||
@ -88,7 +86,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), clienttypes.NewHeight(0, height.VersionHeight-3), suite.now.Add(time.Minute), suite.valSet, bothValSet, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -99,7 +96,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
Header2: suite.header,
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -110,7 +106,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -121,7 +116,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers),
|
||||
Header2: suite.header,
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -132,7 +126,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -143,40 +136,16 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: "GAIA",
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
false,
|
||||
},
|
||||
{
|
||||
"wrong chainID on header1",
|
||||
"chainIDs do not match",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.VersionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
ChainId: "ethermint",
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
false,
|
||||
},
|
||||
{
|
||||
"wrong chainID on header2",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.VersionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
false,
|
||||
},
|
||||
{
|
||||
"wrong chainID in misbehaviour",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
ChainId: "ethermint",
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -187,7 +156,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, 6, clienttypes.NewHeight(0, 4), suite.now, suite.valSet, suite.valSet, signers),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -198,7 +166,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.header,
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
@ -209,7 +176,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.header,
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error {
|
||||
@ -231,7 +197,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error {
|
||||
@ -253,7 +218,6 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
ChainId: chainID,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error {
|
||||
|
||||
@ -7,15 +7,14 @@ import (
|
||||
fmt "fmt"
|
||||
_go "github.com/confio/ics23/go"
|
||||
types "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
types2 "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types"
|
||||
types1 "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
|
||||
_ "github.com/golang/protobuf/ptypes/duration"
|
||||
_ "github.com/golang/protobuf/ptypes/timestamp"
|
||||
types1 "github.com/tendermint/tendermint/abci/types"
|
||||
github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes"
|
||||
types3 "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
types2 "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
@ -50,18 +49,16 @@ type ClientState struct {
|
||||
FrozenHeight types.Height `protobuf:"bytes,6,opt,name=frozen_height,json=frozenHeight,proto3" json:"frozen_height" yaml:"frozen_height"`
|
||||
// Latest height the client was updated to
|
||||
LatestHeight types.Height `protobuf:"bytes,7,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height" yaml:"latest_height"`
|
||||
// Consensus params of the chain
|
||||
ConsensusParams *types1.ConsensusParams `protobuf:"bytes,8,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params,omitempty" yaml:"consensus_params"`
|
||||
// Proof specifications used in verifying counterparty state
|
||||
ProofSpecs []*_go.ProofSpec `protobuf:"bytes,9,rep,name=proof_specs,json=proofSpecs,proto3" json:"proof_specs,omitempty" yaml:"proof_specs"`
|
||||
ProofSpecs []*_go.ProofSpec `protobuf:"bytes,8,rep,name=proof_specs,json=proofSpecs,proto3" json:"proof_specs,omitempty" yaml:"proof_specs"`
|
||||
// Path at which next upgraded client will be committed
|
||||
UpgradePath string `protobuf:"bytes,10,opt,name=upgrade_path,json=upgradePath,proto3" json:"upgrade_path,omitempty" yaml:"upgrade_path"`
|
||||
UpgradePath string `protobuf:"bytes,9,opt,name=upgrade_path,json=upgradePath,proto3" json:"upgrade_path,omitempty" yaml:"upgrade_path"`
|
||||
// This flag, when set to true, will allow governance to recover a client
|
||||
// which has expired
|
||||
AllowUpdateAfterExpiry bool `protobuf:"varint,11,opt,name=allow_update_after_expiry,json=allowUpdateAfterExpiry,proto3" json:"allow_update_after_expiry,omitempty" yaml:"allow_update_after_expiry"`
|
||||
AllowUpdateAfterExpiry bool `protobuf:"varint,10,opt,name=allow_update_after_expiry,json=allowUpdateAfterExpiry,proto3" json:"allow_update_after_expiry,omitempty" yaml:"allow_update_after_expiry"`
|
||||
// This flag, when set to true, will allow governance to unfreeze a client
|
||||
// whose chain has experienced a misbehaviour event
|
||||
AllowUpdateAfterMisbehaviour bool `protobuf:"varint,12,opt,name=allow_update_after_misbehaviour,json=allowUpdateAfterMisbehaviour,proto3" json:"allow_update_after_misbehaviour,omitempty" yaml:"allow_update_after_misbehaviour"`
|
||||
AllowUpdateAfterMisbehaviour bool `protobuf:"varint,11,opt,name=allow_update_after_misbehaviour,json=allowUpdateAfterMisbehaviour,proto3" json:"allow_update_after_misbehaviour,omitempty" yaml:"allow_update_after_misbehaviour"`
|
||||
}
|
||||
|
||||
func (m *ClientState) Reset() { *m = ClientState{} }
|
||||
@ -103,7 +100,7 @@ type ConsensusState struct {
|
||||
// was stored.
|
||||
Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"`
|
||||
// commitment root (i.e app hash)
|
||||
Root types2.MerkleRoot `protobuf:"bytes,2,opt,name=root,proto3" json:"root"`
|
||||
Root types1.MerkleRoot `protobuf:"bytes,2,opt,name=root,proto3" json:"root"`
|
||||
NextValidatorsHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,3,opt,name=next_validators_hash,json=nextValidatorsHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"next_validators_hash,omitempty" yaml:"next_validators_hash"`
|
||||
}
|
||||
|
||||
@ -144,13 +141,13 @@ var xxx_messageInfo_ConsensusState proto.InternalMessageInfo
|
||||
// that implements Misbehaviour interface expected by ICS-02
|
||||
type Misbehaviour struct {
|
||||
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"`
|
||||
ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"`
|
||||
Header1 *Header `protobuf:"bytes,3,opt,name=header_1,json=header1,proto3" json:"header_1,omitempty" yaml:"header_1"`
|
||||
Header2 *Header `protobuf:"bytes,4,opt,name=header_2,json=header2,proto3" json:"header_2,omitempty" yaml:"header_2"`
|
||||
Header1 *Header `protobuf:"bytes,2,opt,name=header_1,json=header1,proto3" json:"header_1,omitempty" yaml:"header_1"`
|
||||
Header2 *Header `protobuf:"bytes,3,opt,name=header_2,json=header2,proto3" json:"header_2,omitempty" yaml:"header_2"`
|
||||
}
|
||||
|
||||
func (m *Misbehaviour) Reset() { *m = Misbehaviour{} }
|
||||
func (*Misbehaviour) ProtoMessage() {}
|
||||
func (m *Misbehaviour) Reset() { *m = Misbehaviour{} }
|
||||
func (m *Misbehaviour) String() string { return proto.CompactTextString(m) }
|
||||
func (*Misbehaviour) ProtoMessage() {}
|
||||
func (*Misbehaviour) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c6d6cf2b288949be, []int{2}
|
||||
}
|
||||
@ -194,10 +191,10 @@ var xxx_messageInfo_Misbehaviour proto.InternalMessageInfo
|
||||
// hash to TrustedConsensusState.NextValidatorsHash since that is the last
|
||||
// trusted validator set at the TrustedHeight.
|
||||
type Header struct {
|
||||
*types3.SignedHeader `protobuf:"bytes,1,opt,name=signed_header,json=signedHeader,proto3,embedded=signed_header" json:"signed_header,omitempty" yaml:"signed_header"`
|
||||
ValidatorSet *types3.ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty" yaml:"validator_set"`
|
||||
*types2.SignedHeader `protobuf:"bytes,1,opt,name=signed_header,json=signedHeader,proto3,embedded=signed_header" json:"signed_header,omitempty" yaml:"signed_header"`
|
||||
ValidatorSet *types2.ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty" yaml:"validator_set"`
|
||||
TrustedHeight types.Height `protobuf:"bytes,3,opt,name=trusted_height,json=trustedHeight,proto3" json:"trusted_height" yaml:"trusted_height"`
|
||||
TrustedValidators *types3.ValidatorSet `protobuf:"bytes,4,opt,name=trusted_validators,json=trustedValidators,proto3" json:"trusted_validators,omitempty" yaml:"trusted_validators"`
|
||||
TrustedValidators *types2.ValidatorSet `protobuf:"bytes,4,opt,name=trusted_validators,json=trustedValidators,proto3" json:"trusted_validators,omitempty" yaml:"trusted_validators"`
|
||||
}
|
||||
|
||||
func (m *Header) Reset() { *m = Header{} }
|
||||
@ -233,7 +230,7 @@ func (m *Header) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_Header proto.InternalMessageInfo
|
||||
|
||||
func (m *Header) GetValidatorSet() *types3.ValidatorSet {
|
||||
func (m *Header) GetValidatorSet() *types2.ValidatorSet {
|
||||
if m != nil {
|
||||
return m.ValidatorSet
|
||||
}
|
||||
@ -247,14 +244,14 @@ func (m *Header) GetTrustedHeight() types.Height {
|
||||
return types.Height{}
|
||||
}
|
||||
|
||||
func (m *Header) GetTrustedValidators() *types3.ValidatorSet {
|
||||
func (m *Header) GetTrustedValidators() *types2.ValidatorSet {
|
||||
if m != nil {
|
||||
return m.TrustedValidators
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Fraction defines the protobuf message type for tmmath.Fraction
|
||||
// Fraction defines the protobuf message type for tmmath.Fraction that only supports positive values.
|
||||
type Fraction struct {
|
||||
Numerator uint64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"`
|
||||
Denominator uint64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"`
|
||||
@ -320,79 +317,75 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_c6d6cf2b288949be = []byte{
|
||||
// 1142 bytes of a gzipped FileDescriptorProto
|
||||
// 1079 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x6f, 0xe3, 0xc4,
|
||||
0x17, 0x6f, 0xda, 0x7e, 0xb7, 0xe9, 0x24, 0xdd, 0xf6, 0xeb, 0x2d, 0xbb, 0x69, 0xb7, 0x1b, 0x47,
|
||||
0x06, 0x2d, 0x15, 0xd2, 0xda, 0x24, 0x8b, 0x84, 0x54, 0x71, 0xc1, 0x5b, 0x50, 0x8b, 0x58, 0xa9,
|
||||
0x72, 0xf9, 0x21, 0x21, 0x81, 0x99, 0xd8, 0x93, 0x78, 0x54, 0xdb, 0x63, 0x3c, 0x93, 0x90, 0xf2,
|
||||
0x17, 0xc0, 0x6d, 0x8f, 0x2b, 0x4e, 0x1c, 0xf8, 0x47, 0xb8, 0xed, 0xb1, 0xe2, 0xc4, 0xc9, 0xa0,
|
||||
0xf6, 0x3f, 0xc8, 0x91, 0x13, 0x9a, 0x1f, 0x8e, 0x27, 0xd9, 0x2e, 0xd5, 0x72, 0x49, 0xe6, 0xbd,
|
||||
0xf7, 0x79, 0xef, 0xa3, 0x79, 0xf3, 0xe6, 0x33, 0x06, 0x0e, 0xee, 0x07, 0x4e, 0x8c, 0x87, 0x11,
|
||||
0x0b, 0x62, 0x8c, 0x52, 0x46, 0x1d, 0x86, 0xd2, 0x10, 0xe5, 0x09, 0x4e, 0x99, 0x33, 0xee, 0x6a,
|
||||
0x96, 0x9d, 0xe5, 0x84, 0x11, 0xa3, 0x8d, 0xfb, 0x81, 0xad, 0x27, 0xd8, 0x1a, 0x64, 0xdc, 0xdd,
|
||||
0xed, 0x68, 0xf9, 0xec, 0x3c, 0x43, 0xd4, 0x19, 0xc3, 0x18, 0x87, 0x90, 0x91, 0x5c, 0x56, 0xd8,
|
||||
0xdd, 0x7b, 0x09, 0x21, 0x7e, 0x55, 0xf4, 0xbe, 0x16, 0x85, 0xfd, 0x00, 0xcf, 0x05, 0xef, 0x04,
|
||||
0x24, 0x1d, 0x60, 0xe2, 0x64, 0x39, 0x21, 0x83, 0xd2, 0xd9, 0x1e, 0x12, 0x32, 0x8c, 0x91, 0x23,
|
||||
0xac, 0xfe, 0x68, 0xe0, 0x84, 0xa3, 0x1c, 0x32, 0x4c, 0x52, 0x15, 0x37, 0x17, 0xe3, 0x0c, 0x27,
|
||||
0x88, 0x32, 0x98, 0x64, 0x25, 0x80, 0xf7, 0x20, 0x20, 0x39, 0x72, 0xe4, 0x96, 0xf8, 0xbe, 0xe5,
|
||||
0x4a, 0x01, 0xde, 0xae, 0x00, 0x24, 0x49, 0x30, 0x4b, 0x4a, 0xd0, 0xcc, 0x52, 0xc0, 0xed, 0x21,
|
||||
0x19, 0x12, 0xb1, 0x74, 0xf8, 0x4a, 0x7a, 0xad, 0xdf, 0xeb, 0xa0, 0xf1, 0x44, 0xd4, 0x3b, 0x65,
|
||||
0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, 0xcc, 0xf7, 0x86, 0x98,
|
||||
0x45, 0xa3, 0x3e, 0xa7, 0xd3, 0x5f, 0x22, 0x6d, 0x19, 0xe3, 0x3e, 0x75, 0xfa, 0xe7, 0x0c, 0x51,
|
||||
0xfb, 0x08, 0x4d, 0x5c, 0xbe, 0xf0, 0x0c, 0x5e, 0xee, 0x8b, 0x59, 0xb5, 0x23, 0x48, 0x23, 0xd5,
|
||||
0xa6, 0xdf, 0x96, 0x41, 0x53, 0xef, 0x9e, 0xd1, 0x05, 0xeb, 0xf2, 0x0a, 0xcd, 0xd4, 0xd7, 0xdd,
|
||||
0x9e, 0x16, 0xe6, 0x96, 0x9a, 0xec, 0x32, 0x64, 0x79, 0x75, 0xb9, 0x3e, 0x0e, 0x0d, 0x5b, 0xd3,
|
||||
0xeb, 0x65, 0x91, 0x71, 0x67, 0x5a, 0x98, 0x9b, 0x2a, 0x43, 0x45, 0xac, 0x4a, 0xc4, 0x21, 0xa8,
|
||||
0x47, 0x08, 0x86, 0x28, 0xf7, 0xbb, 0x4a, 0x56, 0x1f, 0xde, 0xa4, 0xe0, 0x47, 0x02, 0xef, 0xb6,
|
||||
0x2f, 0x0b, 0x73, 0x4d, 0xae, 0xbb, 0x15, 0x45, 0x59, 0xcc, 0xf2, 0xd6, 0xe4, 0xb2, 0xab, 0x51,
|
||||
0xf4, 0x94, 0xa0, 0xfe, 0x07, 0x8a, 0xde, 0x4b, 0x14, 0xbd, 0x19, 0x45, 0xef, 0xa0, 0xce, 0xfb,
|
||||
0xf7, 0x9c, 0xf7, 0xf0, 0xe7, 0x15, 0x70, 0x4b, 0x66, 0x18, 0x10, 0x6c, 0x50, 0x3c, 0x4c, 0x51,
|
||||
0xe8, 0x4b, 0x98, 0x1a, 0xb3, 0xb6, 0xce, 0x25, 0x1f, 0xec, 0x53, 0x01, 0x53, 0xa4, 0x7b, 0x17,
|
||||
0x85, 0x59, 0xab, 0x34, 0x6a, 0xae, 0x84, 0xe5, 0x35, 0xa9, 0x86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 0x02, 0x00, 0x00, 0xff, 0xff, 0xb3, 0x43,
|
||||
0xab, 0xfe, 0x75, 0x0a, 0x00, 0x00,
|
||||
0x17, 0x6f, 0xda, 0x7e, 0xb7, 0xe9, 0x24, 0xdd, 0xf6, 0xeb, 0x2d, 0xdd, 0xb4, 0x74, 0xe3, 0xc8,
|
||||
0xa0, 0xa5, 0x42, 0xaa, 0x4d, 0xb2, 0x48, 0x48, 0x15, 0x17, 0xdc, 0x82, 0x5a, 0xc4, 0x4a, 0x95,
|
||||
0xcb, 0x0f, 0x09, 0x09, 0xcc, 0xc4, 0x9e, 0x24, 0xa3, 0xda, 0x1e, 0xe3, 0x99, 0x84, 0x94, 0xbf,
|
||||
0x00, 0x0e, 0x48, 0x7b, 0x44, 0x9c, 0x38, 0xf0, 0xc7, 0xec, 0xb1, 0x47, 0x4e, 0x06, 0xb5, 0x17,
|
||||
0xce, 0x39, 0x72, 0x42, 0xf3, 0xc3, 0xf6, 0x34, 0xdb, 0xa5, 0x5a, 0x2e, 0xed, 0xbc, 0xf7, 0x3e,
|
||||
0xef, 0xf3, 0xc9, 0xbc, 0x79, 0xf3, 0xc6, 0xc0, 0xc1, 0xfd, 0xc0, 0x89, 0xf0, 0x70, 0xc4, 0x82,
|
||||
0x08, 0xa3, 0x84, 0x51, 0x87, 0xa1, 0x24, 0x44, 0x59, 0x8c, 0x13, 0xe6, 0x4c, 0xba, 0x9a, 0x65,
|
||||
0xa7, 0x19, 0x61, 0xc4, 0x68, 0xe3, 0x7e, 0x60, 0xeb, 0x09, 0xb6, 0x06, 0x99, 0x74, 0x77, 0x3a,
|
||||
0x5a, 0x3e, 0xbb, 0x48, 0x11, 0x75, 0x26, 0x30, 0xc2, 0x21, 0x64, 0x24, 0x93, 0x0c, 0x3b, 0xbb,
|
||||
0x2f, 0x20, 0xc4, 0x5f, 0x15, 0x7d, 0x10, 0x90, 0x64, 0x80, 0x89, 0x93, 0x66, 0x84, 0x0c, 0x0a,
|
||||
0x67, 0x7b, 0x48, 0xc8, 0x30, 0x42, 0x8e, 0xb0, 0xfa, 0xe3, 0x81, 0x13, 0x8e, 0x33, 0xc8, 0x30,
|
||||
0x49, 0x54, 0xdc, 0x9c, 0x8f, 0x33, 0x1c, 0x23, 0xca, 0x60, 0x9c, 0x16, 0x00, 0xbe, 0xcd, 0x80,
|
||||
0x64, 0xc8, 0x91, 0xbf, 0x9a, 0x6f, 0x4d, 0xae, 0x14, 0xe0, 0xad, 0x0a, 0x40, 0xe2, 0x18, 0xb3,
|
||||
0xb8, 0x00, 0x95, 0x96, 0x02, 0x6e, 0x0e, 0xc9, 0x90, 0x88, 0xa5, 0xc3, 0x57, 0xd2, 0x6b, 0xfd,
|
||||
0xb5, 0x02, 0x1a, 0x87, 0x82, 0xef, 0x8c, 0x41, 0x86, 0x8c, 0x6d, 0x50, 0x0f, 0x46, 0x10, 0x27,
|
||||
0x3e, 0x0e, 0x5b, 0xb5, 0x4e, 0x6d, 0x6f, 0xd5, 0x5b, 0x11, 0xf6, 0x49, 0x68, 0x20, 0xd0, 0x60,
|
||||
0xd9, 0x98, 0x32, 0x3f, 0x42, 0x13, 0x14, 0xb5, 0x16, 0x3b, 0xb5, 0xbd, 0x46, 0x6f, 0xcf, 0xfe,
|
||||
0xf7, 0xb2, 0xda, 0x1f, 0x65, 0x30, 0xe0, 0x1b, 0x76, 0x77, 0x9e, 0xe7, 0xe6, 0xc2, 0x2c, 0x37,
|
||||
0x8d, 0x0b, 0x18, 0x47, 0x07, 0x96, 0x46, 0x65, 0x79, 0x40, 0x58, 0x9f, 0x70, 0xc3, 0x18, 0x80,
|
||||
0x75, 0x61, 0xe1, 0x64, 0xe8, 0xa7, 0x28, 0xc3, 0x24, 0x6c, 0x2d, 0x09, 0xa9, 0x6d, 0x5b, 0x16,
|
||||
0xcb, 0x2e, 0x8a, 0x65, 0x1f, 0xa9, 0x62, 0xba, 0x96, 0xe2, 0xde, 0xd2, 0xb8, 0xab, 0x7c, 0xeb,
|
||||
0xe7, 0x3f, 0xcc, 0x9a, 0x77, 0xbf, 0xf0, 0x9e, 0x0a, 0xa7, 0x81, 0xc1, 0xc6, 0x38, 0xe9, 0x93,
|
||||
0x24, 0xd4, 0x84, 0x96, 0xef, 0x12, 0x7a, 0x43, 0x09, 0x3d, 0x94, 0x42, 0xf3, 0x04, 0x52, 0x69,
|
||||
0xbd, 0x74, 0x2b, 0x29, 0x04, 0xd6, 0x63, 0x38, 0xf5, 0x83, 0x88, 0x04, 0xe7, 0x7e, 0x98, 0xe1,
|
||||
0x01, 0x6b, 0xfd, 0xef, 0x15, 0xb7, 0x34, 0x97, 0x2f, 0x85, 0xd6, 0x62, 0x38, 0x3d, 0xe4, 0xce,
|
||||
0x23, 0xee, 0x33, 0xbe, 0x02, 0x6b, 0x83, 0x8c, 0x7c, 0x8f, 0x12, 0x7f, 0x84, 0xf8, 0x81, 0xb4,
|
||||
0xee, 0x09, 0x91, 0x1d, 0x71, 0x44, 0xbc, 0x45, 0x6c, 0xd5, 0x39, 0x93, 0xae, 0x7d, 0x2c, 0x10,
|
||||
0xee, 0xae, 0x52, 0xd9, 0x94, 0x2a, 0x37, 0xd2, 0x2d, 0xaf, 0x29, 0x6d, 0x89, 0xe5, 0xf4, 0x11,
|
||||
0x64, 0x88, 0xb2, 0x82, 0x7e, 0xe5, 0x55, 0xe9, 0x6f, 0xa4, 0x5b, 0x5e, 0x53, 0xda, 0x8a, 0xfe,
|
||||
0x04, 0x34, 0xc4, 0xd5, 0xf1, 0x69, 0x8a, 0x02, 0xda, 0xaa, 0x77, 0x96, 0xf6, 0x1a, 0xbd, 0x0d,
|
||||
0x1b, 0x07, 0xb4, 0xf7, 0xc4, 0x3e, 0xe5, 0x91, 0xb3, 0x14, 0x05, 0xee, 0x56, 0xd5, 0x42, 0x1a,
|
||||
0xdc, 0xf2, 0x40, 0x5a, 0x40, 0xa8, 0x71, 0x00, 0x9a, 0xe3, 0x74, 0x98, 0xc1, 0x10, 0xf9, 0x29,
|
||||
0x64, 0xa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, 0x8b, 0xbd, 0xf3, 0xde,
|
||||
0xfe, 0xfc, 0xc7, 0x52, 0xff, 0x9e, 0x98, 0x28, 0x4f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x4c,
|
||||
0xb7, 0x2c, 0x8e, 0xba, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *ClientState) Marshal() (dAtA []byte, err error) {
|
||||
@ -423,7 +416,7 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x60
|
||||
dAtA[i] = 0x58
|
||||
}
|
||||
if m.AllowUpdateAfterExpiry {
|
||||
i--
|
||||
@ -433,14 +426,14 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x58
|
||||
dAtA[i] = 0x50
|
||||
}
|
||||
if len(m.UpgradePath) > 0 {
|
||||
i -= len(m.UpgradePath)
|
||||
copy(dAtA[i:], m.UpgradePath)
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(len(m.UpgradePath)))
|
||||
i--
|
||||
dAtA[i] = 0x52
|
||||
dAtA[i] = 0x4a
|
||||
}
|
||||
if len(m.ProofSpecs) > 0 {
|
||||
for iNdEx := len(m.ProofSpecs) - 1; iNdEx >= 0; iNdEx-- {
|
||||
@ -453,21 +446,9 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x4a
|
||||
dAtA[i] = 0x42
|
||||
}
|
||||
}
|
||||
if m.ConsensusParams != nil {
|
||||
{
|
||||
size, err := m.ConsensusParams.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
}
|
||||
{
|
||||
size, err := m.LatestHeight.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
@ -488,29 +469,29 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x32
|
||||
n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxClockDrift, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxClockDrift):])
|
||||
n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxClockDrift, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxClockDrift):])
|
||||
if err3 != nil {
|
||||
return 0, err3
|
||||
}
|
||||
i -= n3
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(n3))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod):])
|
||||
if err4 != nil {
|
||||
return 0, err4
|
||||
}
|
||||
i -= n4
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(n4))
|
||||
i--
|
||||
dAtA[i] = 0x2a
|
||||
n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod):])
|
||||
dAtA[i] = 0x22
|
||||
n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TrustingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TrustingPeriod):])
|
||||
if err5 != nil {
|
||||
return 0, err5
|
||||
}
|
||||
i -= n5
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(n5))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TrustingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TrustingPeriod):])
|
||||
if err6 != nil {
|
||||
return 0, err6
|
||||
}
|
||||
i -= n6
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(n6))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
{
|
||||
size, err := m.TrustLevel.MarshalToSizedBuffer(dAtA[:i])
|
||||
@ -569,12 +550,12 @@ func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):])
|
||||
if err9 != nil {
|
||||
return 0, err9
|
||||
n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):])
|
||||
if err8 != nil {
|
||||
return 0, err8
|
||||
}
|
||||
i -= n9
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(n9))
|
||||
i -= n8
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(n8))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
@ -610,7 +591,7 @@ func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if m.Header1 != nil {
|
||||
{
|
||||
@ -622,13 +603,6 @@ func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.ChainId) > 0 {
|
||||
i -= len(m.ChainId)
|
||||
copy(dAtA[i:], m.ChainId)
|
||||
i = encodeVarintTendermint(dAtA, i, uint64(len(m.ChainId)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.ClientId) > 0 {
|
||||
@ -776,10 +750,6 @@ func (m *ClientState) Size() (n int) {
|
||||
n += 1 + l + sovTendermint(uint64(l))
|
||||
l = m.LatestHeight.Size()
|
||||
n += 1 + l + sovTendermint(uint64(l))
|
||||
if m.ConsensusParams != nil {
|
||||
l = m.ConsensusParams.Size()
|
||||
n += 1 + l + sovTendermint(uint64(l))
|
||||
}
|
||||
if len(m.ProofSpecs) > 0 {
|
||||
for _, e := range m.ProofSpecs {
|
||||
l = e.Size()
|
||||
@ -826,10 +796,6 @@ func (m *Misbehaviour) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTendermint(uint64(l))
|
||||
}
|
||||
l = len(m.ChainId)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTendermint(uint64(l))
|
||||
}
|
||||
if m.Header1 != nil {
|
||||
l = m.Header1.Size()
|
||||
n += 1 + l + sovTendermint(uint64(l))
|
||||
@ -1145,42 +1111,6 @@ func (m *ClientState) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 8:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ConsensusParams", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTendermint
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTendermint
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTendermint
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.ConsensusParams == nil {
|
||||
m.ConsensusParams = &types1.ConsensusParams{}
|
||||
}
|
||||
if err := m.ConsensusParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 9:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ProofSpecs", wireType)
|
||||
}
|
||||
@ -1214,7 +1144,7 @@ func (m *ClientState) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 10:
|
||||
case 9:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field UpgradePath", wireType)
|
||||
}
|
||||
@ -1246,7 +1176,7 @@ func (m *ClientState) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.UpgradePath = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 11:
|
||||
case 10:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AllowUpdateAfterExpiry", wireType)
|
||||
}
|
||||
@ -1266,7 +1196,7 @@ func (m *ClientState) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
}
|
||||
m.AllowUpdateAfterExpiry = bool(v != 0)
|
||||
case 12:
|
||||
case 11:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AllowUpdateAfterMisbehaviour", wireType)
|
||||
}
|
||||
@ -1525,38 +1455,6 @@ func (m *Misbehaviour) Unmarshal(dAtA []byte) error {
|
||||
m.ClientId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTendermint
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTendermint
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTendermint
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ChainId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Header1", wireType)
|
||||
}
|
||||
@ -1592,7 +1490,7 @@ func (m *Misbehaviour) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Header2", wireType)
|
||||
}
|
||||
@ -1711,7 +1609,7 @@ func (m *Header) Unmarshal(dAtA []byte) error {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.SignedHeader == nil {
|
||||
m.SignedHeader = &types3.SignedHeader{}
|
||||
m.SignedHeader = &types2.SignedHeader{}
|
||||
}
|
||||
if err := m.SignedHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
@ -1747,7 +1645,7 @@ func (m *Header) Unmarshal(dAtA []byte) error {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.ValidatorSet == nil {
|
||||
m.ValidatorSet = &types3.ValidatorSet{}
|
||||
m.ValidatorSet = &types2.ValidatorSet{}
|
||||
}
|
||||
if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
@ -1816,7 +1714,7 @@ func (m *Header) Unmarshal(dAtA []byte) error {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.TrustedValidators == nil {
|
||||
m.TrustedValidators = &types3.ValidatorSet{}
|
||||
m.TrustedValidators = &types2.ValidatorSet{}
|
||||
}
|
||||
if err := m.TrustedValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
|
||||
@ -57,7 +57,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "successful update with next height and same validator set",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
@ -67,7 +67,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "successful update with future height and different validator set",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus5.VersionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
@ -77,7 +77,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "successful update with next height and different validator set",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), bothValSet.Hash())
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.headerTime, bothValSet, bothValSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
@ -87,7 +87,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "successful update for a previous height",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
consStateHeight = heightMinus3
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightMinus1.VersionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
@ -98,7 +98,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "successful update for a previous version",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainIDVersion0, int64(height.VersionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
@ -108,7 +108,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update with incorrect header chain-id",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader("ethermint", int64(heightPlus1.VersionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
@ -118,7 +118,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update to a future version",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainIDVersion0, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainIDVersion0, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainIDVersion1, 1, height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
@ -128,7 +128,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update: header height version and trusted height version mismatch",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainIDVersion1, 3, height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
@ -138,7 +138,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update with next height: update header mismatches nextValSetHash",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
@ -148,7 +148,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update with next height: update header mismatches different nextValSetHash",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), bothValSet.Hash())
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.headerTime, suite.valSet, bothValSet, signers)
|
||||
currentTime = suite.now
|
||||
@ -158,7 +158,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update with future height: too much change in validator set",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus5.VersionHeight), height, suite.headerTime, altValSet, suite.valSet, altSigners)
|
||||
currentTime = suite.now
|
||||
@ -168,7 +168,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful updates, passed in incorrect trusted validators for given consensus state",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus5.VersionHeight), height, suite.headerTime, bothValSet, bothValSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
@ -178,7 +178,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update: trusting period has passed since last client timestamp",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
// make current time pass trusting period from last timestamp on clientstate
|
||||
@ -189,7 +189,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update: header timestamp is past current timestamp",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
@ -199,7 +199,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "unsuccessful update: header timestamp is not past last client timestamp",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.clientTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
@ -209,7 +209,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "header basic validation failed",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.VersionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
// cause new header to fail validatebasic by changing commit height to mismatch header height
|
||||
@ -221,7 +221,7 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
||||
{
|
||||
name: "header height < consensus height",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(height.VersionNumber, heightPlus5.VersionHeight), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(height.VersionNumber, heightPlus5.VersionHeight), commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
consensusState = types.NewConsensusState(suite.clientTime, commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()), suite.valsHash)
|
||||
// Make new header at height less than latest client state
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightMinus1.VersionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
|
||||
@ -3,7 +3,6 @@ package types
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@ -14,51 +13,54 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
)
|
||||
|
||||
// VerifyUpgrade checks if the upgraded client has been committed by the current client
|
||||
// VerifyUpgradeAndUpdateState checks if the upgraded client has been committed by the current client
|
||||
// It will zero out all client-specific fields (e.g. TrustingPeriod and verify all data
|
||||
// in client state that must be the same across all valid Tendermint clients for the new chain.
|
||||
// VerifyUpgrade will return an error if:
|
||||
// - the upgradedClient is not a Tendermint ClientState
|
||||
// - the lastest height of the client state does not have the same version number or has a greater
|
||||
// height than the committed client.
|
||||
// - the height of upgraded client is not greater than that of current client
|
||||
// - the latest height of the new client does not match the height in committed client
|
||||
// - the latest height of the new client does not match or is greater than the height in committed client
|
||||
// - any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod,
|
||||
// and ProofSpecs do not match parameters set by committed client
|
||||
func (cs ClientState) VerifyUpgrade(
|
||||
func (cs ClientState) VerifyUpgradeAndUpdateState(
|
||||
ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore,
|
||||
upgradedClient exported.ClientState, upgradeHeight exported.Height, proofUpgrade []byte,
|
||||
) error {
|
||||
) (exported.ClientState, exported.ConsensusState, error) {
|
||||
if cs.UpgradePath == "" {
|
||||
return sdkerrors.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade client, no upgrade path set")
|
||||
return nil, nil, sdkerrors.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade client, no upgrade path set")
|
||||
}
|
||||
upgradePath, err := constructUpgradeMerklePath(cs.UpgradePath, upgradeHeight)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade client, unescaping key with URL format failed: %v", err)
|
||||
return nil, nil, sdkerrors.Wrapf(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade client, unescaping key with URL format failed: %v", err)
|
||||
}
|
||||
|
||||
// UpgradeHeight must be in same version as client state height
|
||||
if cs.GetLatestHeight().GetVersionNumber() != upgradeHeight.GetVersionNumber() {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "version at which upgrade occurs must be same as current client version. expected version %d, got %d",
|
||||
return nil, nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "version at which upgrade occurs must be same as current client version. expected version %d, got %d",
|
||||
cs.GetLatestHeight().GetVersionNumber(), upgradeHeight.GetVersionNumber())
|
||||
}
|
||||
|
||||
tmClient, ok := upgradedClient.(*ClientState)
|
||||
if !ok {
|
||||
return sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "upgraded client must be Tendermint client. expected: %T got: %T",
|
||||
&ClientState{}, upgradedClient)
|
||||
// UpgradeHeight must be greater than or equal to current client state height
|
||||
if cs.GetLatestHeight().GetVersionHeight() > upgradeHeight.GetVersionHeight() {
|
||||
return nil, nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "version height at which upgrade occurs must be greater than or equal to current client height (%d > %d)",
|
||||
cs.GetLatestHeight().GetVersionHeight(), upgradeHeight.GetVersionHeight(),
|
||||
)
|
||||
}
|
||||
|
||||
if !upgradedClient.GetLatestHeight().GT(cs.GetLatestHeight()) {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "upgraded client height %s must be greater than current client height %s",
|
||||
return nil, nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "upgraded client height %s must be greater than current client height %s",
|
||||
upgradedClient.GetLatestHeight(), cs.GetLatestHeight())
|
||||
}
|
||||
|
||||
if len(proofUpgrade) == 0 {
|
||||
return sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "proof of upgrade is empty")
|
||||
return nil, nil, sdkerrors.Wrap(commitmenttypes.ErrInvalidProof, "proof of upgrade is empty")
|
||||
}
|
||||
|
||||
var merkleProof commitmenttypes.MerkleProof
|
||||
if err := cdc.UnmarshalBinaryBare(proofUpgrade, &merkleProof); err != nil {
|
||||
return sdkerrors.Wrapf(commitmenttypes.ErrInvalidProof, "could not unmarshal merkle proof: %v", err)
|
||||
return nil, nil, sdkerrors.Wrapf(commitmenttypes.ErrInvalidProof, "could not unmarshal merkle proof: %v", err)
|
||||
}
|
||||
|
||||
// counterparty chain must commit the upgraded client with all client-customizable fields zeroed out
|
||||
@ -66,7 +68,7 @@ func (cs ClientState) VerifyUpgrade(
|
||||
committedClient := upgradedClient.ZeroCustomFields()
|
||||
bz, err := codec.MarshalAny(cdc, committedClient)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrapf(clienttypes.ErrInvalidClient, "could not marshal client state: %v", err)
|
||||
return nil, nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClient, "could not marshal client state: %v", err)
|
||||
}
|
||||
|
||||
// Must prove against latest consensus state to ensure we are verifying against latest upgrade plan
|
||||
@ -74,34 +76,38 @@ func (cs ClientState) VerifyUpgrade(
|
||||
// at this consensus state
|
||||
consState, err := GetConsensusState(clientStore, cdc, upgradeHeight)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "could not retrieve consensus state for upgradeHeight")
|
||||
return nil, nil, sdkerrors.Wrap(err, "could not retrieve consensus state for upgradeHeight")
|
||||
}
|
||||
|
||||
if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) {
|
||||
return sdkerrors.Wrap(clienttypes.ErrInvalidClient, "cannot upgrade an expired client")
|
||||
return nil, nil, sdkerrors.Wrap(clienttypes.ErrInvalidClient, "cannot upgrade an expired client")
|
||||
}
|
||||
|
||||
tmCommittedClient, ok := committedClient.(*ClientState)
|
||||
if !ok {
|
||||
return sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "upgraded client must be Tendermint client. expected: %T got: %T",
|
||||
return nil, nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "upgraded client must be Tendermint client. expected: %T got: %T",
|
||||
&ClientState{}, upgradedClient)
|
||||
}
|
||||
|
||||
// Relayer must keep all client-chosen parameters the same as the previous client.
|
||||
// Compare relayer-provided client state against expected client state.
|
||||
// Relayer chosen client parameters are ignored.
|
||||
// All chain-chosen parameters come from committed client, all client-chosen parameters
|
||||
// come from current client
|
||||
expectedClient := NewClientState(
|
||||
// come from current client.
|
||||
updatedClientState := NewClientState(
|
||||
tmCommittedClient.ChainId, cs.TrustLevel, cs.TrustingPeriod, tmCommittedClient.UnbondingPeriod,
|
||||
cs.MaxClockDrift, tmCommittedClient.LatestHeight, tmCommittedClient.ConsensusParams, tmCommittedClient.ProofSpecs, tmCommittedClient.UpgradePath,
|
||||
cs.MaxClockDrift, tmCommittedClient.LatestHeight, tmCommittedClient.ProofSpecs, tmCommittedClient.UpgradePath,
|
||||
cs.AllowUpdateAfterExpiry, cs.AllowUpdateAfterMisbehaviour,
|
||||
)
|
||||
if !reflect.DeepEqual(expectedClient, tmClient) {
|
||||
return sdkerrors.Wrapf(clienttypes.ErrInvalidClient, "upgraded client does not maintain previous chosen parameters. expected: %v got: %v",
|
||||
expectedClient, tmClient)
|
||||
|
||||
if err := updatedClientState.Validate(); err != nil {
|
||||
return nil, nil, sdkerrors.Wrap(err, "updated client state failed basic validation")
|
||||
}
|
||||
|
||||
return merkleProof.VerifyMembership(cs.ProofSpecs, consState.GetRoot(), upgradePath, bz)
|
||||
if err := merkleProof.VerifyMembership(cs.ProofSpecs, consState.GetRoot(), upgradePath, bz); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: Return valid consensus state https://github.com/cosmos/cosmos-sdk/issues/7708
|
||||
return updatedClientState, &ConsensusState{}, nil
|
||||
}
|
||||
|
||||
// construct MerklePath from upgradePath
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
||||
)
|
||||
|
||||
@ -26,7 +25,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "successful upgrade",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -51,7 +50,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "successful upgrade with different client chosen parameters set in upgraded client",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -60,7 +59,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
@ -71,7 +70,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
|
||||
// Previous client-chosen parameters must be the same as upgraded client chosen parameters
|
||||
tmClient, _ := cs.(*types.ClientState)
|
||||
oldClient := types.NewClientState(tmClient.ChainId, types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, tmClient.LatestHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
oldClient := types.NewClientState(tmClient.ChainId, types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, tmClient.LatestHeight, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientA, oldClient)
|
||||
|
||||
proofUpgrade, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
@ -82,7 +81,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: upgrade height version does not match current client version",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(10, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -103,11 +102,37 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "unsuccessful upgrade: upgrade height version height is less than the current client version height",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(10, uint64(suite.chainB.GetContext().BlockHeight()-1))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgrade, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
||||
{
|
||||
name: "unsuccessful upgrade: chain-specified parameters do not match committed client",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -116,7 +141,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = types.NewClientState("wrongchainID", types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, true, true)
|
||||
upgradedClient = types.NewClientState("wrongchainID", types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, true, true)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
@ -133,12 +158,12 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: client-specified parameters do not match previous client",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, upgradeHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, upgradeHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, upgradeHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, upgradeHeight, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
@ -154,7 +179,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
{
|
||||
name: "unsuccessful upgrade: proof is empty",
|
||||
setup: func() {
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
proofUpgrade = []byte{}
|
||||
},
|
||||
expPass: false,
|
||||
@ -162,7 +187,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
{
|
||||
name: "unsuccessful upgrade: proof unmarshal failed",
|
||||
setup: func() {
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
proofUpgrade = []byte("proof")
|
||||
},
|
||||
expPass: false,
|
||||
@ -171,7 +196,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: proof verification failed",
|
||||
setup: func() {
|
||||
// create but do not store upgraded client
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -187,7 +212,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: upgrade path is empty",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -217,7 +242,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: upgrade path is malformed and cannot be correctly unescaped",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -247,7 +272,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: upgraded height is not greater than current height",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, height, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
@ -272,7 +297,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: consensus state for upgrade height cannot be found",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+100))
|
||||
@ -297,7 +322,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
name: "unsuccessful upgrade: client is expired",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, upgradeHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, upgradeHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
|
||||
@ -317,6 +342,31 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "unsuccessful upgrade: updated unbonding period is equal to trusting period",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
||||
// upgrade Height is at next block
|
||||
upgradeHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(upgradeHeight.GetVersionHeight()), upgradedClient)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgrade, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
@ -332,7 +382,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
cs := suite.chainA.GetClientState(clientA)
|
||||
clientStore := suite.chainA.App.IBCKeeper.ClientKeeper.ClientStore(suite.chainA.GetContext(), clientA)
|
||||
|
||||
err := cs.VerifyUpgrade(
|
||||
clientState, consensusState, err := cs.VerifyUpgradeAndUpdateState(
|
||||
suite.chainA.GetContext(),
|
||||
suite.cdc,
|
||||
clientStore,
|
||||
@ -343,8 +393,14 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err, "verify upgrade failed on valid case: %s", tc.name)
|
||||
suite.Require().NotNil(clientState, "verify upgrade failed on valid case: %s", tc.name)
|
||||
suite.Require().NotNil(consensusState, "verify upgrade failed on valid case: %s", tc.name)
|
||||
} else {
|
||||
suite.Require().Error(err, "verify upgrade passed on invalid case: %s", tc.name)
|
||||
suite.Require().Nil(clientState, "verify upgrade passed on invalid case: %s", tc.name)
|
||||
|
||||
suite.Require().Nil(consensusState, "verify upgrade passed on invalid case: %s", tc.name)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,12 +102,12 @@ func (cs ClientState) CheckProposedHeaderAndUpdateState(
|
||||
return nil, nil, sdkerrors.Wrap(clienttypes.ErrUpdateClientFailed, "cannot update localhost client with a proposal")
|
||||
}
|
||||
|
||||
// VerifyUpgrade returns an error since localhost cannot be upgraded
|
||||
func (cs ClientState) VerifyUpgrade(
|
||||
// VerifyUpgradeAndUpdateState returns an error since localhost cannot be upgraded
|
||||
func (cs ClientState) VerifyUpgradeAndUpdateState(
|
||||
_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore,
|
||||
_ exported.ClientState, _ exported.Height, _ []byte,
|
||||
) error {
|
||||
return sdkerrors.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade localhost client")
|
||||
) (exported.ClientState, exported.ConsensusState, error) {
|
||||
return nil, nil, sdkerrors.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade localhost client")
|
||||
}
|
||||
|
||||
// VerifyClientState verifies that the localhost client state is stored locally
|
||||
|
||||
@ -60,8 +60,6 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultConsensusParams = simapp.DefaultConsensusParams
|
||||
|
||||
DefaultOpenInitVersion *connectiontypes.Version
|
||||
|
||||
// Default params variables used to create a TM client
|
||||
@ -75,14 +73,6 @@ var (
|
||||
|
||||
MockAcknowledgement = mock.MockAcknowledgement
|
||||
MockCommitment = mock.MockCommitment
|
||||
|
||||
// Conditionals for expected output of executing messages.
|
||||
// Change values to false to test messages expected to fail.
|
||||
// Reset to true otherwise successful messages will error.
|
||||
// Use in rare cases, will be deprecated in favor of better
|
||||
// dev ux.
|
||||
ExpSimPassSend = true
|
||||
ExpPassSend = true
|
||||
)
|
||||
|
||||
// TestChain is a testing struct that wraps a simapp with the last TM Header, the current ABCI
|
||||
@ -178,8 +168,7 @@ func NewTestChain(t *testing.T, chainID string) *TestChain {
|
||||
|
||||
// GetContext returns the current context for the application.
|
||||
func (chain *TestChain) GetContext() sdk.Context {
|
||||
ctx := chain.App.BaseApp.NewContext(false, chain.CurrentHeader)
|
||||
return ctx.WithConsensusParams(DefaultConsensusParams)
|
||||
return chain.App.BaseApp.NewContext(false, chain.CurrentHeader)
|
||||
}
|
||||
|
||||
// QueryProof performs an abci query with the given key and returns the proto encoded merkle proof
|
||||
@ -299,7 +288,7 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) {
|
||||
chain.ChainID,
|
||||
[]uint64{chain.SenderAccount.GetAccountNumber()},
|
||||
[]uint64{chain.SenderAccount.GetSequence()},
|
||||
ExpSimPassSend, ExpPassSend, chain.senderPrivKey,
|
||||
true, true, chain.senderPrivKey,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -431,8 +420,7 @@ func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, client
|
||||
height := counterparty.LastHeader.GetHeight().(clienttypes.Height)
|
||||
clientState = ibctmtypes.NewClientState(
|
||||
counterparty.ChainID, DefaultTrustLevel, TrustingPeriod, UnbondingPeriod, MaxClockDrift,
|
||||
height, counterparty.App.GetConsensusParams(counterparty.GetContext()), commitmenttypes.GetSDKSpecs(),
|
||||
UpgradePath, false, false,
|
||||
height, commitmenttypes.GetSDKSpecs(), UpgradePath, false, false,
|
||||
)
|
||||
consensusState = counterparty.LastHeader.ConsensusState()
|
||||
case exported.Solomachine:
|
||||
|
||||
@ -12,7 +12,9 @@ import (
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -181,6 +183,37 @@ func TestInvalidPubKeyTypeMsgCreateValidator(t *testing.T) {
|
||||
tstaking.CreateValidator(addr, invalidPk, 10, false)
|
||||
}
|
||||
|
||||
func TestBothPubKeyTypesMsgCreateValidator(t *testing.T) {
|
||||
app, ctx, _, valAddrs := bootstrapHandlerGenesisTest(t, 1000, 2, 1000)
|
||||
ctx = ctx.WithConsensusParams(&abci.ConsensusParams{
|
||||
Validator: &tmproto.ValidatorParams{PubKeyTypes: []string{tmtypes.ABCIPubKeyTypeEd25519, tmtypes.ABCIPubKeyTypeSecp256k1}},
|
||||
})
|
||||
|
||||
tstaking := teststaking.NewHelper(t, ctx, app.StakingKeeper)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
addr sdk.ValAddress
|
||||
pk cryptotypes.PubKey
|
||||
}{
|
||||
{
|
||||
"can create a validator with ed25519 pubkey",
|
||||
valAddrs[0],
|
||||
ed25519.GenPrivKey().PubKey(),
|
||||
},
|
||||
{
|
||||
"can create a validator with secp256k1 pubkey",
|
||||
valAddrs[1],
|
||||
secp256k1.GenPrivKey().PubKey(),
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(*testing.T) {
|
||||
tstaking.CreateValidator(tc.addr, tc.pk, 10, true)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLegacyValidatorDelegations(t *testing.T) {
|
||||
app, ctx, delAddrs, valAddrs := bootstrapHandlerGenesisTest(t, 1000, 2, 100000000)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -10,9 +10,9 @@ import (
|
||||
// pattern. This is useful for custom upgrade loading logic.
|
||||
func UpgradeStoreLoader(upgradeHeight int64, storeUpgrades *store.StoreUpgrades) baseapp.StoreLoader {
|
||||
return func(ms sdk.CommitMultiStore) error {
|
||||
if upgradeHeight == ms.LastCommitID().Version {
|
||||
if upgradeHeight == ms.LastCommitID().Version+1 {
|
||||
// Check if the current commit version and upgrade height matches
|
||||
if len(storeUpgrades.Renamed) > 0 || len(storeUpgrades.Deleted) > 0 {
|
||||
if len(storeUpgrades.Renamed) > 0 || len(storeUpgrades.Deleted) > 0 || len(storeUpgrades.Added) > 0 {
|
||||
return ms.LoadLatestVersionAndUpgrade(storeUpgrades)
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,11 +65,13 @@ func checkStore(t *testing.T, db dbm.DB, ver int64, storeKey string, k, v []byte
|
||||
// Test that we can make commits and then reload old versions.
|
||||
// Test that LoadLatestVersion actually does.
|
||||
func TestSetLoader(t *testing.T) {
|
||||
upgradeHeight := int64(5)
|
||||
|
||||
// set a temporary home dir
|
||||
homeDir := t.TempDir()
|
||||
upgradeInfoFilePath := filepath.Join(homeDir, "upgrade-info.json")
|
||||
upgradeInfo := &store.UpgradeInfo{
|
||||
Name: "test", Height: 0,
|
||||
Name: "test", Height: upgradeHeight,
|
||||
}
|
||||
|
||||
data, err := json.Marshal(upgradeInfo)
|
||||
@ -92,7 +94,7 @@ func TestSetLoader(t *testing.T) {
|
||||
loadStoreKey: "foo",
|
||||
},
|
||||
"rename with inline opts": {
|
||||
setLoader: useUpgradeLoader(0, &store.StoreUpgrades{
|
||||
setLoader: useUpgradeLoader(upgradeHeight, &store.StoreUpgrades{
|
||||
Renamed: []store.StoreRename{{
|
||||
OldKey: "foo",
|
||||
NewKey: "bar",
|
||||
@ -116,25 +118,36 @@ func TestSetLoader(t *testing.T) {
|
||||
|
||||
// load the app with the existing db
|
||||
opts := []func(*baseapp.BaseApp){baseapp.SetPruning(store.PruneNothing)}
|
||||
|
||||
origapp := baseapp.NewBaseApp(t.Name(), defaultLogger(), db, nil, opts...)
|
||||
origapp.MountStores(sdk.NewKVStoreKey(tc.origStoreKey))
|
||||
err := origapp.LoadLatestVersion()
|
||||
require.Nil(t, err)
|
||||
|
||||
for i := int64(2); i <= upgradeHeight-1; i++ {
|
||||
origapp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: i}})
|
||||
res := origapp.Commit()
|
||||
require.NotNil(t, res.Data)
|
||||
}
|
||||
|
||||
if tc.setLoader != nil {
|
||||
opts = append(opts, tc.setLoader)
|
||||
}
|
||||
|
||||
// load the new app with the original app db
|
||||
app := baseapp.NewBaseApp(t.Name(), defaultLogger(), db, nil, opts...)
|
||||
capKey := sdk.NewKVStoreKey("main")
|
||||
app.MountStores(capKey)
|
||||
app.MountStores(sdk.NewKVStoreKey(tc.loadStoreKey))
|
||||
err := app.LoadLatestVersion()
|
||||
err = app.LoadLatestVersion()
|
||||
require.Nil(t, err)
|
||||
|
||||
// "execute" one block
|
||||
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: 2}})
|
||||
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: upgradeHeight}})
|
||||
res := app.Commit()
|
||||
require.NotNil(t, res.Data)
|
||||
|
||||
// check db is properly updated
|
||||
checkStore(t, db, 2, tc.loadStoreKey, k, v)
|
||||
checkStore(t, db, 2, tc.loadStoreKey, []byte("foo"), nil)
|
||||
checkStore(t, db, upgradeHeight, tc.loadStoreKey, k, v)
|
||||
checkStore(t, db, upgradeHeight, tc.loadStoreKey, []byte("foo"), nil)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user