Rename Version to Revision in IBC Height (#8020)
* rename Version to Revision in ibc Height * lint Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
88e03e4f40
commit
c15884a204
File diff suppressed because it is too large
Load Diff
|
@ -38,8 +38,8 @@ service Query {
|
|||
// associated with the provided channel identifiers.
|
||||
rpc ChannelConsensusState(QueryChannelConsensusStateRequest) returns (QueryChannelConsensusStateResponse) {
|
||||
option (google.api.http).get =
|
||||
"/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/version/"
|
||||
"{version_number}/height/{version_height}";
|
||||
"/ibc/core/channel/v1beta1/channels/{channel_id}/ports/{port_id}/consensus_state/revision/"
|
||||
"{revision_number}/height/{revision_height}";
|
||||
}
|
||||
|
||||
// PacketCommitment queries a stored packet commitment hash.
|
||||
|
@ -176,10 +176,10 @@ message QueryChannelConsensusStateRequest {
|
|||
string port_id = 1;
|
||||
// channel unique identifier
|
||||
string channel_id = 2;
|
||||
// version number of the consensus state
|
||||
uint64 version_number = 3;
|
||||
// version height of the consensus state
|
||||
uint64 version_height = 4;
|
||||
// revision number of the consensus state
|
||||
uint64 revision_number = 3;
|
||||
// revision height of the consensus state
|
||||
uint64 revision_height = 4;
|
||||
}
|
||||
|
||||
// QueryChannelClientStateResponse is the Response type for the
|
||||
|
|
|
@ -52,19 +52,19 @@ message ClientUpdateProposal {
|
|||
// that can be compared against another Height for the purposes of updating and
|
||||
// freezing clients
|
||||
//
|
||||
// Normally the VersionHeight is incremented at each height while keeping version
|
||||
// number the same However some consensus algorithms may choose to reset the
|
||||
// Normally the RevisionHeight is incremented at each height while keeping RevisionNumber
|
||||
// the same. However some consensus algorithms may choose to reset the
|
||||
// height in certain conditions e.g. hard forks, state-machine breaking changes
|
||||
// In these cases, the version number is incremented so that height continues to
|
||||
// be monitonically increasing even as the VersionHeight gets reset
|
||||
// In these cases, the RevisionNumber is incremented so that height continues to
|
||||
// be monitonically increasing even as the RevisionHeight gets reset
|
||||
message Height {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
// the version that the client is currently on
|
||||
uint64 version_number = 1 [(gogoproto.moretags) = "yaml:\"version_number\""];
|
||||
// the height within the given version
|
||||
uint64 version_height = 2 [(gogoproto.moretags) = "yaml:\"version_height\""];
|
||||
// the revision that the client is currently on
|
||||
uint64 revision_number = 1 [(gogoproto.moretags) = "yaml:\"revision_number\""];
|
||||
// the height within the given revision
|
||||
uint64 revision_height = 2 [(gogoproto.moretags) = "yaml:\"revision_height\""];
|
||||
}
|
||||
|
||||
// Params defines the set of IBC light client parameters.
|
||||
|
|
|
@ -24,8 +24,8 @@ service Query {
|
|||
// ConsensusState queries a consensus state associated with a client state at
|
||||
// a given height.
|
||||
rpc ConsensusState(QueryConsensusStateRequest) returns (QueryConsensusStateResponse) {
|
||||
option (google.api.http).get = "/ibc/core/client/v1beta1/consensus_states/{client_id}/version/{version_number}/"
|
||||
"height/{version_height}";
|
||||
option (google.api.http).get = "/ibc/core/client/v1beta1/consensus_states/{client_id}/revision/{revision_number}/"
|
||||
"height/{revision_height}";
|
||||
}
|
||||
|
||||
// ConsensusStates queries all the consensus state associated with a given
|
||||
|
@ -82,10 +82,10 @@ message QueryClientStatesResponse {
|
|||
message QueryConsensusStateRequest {
|
||||
// client identifier
|
||||
string client_id = 1;
|
||||
// consensus state version number
|
||||
uint64 version_number = 2;
|
||||
// consensus state version height
|
||||
uint64 version_height = 3;
|
||||
// consensus state revision number
|
||||
uint64 revision_number = 2;
|
||||
// consensus state revision height
|
||||
uint64 revision_height = 3;
|
||||
// latest_height overrrides the height field and queries the latest stored
|
||||
// ConsensusState
|
||||
bool latest_height = 4;
|
||||
|
|
|
@ -38,7 +38,7 @@ service Query {
|
|||
// connection.
|
||||
rpc ConnectionConsensusState(QueryConnectionConsensusStateRequest) returns (QueryConnectionConsensusStateResponse) {
|
||||
option (google.api.http).get = "/ibc/core/connection/v1beta1/connections/{connection_id}/consensus_state/"
|
||||
"version/{version_number}/height/{version_height}";
|
||||
"revision/{revision_number}/height/{revision_height}";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,9 +118,9 @@ message QueryConnectionClientStateResponse {
|
|||
// Query/ConnectionConsensusState RPC method
|
||||
message QueryConnectionConsensusStateRequest {
|
||||
// connection identifier
|
||||
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];
|
||||
uint64 version_number = 2;
|
||||
uint64 version_height = 3;
|
||||
string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];
|
||||
uint64 revision_number = 2;
|
||||
uint64 revision_height = 3;
|
||||
}
|
||||
|
||||
// QueryConnectionConsensusStateResponse is the response type for the
|
||||
|
|
|
@ -29,7 +29,7 @@ func NewTransferTxCmd() *cobra.Command {
|
|||
Short: "Transfer a fungible token through IBC",
|
||||
Long: strings.TrimSpace(`Transfer a fungible token through IBC. Timeouts can be specified
|
||||
as absolute or relative using the "absolute-timeouts" flag. Timeout height can be set by passing in the height string
|
||||
in the form {version}-{height} using the "packet-timeout-height" flag. Relative timeouts are added to
|
||||
in the form {revision}-{height} using the "packet-timeout-height" flag. Relative timeouts are added to
|
||||
the block height and block timestamp queried from the latest consensus state corresponding
|
||||
to the counterparty channel. Any timeout set to 0 is disabled.`),
|
||||
Example: fmt.Sprintf("%s tx ibc-transfer transfer [src-port] [src-channel] [receiver] [amount]", version.AppName),
|
||||
|
@ -85,8 +85,8 @@ to the counterparty channel. Any timeout set to 0 is disabled.`),
|
|||
|
||||
if !timeoutHeight.IsZero() {
|
||||
absoluteHeight := height
|
||||
absoluteHeight.VersionNumber += timeoutHeight.VersionNumber
|
||||
absoluteHeight.VersionHeight += timeoutHeight.VersionHeight
|
||||
absoluteHeight.RevisionNumber += timeoutHeight.RevisionNumber
|
||||
absoluteHeight.RevisionHeight += timeoutHeight.RevisionHeight
|
||||
timeoutHeight = absoluteHeight
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ func (suite *ClientTestSuite) SetupTest() {
|
|||
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
|
||||
|
||||
// set localhost client
|
||||
version := types.ParseChainID(suite.chainA.GetContext().ChainID())
|
||||
revision := types.ParseChainID(suite.chainA.GetContext().ChainID())
|
||||
localHostClient := localhosttypes.NewClientState(
|
||||
suite.chainA.GetContext().ChainID(), types.NewHeight(version, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
suite.chainA.GetContext().ChainID(), types.NewHeight(revision, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
)
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), exported.Localhost, localHostClient)
|
||||
}
|
||||
|
|
|
@ -77,10 +77,10 @@ func QueryConsensusState(
|
|||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
req := &types.QueryConsensusStateRequest{
|
||||
ClientId: clientID,
|
||||
VersionNumber: height.GetVersionNumber(),
|
||||
VersionHeight: height.GetVersionHeight(),
|
||||
LatestHeight: latestHeight,
|
||||
ClientId: clientID,
|
||||
RevisionNumber: height.GetRevisionNumber(),
|
||||
RevisionHeight: height.GetRevisionHeight(),
|
||||
LatestHeight: latestHeight,
|
||||
}
|
||||
|
||||
return queryClient.ConsensusState(context.Background(), req)
|
||||
|
|
|
@ -50,9 +50,9 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
|||
}
|
||||
|
||||
// client id is always "localhost"
|
||||
version := types.ParseChainID(ctx.ChainID())
|
||||
revision := types.ParseChainID(ctx.ChainID())
|
||||
clientState := localhosttypes.NewClientState(
|
||||
ctx.ChainID(), types.NewHeight(version, uint64(ctx.BlockHeight())),
|
||||
ctx.ChainID(), types.NewHeight(revision, uint64(ctx.BlockHeight())),
|
||||
)
|
||||
|
||||
if err := clientState.Validate(); err != nil {
|
||||
|
|
|
@ -56,17 +56,17 @@ func (suite *KeeperTestSuite) TestCreateClient() {
|
|||
func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
||||
// Must create header creation functions since suite.header gets recreated on each test case
|
||||
createFutureUpdateFn := func(s *KeeperTestSuite) *ibctmtypes.Header {
|
||||
heightPlus3 := clienttypes.NewHeight(suite.header.GetHeight().GetVersionNumber(), suite.header.GetHeight().GetVersionHeight()+3)
|
||||
heightPlus3 := clienttypes.NewHeight(suite.header.GetHeight().GetRevisionNumber(), suite.header.GetHeight().GetRevisionHeight()+3)
|
||||
height := suite.header.GetHeight().(clienttypes.Height)
|
||||
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus3.VersionHeight), height, suite.header.Header.Time.Add(time.Hour),
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus3.RevisionHeight), height, suite.header.Header.Time.Add(time.Hour),
|
||||
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
}
|
||||
createPastUpdateFn := func(s *KeeperTestSuite) *ibctmtypes.Header {
|
||||
heightMinus2 := clienttypes.NewHeight(suite.header.GetHeight().GetVersionNumber(), suite.header.GetHeight().GetVersionHeight()-2)
|
||||
heightMinus4 := clienttypes.NewHeight(suite.header.GetHeight().GetVersionNumber(), suite.header.GetHeight().GetVersionHeight()-4)
|
||||
heightMinus2 := clienttypes.NewHeight(suite.header.GetHeight().GetRevisionNumber(), suite.header.GetHeight().GetRevisionHeight()-2)
|
||||
heightMinus4 := clienttypes.NewHeight(suite.header.GetHeight().GetRevisionNumber(), suite.header.GetHeight().GetRevisionHeight()-4)
|
||||
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightMinus2.VersionHeight), heightMinus4, suite.header.Header.Time,
|
||||
return suite.chainA.CreateTMClientHeader(testChainID, int64(heightMinus2.RevisionHeight), heightMinus4, suite.header.Header.Time,
|
||||
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
}
|
||||
var (
|
||||
|
@ -146,7 +146,7 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
|||
}, false},
|
||||
{"valid past update before client was frozen", func() error {
|
||||
clientState = ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false)
|
||||
clientState.FrozenHeight = types.NewHeight(0, testClientHeight.VersionHeight-1)
|
||||
clientState.FrozenHeight = types.NewHeight(0, testClientHeight.RevisionHeight-1)
|
||||
err := suite.keeper.CreateClient(suite.ctx, testClientID, clientState, suite.consensusState)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
|
@ -221,8 +221,8 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
|
|||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestUpdateClientLocalhost() {
|
||||
version := types.ParseChainID(suite.chainA.ChainID)
|
||||
var localhostClient exported.ClientState = localhosttypes.NewClientState(suite.chainA.ChainID, types.NewHeight(version, uint64(suite.chainA.GetContext().BlockHeight())))
|
||||
revision := types.ParseChainID(suite.chainA.ChainID)
|
||||
var localhostClient exported.ClientState = localhosttypes.NewClientState(suite.chainA.ChainID, types.NewHeight(revision, uint64(suite.chainA.GetContext().BlockHeight())))
|
||||
|
||||
ctx := suite.chainA.GetContext().WithBlockHeight(suite.chainA.GetContext().BlockHeight() + 1)
|
||||
err := suite.chainA.App.IBCKeeper.ClientKeeper.UpdateClient(ctx, exported.Localhost, nil)
|
||||
|
@ -260,8 +260,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -272,8 +272,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: true,
|
||||
},
|
||||
|
@ -290,8 +290,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -302,8 +302,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
clientA = "wrongclientid"
|
||||
},
|
||||
|
@ -322,8 +322,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -334,8 +334,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
// set frozen client in store
|
||||
tmClient, ok := cs.(*ibctmtypes.ClientState)
|
||||
|
@ -358,8 +358,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = ibctmtypes.NewClientState("wrongchainID", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, true, true)
|
||||
|
@ -371,8 +371,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -435,8 +435,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
{
|
||||
"trusting period misbehavior should pass",
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
@ -451,8 +451,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
{
|
||||
"misbehavior at later height should pass",
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
@ -477,8 +477,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
{
|
||||
"misbehavior at later height with different trusted heights should pass",
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
@ -503,8 +503,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
{
|
||||
"trusted ConsensusState1 not found",
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), heightPlus3, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, valSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
@ -519,8 +519,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
{
|
||||
"trusted ConsensusState2 not found",
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), testClientHeight, altTime, bothValSet, valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(heightPlus5.RevisionHeight), heightPlus3, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
@ -541,8 +541,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
{
|
||||
"client already frozen at earlier height",
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
@ -560,8 +560,8 @@ func (suite *KeeperTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
{
|
||||
"misbehaviour check failed",
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, altTime, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeight, suite.ctx.BlockTime(), altValSet, bothValSet, altSigners),
|
||||
ClientId: testClientID,
|
||||
},
|
||||
func() error {
|
||||
|
|
|
@ -112,11 +112,11 @@ func (q Keeper) ConsensusState(c context.Context, req *types.QueryConsensusState
|
|||
found bool
|
||||
)
|
||||
|
||||
height := types.NewHeight(req.VersionNumber, req.VersionHeight)
|
||||
height := types.NewHeight(req.RevisionNumber, req.RevisionHeight)
|
||||
if req.LatestHeight {
|
||||
consensusState, found = q.GetLatestClientConsensusState(ctx, req.ClientId)
|
||||
} else {
|
||||
if req.VersionHeight == 0 {
|
||||
if req.RevisionHeight == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "consensus state height cannot be 0")
|
||||
}
|
||||
|
||||
|
|
|
@ -184,8 +184,8 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() {
|
|||
func() {
|
||||
req = &types.QueryConsensusStateRequest{
|
||||
ClientId: testClientID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 0,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 0,
|
||||
LatestHeight: false,
|
||||
}
|
||||
},
|
||||
|
@ -236,8 +236,8 @@ func (suite *KeeperTestSuite) TestQueryConsensusState() {
|
|||
|
||||
req = &types.QueryConsensusStateRequest{
|
||||
ClientId: testClientID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: height,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: height,
|
||||
}
|
||||
},
|
||||
true,
|
||||
|
|
|
@ -167,18 +167,18 @@ func (k Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string)
|
|||
|
||||
// GetSelfConsensusState introspects the (self) past historical info at a given height
|
||||
// and returns the expected consensus state at that height.
|
||||
// For now, can only retrieve self consensus states for the current version
|
||||
// For now, can only retrieve self consensus states for the current revision
|
||||
func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, bool) {
|
||||
selfHeight, ok := height.(types.Height)
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
// check that height version matches chainID version
|
||||
version := types.ParseChainID(ctx.ChainID())
|
||||
if version != height.GetVersionNumber() {
|
||||
// check that height revision matches chainID revision
|
||||
revision := types.ParseChainID(ctx.ChainID())
|
||||
if revision != height.GetRevisionNumber() {
|
||||
return nil, false
|
||||
}
|
||||
histInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, int64(selfHeight.VersionHeight))
|
||||
histInfo, found := k.stakingKeeper.GetHistoricalInfo(ctx, int64(selfHeight.RevisionHeight))
|
||||
if !found {
|
||||
return nil, false
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height exported.Height) (
|
|||
|
||||
// ValidateSelfClient validates the client parameters for a client of the running chain
|
||||
// This function is only used to validate the client state the counterparty stores for this chain
|
||||
// Client must be in same version as the executing chain
|
||||
// Client must be in same revision as the executing chain
|
||||
func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error {
|
||||
tmClient, ok := clientState.(*ibctmtypes.ClientState)
|
||||
if !ok {
|
||||
|
@ -210,15 +210,15 @@ func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientS
|
|||
ctx.ChainID(), tmClient.ChainId)
|
||||
}
|
||||
|
||||
version := types.ParseChainID(ctx.ChainID())
|
||||
revision := types.ParseChainID(ctx.ChainID())
|
||||
|
||||
// client must be in the same version as executing chain
|
||||
if tmClient.LatestHeight.VersionNumber != version {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client is not in the same version as the chain. expected version: %d, got: %d",
|
||||
tmClient.LatestHeight.VersionNumber, version)
|
||||
// client must be in the same revision as executing chain
|
||||
if tmClient.LatestHeight.RevisionNumber != revision {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client is not in the same revision as the chain. expected revision: %d, got: %d",
|
||||
tmClient.LatestHeight.RevisionNumber, revision)
|
||||
}
|
||||
|
||||
selfHeight := types.NewHeight(version, uint64(ctx.BlockHeight()))
|
||||
selfHeight := types.NewHeight(revision, uint64(ctx.BlockHeight()))
|
||||
if tmClient.LatestHeight.GTE(selfHeight) {
|
||||
return sdkerrors.Wrapf(types.ErrInvalidClient, "client has LatestHeight %d greater than or equal to chain height %d",
|
||||
tmClient.LatestHeight, selfHeight)
|
||||
|
|
|
@ -27,8 +27,8 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
testChainID = "gaiahub-0"
|
||||
testChainIDVersion1 = "gaiahub-1"
|
||||
testChainID = "gaiahub-0"
|
||||
testChainIDRevision1 = "gaiahub-1"
|
||||
|
||||
testClientID = "gaiachain"
|
||||
testClientID2 = "ethbridge"
|
||||
|
@ -42,9 +42,9 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
testClientHeight = types.NewHeight(0, 5)
|
||||
testClientHeightVersion1 = types.NewHeight(1, 5)
|
||||
newClientHeight = types.NewHeight(1, 1)
|
||||
testClientHeight = types.NewHeight(0, 5)
|
||||
testClientHeightRevision1 = types.NewHeight(1, 5)
|
||||
newClientHeight = types.NewHeight(1, 1)
|
||||
)
|
||||
|
||||
type KeeperTestSuite struct {
|
||||
|
@ -94,7 +94,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||
validator := tmtypes.NewValidator(pubKey, 1)
|
||||
suite.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
|
||||
suite.valSetHash = suite.valSet.Hash()
|
||||
suite.header = suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.VersionHeight), testClientHeightMinus1, now2, suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
suite.header = suite.chainA.CreateTMClientHeader(testChainID, int64(testClientHeight.RevisionHeight), testClientHeightMinus1, now2, suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
suite.consensusState = ibctmtypes.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot([]byte("hash")), suite.valSetHash)
|
||||
|
||||
var validators stakingtypes.Validators
|
||||
|
@ -116,9 +116,9 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||
}
|
||||
|
||||
// add localhost client
|
||||
version := types.ParseChainID(suite.chainA.ChainID)
|
||||
revision := types.ParseChainID(suite.chainA.ChainID)
|
||||
localHostClient := localhosttypes.NewClientState(
|
||||
suite.chainA.ChainID, types.NewHeight(version, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
suite.chainA.ChainID, types.NewHeight(revision, uint64(suite.chainA.GetContext().BlockHeight())),
|
||||
)
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), exported.Localhost, localHostClient)
|
||||
|
||||
|
@ -190,8 +190,8 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
|||
false,
|
||||
},
|
||||
{
|
||||
"invalid client version",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeightVersion1, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
"invalid client revision",
|
||||
ibctmtypes.NewClientState(suite.chainA.ChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeightRevision1, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
false,
|
||||
},
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
|
|||
|
||||
testClientHeightPlus5 := types.NewHeight(0, height+5)
|
||||
|
||||
header := suite.chainA.CreateTMClientHeader(testClientID, int64(testClientHeightPlus5.VersionHeight), testClientHeight, suite.header.Header.Time.Add(time.Minute),
|
||||
header := suite.chainA.CreateTMClientHeader(testClientID, int64(testClientHeightPlus5.RevisionHeight), testClientHeight, suite.header.Header.Time.Add(time.Minute),
|
||||
suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
|
||||
// mock update functionality
|
||||
|
|
|
@ -242,16 +242,16 @@ var xxx_messageInfo_ClientUpdateProposal proto.InternalMessageInfo
|
|||
// that can be compared against another Height for the purposes of updating and
|
||||
// freezing clients
|
||||
//
|
||||
// Normally the VersionHeight is incremented at each height while keeping version
|
||||
// number the same However some consensus algorithms may choose to reset the
|
||||
// Normally the RevisionHeight is incremented at each height while keeping RevisionNumber
|
||||
// the same. However some consensus algorithms may choose to reset the
|
||||
// height in certain conditions e.g. hard forks, state-machine breaking changes
|
||||
// In these cases, the version number is incremented so that height continues to
|
||||
// be monitonically increasing even as the VersionHeight gets reset
|
||||
// In these cases, the RevisionNumber is incremented so that height continues to
|
||||
// be monitonically increasing even as the RevisionHeight gets reset
|
||||
type Height struct {
|
||||
// the version that the client is currently on
|
||||
VersionNumber uint64 `protobuf:"varint,1,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty" yaml:"version_number"`
|
||||
// the height within the given version
|
||||
VersionHeight uint64 `protobuf:"varint,2,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty" yaml:"version_height"`
|
||||
// the revision that the client is currently on
|
||||
RevisionNumber uint64 `protobuf:"varint,1,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty" yaml:"revision_number"`
|
||||
// the height within the given revision
|
||||
RevisionHeight uint64 `protobuf:"varint,2,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty" yaml:"revision_height"`
|
||||
}
|
||||
|
||||
func (m *Height) Reset() { *m = Height{} }
|
||||
|
@ -344,44 +344,43 @@ func init() {
|
|||
func init() { proto.RegisterFile("ibc/core/client/v1/client.proto", fileDescriptor_b6bc4c8185546947) }
|
||||
|
||||
var fileDescriptor_b6bc4c8185546947 = []byte{
|
||||
// 579 bytes of a gzipped FileDescriptorProto
|
||||
// 574 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbd, 0x8e, 0xd3, 0x4c,
|
||||
0x14, 0xcd, 0x6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0x9f, 0x13,
|
||||
0xe6, 0xbf, 0x33, 0xcf, 0xcd, 0xeb, 0x57, 0xe5, 0x7e, 0xef, 0x44, 0x3e, 0x2c, 0x7c, 0x31, 0xc5,
|
||||
0xcc, 0x2d, 0x67, 0xb6, 0x3e, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x91, 0xd2, 0x2f, 0x3f, 0x78,
|
||||
0x04, 0x00, 0x00,
|
||||
0x14, 0x8d, 0x93, 0x7c, 0xd1, 0x66, 0xf2, 0x29, 0x59, 0x99, 0x84, 0xf5, 0xa6, 0xb0, 0xa3, 0xa9,
|
||||
0x52, 0xec, 0xda, 0x24, 0x14, 0xa0, 0x74, 0x38, 0x0d, 0x5b, 0x80, 0x82, 0x11, 0x02, 0xd1, 0x44,
|
||||
0xfe, 0x99, 0x75, 0x46, 0x38, 0x9e, 0xc8, 0x33, 0x09, 0x9b, 0x37, 0xa0, 0xa4, 0xa4, 0xa0, 0xe0,
|
||||
0x09, 0xe8, 0x78, 0x03, 0x8a, 0x2d, 0xb7, 0xa4, 0xb2, 0x50, 0xf2, 0x06, 0x79, 0x02, 0xe4, 0x99,
|
||||
0xc9, 0x12, 0x07, 0x22, 0xad, 0xa8, 0x7c, 0x7d, 0xe6, 0xcc, 0xb9, 0xe7, 0xdc, 0x19, 0x0d, 0x30,
|
||||
0xb0, 0xe7, 0x5b, 0x3e, 0x49, 0x90, 0xe5, 0x47, 0x18, 0xc5, 0xcc, 0x5a, 0xf4, 0x64, 0x65, 0xce,
|
||||
0x12, 0xc2, 0x88, 0xaa, 0x62, 0xcf, 0x37, 0x33, 0x82, 0x29, 0xe1, 0x45, 0xaf, 0xdd, 0x0c, 0x49,
|
||||
0x48, 0xf8, 0xb2, 0x95, 0x55, 0x82, 0xd9, 0x3e, 0x0d, 0x09, 0x09, 0x23, 0x64, 0xf1, 0x3f, 0x6f,
|
||||
0x7e, 0x69, 0xb9, 0xf1, 0x52, 0x2c, 0xc1, 0xcf, 0x0a, 0x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0x65, 0x1b, 0x59, 0xf8, 0x4d, 0x6a, 0x9c, 0xc8, 0x5e,
|
||||
0x7b, 0x9a, 0xd0, 0x69, 0xe4, 0x53, 0x50, 0xf8, 0x4d, 0x01, 0x4d, 0x11, 0xe3, 0xd5, 0x2c, 0x70,
|
||||
0x19, 0x1a, 0x25, 0x64, 0x46, 0xa8, 0x1b, 0xa9, 0x4d, 0xf0, 0x1f, 0xc3, 0x2c, 0x42, 0x22, 0x81,
|
||||
0x23, 0x7e, 0xd4, 0x0e, 0xa8, 0x05, 0x88, 0xfa, 0x09, 0x9e, 0x31, 0x4c, 0x62, 0x3e, 0xcb, 0xaa,
|
||||
0xb3, 0x0b, 0xe5, 0xd3, 0x97, 0xee, 0x94, 0xfe, 0x2c, 0x3b, 0x5e, 0x37, 0x40, 0x89, 0x56, 0x3e,
|
||||
0x7c, 0x36, 0x8e, 0xe4, 0x0c, 0xca, 0x1f, 0xbe, 0x18, 0x85, 0xec, 0x3a, 0x57, 0xe4, 0xed, 0x18,
|
||||
0x82, 0x46, 0x82, 0x16, 0x98, 0x62, 0x12, 0x8f, 0xe3, 0xf9, 0xd4, 0x43, 0x09, 0xf7, 0x5c, 0xb6,
|
||||
0xdb, 0x9b, 0xd4, 0xb8, 0x2f, 0xfa, 0xee, 0x11, 0xa0, 0x53, 0xdf, 0x22, 0xcf, 0x39, 0x90, 0x13,
|
||||
0x91, 0x77, 0xad, 0x78, 0x50, 0x44, 0x10, 0x76, 0x44, 0x84, 0x93, 0xc1, 0x51, 0x66, 0xed, 0x53,
|
||||
0x66, 0xef, 0x19, 0xa8, 0x8c, 0xdc, 0xc4, 0x9d, 0xd2, 0x4c, 0xd8, 0x8d, 0x22, 0xf2, 0x1e, 0x05,
|
||||
0x63, 0x11, 0x98, 0x6a, 0x4a, 0xa7, 0xd4, 0xad, 0xee, 0x0a, 0xef, 0x11, 0xa0, 0x53, 0x97, 0x88,
|
||||
0x38, 0x19, 0x6a, 0xbf, 0xb8, 0x5e, 0xe9, 0xca, 0xcd, 0x4a, 0x57, 0x7e, 0xae, 0x74, 0xe5, 0xe3,
|
||||
0x5a, 0x2f, 0xdc, 0xac, 0xf5, 0xc2, 0x8f, 0xb5, 0x5e, 0x78, 0xfb, 0x28, 0xc4, 0x6c, 0x32, 0xf7,
|
||||
0x4c, 0x9f, 0x4c, 0x2d, 0x9f, 0xd0, 0x29, 0xa1, 0xf2, 0x73, 0x4e, 0x83, 0x77, 0xd6, 0x95, 0x75,
|
||||
0xfb, 0xb6, 0x3c, 0xe8, 0x9f, 0xcb, 0xe7, 0x85, 0x2d, 0x67, 0x88, 0x7a, 0x15, 0x3e, 0xdc, 0x87,
|
||||
0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x39, 0xbe, 0xfd, 0x04, 0x7e, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *IdentifiedClientState) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -591,13 +590,13 @@ func (m *Height) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintClient(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
|
@ -729,11 +728,11 @@ func (m *Height) Size() (n int) {
|
|||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovClient(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovClient(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovClient(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovClient(uint64(m.RevisionHeight))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
@ -1337,9 +1336,9 @@ func (m *Height) Unmarshal(dAtA []byte) error {
|
|||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowClient
|
||||
|
@ -1349,16 +1348,16 @@ func (m *Height) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowClient
|
||||
|
@ -1368,7 +1367,7 @@ func (m *Height) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
|||
valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{val})
|
||||
|
||||
heightMinus1 := types.NewHeight(0, height-1)
|
||||
header := suite.chainA.CreateTMClientHeader(chainID, int64(clientHeight.VersionHeight), heightMinus1, now, valSet, valSet, []tmtypes.PrivValidator{privVal})
|
||||
header := suite.chainA.CreateTMClientHeader(chainID, int64(clientHeight.RevisionHeight), heightMinus1, now, valSet, valSet, []tmtypes.PrivValidator{privVal})
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
|
|
@ -14,10 +14,10 @@ import (
|
|||
|
||||
var _ exported.Height = (*Height)(nil)
|
||||
|
||||
// IsVersionFormat checks if a chainID is in the format required for parsing versions
|
||||
// The chainID must be in the form: `{chainID}-{version}
|
||||
// IsRevisionFormat checks if a chainID is in the format required for parsing revisions
|
||||
// The chainID must be in the form: `{chainID}-{revision}
|
||||
// 24-host may enforce stricter checks on chainID
|
||||
var IsVersionFormat = regexp.MustCompile(`^.+[^-]-{1}[1-9][0-9]*$`).MatchString
|
||||
var IsRevisionFormat = regexp.MustCompile(`^.+[^-]-{1}[1-9][0-9]*$`).MatchString
|
||||
|
||||
// ZeroHeight is a helper function which returns an uninitialized height.
|
||||
func ZeroHeight() Height {
|
||||
|
@ -25,21 +25,21 @@ func ZeroHeight() Height {
|
|||
}
|
||||
|
||||
// NewHeight is a constructor for the IBC height type
|
||||
func NewHeight(versionNumber, versionHeight uint64) Height {
|
||||
func NewHeight(revisionNumber, revisionHeight uint64) Height {
|
||||
return Height{
|
||||
VersionNumber: versionNumber,
|
||||
VersionHeight: versionHeight,
|
||||
RevisionNumber: revisionNumber,
|
||||
RevisionHeight: revisionHeight,
|
||||
}
|
||||
}
|
||||
|
||||
// GetVersionNumber returns the version-number of the height
|
||||
func (h Height) GetVersionNumber() uint64 {
|
||||
return h.VersionNumber
|
||||
// GetRevisionNumber returns the revision-number of the height
|
||||
func (h Height) GetRevisionNumber() uint64 {
|
||||
return h.RevisionNumber
|
||||
}
|
||||
|
||||
// GetVersionHeight returns the version-height of the height
|
||||
func (h Height) GetVersionHeight() uint64 {
|
||||
return h.VersionHeight
|
||||
// GetRevisionHeight returns the revision-height of the height
|
||||
func (h Height) GetRevisionHeight() uint64 {
|
||||
return h.RevisionHeight
|
||||
}
|
||||
|
||||
// Compare implements a method to compare two heights. When comparing two heights a, b
|
||||
|
@ -48,20 +48,20 @@ func (h Height) GetVersionHeight() uint64 {
|
|||
// 0 if a = b
|
||||
// 1 if a > b
|
||||
//
|
||||
// It first compares based on version numbers, whichever has the higher version number is the higher height
|
||||
// If version number is the same, then the version height is compared
|
||||
// It first compares based on revision numbers, whichever has the higher revision number is the higher height
|
||||
// If revision number is the same, then the revision height is compared
|
||||
func (h Height) Compare(other exported.Height) int64 {
|
||||
height, ok := other.(Height)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("cannot compare against invalid height type: %T. expected height type: %T", other, h))
|
||||
}
|
||||
var a, b big.Int
|
||||
if h.VersionNumber != height.VersionNumber {
|
||||
a.SetUint64(h.VersionNumber)
|
||||
b.SetUint64(height.VersionNumber)
|
||||
if h.RevisionNumber != height.RevisionNumber {
|
||||
a.SetUint64(h.RevisionNumber)
|
||||
b.SetUint64(height.RevisionNumber)
|
||||
} else {
|
||||
a.SetUint64(h.VersionHeight)
|
||||
b.SetUint64(height.VersionHeight)
|
||||
a.SetUint64(h.RevisionHeight)
|
||||
b.SetUint64(height.RevisionHeight)
|
||||
}
|
||||
return int64(a.Cmp(&b))
|
||||
}
|
||||
|
@ -95,27 +95,27 @@ func (h Height) EQ(other exported.Height) bool {
|
|||
|
||||
// String returns a string representation of Height
|
||||
func (h Height) String() string {
|
||||
return fmt.Sprintf("%d-%d", h.VersionNumber, h.VersionHeight)
|
||||
return fmt.Sprintf("%d-%d", h.RevisionNumber, h.RevisionHeight)
|
||||
}
|
||||
|
||||
// Decrement will return a new height with the VersionHeight decremented
|
||||
// If the VersionHeight is already at lowest value (1), then false success flag is returend
|
||||
// Decrement will return a new height with the RevisionHeight decremented
|
||||
// If the RevisionHeight is already at lowest value (1), then false success flag is returend
|
||||
func (h Height) Decrement() (decremented exported.Height, success bool) {
|
||||
if h.VersionHeight == 0 {
|
||||
if h.RevisionHeight == 0 {
|
||||
return Height{}, false
|
||||
}
|
||||
return NewHeight(h.VersionNumber, h.VersionHeight-1), true
|
||||
return NewHeight(h.RevisionNumber, h.RevisionHeight-1), true
|
||||
}
|
||||
|
||||
// Increment will return a height with the same version number but an
|
||||
// incremented version height
|
||||
// Increment will return a height with the same revision number but an
|
||||
// incremented revision height
|
||||
func (h Height) Increment() Height {
|
||||
return NewHeight(h.VersionNumber, h.VersionHeight+1)
|
||||
return NewHeight(h.RevisionNumber, h.RevisionHeight+1)
|
||||
}
|
||||
|
||||
// IsZero returns true if height version and version-height are both 0
|
||||
// IsZero returns true if height revision and revision-height are both 0
|
||||
func (h Height) IsZero() bool {
|
||||
return h.VersionNumber == 0 && h.VersionHeight == 0
|
||||
return h.RevisionNumber == 0 && h.RevisionHeight == 0
|
||||
}
|
||||
|
||||
// MustParseHeight will attempt to parse a string representation of a height and panic if
|
||||
|
@ -134,55 +134,55 @@ func MustParseHeight(heightStr string) Height {
|
|||
func ParseHeight(heightStr string) (Height, error) {
|
||||
splitStr := strings.Split(heightStr, "-")
|
||||
if len(splitStr) != 2 {
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "expected height string format: {version}-{height}. Got: %s", heightStr)
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "expected height string format: {revision}-{height}. Got: %s", heightStr)
|
||||
}
|
||||
versionNumber, err := strconv.ParseUint(splitStr[0], 10, 64)
|
||||
revisionNumber, err := strconv.ParseUint(splitStr[0], 10, 64)
|
||||
if err != nil {
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid version number. parse err: %s", err)
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid revision number. parse err: %s", err)
|
||||
}
|
||||
versionHeight, err := strconv.ParseUint(splitStr[1], 10, 64)
|
||||
revisionHeight, err := strconv.ParseUint(splitStr[1], 10, 64)
|
||||
if err != nil {
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid version height. parse err: %s", err)
|
||||
return Height{}, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "invalid revision height. parse err: %s", err)
|
||||
}
|
||||
return NewHeight(versionNumber, versionHeight), nil
|
||||
return NewHeight(revisionNumber, revisionHeight), nil
|
||||
}
|
||||
|
||||
// SetVersionNumber takes a chainID in valid version format and swaps the version number
|
||||
// in the chainID with the given version number.
|
||||
func SetVersionNumber(chainID string, version uint64) (string, error) {
|
||||
if !IsVersionFormat(chainID) {
|
||||
// SetRevisionNumber takes a chainID in valid revision format and swaps the revision number
|
||||
// in the chainID with the given revision number.
|
||||
func SetRevisionNumber(chainID string, revision uint64) (string, error) {
|
||||
if !IsRevisionFormat(chainID) {
|
||||
return "", sdkerrors.Wrapf(
|
||||
sdkerrors.ErrInvalidChainID, "chainID is not in version format: %s", chainID,
|
||||
sdkerrors.ErrInvalidChainID, "chainID is not in revision format: %s", chainID,
|
||||
)
|
||||
}
|
||||
|
||||
splitStr := strings.Split(chainID, "-")
|
||||
// swap out version number with given version
|
||||
splitStr[len(splitStr)-1] = strconv.Itoa(int(version))
|
||||
// swap out revision number with given revision
|
||||
splitStr[len(splitStr)-1] = strconv.Itoa(int(revision))
|
||||
return strings.Join(splitStr, "-"), nil
|
||||
}
|
||||
|
||||
// ParseChainID is a utility function that returns an version number from the given ChainID.
|
||||
// ParseChainID attempts to parse a chain id in the format: `{chainID}-{version}`
|
||||
// and return the versionnumber as a uint64.
|
||||
// If the chainID is not in the expected format, a default version value of 0 is returned.
|
||||
// ParseChainID is a utility function that returns an revision number from the given ChainID.
|
||||
// ParseChainID attempts to parse a chain id in the format: `{chainID}-{revision}`
|
||||
// and return the revisionnumber as a uint64.
|
||||
// If the chainID is not in the expected format, a default revision value of 0 is returned.
|
||||
func ParseChainID(chainID string) uint64 {
|
||||
if !IsVersionFormat(chainID) {
|
||||
// chainID is not in version format, return 0 as default
|
||||
if !IsRevisionFormat(chainID) {
|
||||
// chainID is not in revision format, return 0 as default
|
||||
return 0
|
||||
}
|
||||
splitStr := strings.Split(chainID, "-")
|
||||
version, err := strconv.ParseUint(splitStr[len(splitStr)-1], 10, 64)
|
||||
revision, err := strconv.ParseUint(splitStr[len(splitStr)-1], 10, 64)
|
||||
// sanity check: error should always be nil since regex only allows numbers in last element
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("regex allowed non-number value as last split element for chainID: %s", chainID))
|
||||
}
|
||||
return version
|
||||
return revision
|
||||
}
|
||||
|
||||
// GetSelfHeight is a utility function that returns self height given context
|
||||
// Version number is retrieved from ctx.ChainID()
|
||||
// Revision number is retrieved from ctx.ChainID()
|
||||
func GetSelfHeight(ctx sdk.Context) Height {
|
||||
version := ParseChainID(ctx.ChainID())
|
||||
return NewHeight(version, uint64(ctx.BlockHeight()))
|
||||
revision := ParseChainID(ctx.ChainID())
|
||||
return NewHeight(revision, uint64(ctx.BlockHeight()))
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ func TestCompareHeights(t *testing.T) {
|
|||
height2 types.Height
|
||||
compareSign int64
|
||||
}{
|
||||
{"version number 1 is lesser", types.NewHeight(1, 3), types.NewHeight(3, 4), -1},
|
||||
{"version number 1 is greater", types.NewHeight(7, 5), types.NewHeight(4, 5), 1},
|
||||
{"version height 1 is lesser", types.NewHeight(3, 4), types.NewHeight(3, 9), -1},
|
||||
{"version height 1 is greater", types.NewHeight(3, 8), types.NewHeight(3, 3), 1},
|
||||
{"version number is MaxUint64", types.NewHeight(math.MaxUint64, 1), types.NewHeight(0, 1), 1},
|
||||
{"version height is MaxUint64", types.NewHeight(1, math.MaxUint64), types.NewHeight(1, 0), 1},
|
||||
{"revision number 1 is lesser", types.NewHeight(1, 3), types.NewHeight(3, 4), -1},
|
||||
{"revision number 1 is greater", types.NewHeight(7, 5), types.NewHeight(4, 5), 1},
|
||||
{"revision height 1 is lesser", types.NewHeight(3, 4), types.NewHeight(3, 9), -1},
|
||||
{"revision height 1 is greater", types.NewHeight(3, 8), types.NewHeight(3, 3), 1},
|
||||
{"revision number is MaxUint64", types.NewHeight(math.MaxUint64, 1), types.NewHeight(0, 1), 1},
|
||||
{"revision height is MaxUint64", types.NewHeight(1, math.MaxUint64), types.NewHeight(1, 0), 1},
|
||||
{"height is equal", types.NewHeight(4, 4), types.NewHeight(4, 4), 0},
|
||||
}
|
||||
|
||||
|
@ -66,11 +66,11 @@ func TestString(t *testing.T) {
|
|||
_, err := types.ParseHeight("height")
|
||||
require.Error(t, err, "invalid height string passed")
|
||||
|
||||
_, err = types.ParseHeight("version-10")
|
||||
require.Error(t, err, "invalid version string passed")
|
||||
_, err = types.ParseHeight("revision-10")
|
||||
require.Error(t, err, "invalid revision string passed")
|
||||
|
||||
_, err = types.ParseHeight("3-height")
|
||||
require.Error(t, err, "invalid version-height string passed")
|
||||
require.Error(t, err, "invalid revision-height string passed")
|
||||
|
||||
height := types.NewHeight(3, 4)
|
||||
recovered, err := types.ParseHeight(height.String())
|
||||
|
@ -100,7 +100,7 @@ func (suite *TypesTestSuite) TestMustParseHeight() {
|
|||
func TestParseChainID(t *testing.T) {
|
||||
cases := []struct {
|
||||
chainID string
|
||||
version uint64
|
||||
revision uint64
|
||||
formatted bool
|
||||
}{
|
||||
{"gaiamainnet-3", 3, true},
|
||||
|
@ -114,36 +114,36 @@ func TestParseChainID(t *testing.T) {
|
|||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
require.Equal(t, tc.formatted, types.IsVersionFormat(tc.chainID), "case %d does not match expected format", i)
|
||||
require.Equal(t, tc.formatted, types.IsRevisionFormat(tc.chainID), "case %d does not match expected format", i)
|
||||
|
||||
version := types.ParseChainID(tc.chainID)
|
||||
require.Equal(t, tc.version, version, "case %d returns incorrect version", i)
|
||||
revision := types.ParseChainID(tc.chainID)
|
||||
require.Equal(t, tc.revision, revision, "case %d returns incorrect revision", i)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestSetVersionNumber(t *testing.T) {
|
||||
// Test SetVersionNumber
|
||||
chainID, err := types.SetVersionNumber("gaiamainnet", 3)
|
||||
require.Error(t, err, "invalid version format passed SetVersionNumber")
|
||||
require.Equal(t, "", chainID, "invalid version format returned non-empty string on SetVersionNumber")
|
||||
func TestSetRevisionNumber(t *testing.T) {
|
||||
// Test SetRevisionNumber
|
||||
chainID, err := types.SetRevisionNumber("gaiamainnet", 3)
|
||||
require.Error(t, err, "invalid revision format passed SetRevisionNumber")
|
||||
require.Equal(t, "", chainID, "invalid revision format returned non-empty string on SetRevisionNumber")
|
||||
chainID = "gaiamainnet-3"
|
||||
|
||||
chainID, err = types.SetVersionNumber(chainID, 4)
|
||||
require.NoError(t, err, "valid version format failed SetVersionNumber")
|
||||
require.Equal(t, "gaiamainnet-4", chainID, "valid version format returned incorrect string on SetVersionNumber")
|
||||
chainID, err = types.SetRevisionNumber(chainID, 4)
|
||||
require.NoError(t, err, "valid revision format failed SetRevisionNumber")
|
||||
require.Equal(t, "gaiamainnet-4", chainID, "valid revision format returned incorrect string on SetRevisionNumber")
|
||||
}
|
||||
|
||||
func (suite *TypesTestSuite) TestSelfHeight() {
|
||||
ctx := suite.chainA.GetContext()
|
||||
|
||||
// Test default version
|
||||
// Test default revision
|
||||
ctx = ctx.WithChainID("gaiamainnet")
|
||||
ctx = ctx.WithBlockHeight(10)
|
||||
height := types.GetSelfHeight(ctx)
|
||||
suite.Require().Equal(types.NewHeight(0, 10), height, "default self height failed")
|
||||
|
||||
// Test successful version format
|
||||
// Test successful revision format
|
||||
ctx = ctx.WithChainID("gaiamainnet-3")
|
||||
ctx = ctx.WithBlockHeight(18)
|
||||
height = types.GetSelfHeight(ctx)
|
||||
|
|
|
@ -497,8 +497,8 @@ func (suite *TypesTestSuite) TestMarshalMsgSubmitMisbehaviour() {
|
|||
"tendermint client", func() {
|
||||
height := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height))
|
||||
heightMinus1 := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)-1)
|
||||
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)
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2)
|
||||
msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress())
|
||||
|
@ -555,8 +555,8 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() {
|
|||
func() {
|
||||
height := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height))
|
||||
heightMinus1 := types.NewHeight(0, uint64(suite.chainA.CurrentHeader.Height)-1)
|
||||
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)
|
||||
header1 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time, suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
header2 := suite.chainA.CreateTMClientHeader(suite.chainA.ChainID, int64(height.RevisionHeight), heightMinus1, suite.chainA.CurrentHeader.Time.Add(time.Minute), suite.chainA.Vals, suite.chainA.Vals, suite.chainA.Signers)
|
||||
|
||||
misbehaviour := ibctmtypes.NewMisbehaviour("tendermint", header1, header2)
|
||||
msg, err = types.NewMsgSubmitMisbehaviour("tendermint", misbehaviour, suite.chainA.SenderAccount.GetAddress())
|
||||
|
|
|
@ -253,10 +253,10 @@ func (m *QueryClientStatesResponse) GetPagination() *query.PageResponse {
|
|||
type QueryConsensusStateRequest struct {
|
||||
// client identifier
|
||||
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
|
||||
// consensus state version number
|
||||
VersionNumber uint64 `protobuf:"varint,2,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"`
|
||||
// consensus state version height
|
||||
VersionHeight uint64 `protobuf:"varint,3,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty"`
|
||||
// consensus state revision number
|
||||
RevisionNumber uint64 `protobuf:"varint,2,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty"`
|
||||
// consensus state revision height
|
||||
RevisionHeight uint64 `protobuf:"varint,3,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty"`
|
||||
// latest_height overrrides the height field and queries the latest stored
|
||||
// ConsensusState
|
||||
LatestHeight bool `protobuf:"varint,4,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height,omitempty"`
|
||||
|
@ -302,16 +302,16 @@ func (m *QueryConsensusStateRequest) GetClientId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryConsensusStateRequest) GetVersionNumber() uint64 {
|
||||
func (m *QueryConsensusStateRequest) GetRevisionNumber() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionNumber
|
||||
return m.RevisionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryConsensusStateRequest) GetVersionHeight() uint64 {
|
||||
func (m *QueryConsensusStateRequest) GetRevisionHeight() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionHeight
|
||||
return m.RevisionHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -599,59 +599,59 @@ func init() {
|
|||
func init() { proto.RegisterFile("ibc/core/client/v1/query.proto", fileDescriptor_dc42cdfd1d52d76e) }
|
||||
|
||||
var fileDescriptor_dc42cdfd1d52d76e = []byte{
|
||||
// 823 bytes of a gzipped FileDescriptorProto
|
||||
// 824 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x4f, 0xdb, 0x48,
|
||||
0x18, 0xce, 0xf0, 0x25, 0x98, 0x04, 0x58, 0x8d, 0xd0, 0x6e, 0x30, 0xc8, 0x44, 0x5e, 0x2d, 0x9b,
|
||||
0xdd, 0x85, 0x19, 0x92, 0xdd, 0x2d, 0x52, 0x25, 0x0e, 0x05, 0x89, 0x96, 0x4b, 0x0b, 0xee, 0xa1,
|
||||
0x52, 0xa5, 0x0a, 0xd9, 0xce, 0xc4, 0xb1, 0x4a, 0x3c, 0x21, 0xe3, 0x44, 0x45, 0x88, 0x0b, 0x7f,
|
||||
0xa0, 0x95, 0x7a, 0xec, 0xb5, 0xa7, 0xaa, 0xea, 0xa5, 0x87, 0xfe, 0x83, 0x8a, 0x23, 0x52, 0x7b,
|
||||
0xe8, 0xa9, 0x1f, 0xd0, 0x1f, 0xd1, 0x63, 0xe5, 0x99, 0x31, 0xb1, 0x89, 0x11, 0x16, 0x6a, 0x4f,
|
||||
0xb1, 0xdf, 0xaf, 0x79, 0x9e, 0xe7, 0x7d, 0xdf, 0x71, 0xa0, 0xee, 0xd9, 0x0e, 0x71, 0x58, 0x9b,
|
||||
0x12, 0x67, 0xc7, 0xa3, 0x7e, 0x40, 0xba, 0x15, 0xb2, 0xdb, 0xa1, 0xed, 0x3d, 0xdc, 0x6a, 0xb3,
|
||||
0x80, 0x21, 0xe4, 0xd9, 0x0e, 0x0e, 0xfd, 0x58, 0xfa, 0x71, 0xb7, 0xa2, 0xfd, 0xed, 0x30, 0xde,
|
||||
0x64, 0x9c, 0xd8, 0x16, 0xa7, 0x32, 0x98, 0x74, 0x2b, 0x36, 0x0d, 0xac, 0x0a, 0x69, 0x59, 0xae,
|
||||
0xe7, 0x5b, 0x81, 0xc7, 0x7c, 0x99, 0xaf, 0xcd, 0xa5, 0xd4, 0x57, 0x95, 0x64, 0xc0, 0xb4, 0xcb,
|
||||
0x98, 0xbb, 0x43, 0x89, 0x78, 0xb3, 0x3b, 0x75, 0x62, 0xf9, 0xea, 0x6c, 0x6d, 0x56, 0xb9, 0xac,
|
||||
0x96, 0x47, 0x2c, 0xdf, 0x67, 0x81, 0x28, 0xcc, 0x95, 0x77, 0xca, 0x65, 0x2e, 0x13, 0x8f, 0x24,
|
||||
0x7c, 0x92, 0x56, 0xe3, 0x1a, 0xfc, 0x6d, 0x2b, 0x44, 0xb4, 0x26, 0xce, 0xb8, 0x1b, 0x58, 0x01,
|
||||
0x35, 0xe9, 0x6e, 0x87, 0xf2, 0x00, 0xcd, 0xc0, 0x31, 0x79, 0xf2, 0xb6, 0x57, 0x2b, 0x82, 0x12,
|
||||
0x28, 0x8f, 0x99, 0xa3, 0xd2, 0xb0, 0x51, 0x33, 0x5e, 0x01, 0x58, 0xec, 0x4f, 0xe4, 0x2d, 0xe6,
|
||||
0x73, 0x8a, 0x96, 0x61, 0x41, 0x65, 0xf2, 0xd0, 0x2e, 0x92, 0xf3, 0xd5, 0x29, 0x2c, 0xf1, 0xe1,
|
||||
0x08, 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||||
0xc8, 0x90, 0x39, 0xae, 0xac, 0xb7, 0x85, 0x31, 0x1e, 0x16, 0x6b, 0x72, 0x2f, 0x4c, 0x36, 0x11,
|
||||
0xfd, 0x0e, 0xc7, 0x77, 0x42, 0x6e, 0x41, 0x14, 0x35, 0x54, 0x02, 0xe5, 0x51, 0xb3, 0x20, 0x8d,
|
||||
0xaa, 0xd3, 0x6f, 0x00, 0x9c, 0x49, 0x85, 0xab, 0xfa, 0xb0, 0x02, 0x27, 0x9d, 0xc8, 0x93, 0x61,
|
||||
0x40, 0x27, 0x9c, 0x44, 0x99, 0x9f, 0x39, 0xa3, 0x87, 0xe9, 0xc8, 0x79, 0x26, 0xa5, 0xd7, 0x53,
|
||||
0xda, 0x7d, 0x95, 0x21, 0x7e, 0x0b, 0xe0, 0x6c, 0x3a, 0x08, 0xa5, 0xdf, 0x03, 0xf8, 0xcb, 0x39,
|
||||
0xfd, 0xa2, 0x51, 0x5e, 0x48, 0xa3, 0x9b, 0x2c, 0x73, 0xcf, 0x0b, 0x1a, 0x09, 0x01, 0x26, 0x93,
|
||||
0xf2, 0xfe, 0xc0, 0xb1, 0xd5, 0x12, 0x1b, 0xbf, 0x69, 0xb5, 0xad, 0x66, 0xa4, 0xa4, 0x71, 0x27,
|
||||
0xb1, 0xa8, 0x91, 0x4f, 0x11, 0xac, 0xc2, 0x91, 0x96, 0xb0, 0xa8, 0xb9, 0x48, 0xed, 0xa2, 0xca,
|
||||
0x51, 0x91, 0xd5, 0x6f, 0x23, 0x70, 0x58, 0x54, 0x44, 0xcf, 0x01, 0xcc, 0xc7, 0xb6, 0x12, 0xfd,
|
||||
0x93, 0x96, 0x7d, 0xc1, 0x9d, 0xab, 0x2d, 0x64, 0x0b, 0x96, 0x40, 0x8d, 0xeb, 0x87, 0xef, 0xbe,
|
||||
0x3e, 0x1d, 0xf8, 0x0f, 0x55, 0x49, 0xff, 0x57, 0x43, 0x7e, 0x5f, 0x12, 0x17, 0x0e, 0xd9, 0x3f,
|
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, 0x54, 0xb5,
|
||||
0x83, 0xbd, 0x16, 0xe5, 0xf6, 0x88, 0xf8, 0x02, 0xfc, 0xfb, 0x3d, 0x00, 0x00, 0xff, 0xff, 0xca,
|
||||
0xdc, 0xd5, 0x38, 0xee, 0x09, 0x00, 0x00,
|
||||
0x18, 0xce, 0xf0, 0x25, 0x98, 0x04, 0xb2, 0x1a, 0xa1, 0xdd, 0x60, 0x90, 0x89, 0xbc, 0x12, 0x64,
|
||||
0x77, 0x61, 0x86, 0x64, 0x3f, 0x90, 0x56, 0xe2, 0xb0, 0x20, 0xb1, 0xe5, 0xd2, 0x82, 0x7b, 0xa8,
|
||||
0x54, 0xa9, 0x42, 0xb6, 0x33, 0x38, 0x16, 0xc4, 0x13, 0x32, 0x4e, 0x54, 0x84, 0xb8, 0xf0, 0x07,
|
||||
0x5a, 0xa9, 0xc7, 0x5e, 0x7b, 0xea, 0xa1, 0xaa, 0xd4, 0x43, 0xff, 0x41, 0xc5, 0x11, 0xa9, 0x3d,
|
||||
0xf4, 0xd4, 0x56, 0xc0, 0xbf, 0xe8, 0xa5, 0xf2, 0xcc, 0x18, 0xec, 0xc4, 0x08, 0x0b, 0xb5, 0xa7,
|
||||
0xd8, 0xef, 0xd7, 0x3c, 0xcf, 0xf3, 0xbe, 0xef, 0x38, 0x50, 0xf7, 0x6c, 0x87, 0x38, 0xac, 0x4d,
|
||||
0x89, 0xb3, 0xe7, 0x51, 0x3f, 0x20, 0xdd, 0x2a, 0xd9, 0xef, 0xd0, 0xf6, 0x01, 0x6e, 0xb5, 0x59,
|
||||
0xc0, 0x10, 0xf2, 0x6c, 0x07, 0x87, 0x7e, 0x2c, 0xfd, 0xb8, 0x5b, 0xd5, 0x7e, 0x77, 0x18, 0x6f,
|
||||
0x32, 0x4e, 0x6c, 0x8b, 0x53, 0x19, 0x4c, 0xba, 0x55, 0x9b, 0x06, 0x56, 0x95, 0xb4, 0x2c, 0xd7,
|
||||
0xf3, 0xad, 0xc0, 0x63, 0xbe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,
|
||||
0xa5, 0x77, 0x44, 0xe4, 0x9d, 0x10, 0x73, 0x48, 0xc3, 0x11, 0x7a, 0x03, 0x60, 0xb1, 0x67, 0xcd,
|
||||
0x50, 0x56, 0xdc, 0x97, 0xad, 0x58, 0xca, 0x9e, 0xa0, 0x98, 0xae, 0x08, 0xa6, 0xcb, 0xe8, 0xef,
|
||||
0x5b, 0x31, 0x45, 0x4f, 0x2e, 0x47, 0x47, 0x2e, 0xc1, 0x8d, 0xa3, 0x93, 0xd8, 0xbd, 0x1b, 0x47,
|
||||
0x27, 0xb9, 0x8d, 0x86, 0x21, 0xc0, 0xce, 0x20, 0x4d, 0x82, 0x4d, 0xe2, 0x94, 0xdb, 0xb7, 0xba,
|
||||
0x75, 0x72, 0xa6, 0x83, 0xd3, 0x33, 0x1d, 0x7c, 0x39, 0xd3, 0xc1, 0xd3, 0x73, 0x3d, 0x77, 0x7a,
|
||||
0xae, 0xe7, 0x3e, 0x9e, 0xeb, 0xb9, 0x87, 0xcb, 0xae, 0x17, 0x34, 0x3a, 0x36, 0x76, 0x58, 0x93,
|
||||
0xa8, 0xbf, 0x62, 0xf2, 0x67, 0x91, 0xd7, 0x77, 0xc9, 0xe3, 0x2b, 0x01, 0x96, 0x6a, 0x8b, 0xaa,
|
||||
0x76, 0x70, 0xd0, 0xa2, 0xdc, 0x1e, 0x11, 0x1f, 0x81, 0x3f, 0xbf, 0x05, 0x00, 0x00, 0xff, 0xff,
|
||||
0xa7, 0x0d, 0x7c, 0x62, 0xf5, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -1088,13 +1088,13 @@ func (m *QueryConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, err
|
|||
i--
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
|
@ -1394,11 +1394,11 @@ func (m *QueryConsensusStateRequest) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionHeight))
|
||||
}
|
||||
if m.LatestHeight {
|
||||
n += 2
|
||||
|
@ -2005,9 +2005,9 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2017,16 +2017,16 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2036,7 +2036,7 @@ func (m *QueryConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ func local_request_Query_ClientStates_0(ctx context.Context, marshaler runtime.M
|
|||
}
|
||||
|
||||
var (
|
||||
filter_Query_ConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0, "version_number": 1, "version_height": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
|
||||
filter_Query_ConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0, "revision_number": 1, "revision_height": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
|
||||
)
|
||||
|
||||
func request_Query_ConsensusState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
|
@ -147,26 +147,26 @@ func request_Query_ConsensusState_0(ctx context.Context, marshaler runtime.Marsh
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
|
@ -203,26 +203,26 @@ func local_request_Query_ConsensusState_0(ctx context.Context, marshaler runtime
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
|
@ -582,7 +582,7 @@ var (
|
|||
|
||||
pattern_Query_ClientStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "core", "client", "v1beta1", "client_states"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id", "version", "version_number", "height", "version_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id", "revision", "revision_number", "height", "revision_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ConsensusStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ func GetCmdQueryConnection() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
clientCtx = clientCtx.WithHeight(int64(connRes.ProofHeight.VersionHeight))
|
||||
clientCtx = clientCtx.WithHeight(int64(connRes.ProofHeight.RevisionHeight))
|
||||
return clientCtx.PrintOutput(connRes)
|
||||
},
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ func GetCmdQueryClientConnections() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
clientCtx = clientCtx.WithHeight(int64(connPathsRes.ProofHeight.VersionHeight))
|
||||
clientCtx = clientCtx.WithHeight(int64(connPathsRes.ProofHeight.RevisionHeight))
|
||||
return clientCtx.PrintOutput(connPathsRes)
|
||||
},
|
||||
}
|
||||
|
|
|
@ -143,9 +143,9 @@ func QueryConnectionConsensusState(
|
|||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
req := &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: connectionID,
|
||||
VersionNumber: height.VersionNumber,
|
||||
VersionHeight: height.VersionHeight,
|
||||
ConnectionId: connectionID,
|
||||
RevisionNumber: height.RevisionNumber,
|
||||
RevisionHeight: height.RevisionHeight,
|
||||
}
|
||||
|
||||
res, err := queryClient.ConnectionConsensusState(context.Background(), req)
|
||||
|
|
|
@ -160,7 +160,7 @@ func (q Keeper) ConnectionConsensusState(c context.Context, req *types.QueryConn
|
|||
)
|
||||
}
|
||||
|
||||
height := clienttypes.NewHeight(req.VersionNumber, req.VersionHeight)
|
||||
height := clienttypes.NewHeight(req.RevisionNumber, req.RevisionHeight)
|
||||
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, height)
|
||||
if !found {
|
||||
return nil, status.Error(
|
||||
|
|
|
@ -339,8 +339,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
|||
func() {
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: "",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
|
@ -350,8 +350,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
|||
func() {
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: "test-connection-id",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
|
@ -363,8 +363,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
|||
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: connA.ID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
}
|
||||
}, false,
|
||||
},
|
||||
|
@ -380,8 +380,8 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
|||
|
||||
req = &types.QueryConnectionConsensusStateRequest{
|
||||
ConnectionId: connA.ID,
|
||||
VersionNumber: clientState.GetLatestHeight().GetVersionNumber(),
|
||||
VersionHeight: clientState.GetLatestHeight().GetVersionHeight(),
|
||||
RevisionNumber: clientState.GetLatestHeight().GetRevisionNumber(),
|
||||
RevisionHeight: clientState.GetLatestHeight().GetRevisionHeight(),
|
||||
}
|
||||
},
|
||||
true,
|
||||
|
|
|
@ -478,5 +478,5 @@ func (suite *KeeperTestSuite) TestVerifyNextSequenceRecv() {
|
|||
}
|
||||
|
||||
func malleateHeight(height exported.Height, diff uint64) exported.Height {
|
||||
return clienttypes.NewHeight(height.GetVersionNumber(), height.GetVersionHeight()+diff)
|
||||
return clienttypes.NewHeight(height.GetRevisionNumber(), height.GetRevisionHeight()+diff)
|
||||
}
|
||||
|
|
|
@ -484,9 +484,9 @@ func (m *QueryConnectionClientStateResponse) GetProofHeight() types.Height {
|
|||
// Query/ConnectionConsensusState RPC method
|
||||
type QueryConnectionConsensusStateRequest struct {
|
||||
// connection identifier
|
||||
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
|
||||
VersionNumber uint64 `protobuf:"varint,2,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"`
|
||||
VersionHeight uint64 `protobuf:"varint,3,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty"`
|
||||
ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"`
|
||||
RevisionNumber uint64 `protobuf:"varint,2,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty"`
|
||||
RevisionHeight uint64 `protobuf:"varint,3,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryConnectionConsensusStateRequest) Reset() { *m = QueryConnectionConsensusStateRequest{} }
|
||||
|
@ -529,16 +529,16 @@ func (m *QueryConnectionConsensusStateRequest) GetConnectionId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryConnectionConsensusStateRequest) GetVersionNumber() uint64 {
|
||||
func (m *QueryConnectionConsensusStateRequest) GetRevisionNumber() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionNumber
|
||||
return m.RevisionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryConnectionConsensusStateRequest) GetVersionHeight() uint64 {
|
||||
func (m *QueryConnectionConsensusStateRequest) GetRevisionHeight() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionHeight
|
||||
return m.RevisionHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -635,63 +635,63 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_cd8d529f8c7cd06b = []byte{
|
||||
// 887 bytes of a gzipped FileDescriptorProto
|
||||
// 892 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x4f, 0x33, 0x45,
|
||||
0x18, 0xee, 0x14, 0xbe, 0x2f, 0x1f, 0x53, 0x40, 0x9d, 0x14, 0xa8, 0xab, 0x16, 0x5c, 0x45, 0x0a,
|
||||
0x91, 0x19, 0x0a, 0xd1, 0x20, 0xd0, 0x44, 0x21, 0x88, 0x1c, 0x24, 0xb8, 0xc6, 0x8b, 0x17, 0xb2,
|
||||
0xbb, 0x1d, 0xb6, 0x1b, 0xe9, 0x4e, 0xe9, 0x6e, 0x1b, 0x1b, 0xd2, 0x83, 0xfe, 0x02, 0x13, 0x8f,
|
||||
0xde, 0x3c, 0x70, 0xf5, 0xe0, 0xd1, 0x1f, 0x20, 0x47, 0x12, 0x2f, 0x5e, 0x24, 0xa6, 0x78, 0xf5,
|
||||
0xe2, 0x2f, 0x30, 0x3b, 0x33, 0x65, 0x67, 0xe9, 0xb6, 0x94, 0xe6, 0xe3, 0xd4, 0xdd, 0x77, 0xde,
|
||||
0x77, 0xe6, 0x79, 0x9e, 0xf7, 0x9d, 0x67, 0x0b, 0x75, 0xd7, 0xb2, 0x89, 0xcd, 0xea, 0x94, 0xd8,
|
||||
0xcc, 0xf3, 0xa8, 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x65, 0xe1, 0xb3, 0x5a, 0x9d, 0xb1, 0xd3, 0x5c, 0x7a, 0x01, 0x14, 0x26, 0x0d, 0xf1, 0x82, 0xf6,
|
||||
0xe0, 0x24, 0x7f, 0x38, 0xa9, 0x50, 0xd7, 0xa9, 0x04, 0xb9, 0x31, 0xbe, 0xbd, 0xa6, 0x6c, 0x2f,
|
||||
0x74, 0x6c, 0x16, 0xf1, 0x67, 0x3c, 0x63, 0x77, 0xfc, 0xea, 0x66, 0x3e, 0x65, 0x64, 0x78, 0x95,
|
||||
0x08, 0xe9, 0x66, 0x0f, 0x78, 0xbf, 0xcb, 0xfe, 0x53, 0x08, 0xa3, 0x76, 0x49, 0xf0, 0xef, 0x61,
|
||||
0xd1, 0x5b, 0x1c, 0xf6, 0x16, 0x8b, 0x11, 0x91, 0xbd, 0xc5, 0xc7, 0xa6, 0x43, 0x65, 0xad, 0xa1,
|
||||
0x54, 0xea, 0xff, 0x02, 0x98, 0xeb, 0x3d, 0x43, 0x2a, 0x74, 0x04, 0x33, 0x11, 0x51, 0x3f, 0x07,
|
||||
0x16, 0xc6, 0x0a, 0x99, 0xf5, 0xf7, 0xfb, 0x49, 0x74, 0x58, 0xa6, 0x5e, 0xe0, 0x9e, 0xba, 0xb4,
|
||||
0xac, 0x88, 0xad, 0x6e, 0x80, 0x0e, 0x62, 0xa0, 0xd3, 0x1c, 0xf4, 0xd2, 0x83, 0xa0, 0x05, 0x18,
|
||||
0x15, 0x35, 0xda, 0x84, 0xcf, 0x1f, 0xa9, 0xab, 0xcc, 0xd7, 0x77, 0xe0, 0x5b, 0x82, 0x2e, 0x4f,
|
||||
0x4b, 0x10, 0xf6, 0x0d, 0x38, 0x21, 0xb6, 0x88, 0x46, 0xea, 0x85, 0x08, 0x1c, 0x96, 0xf5, 0x4b,
|
||||
0x00, 0xf3, 0xfd, 0xca, 0xa5, 0x66, 0xcb, 0xf0, 0x55, 0x65, 0x2c, 0x6b, 0x66, 0x50, 0x11, 0xc2,
|
||||
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xcc,
|
||||
0xa0, 0x22, 0x84, 0x9b, 0x32, 0x9e, 0x45, 0xf1, 0xe3, 0x30, 0xfc, 0x90, 0x93, 0x63, 0xc1, 0xd7,
|
||||
0x7b, 0xba, 0x2a, 0x10, 0x7f, 0x1a, 0x98, 0x41, 0x77, 0x0e, 0x50, 0x29, 0xf1, 0x06, 0xed, 0xe6,
|
||||
0xfe, 0xbb, 0x9e, 0xcf, 0xb6, 0xcc, 0xea, 0xd9, 0x96, 0x1e, 0x5b, 0xd6, 0x7b, 0xee, 0x56, 0x07,
|
||||
0x40, 0x7d, 0xd8, 0x21, 0x52, 0x10, 0x13, 0xce, 0xb9, 0xb7, 0x93, 0x71, 0x22, 0xb5, 0xf5, 0xc3,
|
||||
0x14, 0x39, 0xb6, 0xcb, 0x49, 0xd4, 0x94, 0x61, 0x52, 0xf6, 0x9c, 0x71, 0x93, 0xc2, 0x0f, 0x29,
|
||||
0xe4, 0xaf, 0x00, 0xbe, 0xd9, 0x4b, 0x32, 0xa4, 0xe5, 0xf9, 0x0d, 0xff, 0x39, 0x8a, 0x89, 0x96,
|
||||
0xe0, 0xb3, 0x3a, 0x6d, 0xba, 0x7e, 0xb8, 0xea, 0x35, 0xaa, 0x16, 0xad, 0x73, 0x32, 0x93, 0xc6,
|
||||
0xd3, 0x6e, 0xf8, 0x88, 0x47, 0x63, 0x89, 0x0a, 0x31, 0x25, 0x51, 0x22, 0xbf, 0x06, 0x70, 0xf1,
|
||||
0x0e, 0xe4, 0xb2, 0x43, 0x25, 0x18, 0x8e, 0xa6, 0x58, 0x89, 0x75, 0x26, 0x8b, 0x85, 0x31, 0xe3,
|
||||
0xae, 0x31, 0xe3, 0x0f, 0xbc, 0x96, 0xf1, 0xd4, 0x8e, 0x6d, 0x13, 0xbf, 0x31, 0xe9, 0xf8, 0x8d,
|
||||
0x89, 0x5a, 0x33, 0x31, 0xac, 0x35, 0x93, 0x63, 0xb4, 0x66, 0xfd, 0xe7, 0x27, 0xf0, 0x11, 0x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 0x44, 0x59, 0x10,
|
||||
0x81, 0xf6, 0xee, 0x67, 0x97, 0x9d, 0x3c, 0xb8, 0xea, 0xe4, 0xc1, 0xdf, 0x9d, 0x3c, 0xf8, 0xee,
|
||||
0x26, 0x9f, 0xba, 0xba, 0xc9, 0xa7, 0xfe, 0xbc, 0xc9, 0xa7, 0x3e, 0xdf, 0x76, 0xdc, 0xa0, 0xd2,
|
||||
0xb0, 0xb0, 0xcd, 0xaa, 0x44, 0xfe, 0x35, 0x16, 0x3f, 0xab, 0x7e, 0xf9, 0x0b, 0xf2, 0x65, 0x84,
|
||||
0x7a, 0x6d, 0x63, 0x55, 0x01, 0x1e, 0xb4, 0x6a, 0xd4, 0xb7, 0x1e, 0x73, 0x63, 0xdc, 0xf8, 0x3f,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7c, 0x35, 0x91, 0xa4, 0xa7, 0x0b, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -1291,13 +1291,13 @@ func (m *QueryConnectionConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte)
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
|
@ -1523,11 +1523,11 @@ func (m *QueryConnectionConsensusStateRequest) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionHeight))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
@ -2588,9 +2588,9 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2600,16 +2600,16 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2619,7 +2619,7 @@ func (m *QueryConnectionConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
|
|
@ -251,26 +251,26 @@ func request_Query_ConnectionConsensusState_0(ctx context.Context, marshaler run
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := client.ConnectionConsensusState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
|
@ -300,26 +300,26 @@ func local_request_Query_ConnectionConsensusState_0(ctx context.Context, marshal
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := server.ConnectionConsensusState(ctx, &protoReq)
|
||||
|
@ -586,7 +586,7 @@ var (
|
|||
|
||||
pattern_Query_ConnectionClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "connection", "v1beta1", "connections", "connection_id", "client_state"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ConnectionConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "core", "connection", "v1beta1", "connections", "connection_id", "consensus_state", "version", "version_number", "height", "version_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ConnectionConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "core", "connection", "v1beta1", "connections", "connection_id", "consensus_state", "revision", "revision_number", "height", "revision_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -463,7 +463,7 @@ func GetCmdQueryNextSequenceReceive() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
clientCtx = clientCtx.WithHeight(int64(sequenceRes.ProofHeight.VersionHeight))
|
||||
clientCtx = clientCtx.WithHeight(int64(sequenceRes.ProofHeight.RevisionHeight))
|
||||
return clientCtx.PrintOutput(sequenceRes)
|
||||
},
|
||||
}
|
||||
|
|
|
@ -101,10 +101,10 @@ func QueryChannelConsensusState(
|
|||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
req := &types.QueryChannelConsensusStateRequest{
|
||||
PortId: portID,
|
||||
ChannelId: channelID,
|
||||
VersionNumber: height.VersionNumber,
|
||||
VersionHeight: height.VersionHeight,
|
||||
PortId: portID,
|
||||
ChannelId: channelID,
|
||||
RevisionNumber: height.RevisionNumber,
|
||||
RevisionHeight: height.RevisionHeight,
|
||||
}
|
||||
|
||||
res, err := queryClient.ChannelConsensusState(context.Background(), req)
|
||||
|
|
|
@ -182,7 +182,7 @@ func (q Keeper) ChannelConsensusState(c context.Context, req *types.QueryChannel
|
|||
)
|
||||
}
|
||||
|
||||
consHeight := clienttypes.NewHeight(req.VersionNumber, req.VersionHeight)
|
||||
consHeight := clienttypes.NewHeight(req.RevisionNumber, req.RevisionHeight)
|
||||
consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientId, consHeight)
|
||||
if !found {
|
||||
return nil, status.Error(
|
||||
|
|
|
@ -439,8 +439,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
|||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: "",
|
||||
ChannelId: "test-channel-id",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
|
@ -451,8 +451,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
|||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: "test-port-id",
|
||||
ChannelId: "",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
|
@ -463,8 +463,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
|||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: "test-port-id",
|
||||
ChannelId: "test-channel-id",
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
},
|
||||
false,
|
||||
|
@ -484,8 +484,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
|||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: channelA.PortID,
|
||||
ChannelId: channelA.ID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: 1,
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: 1,
|
||||
}
|
||||
}, false,
|
||||
},
|
||||
|
@ -497,8 +497,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
|||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: channelA.PortID,
|
||||
ChannelId: channelA.ID,
|
||||
VersionNumber: 0,
|
||||
VersionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
RevisionNumber: 0,
|
||||
RevisionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height
|
||||
}
|
||||
}, false,
|
||||
},
|
||||
|
@ -518,8 +518,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
|||
req = &types.QueryChannelConsensusStateRequest{
|
||||
PortId: channelA.PortID,
|
||||
ChannelId: channelA.ID,
|
||||
VersionNumber: clientState.GetLatestHeight().GetVersionNumber(),
|
||||
VersionHeight: clientState.GetLatestHeight().GetVersionHeight(),
|
||||
RevisionNumber: clientState.GetLatestHeight().GetRevisionNumber(),
|
||||
RevisionHeight: clientState.GetLatestHeight().GetRevisionHeight(),
|
||||
}
|
||||
},
|
||||
true,
|
||||
|
|
|
@ -769,5 +769,5 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() {
|
|||
}
|
||||
|
||||
func malleateHeight(height exported.Height, diff uint64) exported.Height {
|
||||
return clienttypes.NewHeight(height.GetVersionNumber(), height.GetVersionHeight()+diff)
|
||||
return clienttypes.NewHeight(height.GetRevisionNumber(), height.GetRevisionHeight()+diff)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
// CommitPacket returns the packet commitment bytes. The commitment consists of:
|
||||
// sha256_hash(timeout_timestamp + timeout_height.VersionNumber + timeout_height.VersionHeight + sha256_hash(data))
|
||||
// sha256_hash(timeout_timestamp + timeout_height.RevisionNumber + timeout_height.RevisionHeight + sha256_hash(data))
|
||||
// from a given packet. This results in a fixed length preimage.
|
||||
// NOTE: sdk.Uint64ToBigEndian sets the uint64 to a slice of length 8.
|
||||
func CommitPacket(cdc codec.BinaryMarshaler, packet exported.PacketI) []byte {
|
||||
|
@ -20,11 +20,11 @@ func CommitPacket(cdc codec.BinaryMarshaler, packet exported.PacketI) []byte {
|
|||
|
||||
buf := sdk.Uint64ToBigEndian(packet.GetTimeoutTimestamp())
|
||||
|
||||
versionNumber := sdk.Uint64ToBigEndian(timeoutHeight.GetVersionNumber())
|
||||
buf = append(buf, versionNumber...)
|
||||
revisionNumber := sdk.Uint64ToBigEndian(timeoutHeight.GetRevisionNumber())
|
||||
buf = append(buf, revisionNumber...)
|
||||
|
||||
versionHeight := sdk.Uint64ToBigEndian(timeoutHeight.GetVersionHeight())
|
||||
buf = append(buf, versionHeight...)
|
||||
revisionHeight := sdk.Uint64ToBigEndian(timeoutHeight.GetRevisionHeight())
|
||||
buf = append(buf, revisionHeight...)
|
||||
|
||||
dataHash := sha256.Sum256(packet.GetData())
|
||||
buf = append(buf, dataHash[:]...)
|
||||
|
|
|
@ -512,10 +512,10 @@ type QueryChannelConsensusStateRequest struct {
|
|||
PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"`
|
||||
// channel unique identifier
|
||||
ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
|
||||
// version number of the consensus state
|
||||
VersionNumber uint64 `protobuf:"varint,3,opt,name=version_number,json=versionNumber,proto3" json:"version_number,omitempty"`
|
||||
// version height of the consensus state
|
||||
VersionHeight uint64 `protobuf:"varint,4,opt,name=version_height,json=versionHeight,proto3" json:"version_height,omitempty"`
|
||||
// revision number of the consensus state
|
||||
RevisionNumber uint64 `protobuf:"varint,3,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty"`
|
||||
// revision height of the consensus state
|
||||
RevisionHeight uint64 `protobuf:"varint,4,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryChannelConsensusStateRequest) Reset() { *m = QueryChannelConsensusStateRequest{} }
|
||||
|
@ -565,16 +565,16 @@ func (m *QueryChannelConsensusStateRequest) GetChannelId() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryChannelConsensusStateRequest) GetVersionNumber() uint64 {
|
||||
func (m *QueryChannelConsensusStateRequest) GetRevisionNumber() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionNumber
|
||||
return m.RevisionNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *QueryChannelConsensusStateRequest) GetVersionHeight() uint64 {
|
||||
func (m *QueryChannelConsensusStateRequest) GetRevisionHeight() uint64 {
|
||||
if m != nil {
|
||||
return m.VersionHeight
|
||||
return m.RevisionHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -1699,100 +1699,100 @@ func init() {
|
|||
func init() { proto.RegisterFile("ibc/core/channel/v1/query.proto", fileDescriptor_1034a1e9abc4cca1) }
|
||||
|
||||
var fileDescriptor_1034a1e9abc4cca1 = []byte{
|
||||
// 1487 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xdf, 0x6b, 0x14, 0xd7,
|
||||
0x17, 0xcf, 0xdd, 0x44, 0x4d, 0x8e, 0xbf, 0x6f, 0x12, 0x8d, 0x63, 0x5c, 0xe3, 0x7e, 0xbf, 0x6d,
|
||||
0xa3, 0xe0, 0x5c, 0x13, 0xad, 0x15, 0x8a, 0x2d, 0x31, 0x50, 0x1b, 0x50, 0x6b, 0x47, 0x6d, 0x55,
|
||||
0x5a, 0x97, 0xd9, 0xd9, 0xeb, 0x66, 0x48, 0x32, 0xb3, 0xee, 0xcc, 0xc6, 0x84, 0xb0, 0xd0, 0x56,
|
||||
0x90, 0x52, 0x2a, 0x14, 0xa4, 0x14, 0xfa, 0xd2, 0x97, 0x42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0x33, 0x65, 0x6e, 0xb9, 0xe6, 0x75, 0x93, 0x97, 0x7d, 0x5d, 0x02,
|
||||
0x3f, 0x7a, 0x3a, 0x86, 0x32, 0x27, 0x50, 0xbe, 0xb2, 0x2a, 0x4a, 0x09, 0x20, 0x0a, 0x93, 0x9e,
|
||||
0x80, 0x8d, 0x6d, 0xaa, 0x88, 0xf6, 0x85, 0x4f, 0x09, 0xe4, 0x25, 0x41, 0xdb, 0xb2, 0xb8, 0xe1,
|
||||
0x45, 0x6b, 0xd6, 0x32, 0x0f, 0x60, 0x04, 0x2f, 0xf1, 0x28, 0x45, 0x56, 0x9a, 0xb4, 0xce, 0x3d,
|
||||
0xb7, 0xd6, 0xcf, 0x08, 0xec, 0x4f, 0x85, 0xf2, 0xdf, 0x52, 0xfd, 0xb2, 0x2f, 0xba, 0xc4, 0x34,
|
||||
0x2d, 0xac, 0x2f, 0xb8, 0xba, 0xcb, 0x3b, 0x2d, 0xde, 0xdf, 0x03, 0x11, 0x13, 0x42, 0xa3, 0x88,
|
||||
0x3a, 0xec, 0x36, 0x03, 0x7d, 0x8a, 0x12, 0x6a, 0xd1, 0xf1, 0x4c, 0xb0, 0x52, 0x0e, 0x26, 0x11,
|
||||
0x89, 0x48, 0x1a, 0x89, 0x39, 0x6c, 0x26, 0x2d, 0x77, 0xb3, 0xe4, 0xef, 0x11, 0x38, 0x10, 0x63,
|
||||
0xe8, 0x71, 0xb2, 0x9c, 0xba, 0xb3, 0x1e, 0xfa, 0xd1, 0x97, 0x60, 0xdb, 0x22, 0xaf, 0x39, 0xa6,
|
||||
0x6d, 0x15, 0xad, 0xfa, 0x42, 0x89, 0xd7, 0x04, 0xc8, 0x3e, 0x6d, 0x2b, 0xae, 0x9e, 0x13, 0x8b,
|
||||
0x51, 0x33, 0xe4, 0xd2, 0x17, 0x33, 0x43, 0xac, 0xbf, 0x11, 0x28, 0x64, 0x61, 0xc5, 0x84, 0x9c,
|
||||
0x84, 0xed, 0x86, 0xff, 0x26, 0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0xe2, 0x47, 0xdc,
|
||||
0xa3, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x48, 0x61, 0x15, 0x26, 0xa4, 0x1c, 0x00, 0x00,
|
||||
// 1482 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xdd, 0x6f, 0x14, 0x55,
|
||||
0x14, 0xef, 0xdd, 0x16, 0x68, 0x0f, 0xc8, 0xc7, 0x6d, 0x0b, 0x65, 0x28, 0x4b, 0x19, 0x8d, 0x14,
|
||||
0x12, 0xe6, 0xd2, 0x82, 0x48, 0x62, 0xd0, 0x94, 0x26, 0x62, 0x13, 0x40, 0x1c, 0x40, 0x81, 0x28,
|
||||
0x9b, 0xd9, 0xd9, 0xcb, 0x76, 0xd2, 0x76, 0x66, 0xd8, 0x99, 0x2d, 0x6d, 0x9a, 0x7d, 0x50, 0x13,
|
||||
0xe2, 0x83, 0x24, 0x26, 0x3c, 0x68, 0x7c, 0xf1, 0xc5, 0xc4, 0xf0, 0xe0, 0x83, 0xff, 0x83, 0x0f,
|
||||
0xbc, 0x49, 0xa2, 0x26, 0x18, 0x13, 0x24, 0x60, 0x22, 0x0f, 0x3e, 0xeb, 0xab, 0x99, 0xfb, 0x31,
|
||||
0x1f, 0xbb, 0x33, 0xd3, 0x2e, 0xdb, 0x4d, 0x1a, 0x9f, 0xba, 0x73, 0xe7, 0x9c, 0x73, 0x7f, 0xbf,
|
||||
0xdf, 0xb9, 0xe7, 0xec, 0x3d, 0x5b, 0x38, 0x60, 0x95, 0x4d, 0x62, 0x3a, 0x35, 0x4a, 0xcc, 0x59,
|
||||
0xc3, 0xb6, 0xe9, 0x3c, 0x59, 0x9c, 0x20, 0xb7, 0xea, 0xb4, 0xb6, 0xac, 0xb9, 0x35, 0xc7, 0x77,
|
||||
0xf0, 0xa0, 0x55, 0x36, 0xb5, 0xc0, 0x40, 0x13, 0x06, 0xda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, 0x9d, 0x3f, 0xe0, 0x69, 0xd8, 0xc6, 0x3e, 0x94,
|
||||
0x66, 0xa9, 0x55, 0x9d, 0xf5, 0x47, 0x7a, 0x59, 0x48, 0x25, 0x16, 0x92, 0x67, 0x60, 0x71, 0x42,
|
||||
0x7b, 0x87, 0x59, 0x9c, 0xe9, 0x7b, 0xf0, 0xf8, 0x40, 0x8f, 0xbe, 0x95, 0x79, 0xf1, 0x25, 0xf5,
|
||||
0x46, 0x12, 0xaa, 0x27, 0xb9, 0xbf, 0x0d, 0x10, 0x25, 0x46, 0xa0, 0x7d, 0x55, 0xe3, 0x59, 0xd4,
|
||||
0x82, 0x2c, 0x6a, 0xfc, 0x50, 0x88, 0x2c, 0x6a, 0x17, 0x8d, 0x2a, 0x15, 0xbe, 0x7a, 0xcc, 0x53,
|
||||
0x7d, 0x8c, 0x60, 0xb8, 0x69, 0x03, 0x21, 0xc6, 0x19, 0xe8, 0x17, 0xfc, 0xbc, 0x11, 0x34, 0xd6,
|
||||
0xcb, 0xe2, 0xa7, 0xa9, 0x31, 0x53, 0xa1, 0xb6, 0x6f, 0xdd, 0xb4, 0x68, 0x45, 0xea, 0x12, 0xfa,
|
||||
0xe1, 0xb3, 0x09, 0x94, 0x05, 0x86, 0xf2, 0xd0, 0xaa, 0x28, 0x39, 0x80, 0x38, 0x4c, 0x7c, 0x0a,
|
||||
0x36, 0xb7, 0xa9, 0xa2, 0xb0, 0x57, 0x3f, 0x43, 0x50, 0xe4, 0x04, 0x1d, 0xdb, 0xa6, 0x66, 0x10,
|
||||
0xad, 0x59, 0xcb, 0x22, 0x80, 0x19, 0xbe, 0x14, 0x47, 0x29, 0xb6, 0xd2, 0xa4, 0x75, 0xe1, 0x85,
|
||||
0xb5, 0x7e, 0x8e, 0xe0, 0x40, 0x26, 0x94, 0xff, 0x97, 0xea, 0x57, 0xa5, 0xe8, 0x1c, 0xd3, 0x34,
|
||||
0xb3, 0xbe, 0xe4, 0x1b, 0x3e, 0xed, 0xb4, 0x78, 0xff, 0x08, 0x45, 0x4c, 0x09, 0x2d, 0x44, 0x34,
|
||||
0x60, 0x8f, 0x15, 0xea, 0x53, 0xe2, 0x50, 0x4b, 0x5e, 0x60, 0x22, 0x2a, 0xe5, 0x70, 0x1a, 0x91,
|
||||
0x98, 0xa4, 0xb1, 0x98, 0xc3, 0x56, 0xda, 0x72, 0x37, 0x4b, 0xfe, 0x7b, 0x04, 0x07, 0x13, 0x0c,
|
||||
0x03, 0x4e, 0xb6, 0x57, 0xf7, 0xd6, 0x43, 0x3f, 0x7c, 0x08, 0x76, 0xd4, 0xe8, 0xa2, 0xe5, 0x59,
|
||||
0x8e, 0x5d, 0xb2, 0xeb, 0x0b, 0x65, 0x5a, 0x63, 0x28, 0xfb, 0xf4, 0xed, 0x72, 0xf9, 0x02, 0x5b,
|
||||
0x4d, 0x18, 0x0a, 0x3a, 0x7d, 0x49, 0x43, 0x81, 0xf7, 0x77, 0x04, 0x6a, 0x1e, 0x5e, 0x91, 0x94,
|
||||
0xd3, 0xb0, 0xc3, 0x94, 0x6f, 0x12, 0xc9, 0x18, 0xd2, 0xf8, 0xf7, 0x81, 0x26, 0xbf, 0x0f, 0xb4,
|
||||
0x29, 0x7b, 0x59, 0xdf, 0x6e, 0x26, 0xc2, 0xe0, 0x7d, 0x30, 0x20, 0x12, 0x19, 0xb2, 0xea, 0xe7,
|
||||
0x0b, 0x33, 0x95, 0x28, 0x1b, 0xbd, 0x79, 0xd9, 0xe8, 0x7b, 0x91, 0x6c, 0xd4, 0x60, 0x94, 0x91,
|
||||
0xbb, 0x68, 0x98, 0x73, 0xd4, 0x9f, 0x76, 0x16, 0x16, 0x2c, 0x7f, 0x81, 0xda, 0x7e, 0xa7, 0x79,
|
||||
0x50, 0xa0, 0xdf, 0x0b, 0x42, 0xd8, 0x26, 0x15, 0x09, 0x08, 0x9f, 0xd5, 0xaf, 0x11, 0xec, 0xcf,
|
||||
0xd8, 0x54, 0x88, 0xc9, 0x5a, 0x96, 0x5c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0x3b, 0xd6, 0x3b, 0xde, 0xa7, 0xef, 0x75, 0x9b, 0x9a, 0xe5, 0x25, 0x69, 0xa0,
|
||||
0x2e, 0x89, 0x76, 0x9a, 0x02, 0x4c, 0x24, 0x63, 0x14, 0x06, 0xa2, 0x78, 0x88, 0xc5, 0x8b, 0x16,
|
||||
0x62, 0x9a, 0x14, 0xda, 0xd4, 0xe4, 0x8e, 0x6c, 0x37, 0xd1, 0xd6, 0x53, 0xe6, 0x5c, 0xc7, 0x82,
|
||||
0x1c, 0x83, 0x21, 0x21, 0x88, 0x61, 0xce, 0xb5, 0x28, 0x81, 0x5d, 0x79, 0xf2, 0x22, 0x09, 0xea,
|
||||
0xb0, 0x2f, 0x15, 0x47, 0x97, 0xf9, 0x5f, 0x13, 0x77, 0xdd, 0x0b, 0x74, 0x29, 0xcc, 0x87, 0xce,
|
||||
0x01, 0x74, 0x7a, 0x8f, 0xfe, 0x01, 0xc1, 0x58, 0x76, 0x6c, 0xc1, 0x6b, 0x12, 0x86, 0x6d, 0xba,
|
||||
0x14, 0x1d, 0x96, 0x92, 0x60, 0xcf, 0xb6, 0xea, 0xd3, 0x07, 0xed, 0x56, 0xdf, 0x2e, 0xb6, 0xb0,
|
||||
0xc9, 0x9f, 0x76, 0xc3, 0x26, 0x86, 0x19, 0x7f, 0x87, 0x60, 0x8b, 0xb8, 0x6e, 0xe2, 0xf1, 0xd4,
|
||||
0x7a, 0x4f, 0xf9, 0xc1, 0x40, 0x39, 0xbc, 0x06, 0x4b, 0xce, 0x5c, 0x3d, 0xfb, 0xc9, 0xcf, 0x7f,
|
||||
0xde, 0x2b, 0x4c, 0xe1, 0xb7, 0x48, 0xca, 0xaf, 0x1d, 0xfc, 0x87, 0x11, 0x39, 0x6f, 0x91, 0x95,
|
||||
0x48, 0xe7, 0x06, 0x09, 0xd4, 0xf7, 0xc8, 0x8a, 0xc8, 0x49, 0x03, 0xdf, 0x45, 0xd0, 0x2f, 0xa7,
|
||||
0x3c, 0xbc, 0x3a, 0x00, 0x79, 0xb6, 0x95, 0x23, 0x6b, 0x31, 0x15, 0x60, 0x8f, 0x30, 0xb0, 0xaf,
|
||||
0x60, 0x75, 0x75, 0xb0, 0xf8, 0x47, 0x04, 0xb8, 0x75, 0xfe, 0xc4, 0xc7, 0x73, 0xb6, 0xcb, 0x1a,
|
||||
0x9c, 0x95, 0x13, 0xed, 0x39, 0x09, 0xb4, 0xd3, 0x0c, 0xed, 0x69, 0xfc, 0x46, 0x0e, 0xda, 0xd0,
|
||||
0x3b, 0x50, 0x37, 0x7c, 0x68, 0x44, 0x34, 0x7e, 0x0d, 0x68, 0xb4, 0x4c, 0x80, 0xb9, 0x34, 0xb2,
|
||||
0x46, 0xd1, 0x5c, 0x1a, 0x99, 0x43, 0xa6, 0x7a, 0x99, 0xd1, 0xb8, 0x80, 0xcf, 0x75, 0x78, 0x42,
|
||||
0x48, 0x7c, 0x3e, 0xc5, 0x5f, 0x15, 0x60, 0x38, 0x75, 0x8e, 0xc2, 0x27, 0x57, 0x47, 0x99, 0x36,
|
||||
0x28, 0x2a, 0xaf, 0xb7, 0xed, 0x27, 0x08, 0xde, 0x45, 0x8c, 0xe1, 0x1d, 0x84, 0x3f, 0x45, 0x1d,
|
||||
0x73, 0x4c, 0x4e, 0x7e, 0x44, 0x8e, 0x90, 0x64, 0xa5, 0x69, 0x18, 0x6d, 0x10, 0xde, 0x20, 0x62,
|
||||
0x2f, 0xf8, 0x42, 0x03, 0x3f, 0x41, 0xb0, 0xb3, 0xf9, 0x46, 0x8f, 0x27, 0xb2, 0xd9, 0x65, 0x4c,
|
||||
0x6c, 0xca, 0x64, 0x3b, 0x2e, 0x42, 0x0b, 0xca, 0xa4, 0x28, 0xe1, 0x8f, 0x3a, 0x15, 0xa2, 0xe5,
|
||||
0x8b, 0xd8, 0x23, 0x2b, 0xb2, 0xbb, 0x36, 0xf0, 0x23, 0x04, 0xbb, 0x5a, 0x86, 0x16, 0xdc, 0x06,
|
||||
0xe0, 0xb0, 0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
||||
0x0c, 0xa6, 0x5c, 0x92, 0x71, 0xce, 0xb5, 0x21, 0xfb, 0xbe, 0xae, 0xbc, 0xd6, 0xa6, 0x97, 0x10,
|
||||
0xe2, 0x0a, 0xd3, 0xe1, 0x5d, 0x7c, 0xbe, 0x53, 0x1d, 0x12, 0xf7, 0xf9, 0x33, 0xfa, 0x83, 0xa7,
|
||||
0x45, 0xf4, 0xf0, 0x69, 0x11, 0x3d, 0x79, 0x5a, 0x44, 0x5f, 0x3c, 0x2b, 0xf6, 0x3c, 0x7c, 0x56,
|
||||
0xec, 0x79, 0xf4, 0xac, 0xd8, 0x73, 0xfd, 0x54, 0xd5, 0xf2, 0x67, 0xeb, 0x65, 0xcd, 0x74, 0x16,
|
||||
0x88, 0xf8, 0xe7, 0x20, 0xff, 0x73, 0xd4, 0xab, 0xcc, 0x91, 0xa5, 0x08, 0xc6, 0xb1, 0x13, 0x47,
|
||||
0x25, 0x12, 0x7f, 0xd9, 0xa5, 0x5e, 0x79, 0x33, 0xfb, 0x1d, 0xf7, 0xf8, 0x7f, 0x01, 0x00, 0x00,
|
||||
0xff, 0xff, 0xce, 0x1d, 0x1b, 0xcd, 0xab, 0x1c, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -2740,13 +2740,13 @@ func (m *QueryChannelConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte) (i
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.VersionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionHeight))
|
||||
i--
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.RevisionNumber))
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
}
|
||||
|
@ -3775,11 +3775,11 @@ func (m *QueryChannelConsensusStateRequest) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
if m.VersionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionNumber))
|
||||
if m.RevisionNumber != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionNumber))
|
||||
}
|
||||
if m.VersionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.VersionHeight))
|
||||
if m.RevisionHeight != 0 {
|
||||
n += 1 + sovQuery(uint64(m.RevisionHeight))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
@ -5295,9 +5295,9 @@ func (m *QueryChannelConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionNumber", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType)
|
||||
}
|
||||
m.VersionNumber = 0
|
||||
m.RevisionNumber = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -5307,16 +5307,16 @@ func (m *QueryChannelConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionNumber |= uint64(b&0x7F) << shift
|
||||
m.RevisionNumber |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VersionHeight", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType)
|
||||
}
|
||||
m.VersionHeight = 0
|
||||
m.RevisionHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -5326,7 +5326,7 @@ func (m *QueryChannelConsensusStateRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VersionHeight |= uint64(b&0x7F) << shift
|
||||
m.RevisionHeight |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
|
|
@ -324,26 +324,26 @@ func request_Query_ChannelConsensusState_0(ctx context.Context, marshaler runtim
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := client.ChannelConsensusState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
|
@ -384,26 +384,26 @@ func local_request_Query_ChannelConsensusState_0(ctx context.Context, marshaler
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_number"]
|
||||
val, ok = pathParams["revision_number"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_number")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_number")
|
||||
}
|
||||
|
||||
protoReq.VersionNumber, err = runtime.Uint64(val)
|
||||
protoReq.RevisionNumber, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_number", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_number", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["version_height"]
|
||||
val, ok = pathParams["revision_height"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_height")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "revision_height")
|
||||
}
|
||||
|
||||
protoReq.VersionHeight, err = runtime.Uint64(val)
|
||||
protoReq.RevisionHeight, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_height", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "revision_height", err)
|
||||
}
|
||||
|
||||
msg, err := server.ChannelConsensusState(ctx, &protoReq)
|
||||
|
@ -1744,7 +1744,7 @@ var (
|
|||
|
||||
pattern_Query_ChannelClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "client_state"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ChannelConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 2, 9, 1, 0, 4, 1, 5, 10, 2, 11, 1, 0, 4, 1, 5, 12}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "consensus_state", "version", "version_number", "height", "version_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ChannelConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 2, 9, 1, 0, 4, 1, 5, 10, 2, 11, 1, 0, 4, 1, 5, 12}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "consensus_state", "revision", "revision_number", "height", "revision_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_PacketCommitment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "core", "channel", "v1beta1", "channels", "channel_id", "ports", "port_id", "packet_commitments", "sequence"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
|
|
|
@ -62,6 +62,6 @@ func QueryTendermintProof(clientCtx client.Context, key []byte) ([]byte, []byte,
|
|||
return nil, nil, clienttypes.Height{}, err
|
||||
}
|
||||
|
||||
version := clienttypes.ParseChainID(clientCtx.ChainID)
|
||||
return res.Value, proofBz, clienttypes.NewHeight(version, uint64(res.Height)+1), nil
|
||||
revision := clienttypes.ParseChainID(clientCtx.ChainID)
|
||||
return res.Value, proofBz, clienttypes.NewHeight(revision, uint64(res.Height)+1), nil
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ type ClientState interface {
|
|||
CheckProposedHeaderAndUpdateState(sdk.Context, codec.BinaryMarshaler, sdk.KVStore, Header) (ClientState, ConsensusState, error)
|
||||
|
||||
// Upgrade functions
|
||||
// NOTE: proof heights are not included as upgrade to a new version is expected to pass only on the last
|
||||
// height committed by the current version. Clients are responsible for ensuring that the planned last
|
||||
// height of the current version is somehow encoded in the proof verification process.
|
||||
// NOTE: proof heights are not included as upgrade to a new revision is expected to pass only on the last
|
||||
// height committed by the current revision. Clients are responsible for ensuring that the planned last
|
||||
// height of the current revision is somehow encoded in the proof verification process.
|
||||
// This is to ensure that no premature upgrades occur, since upgrade plans committed to by the counterparty
|
||||
// may be cancelled or modified before the last planned height.
|
||||
VerifyUpgradeAndUpdateState(
|
||||
|
@ -182,8 +182,8 @@ type Height interface {
|
|||
EQ(Height) bool
|
||||
GT(Height) bool
|
||||
GTE(Height) bool
|
||||
GetVersionNumber() uint64
|
||||
GetVersionHeight() uint64
|
||||
GetRevisionNumber() uint64
|
||||
GetRevisionHeight() uint64
|
||||
Decrement() (Height, bool)
|
||||
String() string
|
||||
}
|
||||
|
|
|
@ -640,8 +640,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -652,8 +652,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradeClient, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradeClient, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
msg, err = clienttypes.NewMsgUpgradeClient(clientA, upgradedClient, upgradedConsState,
|
||||
proofUpgradeClient, proofUpgradedConsState, suite.chainA.SenderAccount.GetAddress())
|
||||
|
@ -677,8 +677,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
|
|
@ -78,38 +78,38 @@ IBC Client Heights are represented by the struct:
|
|||
|
||||
```go
|
||||
type Height struct {
|
||||
VersionNumber uint64
|
||||
VersionHeight uint64
|
||||
RevisionNumber uint64
|
||||
RevisionHeight uint64
|
||||
}
|
||||
```
|
||||
|
||||
The `VersionNumber` represents the version of the chain that the height is representing.
|
||||
An version typically represents a continuous, monotonically increasing range of block-heights.
|
||||
The `VersionHeight` represents the height of the chain within the given version.
|
||||
The `RevisionNumber` represents the revision of the chain that the height is representing.
|
||||
An revision typically represents a continuous, monotonically increasing range of block-heights.
|
||||
The `RevisionHeight` represents the height of the chain within the given revision.
|
||||
|
||||
On any reset of the `VersionHeight`, for example, when hard-forking a Tendermint chain,
|
||||
the `VersionNumber` will get incremented. This allows IBC clients to distinguish between a
|
||||
block-height `n` of a previous version of the chain (at version `p`) and block-height `n` of the current
|
||||
version of the chain (at version `e`).
|
||||
On any reset of the `RevisionHeight`, for example, when hard-forking a Tendermint chain,
|
||||
the `RevisionNumber` will get incremented. This allows IBC clients to distinguish between a
|
||||
block-height `n` of a previous revision of the chain (at revision `p`) and block-height `n` of the current
|
||||
revision of the chain (at revision `e`).
|
||||
|
||||
`Heights` that share the same version number can be compared by simply comparing their respective `VersionHeights`.
|
||||
Heights that do not share the same version number will only be compared using their respective `VersionNumbers`.
|
||||
Thus a height `h` with version number `e+1` will always be greater than a height `g` with version number `e`,
|
||||
**REGARDLESS** of the difference in version heights.
|
||||
`Heights` that share the same revision number can be compared by simply comparing their respective `RevisionHeights`.
|
||||
Heights that do not share the same revision number will only be compared using their respective `RevisionNumbers`.
|
||||
Thus a height `h` with revision number `e+1` will always be greater than a height `g` with revision number `e`,
|
||||
**REGARDLESS** of the difference in revision heights.
|
||||
|
||||
Ex:
|
||||
|
||||
```go
|
||||
Height{VersionNumber: 3, VersionHeight: 0} > Height{VersionNumber: 2, VersionHeight: 100000000000}
|
||||
Height{RevisionNumber: 3, RevisionHeight: 0} > Height{RevisionNumber: 2, RevisionHeight: 100000000000}
|
||||
```
|
||||
|
||||
When a Tendermint chain is running a particular version, relayers can simply submit headers and proofs with the version number
|
||||
given by the chain's chainID, and the version height given by the Tendermint block height. When a chain updates using a hard-fork
|
||||
and resets its block-height, it is responsible for updating its chain-id to increment the version number.
|
||||
IBC Tendermint clients then verifies the version number against their `ChainId` and treat the `VersionHeight` as the Tendermint block-height.
|
||||
When a Tendermint chain is running a particular revision, relayers can simply submit headers and proofs with the revision number
|
||||
given by the chain's chainID, and the revision height given by the Tendermint block height. When a chain updates using a hard-fork
|
||||
and resets its block-height, it is responsible for updating its chain-id to increment the revision number.
|
||||
IBC Tendermint clients then verifies the revision number against their `ChainId` and treat the `RevisionHeight` as the Tendermint block-height.
|
||||
|
||||
Tendermint chains wishing to use versions to maintain persistent IBC connections even across height-resetting upgrades must format their chain-ids
|
||||
in the following manner: `{chainID}-{version_number}`. On any height-resetting upgrade, the chainID **MUST** be updated with a higher version number
|
||||
Tendermint chains wishing to use revisions to maintain persistent IBC connections even across height-resetting upgrades must format their chain-ids
|
||||
in the following manner: `{chainID}-{revision_number}`. On any height-resetting upgrade, the chainID **MUST** be updated with a higher revision number
|
||||
than the previous value.
|
||||
|
||||
Ex:
|
||||
|
@ -117,8 +117,8 @@ Ex:
|
|||
- Before upgrade ChainID: `gaiamainnet-3`
|
||||
- After upgrade ChainID: `gaiamainnet-4`
|
||||
|
||||
Clients that do not require versions, such as the solo-machine client, simply hardcode `0` into the version number whenever they
|
||||
need to return an IBC height when implementing IBC interfaces and use the `VersionHeight` exclusively.
|
||||
Clients that do not require revisions, such as the solo-machine client, simply hardcode `0` into the revision number whenever they
|
||||
need to return an IBC height when implementing IBC interfaces and use the `RevisionHeight` exclusively.
|
||||
|
||||
Other client-types may implement their own logic to verify the IBC Heights that relayers provide in their `Update`, `Misbehavior`, and
|
||||
`Verify` functions respectively.
|
||||
|
|
|
@ -33,7 +33,7 @@ func (cs ClientState) ClientType() string {
|
|||
|
||||
// GetLatestHeight returns the latest sequence number.
|
||||
// Return exported.Height to satisfy ClientState interface
|
||||
// Version number is always 0 for a solo-machine.
|
||||
// Revision number is always 0 for a solo-machine.
|
||||
func (cs ClientState) GetLatestHeight() exported.Height {
|
||||
return clienttypes.NewHeight(0, cs.Sequence)
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ func (cs ClientState) IsFrozen() bool {
|
|||
|
||||
// GetFrozenHeight returns the frozen sequence of the client.
|
||||
// Return exported.Height to satisfy interface
|
||||
// Version number is always 0 for a solo-machine
|
||||
// Revision number is always 0 for a solo-machine
|
||||
func (cs ClientState) GetFrozenHeight() exported.Height {
|
||||
return clienttypes.NewHeight(0, cs.FrozenSequence)
|
||||
}
|
||||
|
@ -398,11 +398,11 @@ func produceVerificationArgs(
|
|||
prefix exported.Prefix,
|
||||
proof []byte,
|
||||
) (cryptotypes.PubKey, signing.SignatureData, uint64, uint64, error) {
|
||||
if version := height.GetVersionNumber(); version != 0 {
|
||||
return nil, nil, 0, 0, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "version must be 0 for solomachine, got version-number: %d", version)
|
||||
if revision := height.GetRevisionNumber(); revision != 0 {
|
||||
return nil, nil, 0, 0, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "revision must be 0 for solomachine, got revision-number: %d", revision)
|
||||
}
|
||||
// sequence is encoded in the version height of height struct
|
||||
sequence := height.GetVersionHeight()
|
||||
// sequence is encoded in the revision height of height struct
|
||||
sequence := height.GetRevisionHeight()
|
||||
if cs.IsFrozen() {
|
||||
return nil, nil, 0, 0, clienttypes.ErrClientFrozen
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ func produceVerificationArgs(
|
|||
return nil, nil, 0, 0, sdkerrors.Wrap(clienttypes.ErrInvalidConsensus, "consensus state cannot be empty")
|
||||
}
|
||||
|
||||
latestSequence := cs.GetLatestHeight().GetVersionHeight()
|
||||
latestSequence := cs.GetLatestHeight().GetRevisionHeight()
|
||||
if latestSequence != sequence {
|
||||
return nil, nil, 0, 0, sdkerrors.Wrapf(
|
||||
sdkerrors.ErrInvalidHeight,
|
||||
|
|
|
@ -18,7 +18,7 @@ func (Header) ClientType() string {
|
|||
|
||||
// GetHeight returns the current sequence number as the height.
|
||||
// Return clientexported.Height to satisfy interface
|
||||
// Version number is always 0 for a solo-machine
|
||||
// Revision number is always 0 for a solo-machine
|
||||
func (h Header) GetHeight() exported.Height {
|
||||
return clienttypes.NewHeight(0, h.Sequence)
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ func (misbehaviour Misbehaviour) Type() string {
|
|||
|
||||
// GetHeight returns the sequence at which misbehaviour occurred.
|
||||
// Return exported.Height to satisfy interface
|
||||
// Version number is always 0 for a solo-machine
|
||||
// Revision number is always 0 for a solo-machine
|
||||
func (misbehaviour Misbehaviour) GetHeight() exported.Height {
|
||||
return clienttypes.NewHeight(0, misbehaviour.Sequence)
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ func (suite *SoloMachineTestSuite) TestMisbehaviour() {
|
|||
|
||||
suite.Require().Equal(exported.Solomachine, misbehaviour.ClientType())
|
||||
suite.Require().Equal(suite.solomachine.ClientID, misbehaviour.GetClientID())
|
||||
suite.Require().Equal(uint64(0), misbehaviour.GetHeight().GetVersionNumber())
|
||||
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight().GetVersionHeight())
|
||||
suite.Require().Equal(uint64(0), misbehaviour.GetHeight().GetRevisionNumber())
|
||||
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight().GetRevisionHeight())
|
||||
}
|
||||
|
||||
func (suite *SoloMachineTestSuite) TestMisbehaviourValidateBasic() {
|
||||
|
|
|
@ -79,7 +79,7 @@ func (suite *SoloMachineTestSuite) TestCheckProposedHeaderAndUpdateState() {
|
|||
suite.Require().Equal(headerPubKey, consStatePubKey)
|
||||
suite.Require().Equal(smHeader.NewDiversifier, smConsState.Diversifier)
|
||||
suite.Require().Equal(smHeader.Timestamp, smConsState.Timestamp)
|
||||
suite.Require().Equal(smHeader.GetHeight().GetVersionHeight(), cs.(*types.ClientState).Sequence)
|
||||
suite.Require().Equal(smHeader.GetHeight().GetRevisionHeight(), cs.(*types.ClientState).Sequence)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Nil(cs)
|
||||
|
|
|
@ -55,7 +55,7 @@ func (suite *SoloMachineTestSuite) GetSequenceFromStore() uint64 {
|
|||
var clientState exported.ClientState
|
||||
err := codec.UnmarshalAny(suite.chainA.Codec, &clientState, bz)
|
||||
suite.Require().NoError(err)
|
||||
return clientState.GetLatestHeight().GetVersionHeight()
|
||||
return clientState.GetLatestHeight().GetRevisionHeight()
|
||||
}
|
||||
|
||||
func (suite *SoloMachineTestSuite) GetInvalidProof() []byte {
|
||||
|
|
|
@ -92,8 +92,8 @@ func (cs ClientState) Validate() error {
|
|||
if cs.MaxClockDrift == 0 {
|
||||
return sdkerrors.Wrap(ErrInvalidMaxClockDrift, "max clock drift cannot be zero")
|
||||
}
|
||||
if cs.LatestHeight.VersionHeight == 0 {
|
||||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "tendermint version height cannot be zero")
|
||||
if cs.LatestHeight.RevisionHeight == 0 {
|
||||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "tendermint revision height cannot be zero")
|
||||
}
|
||||
if cs.TrustingPeriod >= cs.UnbondingPeriod {
|
||||
return sdkerrors.Wrapf(
|
||||
|
|
|
@ -137,7 +137,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() {
|
|||
},
|
||||
{
|
||||
name: "client is frozen",
|
||||
clientState: &types.ClientState{LatestHeight: height, FrozenHeight: clienttypes.NewHeight(height.VersionNumber, height.VersionHeight-1)},
|
||||
clientState: &types.ClientState{LatestHeight: height, FrozenHeight: clienttypes.NewHeight(height.RevisionNumber, height.RevisionHeight-1)},
|
||||
consensusState: types.ConsensusState{
|
||||
Root: commitmenttypes.NewMerkleRoot(suite.header.Header.GetAppHash()),
|
||||
},
|
||||
|
|
|
@ -32,8 +32,8 @@ func (h Header) ClientType() string {
|
|||
// header is nil.
|
||||
// NOTE: the header.Header is checked to be non nil in ValidateBasic.
|
||||
func (h Header) GetHeight() exported.Height {
|
||||
version := clienttypes.ParseChainID(h.Header.ChainID)
|
||||
return clienttypes.NewHeight(version, uint64(h.Header.Height))
|
||||
revision := clienttypes.ParseChainID(h.Header.ChainID)
|
||||
return clienttypes.NewHeight(revision, uint64(h.Header.Height))
|
||||
}
|
||||
|
||||
// GetTime returns the current block timestamp. It returns a zero time if
|
||||
|
|
|
@ -60,11 +60,11 @@ func (misbehaviour Misbehaviour) ValidateBasic() error {
|
|||
if misbehaviour.Header2 == nil {
|
||||
return sdkerrors.Wrap(ErrInvalidHeader, "misbehaviour Header2 cannot be nil")
|
||||
}
|
||||
if misbehaviour.Header1.TrustedHeight.VersionHeight == 0 {
|
||||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header1 cannot have zero version height")
|
||||
if misbehaviour.Header1.TrustedHeight.RevisionHeight == 0 {
|
||||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header1 cannot have zero revision height")
|
||||
}
|
||||
if misbehaviour.Header2.TrustedHeight.VersionHeight == 0 {
|
||||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header2 cannot have zero version height")
|
||||
if misbehaviour.Header2.TrustedHeight.RevisionHeight == 0 {
|
||||
return sdkerrors.Wrapf(ErrInvalidHeaderHeight, "misbehaviour Header2 cannot have zero revision height")
|
||||
}
|
||||
if misbehaviour.Header1.TrustedValidators == nil {
|
||||
return sdkerrors.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header1 cannot be empty")
|
||||
|
|
|
@ -102,10 +102,10 @@ func checkMisbehaviourHeader(
|
|||
}
|
||||
|
||||
chainID := clientState.GetChainID()
|
||||
// If chainID is in version format, then set version number of chainID with the version number
|
||||
// If chainID is in revision format, then set revision number of chainID with the revision number
|
||||
// of the misbehaviour header
|
||||
if clienttypes.IsVersionFormat(chainID) {
|
||||
chainID, _ = clienttypes.SetVersionNumber(chainID, header.GetHeight().GetVersionNumber())
|
||||
if clienttypes.IsRevisionFormat(chainID) {
|
||||
chainID, _ = clienttypes.SetRevisionNumber(chainID, header.GetHeight().GetRevisionNumber())
|
||||
}
|
||||
|
||||
// - ValidatorSet must have TrustLevel similarity with trusted FromValidatorSet
|
||||
|
|
|
@ -35,8 +35,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
|
||||
altSigners := []tmtypes.PrivValidator{altPrivVal}
|
||||
|
||||
heightMinus1 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight-1)
|
||||
heightMinus3 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight-3)
|
||||
heightMinus1 := clienttypes.NewHeight(height.RevisionNumber, height.RevisionHeight-1)
|
||||
heightMinus3 := clienttypes.NewHeight(height.RevisionNumber, height.RevisionHeight-3)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
@ -57,8 +57,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -72,8 +72,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
heightMinus1,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -87,53 +87,53 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
heightMinus3,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid misbehaviour at a previous version",
|
||||
types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
"valid misbehaviour at a previous revision",
|
||||
types.NewClientState(chainIDRevision1, 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),
|
||||
heightMinus3,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainIDRevision0, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainIDRevision0, int64(height.RevisionHeight), heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid misbehaviour at a future version",
|
||||
types.NewClientState(chainIDVersion0, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
"valid misbehaviour at a future revision",
|
||||
types.NewClientState(chainIDRevision0, 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),
|
||||
heightMinus3,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainIDRevision0, 3, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainIDRevision0, 3, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid misbehaviour with trusted heights at a previous version",
|
||||
types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath, false, false),
|
||||
"valid misbehaviour with trusted heights at a previous revision",
|
||||
types.NewClientState(chainIDRevision1, 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),
|
||||
heightMinus3,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainIDRevision1, 1, heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainIDRevision1, 1, heightMinus3, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -147,8 +147,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
height,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -162,8 +162,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader("ethermint", int64(height.RevisionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -177,8 +177,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
heightMinus3,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -192,8 +192,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), suite.valsHash),
|
||||
heightMinus3,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus3, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -207,8 +207,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -222,8 +222,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -248,8 +248,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -263,8 +263,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
types.NewConsensusState(suite.now, commitmenttypes.NewMerkleRoot(tmhash.Sum([]byte("app_hash"))), bothValsHash),
|
||||
height,
|
||||
&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),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now.Add(trustingPeriod),
|
||||
|
@ -278,8 +278,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
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, suite.valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -293,8 +293,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
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, altValSet, bothValSet, altSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now, altValSet, bothValSet, altSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), bothValSet, bothValSet, bothSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -308,8 +308,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
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), altValSet, bothValSet, altSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now, bothValSet, bothValSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
@ -323,8 +323,8 @@ func (suite *TendermintTestSuite) TestCheckMisbehaviourAndUpdateState() {
|
|||
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, altValSet, bothValSet, altSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now, altValSet, bothValSet, altSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), height, suite.now.Add(time.Minute), altValSet, bothValSet, altSigners),
|
||||
ClientId: chainID,
|
||||
},
|
||||
suite.now,
|
||||
|
|
|
@ -16,11 +16,11 @@ import (
|
|||
|
||||
func (suite *TendermintTestSuite) TestMisbehaviour() {
|
||||
signers := []tmtypes.PrivValidator{suite.privVal}
|
||||
heightMinus1 := clienttypes.NewHeight(0, height.VersionHeight-1)
|
||||
heightMinus1 := clienttypes.NewHeight(0, height.RevisionHeight-1)
|
||||
|
||||
misbehaviour := &types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
ClientId: clientID,
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,9 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
altPubKey, err := altPrivVal.GetPubKey()
|
||||
suite.Require().NoError(err)
|
||||
|
||||
versionHeight := int64(height.VersionHeight)
|
||||
revisionHeight := int64(height.RevisionHeight)
|
||||
|
||||
altVal := tmtypes.NewValidator(altPubKey, versionHeight)
|
||||
altVal := tmtypes.NewValidator(altPubKey, revisionHeight)
|
||||
|
||||
// Create bothValSet with both suite validator and altVal
|
||||
bothValSet := tmtypes.NewValidatorSet(append(suite.valSet.Validators, altVal))
|
||||
|
@ -51,7 +51,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
|
||||
altSigners := []tmtypes.PrivValidator{altPrivVal}
|
||||
|
||||
heightMinus1 := clienttypes.NewHeight(0, height.VersionHeight-1)
|
||||
heightMinus1 := clienttypes.NewHeight(0, height.RevisionHeight-1)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
@ -63,7 +63,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"valid 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),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
|
@ -85,7 +85,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"valid misbehaviour with different trusted headers",
|
||||
&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),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.NewHeight(0, height.RevisionHeight-3), suite.now.Add(time.Minute), suite.valSet, bothValSet, signers),
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
|
@ -94,7 +94,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
{
|
||||
"trusted height is 0 in Header1",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
Header2: suite.header,
|
||||
ClientId: clientID,
|
||||
},
|
||||
|
@ -105,7 +105,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"trusted height is 0 in Header2",
|
||||
&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),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers),
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
|
@ -114,7 +114,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
{
|
||||
"trusted valset is nil in Header1",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers),
|
||||
Header2: suite.header,
|
||||
ClientId: clientID,
|
||||
},
|
||||
|
@ -125,7 +125,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"trusted valset is nil in Header2",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, nil, signers),
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
|
@ -135,7 +135,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"invalid client ID ",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
ClientId: "GAIA",
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
|
@ -145,7 +145,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"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),
|
||||
Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, signers),
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error { return nil },
|
||||
|
@ -174,19 +174,19 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
{
|
||||
"header 1 doesn't have 2/3 majority",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.header,
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error {
|
||||
// voteSet contains only altVal which is less than 2/3 of total power (height/1height)
|
||||
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight().GetVersionHeight()), 1, tmproto.PrecommitType, altValSet)
|
||||
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight().GetRevisionHeight()), 1, tmproto.PrecommitType, altValSet)
|
||||
blockID, err := tmtypes.BlockIDFromProto(&misbehaviour.Header1.Commit.BlockID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight().GetVersionHeight()), misbehaviour.Header1.Commit.Round, wrongVoteSet, altSigners, suite.now)
|
||||
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight().GetRevisionHeight()), misbehaviour.Header1.Commit.Round, wrongVoteSet, altSigners, suite.now)
|
||||
misbehaviour.Header1.Commit = tmCommit.ToProto()
|
||||
return err
|
||||
},
|
||||
|
@ -196,18 +196,18 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"header 2 doesn't have 2/3 majority",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error {
|
||||
// voteSet contains only altVal which is less than 2/3 of total power (height/1height)
|
||||
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight().GetVersionHeight()), 1, tmproto.PrecommitType, altValSet)
|
||||
wrongVoteSet := tmtypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight().GetRevisionHeight()), 1, tmproto.PrecommitType, altValSet)
|
||||
blockID, err := tmtypes.BlockIDFromProto(&misbehaviour.Header2.Commit.BlockID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight().GetVersionHeight()), misbehaviour.Header2.Commit.Round, wrongVoteSet, altSigners, suite.now)
|
||||
tmCommit, err := tmtypes.MakeCommit(*blockID, int64(misbehaviour.Header2.GetHeight().GetRevisionHeight()), misbehaviour.Header2.Commit.Round, wrongVoteSet, altSigners, suite.now)
|
||||
misbehaviour.Header2.Commit = tmCommit.ToProto()
|
||||
return err
|
||||
},
|
||||
|
@ -217,7 +217,7 @@ func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
|
|||
"validators sign off on wrong commit",
|
||||
&types.Misbehaviour{
|
||||
Header1: suite.header,
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, suite.valSet, bothSigners),
|
||||
ClientId: clientID,
|
||||
},
|
||||
func(misbehaviour *types.Misbehaviour) error {
|
||||
|
|
|
@ -19,13 +19,13 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
chainID = "gaia"
|
||||
chainIDVersion0 = "gaia-version-0"
|
||||
chainIDVersion1 = "gaia-version-1"
|
||||
clientID = "gaiamainnet"
|
||||
trustingPeriod time.Duration = time.Hour * 24 * 7 * 2
|
||||
ubdPeriod time.Duration = time.Hour * 24 * 7 * 3
|
||||
maxClockDrift time.Duration = time.Second * 10
|
||||
chainID = "gaia"
|
||||
chainIDRevision0 = "gaia-revision-0"
|
||||
chainIDRevision1 = "gaia-revision-1"
|
||||
clientID = "gaiamainnet"
|
||||
trustingPeriod time.Duration = time.Hour * 24 * 7 * 2
|
||||
ubdPeriod time.Duration = time.Hour * 24 * 7 * 3
|
||||
maxClockDrift time.Duration = time.Second * 10
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -81,12 +81,12 @@ func (suite *TendermintTestSuite) SetupTest() {
|
|||
pubKey, err := suite.privVal.GetPubKey()
|
||||
suite.Require().NoError(err)
|
||||
|
||||
heightMinus1 := clienttypes.NewHeight(0, height.VersionHeight-1)
|
||||
heightMinus1 := clienttypes.NewHeight(0, height.RevisionHeight-1)
|
||||
|
||||
val := tmtypes.NewValidator(pubKey, 10)
|
||||
suite.valSet = tmtypes.NewValidatorSet([]*tmtypes.Validator{val})
|
||||
suite.valsHash = suite.valSet.Hash()
|
||||
suite.header = suite.chainA.CreateTMClientHeader(chainID, int64(height.VersionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
suite.header = suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, []tmtypes.PrivValidator{suite.privVal})
|
||||
suite.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 1, Time: suite.now})
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
// - the client or header provided are not parseable to tendermint types
|
||||
// - the header is invalid
|
||||
// - header height is less than or equal to the trusted header height
|
||||
// - header version is not equal to trusted header version
|
||||
// - header revision is not equal to trusted header revision
|
||||
// - header valset commit verification fails
|
||||
// - header timestamp is past the trusting period in relation to the consensus state
|
||||
// - header timestamp is less than or equal to the consensus state timestamp
|
||||
|
@ -33,8 +33,8 @@ import (
|
|||
// If we are updating to a past height, a consensus state is created for that height to be persisted in client store
|
||||
// If we are updating to a future height, the consensus state is created and the client state is updated to reflect
|
||||
// the new latest height
|
||||
// UpdateClient must only be used to update within a single version, thus header version number and trusted height's version
|
||||
// number must be the same. To update to a new version, use a separate upgrade path
|
||||
// UpdateClient must only be used to update within a single revision, thus header revision number and trusted height's revision
|
||||
// number must be the same. To update to a new revision, use a separate upgrade path
|
||||
// Tendermint client validity checking uses the bisection algorithm described
|
||||
// in the [Tendermint spec](https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md).
|
||||
func (cs ClientState) CheckHeaderAndUpdateState(
|
||||
|
@ -94,13 +94,13 @@ func checkValidity(
|
|||
return err
|
||||
}
|
||||
|
||||
// UpdateClient only accepts updates with a header at the same version
|
||||
// UpdateClient only accepts updates with a header at the same revision
|
||||
// as the trusted consensus state
|
||||
if header.GetHeight().GetVersionNumber() != header.TrustedHeight.VersionNumber {
|
||||
if header.GetHeight().GetRevisionNumber() != header.TrustedHeight.RevisionNumber {
|
||||
return sdkerrors.Wrapf(
|
||||
ErrInvalidHeaderHeight,
|
||||
"header height version %d does not match trusted header version %d",
|
||||
header.GetHeight().GetVersionNumber(), header.TrustedHeight.VersionNumber,
|
||||
"header height revision %d does not match trusted header revision %d",
|
||||
header.GetHeight().GetRevisionNumber(), header.TrustedHeight.RevisionNumber,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -128,21 +128,21 @@ func checkValidity(
|
|||
}
|
||||
|
||||
chainID := clientState.GetChainID()
|
||||
// If chainID is in version format, then set version number of chainID with the version number
|
||||
// If chainID is in revision format, then set revision number of chainID with the revision number
|
||||
// of the header we are verifying
|
||||
// This is useful if the update is at a previous version rather than an update to the latest version
|
||||
// This is useful if the update is at a previous revision rather than an update to the latest revision
|
||||
// of the client.
|
||||
// The chainID must be set correctly for the previous version before attempting verification.
|
||||
// Updates for previous versions are not supported if the chainID is not in version format.
|
||||
if clienttypes.IsVersionFormat(chainID) {
|
||||
chainID, _ = clienttypes.SetVersionNumber(chainID, header.GetHeight().GetVersionNumber())
|
||||
// The chainID must be set correctly for the previous revision before attempting verification.
|
||||
// Updates for previous revisions are not supported if the chainID is not in revision format.
|
||||
if clienttypes.IsRevisionFormat(chainID) {
|
||||
chainID, _ = clienttypes.SetRevisionNumber(chainID, header.GetHeight().GetRevisionNumber())
|
||||
}
|
||||
|
||||
// Construct a trusted header using the fields in consensus state
|
||||
// Only Height, Time, and NextValidatorsHash are necessary for verification
|
||||
trustedHeader := tmtypes.Header{
|
||||
ChainID: chainID,
|
||||
Height: int64(header.TrustedHeight.VersionHeight),
|
||||
Height: int64(header.TrustedHeight.RevisionHeight),
|
||||
Time: consState.Timestamp,
|
||||
NextValidatorsHash: consState.NextValidatorsHash,
|
||||
}
|
||||
|
|
|
@ -26,15 +26,15 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
|||
altPubKey, err := altPrivVal.GetPubKey()
|
||||
suite.Require().NoError(err)
|
||||
|
||||
versionHeight := int64(height.VersionHeight)
|
||||
revisionHeight := int64(height.RevisionHeight)
|
||||
|
||||
// create modified heights to use for test-cases
|
||||
heightPlus1 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight+1)
|
||||
heightMinus1 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight-1)
|
||||
heightMinus3 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight-3)
|
||||
heightPlus5 := clienttypes.NewHeight(height.VersionNumber, height.VersionHeight+5)
|
||||
heightPlus1 := clienttypes.NewHeight(height.RevisionNumber, height.RevisionHeight+1)
|
||||
heightMinus1 := clienttypes.NewHeight(height.RevisionNumber, height.RevisionHeight-1)
|
||||
heightMinus3 := clienttypes.NewHeight(height.RevisionNumber, height.RevisionHeight-3)
|
||||
heightPlus5 := clienttypes.NewHeight(height.RevisionNumber, height.RevisionHeight+5)
|
||||
|
||||
altVal := tmtypes.NewValidator(altPubKey, versionHeight)
|
||||
altVal := tmtypes.NewValidator(altPubKey, revisionHeight)
|
||||
|
||||
// Create bothValSet with both suite validator and altVal. Would be valid update
|
||||
bothValSet := tmtypes.NewValidatorSet(append(suite.valSet.Validators, altVal))
|
||||
|
@ -57,9 +57,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: true,
|
||||
|
@ -67,9 +67,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: true,
|
||||
|
@ -77,9 +77,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, bothValSet, bothValSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: true,
|
||||
|
@ -87,20 +87,20 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
|||
{
|
||||
name: "successful update for a previous height",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightMinus1.RevisionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: true,
|
||||
},
|
||||
{
|
||||
name: "successful update for a previous version",
|
||||
name: "successful update for a previous revision",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainIDRevision1, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainIDRevision0, int64(height.RevisionHeight), heightMinus3, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: true,
|
||||
|
@ -108,29 +108,29 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
|||
{
|
||||
name: "unsuccessful update with incorrect header chain-id",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader("ethermint", int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "unsuccessful update to a future version",
|
||||
name: "unsuccessful update to a future revision",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainIDVersion0, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainIDRevision0, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainIDRevision1, 1, height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "unsuccessful update: header height version and trusted height version mismatch",
|
||||
name: "unsuccessful update: header height revision and trusted height revision mismatch",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainIDVersion1, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainIDRevision1, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainIDRevision1, 3, height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -138,9 +138,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, bothValSet, suite.valSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -148,9 +148,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, bothValSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -158,9 +158,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, altValSet, suite.valSet, altSigners)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -168,9 +168,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus5.RevisionHeight), height, suite.headerTime, bothValSet, bothValSet, bothSigners)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -178,9 +178,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
// make current time pass trusting period from last timestamp on clientstate
|
||||
currentTime = suite.now.Add(trustingPeriod)
|
||||
},
|
||||
|
@ -189,9 +189,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.now.Add(time.Minute), suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -199,9 +199,9 @@ 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, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.clientTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -209,11 +209,11 @@ func (suite *TendermintTestSuite) TestCheckHeaderAndUpdateState() {
|
|||
{
|
||||
name: "header basic validation failed",
|
||||
setup: func() {
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightPlus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
// cause new header to fail validatebasic by changing commit height to mismatch header height
|
||||
newHeader.SignedHeader.Commit.Height = versionHeight - 1
|
||||
newHeader.SignedHeader.Commit.Height = revisionHeight - 1
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
@ -221,10 +221,10 @@ 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), commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
clientState = types.NewClientState(chainID, types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(height.RevisionNumber, heightPlus5.RevisionHeight), 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)
|
||||
newHeader = suite.chainA.CreateTMClientHeader(chainID, int64(heightMinus1.RevisionHeight), height, suite.headerTime, suite.valSet, suite.valSet, signers)
|
||||
currentTime = suite.now
|
||||
},
|
||||
expPass: false,
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
// 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
|
||||
// - the lastest height of the client state does not have the same revision 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 or is greater than the height in committed client
|
||||
|
@ -35,8 +35,8 @@ func (cs ClientState) VerifyUpgradeAndUpdateState(
|
|||
// last height of current counterparty chain must be client's latest height
|
||||
lastHeight := cs.GetLatestHeight()
|
||||
|
||||
if upgradedClient.GetLatestHeight().GetVersionNumber() <= lastHeight.GetVersionNumber() {
|
||||
return nil, nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "upgraded client height %s must be at greater version than current client height %s",
|
||||
if upgradedClient.GetLatestHeight().GetRevisionNumber() <= lastHeight.GetRevisionNumber() {
|
||||
return nil, nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "upgraded client height %s must be at greater revision than current client height %s",
|
||||
upgradedClient.GetLatestHeight(), lastHeight)
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ func (cs ClientState) VerifyUpgradeAndUpdateState(
|
|||
}
|
||||
|
||||
// Must prove against latest consensus state to ensure we are verifying against latest upgrade plan
|
||||
// This verifies that upgrade is intended for the provided version, since committed client must exist
|
||||
// This verifies that upgrade is intended for the provided revision, since committed client must exist
|
||||
// at this consensus state
|
||||
consState, err := GetConsensusState(clientStore, cdc, lastHeight)
|
||||
if err != nil {
|
||||
|
@ -132,7 +132,7 @@ func constructUpgradeClientMerklePath(upgradePath []string, lastHeight exported.
|
|||
// append lastHeight and `upgradedClient` to last key of upgradePath and use as lastKey of clientPath
|
||||
// this will create the IAVL key that is used to store client in upgrade store
|
||||
lastKey := upgradePath[len(upgradePath)-1]
|
||||
appendedKey := fmt.Sprintf("%s/%d/%s", lastKey, lastHeight.GetVersionHeight(), upgradetypes.KeyUpgradedClient)
|
||||
appendedKey := fmt.Sprintf("%s/%d/%s", lastKey, lastHeight.GetRevisionHeight(), upgradetypes.KeyUpgradedClient)
|
||||
|
||||
clientPath = append(clientPath, appendedKey)
|
||||
return commitmenttypes.NewMerklePath(clientPath...)
|
||||
|
@ -147,7 +147,7 @@ func constructUpgradeConsStateMerklePath(upgradePath []string, lastHeight export
|
|||
// append lastHeight and `upgradedClient` to last key of upgradePath and use as lastKey of clientPath
|
||||
// this will create the IAVL key that is used to store client in upgrade store
|
||||
lastKey := upgradePath[len(upgradePath)-1]
|
||||
appendedKey := fmt.Sprintf("%s/%d/%s", lastKey, lastHeight.GetVersionHeight(), upgradetypes.KeyUpgradedConsState)
|
||||
appendedKey := fmt.Sprintf("%s/%d/%s", lastKey, lastHeight.GetRevisionHeight(), upgradetypes.KeyUpgradedConsState)
|
||||
|
||||
consPath = append(consPath, appendedKey)
|
||||
return commitmenttypes.NewMerklePath(consPath...)
|
||||
|
|
|
@ -35,8 +35,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -47,13 +47,13 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: true,
|
||||
},
|
||||
{
|
||||
name: "unsuccessful upgrade: upgrade height version height is more than the current client version height",
|
||||
name: "unsuccessful upgrade: upgrade height revision height is more than the current client revision height",
|
||||
setup: func() {
|
||||
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, false, false)
|
||||
|
@ -65,8 +65,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = clienttypes.NewHeight(10, uint64(suite.chainB.GetContext().BlockHeight()+10))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -77,8 +77,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -95,8 +95,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = types.NewClientState("wrongchainID", types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath, true, true)
|
||||
|
@ -108,8 +108,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -123,8 +123,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
}
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// change upgradedClient client-specified parameters
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, lastHeight, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
|
@ -136,8 +136,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -154,8 +154,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// change submitted upgradedConsensusState
|
||||
upgradedConsState = &types.ConsensusState{
|
||||
|
@ -171,8 +171,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -183,12 +183,12 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
upgradedConsState = &types.ConsensusState{
|
||||
NextValidatorsHash: []byte("nextValsHash"),
|
||||
}
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
proofUpgradedClient = []byte("proof")
|
||||
},
|
||||
|
@ -202,12 +202,12 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
NextValidatorsHash: []byte("nextValsHash"),
|
||||
}
|
||||
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
proofUpgradedConsState = []byte("proof")
|
||||
},
|
||||
|
@ -225,13 +225,13 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
// upgrade Height is at next block
|
||||
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -247,13 +247,13 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
// upgrade Height is at next block
|
||||
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
|
||||
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -270,7 +270,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -281,8 +281,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
|
||||
// SetClientState with empty upgrade path
|
||||
tmClient, _ := cs.(*types.ClientState)
|
||||
|
@ -304,7 +304,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -315,8 +315,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -333,7 +333,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+100))
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -344,8 +344,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -359,7 +359,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
}
|
||||
|
||||
// zero custom fields and store in upgrade store
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -373,8 +373,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -391,7 +391,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -402,8 +402,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
@ -421,8 +421,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
lastHeight = 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(lastHeight.GetVersionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetVersionHeight()), upgradedConsState)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClient)
|
||||
suite.chainB.App.UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsState)
|
||||
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
|
@ -433,8 +433,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
|||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
suite.Require().True(found)
|
||||
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetVersionHeight())), cs.GetLatestHeight().GetVersionHeight())
|
||||
proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight())
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
|
|
@ -58,8 +58,8 @@ func (cs ClientState) Validate() error {
|
|||
if strings.TrimSpace(cs.ChainId) == "" {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidChainID, "chain id cannot be blank")
|
||||
}
|
||||
if cs.Height.VersionHeight == 0 {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "local version height cannot be zero")
|
||||
if cs.Height.RevisionHeight == 0 {
|
||||
return sdkerrors.Wrapf(sdkerrors.ErrInvalidHeight, "local revision height cannot be zero")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ func (cs *ClientState) CheckHeaderAndUpdateState(
|
|||
) (exported.ClientState, exported.ConsensusState, error) {
|
||||
// use the chain ID from context since the localhost client is from the running chain (i.e self).
|
||||
cs.ChainId = ctx.ChainID()
|
||||
version := clienttypes.ParseChainID(cs.ChainId)
|
||||
cs.Height = clienttypes.NewHeight(version, uint64(ctx.BlockHeight()))
|
||||
revision := clienttypes.ParseChainID(cs.ChainId)
|
||||
cs.Height = clienttypes.NewHeight(revision, uint64(ctx.BlockHeight()))
|
||||
return cs, nil, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -123,8 +123,8 @@ func (suite *LocalhostTestSuite) TestCheckHeaderAndUpdateState() {
|
|||
clientState := types.NewClientState("chainID", clientHeight)
|
||||
cs, _, err := clientState.CheckHeaderAndUpdateState(suite.ctx, nil, nil, nil)
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().Equal(uint64(0), cs.GetLatestHeight().GetVersionNumber())
|
||||
suite.Require().Equal(suite.ctx.BlockHeight(), int64(cs.GetLatestHeight().GetVersionHeight()))
|
||||
suite.Require().Equal(uint64(0), cs.GetLatestHeight().GetRevisionNumber())
|
||||
suite.Require().Equal(suite.ctx.BlockHeight(), int64(cs.GetLatestHeight().GetRevisionHeight()))
|
||||
suite.Require().Equal(suite.ctx.BlockHeader().ChainID, clientState.ChainId)
|
||||
}
|
||||
|
||||
|
|
|
@ -187,12 +187,12 @@ func (chain *TestChain) QueryProof(key []byte) ([]byte, clienttypes.Height) {
|
|||
proof, err := chain.App.AppCodec().MarshalBinaryBare(&merkleProof)
|
||||
require.NoError(chain.t, err)
|
||||
|
||||
version := clienttypes.ParseChainID(chain.ChainID)
|
||||
revision := clienttypes.ParseChainID(chain.ChainID)
|
||||
|
||||
// proof height + 1 is returned as the proof created corresponds to the height the proof
|
||||
// was created in the IAVL tree. Tendermint and subsequently the clients that rely on it
|
||||
// have heights 1 above the IAVL tree. Thus we return proof height + 1
|
||||
return proof, clienttypes.NewHeight(version, uint64(res.Height)+1)
|
||||
return proof, clienttypes.NewHeight(revision, uint64(res.Height)+1)
|
||||
}
|
||||
|
||||
// QueryUpgradeProof performs an abci query with the given key and returns the proto encoded merkle proof
|
||||
|
@ -211,12 +211,12 @@ func (chain *TestChain) QueryUpgradeProof(key []byte, height uint64) ([]byte, cl
|
|||
proof, err := chain.App.AppCodec().MarshalBinaryBare(&merkleProof)
|
||||
require.NoError(chain.t, err)
|
||||
|
||||
version := clienttypes.ParseChainID(chain.ChainID)
|
||||
revision := clienttypes.ParseChainID(chain.ChainID)
|
||||
|
||||
// proof height + 1 is returned as the proof created corresponds to the height the proof
|
||||
// was created in the IAVL tree. Tendermint and subsequently the clients that rely on it
|
||||
// have heights 1 above the IAVL tree. Thus we return proof height + 1
|
||||
return proof, clienttypes.NewHeight(version, uint64(res.Height+1))
|
||||
return proof, clienttypes.NewHeight(revision, uint64(res.Height+1))
|
||||
}
|
||||
|
||||
// QueryClientStateProof performs and abci query for a client state
|
||||
|
@ -510,13 +510,13 @@ func (chain *TestChain) ConstructUpdateTMClientHeader(counterparty *TestChain, c
|
|||
// since the last trusted validators for a header at height h
|
||||
// is the NextValidators at h+1 committed to in header h by
|
||||
// NextValidatorsHash
|
||||
tmTrustedVals, ok = counterparty.GetValsAtHeight(int64(trustedHeight.VersionHeight + 1))
|
||||
tmTrustedVals, ok = counterparty.GetValsAtHeight(int64(trustedHeight.RevisionHeight + 1))
|
||||
if !ok {
|
||||
return nil, sdkerrors.Wrapf(ibctmtypes.ErrInvalidHeaderHeight, "could not retrieve trusted validators at trustedHeight: %d", trustedHeight)
|
||||
}
|
||||
}
|
||||
// inject trusted fields into last header
|
||||
// for now assume version number is 0
|
||||
// for now assume revision number is 0
|
||||
header.TrustedHeight = trustedHeight
|
||||
|
||||
trustedVals, err := tmTrustedVals.ToProto()
|
||||
|
|
|
@ -102,7 +102,7 @@ func (solo *Solomachine) ConsensusState() *solomachinetypes.ConsensusState {
|
|||
}
|
||||
}
|
||||
|
||||
// GetHeight returns an exported.Height with Sequence as VersionHeight
|
||||
// GetHeight returns an exported.Height with Sequence as RevisionHeight
|
||||
func (solo *Solomachine) GetHeight() exported.Height {
|
||||
return clienttypes.NewHeight(0, solo.Sequence)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue