@@ -97,8 +97,8 @@ func TestUpgradeProposalConfirmHeight(t *testing.T) {
9797 expectConfirmHeight uint64
9898 }{
9999 {uint64 (10 ), uint64 (0 ), false , uint64 (10 )},
100- {uint64 (10 ), uint64 (5 ), true , uint64 (0 )},
101- {uint64 (10 ), uint64 (10 ), true , uint64 (0 )},
100+ {uint64 (10 ), uint64 (5 ), false , uint64 (10 )},
101+ {uint64 (10 ), uint64 (10 ), false , uint64 (10 )},
102102 {uint64 (10 ), uint64 (11 ), false , uint64 (10 )},
103103 {uint64 (10 ), uint64 (15 ), false , uint64 (14 )},
104104 }
@@ -259,8 +259,8 @@ func (suite *UpgradeInfoStoreSuite) TestCheckUpgradeVote() {
259259 }{
260260 {0 , 10 , false },
261261 {0 , 1111 , false },
262- {10 , 11 , true },
263- {10 , 10 , true },
262+ {10 , 11 , false },
263+ {10 , 10 , false },
264264 {10 , 9 , false },
265265 }
266266
@@ -287,19 +287,25 @@ func (suite *UpgradeInfoStoreSuite) TestHandleUpgradeProposal() {
287287 expectHitError bool
288288 }{
289289 { // expect height is not zero but less than current height
290- expectHeight : 10 , currentHeight : 10 , claimReady : false , expectPanic : false , expect1stExecuteError : true ,
290+ expectHeight : 10 , currentHeight : 10 , claimReady : false , expectPanic : true , expect1stExecuteError : false ,
291291 },
292292 { // expect height is not zero but only greater than current height 1; and not claim ready
293- expectHeight : 11 , currentHeight : 10 , claimReady : false , expectPanic : true ,
293+ expectHeight : 21 , currentHeight : 20 , claimReady : false , expectPanic : true ,
294294 },
295295 { // expect height is not zero and greater than current height; but not claim ready
296- expectHeight : 12 , currentHeight : 10 , claimReady : false , expectPanic : true , expect1stExecuteError : false ,
296+ expectHeight : 32 , currentHeight : 30 , claimReady : false , expectPanic : true , expect1stExecuteError : false ,
297297 },
298298 { // everything's ok: expect height is not zero and greater than current height; and claim ready
299- expectHeight : 12 , currentHeight : 10 , claimReady : true , expectPanic : false , expect1stExecuteError : false , expectHitError : false ,
299+ expectHeight : 42 , currentHeight : 40 , claimReady : true , expectPanic : false , expect1stExecuteError : false , expectHitError : false ,
300300 },
301301 { // everything's ok: expect height is zero and claim ready
302- expectHeight : 0 , currentHeight : 10 , claimReady : true , expectPanic : false , expect1stExecuteError : false , expectHitError : false ,
302+ expectHeight : 0 , currentHeight : 50 , claimReady : true , expectPanic : false , expect1stExecuteError : false , expectHitError : false ,
303+ },
304+ { // everything's ok: expect height is not zero and equal to current height; and claim ready
305+ expectHeight : 60 , currentHeight : 60 , claimReady : true , expectPanic : false , expect1stExecuteError : false , expectHitError : false ,
306+ },
307+ { // everything's ok: expect height is not zero and less than current height; and claim ready
308+ expectHeight : 70 , currentHeight : 72 , claimReady : true , expectPanic : false , expect1stExecuteError : false , expectHitError : false ,
303309 },
304310 }
305311
@@ -316,6 +322,9 @@ func (suite *UpgradeInfoStoreSuite) TestHandleUpgradeProposal() {
316322 if tt .expectHeight == 0 {
317323 confirmHeight = tt .currentHeight
318324 }
325+ if confirmHeight < tt .currentHeight {
326+ confirmHeight = tt .currentHeight
327+ }
319328 effectiveHeight := confirmHeight + 1
320329
321330 cbCount := 0
@@ -327,7 +336,7 @@ func (suite *UpgradeInfoStoreSuite) TestHandleUpgradeProposal() {
327336 })
328337 }
329338
330- if tt .expectPanic && confirmHeight = = tt .currentHeight {
339+ if tt .expectPanic && confirmHeight < = tt .currentHeight {
331340 suite .Panics (func () { _ = handler (ctx , proposal ) })
332341 continue
333342 }
@@ -339,8 +348,7 @@ func (suite *UpgradeInfoStoreSuite) TestHandleUpgradeProposal() {
339348 continue
340349 }
341350
342- suite .GreaterOrEqual (confirmHeight , tt .currentHeight )
343- if confirmHeight != tt .currentHeight {
351+ if confirmHeight > tt .currentHeight {
344352 // proposal is inserted to gov waiting queue, execute it
345353 expectInfo := types.UpgradeInfo {
346354 Name : upgradeProposal .Name ,
0 commit comments