diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b3eb5d26e5e..db41a1eda64a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,9 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### Bug Fixes +* (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. + + ### API Breaking Changes ## [v0.52.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0) - 2024-XX-XX diff --git a/baseapp/abci.go b/baseapp/abci.go index d2d87a5cf562..49470e0af771 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -914,10 +914,10 @@ func (app *BaseApp) FinalizeBlock(req *abci.FinalizeBlockRequest) (res *abci.Fin func (app *BaseApp) checkHalt(height int64, time time.Time) error { var halt bool switch { - case app.haltHeight > 0 && uint64(height) > app.haltHeight: + case app.haltHeight > 0 && uint64(height) >= app.haltHeight: halt = true - case app.haltTime > 0 && time.Unix() > int64(app.haltTime): + case app.haltTime > 0 && time.Unix() >= int64(app.haltTime): halt = true } diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index b7fb67fad216..43b2c06d550e 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -2257,9 +2257,11 @@ func TestABCI_HaltChain(t *testing.T) { expHalt bool }{ {"default", 0, 0, 10, 0, false}, - {"halt-height-edge", 10, 0, 10, 0, false}, - {"halt-height", 10, 0, 11, 0, true}, - {"halt-time-edge", 0, 10, 1, 10, false}, + {"halt-height-edge", 11, 0, 10, 0, false}, + {"halt-height-equal", 10, 0, 10, 0, true}, + {"halt-height", 10, 0, 10, 0, true}, + {"halt-time-edge", 0, 11, 1, 10, false}, + {"halt-time-equal", 0, 10, 1, 10, true}, {"halt-time", 0, 10, 1, 11, true}, }