Skip to content

Commit

Permalink
fix(baseapp)!: Halt at height now does not produce the halt height bl…
Browse files Browse the repository at this point in the history
…ock (backport #21256) (#21323)

Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
Co-authored-by: Facundo <facundomedica@gmail.com>
  • Loading branch information
3 people authored Aug 16, 2024
1 parent 2f49e9e commit 624fe4a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (cli) [#20779](https://github.com/cosmos/cosmos-sdk/pull/20779) Added `module-hash-by-height` command to query and retrieve module hashes at a specified blockchain height, enhancing debugging capabilities.

### 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.

## [v0.50.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.9) - 2024-08-07

## Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,10 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (res *abci.Res
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
}

Expand Down
8 changes: 5 additions & 3 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1988,9 +1988,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},
}

Expand Down

0 comments on commit 624fe4a

Please sign in to comment.