From d52c17bb74c6136bc9f3e93e78f914a917dfdb41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 24 Aug 2020 23:12:47 +0200 Subject: [PATCH] migrate tm evidence to proto (#7145) * migrate tm evidence to proto * Update proto/ibc/tendermint/tendermint.proto Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Aditya Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- proto/ibc/tendermint/tendermint.proto | 20 + x/ibc/02-client/keeper/client_test.go | 52 +-- x/ibc/07-tendermint/types/codec.go | 5 + x/ibc/07-tendermint/types/evidence.go | 31 +- x/ibc/07-tendermint/types/evidence_test.go | 98 ++-- x/ibc/07-tendermint/types/misbehaviour.go | 4 +- .../07-tendermint/types/misbehaviour_test.go | 96 ++-- x/ibc/07-tendermint/types/tendermint.pb.go | 422 +++++++++++++++--- 8 files changed, 532 insertions(+), 196 deletions(-) diff --git a/proto/ibc/tendermint/tendermint.proto b/proto/ibc/tendermint/tendermint.proto index 5c615b80bd9e..129d293f8279 100644 --- a/proto/ibc/tendermint/tendermint.proto +++ b/proto/ibc/tendermint/tendermint.proto @@ -68,6 +68,26 @@ message ConsensusState { ]; } +// Evidence is a wrapper over two conflicting Headers +// that implements Evidence interface expected by ICS-02 +message Evidence { + 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.nullable) = false, + (gogoproto.moretags) = "yaml:\"header_1\"" + ]; + Header header_2 = 4 [ + (gogoproto.customname) = "Header2", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"header_2\"" + ]; +} + // Header defines the Tendermint client consensus Header. // It encapsulates all the information necessary to update from a trusted // Tendermint ConsensusState. The inclusion of TrustedHeight and diff --git a/x/ibc/02-client/keeper/client_test.go b/x/ibc/02-client/keeper/client_test.go index eed36d568823..d7eecd0aee84 100644 --- a/x/ibc/02-client/keeper/client_test.go +++ b/x/ibc/02-client/keeper/client_test.go @@ -267,17 +267,17 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { testCases := []struct { name string - evidence ibctmtypes.Evidence + evidence *ibctmtypes.Evidence malleate func() error expPass bool }{ { "trusting period misbehavior should pass", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight, testClientHeight, altTime, bothValSet, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight, testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { suite.consensusState.NextValidatorsHash = bothValsHash @@ -290,11 +290,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { }, { "misbehavior at later height should pass", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight, altTime, bothValSet, valSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { suite.consensusState.NextValidatorsHash = valsHash @@ -318,11 +318,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { }, { "misbehavior at later height with different trusted heights should pass", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight, altTime, bothValSet, valSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight+3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { suite.consensusState.NextValidatorsHash = valsHash @@ -346,11 +346,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { }, { "misbehaviour fails validatebasic", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+1, testClientHeight, altTime, bothValSet, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight, testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { suite.consensusState.NextValidatorsHash = bothValsHash @@ -363,11 +363,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { }, { "trusted ConsensusState1 not found", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight+3, altTime, bothValSet, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { suite.consensusState.NextValidatorsHash = valsHash @@ -380,11 +380,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { }, { "trusted ConsensusState2 not found", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight, altTime, bothValSet, valSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight+5, testClientHeight+3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { suite.consensusState.NextValidatorsHash = valsHash @@ -398,17 +398,17 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "client state not found", - ibctmtypes.Evidence{}, + &ibctmtypes.Evidence{}, func() error { return nil }, false, }, { "client already frozen at earlier height", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight, testClientHeight, altTime, bothValSet, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight, testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { suite.consensusState.NextValidatorsHash = bothValsHash @@ -425,11 +425,11 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() { { "misbehaviour check failed", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(testChainID, testClientHeight, testClientHeight, altTime, bothValSet, bothValSet, bothSigners), Header2: ibctmtypes.CreateTestHeader(testChainID, testClientHeight, testClientHeight, suite.ctx.BlockTime(), altValSet, bothValSet, altSigners), - ChainID: testChainID, - ClientID: testClientID, + ChainId: testChainID, + ClientId: testClientID, }, func() error { clientState := ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs()) diff --git a/x/ibc/07-tendermint/types/codec.go b/x/ibc/07-tendermint/types/codec.go index 70d37a7aaeab..1daacf1dfba0 100644 --- a/x/ibc/07-tendermint/types/codec.go +++ b/x/ibc/07-tendermint/types/codec.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + evidenceexported "github.com/cosmos/cosmos-sdk/x/evidence/exported" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" ) @@ -30,6 +31,10 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*clientexported.ConsensusState)(nil), &ConsensusState{}, ) + registry.RegisterImplementations( + (*evidenceexported.Evidence)(nil), + &Evidence{}, + ) } var ( diff --git a/x/ibc/07-tendermint/types/evidence.go b/x/ibc/07-tendermint/types/evidence.go index 4513506fe5a5..c69be74237e7 100644 --- a/x/ibc/07-tendermint/types/evidence.go +++ b/x/ibc/07-tendermint/types/evidence.go @@ -23,13 +23,15 @@ var ( _ clientexported.Misbehaviour = Evidence{} ) -// Evidence is a wrapper over tendermint's DuplicateVoteEvidence -// that implements Evidence interface expected by ICS-02 -type Evidence struct { - ClientID string `json:"client_id" yaml:"client_id"` - Header1 Header `json:"header1" yaml:"header1"` - Header2 Header `json:"header2" yaml:"header2"` - ChainID string `json:"chain_id" yaml:"chain_id"` +// NewEvidence creates a new Evidence instance. +func NewEvidence(clientID, chainID string, header1, header2 Header) *Evidence { + return &Evidence{ + ClientId: clientID, + ChainId: chainID, + Header1: header1, + Header2: header2, + } + } // ClientType is Tendermint light client @@ -39,7 +41,7 @@ func (ev Evidence) ClientType() clientexported.ClientType { // GetClientID returns the ID of the client that committed a misbehaviour. func (ev Evidence) GetClientID() string { - return ev.ClientID + return ev.ClientId } // Route implements Evidence interface @@ -64,8 +66,7 @@ func (ev Evidence) String() string { // Hash implements Evidence interface func (ev Evidence) Hash() tmbytes.HexBytes { - // TODO use submodule cdc - bz := amino.MustMarshalBinaryBare(ev) + bz := SubModuleCdc.MustMarshalBinaryBare(&ev) return tmhash.Sum(bz) } @@ -99,18 +100,18 @@ func (ev Evidence) ValidateBasic() error { return sdkerrors.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty") } - if err := host.ClientIdentifierValidator(ev.ClientID); err != nil { + if err := host.ClientIdentifierValidator(ev.ClientId); err != nil { return sdkerrors.Wrap(err, "evidence client ID is invalid") } // ValidateBasic on both validators - if err := ev.Header1.ValidateBasic(ev.ChainID); err != nil { + if err := ev.Header1.ValidateBasic(ev.ChainId); err != nil { return sdkerrors.Wrap( clienttypes.ErrInvalidEvidence, sdkerrors.Wrap(err, "header 1 failed validation").Error(), ) } - if err := ev.Header2.ValidateBasic(ev.ChainID); err != nil { + if err := ev.Header2.ValidateBasic(ev.ChainId); err != nil { return sdkerrors.Wrap( clienttypes.ErrInvalidEvidence, sdkerrors.Wrap(err, "header 2 failed validation").Error(), @@ -134,10 +135,10 @@ func (ev Evidence) ValidateBasic() error { if blockID1.Equals(*blockID2) { return sdkerrors.Wrap(clienttypes.ErrInvalidEvidence, "headers blockIDs are not equal") } - if err := ValidCommit(ev.ChainID, ev.Header1.Commit, ev.Header1.ValidatorSet); err != nil { + if err := ValidCommit(ev.ChainId, ev.Header1.Commit, ev.Header1.ValidatorSet); err != nil { return err } - if err := ValidCommit(ev.ChainID, ev.Header2.Commit, ev.Header2.ValidatorSet); err != nil { + if err := ValidCommit(ev.ChainId, ev.Header2.Commit, ev.Header2.ValidatorSet); err != nil { return err } return nil diff --git a/x/ibc/07-tendermint/types/evidence_test.go b/x/ibc/07-tendermint/types/evidence_test.go index 0d393141c236..465e90928e4a 100644 --- a/x/ibc/07-tendermint/types/evidence_test.go +++ b/x/ibc/07-tendermint/types/evidence_test.go @@ -4,6 +4,7 @@ import ( "time" "github.com/tendermint/tendermint/crypto/tmhash" + tmbytes "github.com/tendermint/tendermint/libs/bytes" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" @@ -15,19 +16,18 @@ import ( func (suite *TendermintTestSuite) TestEvidence() { signers := []tmtypes.PrivValidator{suite.privVal} - ev := ibctmtypes.Evidence{ + ev := &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now, suite.valSet, suite.valSet, signers), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, } suite.Require().Equal(ev.ClientType(), clientexported.Tendermint) suite.Require().Equal(ev.GetClientID(), clientID) suite.Require().Equal(ev.Route(), "client") suite.Require().Equal(ev.Type(), "client_misbehaviour") - // uncomment when evidence is migrated to proto - // suite.Require().Equal(ev.Hash(), tmbytes.HexBytes(tmhash.Sum(suite.aminoCdc.MustMarshalBinaryBare(ev)))) + suite.Require().Equal(ev.Hash(), tmbytes.HexBytes(tmhash.Sum(suite.cdc.MustMarshalBinaryBare(ev)))) suite.Require().Equal(ev.GetHeight(), int64(height)) } @@ -53,138 +53,138 @@ func (suite *TendermintTestSuite) TestEvidenceValidateBasic() { testCases := []struct { name string - evidence ibctmtypes.Evidence + evidence *ibctmtypes.Evidence malleateEvidence func(ev *ibctmtypes.Evidence) error expPass bool }{ { "valid evidence", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, true, }, { "valid evidence with different trusted headers", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, height-3, suite.now.Add(time.Minute), suite.valSet, bothValSet, signers), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, true, }, { "trusted height is 0 in Header1", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, 0, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), Header2: suite.header, - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "trusted height is 0 in Header2", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, 0, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "trusted valset is nil in Header1", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now.Add(time.Minute), suite.valSet, nil, signers), Header2: suite.header, - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "trusted valset is nil in Header2", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now.Add(time.Minute), suite.valSet, nil, signers), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "invalid client ID ", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now, suite.valSet, suite.valSet, signers), - ChainID: chainID, - ClientID: "GAIA", + ChainId: chainID, + ClientId: "GAIA", }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "wrong chainID on header1", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader("ethermint", height, height-1, suite.now, suite.valSet, suite.valSet, signers), - ChainID: "ethermint", - ClientID: clientID, + ChainId: "ethermint", + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "wrong chainID on header2", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader("ethermint", height, height-1, suite.now, suite.valSet, suite.valSet, signers), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "mismatched heights", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, 6, 4, suite.now, suite.valSet, suite.valSet, signers), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "same block id", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: suite.header, - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { return nil }, false, }, { "header 1 doesn't have 2/3 majority", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, suite.valSet, bothSigners), Header2: suite.header, - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) @@ -202,11 +202,11 @@ func (suite *TendermintTestSuite) TestEvidenceValidateBasic() { }, { "header 2 doesn't have 2/3 majority", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, suite.valSet, bothSigners), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { // voteSet contains only altVal which is less than 2/3 of total power (height/1height) @@ -224,11 +224,11 @@ func (suite *TendermintTestSuite) TestEvidenceValidateBasic() { }, { "validators sign off on wrong commit", - ibctmtypes.Evidence{ + &ibctmtypes.Evidence{ Header1: suite.header, Header2: ibctmtypes.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, suite.valSet, bothSigners), - ChainID: chainID, - ClientID: clientID, + ChainId: chainID, + ClientId: clientID, }, func(ev *ibctmtypes.Evidence) error { tmBlockID := ibctmtypes.MakeBlockID(tmhash.Sum([]byte("other_hash")), 3, tmhash.Sum([]byte("other_partset"))) @@ -242,7 +242,7 @@ func (suite *TendermintTestSuite) TestEvidenceValidateBasic() { for i, tc := range testCases { tc := tc - err := tc.malleateEvidence(&tc.evidence) + err := tc.malleateEvidence(tc.evidence) suite.Require().NoError(err) if tc.expPass { diff --git a/x/ibc/07-tendermint/types/misbehaviour.go b/x/ibc/07-tendermint/types/misbehaviour.go index 543c35849599..4f18b3842d8c 100644 --- a/x/ibc/07-tendermint/types/misbehaviour.go +++ b/x/ibc/07-tendermint/types/misbehaviour.go @@ -32,9 +32,9 @@ func (cs ClientState) CheckMisbehaviourAndUpdateState( "client is already frozen at earlier height %d than misbehaviour height %d", cs.FrozenHeight, misbehaviour.GetHeight()) } - tmEvidence, ok := misbehaviour.(Evidence) + tmEvidence, ok := misbehaviour.(*Evidence) if !ok { - return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, Evidence{}) + return nil, sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "expected type %T, got %T", misbehaviour, &Evidence{}) } // Retrieve trusted consensus states for each Header in misbehaviour diff --git a/x/ibc/07-tendermint/types/misbehaviour_test.go b/x/ibc/07-tendermint/types/misbehaviour_test.go index 57a8f52c08eb..c41f70a499c2 100644 --- a/x/ibc/07-tendermint/types/misbehaviour_test.go +++ b/x/ibc/07-tendermint/types/misbehaviour_test.go @@ -47,11 +47,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, true, @@ -61,11 +61,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-1, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-1, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height-1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, true, @@ -75,11 +75,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-1, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-3, suite.valsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height-3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, true, @@ -89,11 +89,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, suite.valsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, suite.valsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, suite.valSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, true, @@ -103,11 +103,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-1, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-3, suite.valsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -117,11 +117,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-1, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height-3, suite.valsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height-3, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -131,11 +131,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.ClientState{FrozenHeight: 1}, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -145,11 +145,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), nil, // consensus state for trusted height - 1 does not exist in store types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -168,11 +168,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now.Add(2 * time.Minute).Add(simapp.DefaultConsensusParams.Evidence.MaxAgeDuration), false, @@ -182,11 +182,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, uint64(height+simapp.DefaultConsensusParams.Evidence.MaxAgeNumBlocks+1), commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now.Add(time.Hour), false, @@ -196,11 +196,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height-1, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height-1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -210,11 +210,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), &types.ConsensusState{Timestamp: time.Time{}, Root: commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), NextValidatorsHash: bothValsHash}, types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now.Add(ubdPeriod), false, @@ -224,11 +224,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, suite.valSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -238,11 +238,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, altValSet, bothValSet, altSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -252,11 +252,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, bothValSet, bothValSet, bothSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, @@ -266,11 +266,11 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() { types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs()), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), height, bothValsHash), - types.Evidence{ + &types.Evidence{ Header1: types.CreateTestHeader(chainID, height, height, suite.now, altValSet, bothValSet, altSigners), Header2: types.CreateTestHeader(chainID, height, height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners), - ChainID: chainID, - ClientID: chainID, + ChainId: chainID, + ClientId: chainID, }, suite.now, false, diff --git a/x/ibc/07-tendermint/types/tendermint.pb.go b/x/ibc/07-tendermint/types/tendermint.pb.go index 69c145b88ae7..d46ac1dd004e 100644 --- a/x/ibc/07-tendermint/types/tendermint.pb.go +++ b/x/ibc/07-tendermint/types/tendermint.pb.go @@ -130,6 +130,47 @@ func (m *ConsensusState) XXX_DiscardUnknown() { var xxx_messageInfo_ConsensusState proto.InternalMessageInfo +// Evidence is a wrapper over tendermint's DuplicateVoteEvidence +// that implements Evidence interface expected by ICS-02 +type Evidence 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" yaml:"header_1"` + Header2 Header `protobuf:"bytes,4,opt,name=header_2,json=header2,proto3" json:"header_2" yaml:"header_2"` +} + +func (m *Evidence) Reset() { *m = Evidence{} } +func (*Evidence) ProtoMessage() {} +func (*Evidence) Descriptor() ([]byte, []int) { + return fileDescriptor_76a953d5a747dd66, []int{2} +} +func (m *Evidence) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Evidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Evidence.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 *Evidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_Evidence.Merge(m, src) +} +func (m *Evidence) XXX_Size() int { + return m.Size() +} +func (m *Evidence) XXX_DiscardUnknown() { + xxx_messageInfo_Evidence.DiscardUnknown(m) +} + +var xxx_messageInfo_Evidence proto.InternalMessageInfo + // Header defines the Tendermint client consensus Header. // It encapsulates all the information necessary to update from a trusted // Tendermint ConsensusState. The inclusion of TrustedHeight and @@ -153,7 +194,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_76a953d5a747dd66, []int{2} + return fileDescriptor_76a953d5a747dd66, []int{3} } func (m *Header) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -213,7 +254,7 @@ func (m *Fraction) Reset() { *m = Fraction{} } func (m *Fraction) String() string { return proto.CompactTextString(m) } func (*Fraction) ProtoMessage() {} func (*Fraction) Descriptor() ([]byte, []int) { - return fileDescriptor_76a953d5a747dd66, []int{3} + return fileDescriptor_76a953d5a747dd66, []int{4} } func (m *Fraction) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -259,6 +300,7 @@ func (m *Fraction) GetDenominator() int64 { func init() { proto.RegisterType((*ClientState)(nil), "ibc.tendermint.ClientState") proto.RegisterType((*ConsensusState)(nil), "ibc.tendermint.ConsensusState") + proto.RegisterType((*Evidence)(nil), "ibc.tendermint.Evidence") proto.RegisterType((*Header)(nil), "ibc.tendermint.Header") proto.RegisterType((*Fraction)(nil), "ibc.tendermint.Fraction") } @@ -266,60 +308,67 @@ func init() { func init() { proto.RegisterFile("ibc/tendermint/tendermint.proto", fileDescriptor_76a953d5a747dd66) } var fileDescriptor_76a953d5a747dd66 = []byte{ - // 845 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcd, 0x6e, 0xe4, 0x44, - 0x10, 0x1e, 0x27, 0xb3, 0xd9, 0xa4, 0x67, 0x26, 0x59, 0x9a, 0x10, 0x9c, 0x61, 0xb1, 0x47, 0xe6, - 0x92, 0xcb, 0xda, 0x28, 0xbb, 0x02, 0x69, 0x25, 0x24, 0xe4, 0xac, 0x50, 0x16, 0x81, 0x14, 0x79, - 0xf8, 0x91, 0x90, 0x90, 0xe5, 0x9f, 0x1e, 0xbb, 0x15, 0xbb, 0xdb, 0x72, 0xf7, 0x44, 0x13, 0x9e, - 0x60, 0xb9, 0xed, 0x91, 0x23, 0x0f, 0xc1, 0x43, 0xec, 0x31, 0x47, 0x4e, 0x06, 0x25, 0x6f, 0x30, - 0x47, 0x0e, 0x08, 0x75, 0xbb, 0x3d, 0xf6, 0xcc, 0x46, 0x5a, 0x71, 0x49, 0xba, 0xbe, 0xfa, 0xaa, - 0xca, 0x55, 0xfd, 0x55, 0x0f, 0x30, 0x71, 0x18, 0x39, 0x1c, 0x91, 0x18, 0x95, 0x39, 0x26, 0xbc, - 0x73, 0xb4, 0x8b, 0x92, 0x72, 0x0a, 0xf7, 0x71, 0x18, 0xd9, 0x2d, 0x3a, 0x9e, 0x74, 0xc9, 0xd7, - 0x05, 0x62, 0xce, 0x55, 0x90, 0xe1, 0x38, 0xe0, 0xb4, 0xac, 0x23, 0xc6, 0x8f, 0xdf, 0x62, 0xc8, - 0xbf, 0xca, 0xfb, 0x7e, 0x44, 0xc9, 0x0c, 0x53, 0xa7, 0x28, 0x29, 0x9d, 0x35, 0xa0, 0x91, 0x50, - 0x9a, 0x64, 0xc8, 0x91, 0x56, 0x38, 0x9f, 0x39, 0xf1, 0xbc, 0x0c, 0x38, 0xa6, 0x44, 0xf9, 0xcd, - 0x4d, 0x3f, 0xc7, 0x39, 0x62, 0x3c, 0xc8, 0x8b, 0x86, 0x20, 0xda, 0x88, 0x68, 0x9e, 0x63, 0x9e, - 0x23, 0xc2, 0x3b, 0x47, 0x45, 0x38, 0x4c, 0x68, 0x42, 0xe5, 0xd1, 0x11, 0xa7,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 0xf6, 0xc8, 0x3c, 0x47, 0xa5, 0xf0, 0xc8, 0xe9, 0x6f, 0x7b, 0x2d, 0x00, 0x27, 0x60, 0x10, 0x23, - 0x42, 0x73, 0x4c, 0xa4, 0x7f, 0x4b, 0xfa, 0xbb, 0x90, 0x7b, 0xf1, 0xe6, 0xd6, 0xd0, 0x6e, 0x6e, - 0x0d, 0xed, 0xef, 0x5b, 0x43, 0x7b, 0x7d, 0x67, 0xf4, 0x6e, 0xee, 0x8c, 0xde, 0x9f, 0x77, 0x46, - 0xef, 0xa7, 0xcf, 0x3a, 0xb2, 0x89, 0x28, 0xcb, 0x29, 0x53, 0xff, 0x9e, 0xb0, 0xf8, 0xd2, 0x59, - 0x38, 0xe2, 0xf9, 0xff, 0xf4, 0xf3, 0x27, 0x9b, 0xbf, 0x3c, 0xe1, 0x8e, 0xdc, 0x93, 0xa7, 0xff, - 0x05, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x78, 0x14, 0xd9, 0xe7, 0x06, 0x00, 0x00, + // 945 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0xae, 0xd3, 0x6c, 0x9b, 0x4e, 0x92, 0xb6, 0xcc, 0x96, 0x92, 0x86, 0x25, 0x8e, 0xcc, 0xa5, + 0x97, 0xb5, 0x69, 0x76, 0x05, 0x52, 0x25, 0x24, 0xe4, 0x2e, 0xa8, 0x45, 0x20, 0x55, 0x2e, 0x1f, + 0x12, 0x12, 0xb2, 0x1c, 0x7b, 0x92, 0x8c, 0x6a, 0xcf, 0x44, 0x9e, 0x49, 0x95, 0xf2, 0x0b, 0x96, + 0xdb, 0x1e, 0xf7, 0xc8, 0x85, 0x7f, 0xc0, 0x8f, 0xd8, 0x63, 0x8f, 0x9c, 0x0c, 0x6a, 0xff, 0x41, + 0x8e, 0x1c, 0x10, 0x9a, 0x0f, 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0xe1, 0x18, 0xc0, 0x3c, 0xa3, 0x14, 0xaa, 0xee, 0xfe, 0xdb, 0x6e, 0xf9, 0xd1, 0x22, 0x33, 0x0f, + 0x96, 0xab, 0x94, 0x1c, 0x96, 0xf7, 0x9e, 0x76, 0x96, 0x92, 0xb5, 0xbe, 0x06, 0x8d, 0xfc, 0xe3, + 0x00, 0x9f, 0x80, 0x2d, 0x32, 0x4b, 0x50, 0x2a, 0x22, 0xb2, 0xfb, 0xeb, 0x5e, 0xe9, 0x80, 0x7d, + 0xd0, 0x8c, 0x10, 0xa1, 0x09, 0x26, 0x32, 0x5e, 0x93, 0xf1, 0xaa, 0xcb, 0x3d, 0x7f, 0x73, 0xdb, + 0x33, 0x6e, 0x6e, 0x7b, 0xc6, 0xdf, 0xb7, 0x3d, 0xe3, 0xd5, 0x5d, 0x6f, 0xed, 0xe6, 0xae, 0xb7, + 0xf6, 0xe7, 0x5d, 0x6f, 0xed, 0xa7, 0x4f, 0x2b, 0xe3, 0x15, 0x52, 0x96, 0x50, 0xa6, 0xff, 0x3d, + 0x65, 0xd1, 0xa5, 0x33, 0x77, 0xc4, 0x67, 0xf2, 0x93, 0xcf, 0x9e, 0xae, 0x7e, 0xa1, 0x87, 0x1b, + 0x72, 0x9f, 0x3c, 0xfb, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x47, 0x40, 0xa0, 0xf1, 0x0f, 0x08, 0x00, + 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -463,6 +512,63 @@ func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Evidence) 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 *Evidence) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Header2.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTendermint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.Header1.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + 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 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintTendermint(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Header) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -622,6 +728,27 @@ func (m *ConsensusState) Size() (n int) { return n } +func (m *Evidence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovTendermint(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTendermint(uint64(l)) + } + l = m.Header1.Size() + n += 1 + l + sovTendermint(uint64(l)) + l = m.Header2.Size() + n += 1 + l + sovTendermint(uint64(l)) + return n +} + func (m *Header) Size() (n int) { if m == nil { return 0 @@ -1126,6 +1253,189 @@ func (m *ConsensusState) Unmarshal(dAtA []byte) error { } return nil } +func (m *Evidence) 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 ErrIntOverflowTendermint + } + 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: Evidence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Evidence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", 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.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) + } + 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 err := m.Header1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header2", 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 err := m.Header2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTendermint(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTendermint + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTendermint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Header) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0