@@ -10,6 +10,10 @@ import (
10
10
ibctesting "github.com/cosmos/ibc-go/testing"
11
11
)
12
12
13
+ var (
14
+ newChainId = "newChainId-1"
15
+ )
16
+
13
17
func (suite * TendermintTestSuite ) TestVerifyUpgrade () {
14
18
var (
15
19
upgradedClient exported.ClientState
@@ -54,6 +58,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
54
58
name : "successful upgrade to same revision" ,
55
59
setup : func () {
56
60
upgradedHeight := clienttypes .NewHeight (0 , uint64 (suite .chainB .GetContext ().BlockHeight ()+ 2 ))
61
+ // don't use -1 suffix in chain id
57
62
upgradedClient = types .NewClientState ("newChainId" , types .DefaultTrustLevel , trustingPeriod , ubdPeriod + trustingPeriod , maxClockDrift , upgradedHeight , commitmenttypes .GetSDKSpecs (), upgradePath , false , false )
58
63
upgradedClient = upgradedClient .ZeroCustomFields ()
59
64
upgradedClientBz , err = clienttypes .MarshalClientState (suite .chainA .App .AppCodec (), upgradedClient )
@@ -109,7 +114,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
109
114
name : "unsuccessful upgrade: committed client does not have zeroed custom fields" ,
110
115
setup : func () {
111
116
// non-zeroed upgrade client
112
- upgradedClient = types .NewClientState (" newChainId" , types .DefaultTrustLevel , trustingPeriod , ubdPeriod + trustingPeriod , maxClockDrift , newClientHeight , commitmenttypes .GetSDKSpecs (), upgradePath , false , false )
117
+ upgradedClient = types .NewClientState (newChainId , types .DefaultTrustLevel , trustingPeriod , ubdPeriod + trustingPeriod , maxClockDrift , newClientHeight , commitmenttypes .GetSDKSpecs (), upgradePath , false , false )
113
118
upgradedClientBz , err = clienttypes .MarshalClientState (suite .chainA .App .AppCodec (), upgradedClient )
114
119
suite .Require ().NoError (err )
115
120
@@ -167,7 +172,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
167
172
suite .chainB .GetSimApp ().UpgradeKeeper .SetUpgradedConsensusState (suite .chainB .GetContext (), int64 (lastHeight .GetRevisionHeight ()), upgradedConsStateBz )
168
173
169
174
// change upgradedClient client-specified parameters
170
- upgradedClient = types .NewClientState (" newChainId" , types .DefaultTrustLevel , ubdPeriod , ubdPeriod + trustingPeriod , maxClockDrift + 5 , lastHeight , commitmenttypes .GetSDKSpecs (), upgradePath , true , false )
175
+ upgradedClient = types .NewClientState (newChainId , types .DefaultTrustLevel , ubdPeriod , ubdPeriod + trustingPeriod , maxClockDrift + 5 , lastHeight , commitmenttypes .GetSDKSpecs (), upgradePath , true , false )
171
176
172
177
suite .coordinator .CommitBlock (suite .chainB )
173
178
err := path .EndpointA .UpdateClient ()
@@ -398,7 +403,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
398
403
name : "unsuccessful upgrade: final client is not valid" ,
399
404
setup : func () {
400
405
// new client has smaller unbonding period such that old trusting period is no longer valid
401
- upgradedClient = types .NewClientState (" newChainId" , types .DefaultTrustLevel , trustingPeriod , trustingPeriod , maxClockDrift , newClientHeight , commitmenttypes .GetSDKSpecs (), upgradePath , false , false )
406
+ upgradedClient = types .NewClientState (newChainId , types .DefaultTrustLevel , trustingPeriod , trustingPeriod , maxClockDrift , newClientHeight , commitmenttypes .GetSDKSpecs (), upgradePath , false , false )
402
407
upgradedClientBz , err = clienttypes .MarshalClientState (suite .chainA .App .AppCodec (), upgradedClient )
403
408
suite .Require ().NoError (err )
404
409
@@ -433,7 +438,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
433
438
path = ibctesting .NewPath (suite .chainA , suite .chainB )
434
439
435
440
suite .coordinator .SetupClients (path )
436
- upgradedClient = types .NewClientState (" newChainId" , types .DefaultTrustLevel , trustingPeriod , ubdPeriod + trustingPeriod , maxClockDrift , newClientHeight , commitmenttypes .GetSDKSpecs (), upgradePath , false , false )
441
+ upgradedClient = types .NewClientState (newChainId , types .DefaultTrustLevel , trustingPeriod , ubdPeriod + trustingPeriod , maxClockDrift , newClientHeight , commitmenttypes .GetSDKSpecs (), upgradePath , false , false )
437
442
upgradedClient = upgradedClient .ZeroCustomFields ()
438
443
upgradedClientBz , err = clienttypes .MarshalClientState (suite .chainA .App .AppCodec (), upgradedClient )
439
444
suite .Require ().NoError (err )
0 commit comments