Skip to content

Commit e2ec889

Browse files
fix(baseapp)!: Halt at height now does not produce the halt height block (#21256)
1 parent b01d5a0 commit e2ec889

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
4848

4949
### Bug Fixes
5050

51+
* (baseapp) [#21256](https://github.com/cosmos/cosmos-sdk/pull/21256) Halt height will not commit the block indicated, meaning that if halt-height is set to 10, only blocks until 9 (included) will be committed. This is to go back to the original behavior before a change was introduced in v0.50.0.
52+
53+
5154
### API Breaking Changes
5255

5356
## [v0.52.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0) - 2024-XX-XX

baseapp/abci.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,10 +914,10 @@ func (app *BaseApp) FinalizeBlock(req *abci.FinalizeBlockRequest) (res *abci.Fin
914914
func (app *BaseApp) checkHalt(height int64, time time.Time) error {
915915
var halt bool
916916
switch {
917-
case app.haltHeight > 0 && uint64(height) > app.haltHeight:
917+
case app.haltHeight > 0 && uint64(height) >= app.haltHeight:
918918
halt = true
919919

920-
case app.haltTime > 0 && time.Unix() > int64(app.haltTime):
920+
case app.haltTime > 0 && time.Unix() >= int64(app.haltTime):
921921
halt = true
922922
}
923923

baseapp/abci_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,9 +2257,11 @@ func TestABCI_HaltChain(t *testing.T) {
22572257
expHalt bool
22582258
}{
22592259
{"default", 0, 0, 10, 0, false},
2260-
{"halt-height-edge", 10, 0, 10, 0, false},
2261-
{"halt-height", 10, 0, 11, 0, true},
2262-
{"halt-time-edge", 0, 10, 1, 10, false},
2260+
{"halt-height-edge", 11, 0, 10, 0, false},
2261+
{"halt-height-equal", 10, 0, 10, 0, true},
2262+
{"halt-height", 10, 0, 10, 0, true},
2263+
{"halt-time-edge", 0, 11, 1, 10, false},
2264+
{"halt-time-equal", 0, 10, 1, 10, true},
22632265
{"halt-time", 0, 10, 1, 11, true},
22642266
}
22652267

0 commit comments

Comments
 (0)