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 (#21256)

(cherry picked from commit e2ec889)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
facundomedica authored and mergify[bot] committed Aug 16, 2024
1 parent 6833172 commit b9fda00
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ Ref: https://keepachangelog.com/en/1.0.0/

Every module contains its own CHANGELOG.md. Please refer to the module you are interested in.

<<<<<<< HEAD
=======
### Features

* (baseapp) [#20291](https://github.com/cosmos/cosmos-sdk/pull/20291) Simulate nested messages.

### Improvements

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

>>>>>>> e2ec889bb (fix(baseapp)!: Halt at height now does not produce the halt height block (#21256))
## [v0.52.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0) - 2024-XX-XX

Every module contains its own CHANGELOG.md. Please refer to the module you are interested in.
Expand Down
4 changes: 2 additions & 2 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

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

Please sign in to comment.