Skip to content

Commit

Permalink
fix: Set headerInfo in context on setState (#19338)
Browse files Browse the repository at this point in the history
(cherry picked from commit d353f11)

# Conflicts:
#	CHANGELOG.md
#	baseapp/baseapp.go
  • Loading branch information
facundomedica authored and mergify[bot] committed Feb 3, 2024
1 parent d2f9634 commit 50cb981
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

<<<<<<< HEAD
=======
* (baseapp) [#19338](https://github.com/cosmos/cosmos-sdk/pull/19338) Set HeaderInfo in context when calling `setState`.
* (x/staking) [#19226](https://github.com/cosmos/cosmos-sdk/pull/19226) Ensure `GetLastValidators` in `x/staking` does not return an error when `MaxValidators` exceeds total number of bonded validators.
* (baseapp) [#19198](https://github.com/cosmos/cosmos-sdk/pull/19198) Remove usage of pointers in logs in all OE goroutines.
* (baseapp) [#19177](https://github.com/cosmos/cosmos-sdk/pull/19177) Fix baseapp DefaultProposalHandler same-sender non-sequential sequence
* (baseapp) [#18727](https://github.com/cosmos/cosmos-sdk/pull/18727) Ensure that `BaseApp.Init` firstly returns any errors from a nil commit multistore instead of panicking on nil dereferencing and before sealing the app.
* (client) [#18622](https://github.com/cosmos/cosmos-sdk/pull/18622) Fixed a potential under/overflow from `uint64->int64` when computing gas fees as a LegacyDec.
* (client/keys) [#18562](https://github.com/cosmos/cosmos-sdk/pull/18562) `keys delete` won't terminate when a key is not found.
* (baseapp) [#18383](https://github.com/cosmos/cosmos-sdk/pull/18383) Fixed a data race inside BaseApp.getContext, found by end-to-end (e2e) tests.
* (client/server) [#18345](https://github.com/cosmos/cosmos-sdk/pull/18345) Consistently set viper prefix in client and server. It defaults for the binary name for both client and server.
* (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test.
* (simulation) [#18196](https://github.com/cosmos/cosmos-sdk/pull/18196) Fix the problem of `validator set is empty after InitGenesis` in simulation test.
* (baseapp) [#18551](https://github.com/cosmos/cosmos-sdk/pull/18551) Fix SelectTxForProposal the calculation method of tx bytes size is inconsistent with CometBFT
>>>>>>> d353f11b9 (fix: Set headerInfo in context on setState (#19338))
* (abci): [#19200](https://github.com/cosmos/cosmos-sdk/pull/19200) Ensure that sdk side ve math matches cometbft
* [#19106](https://github.com/cosmos/cosmos-sdk/pull/19106) Allow empty public keys when setting signatures. Public keys aren't needed for every transaction.
* (baseapp) [#19198](https://github.com/cosmos/cosmos-sdk/pull/19198) Remove usage of pointers in logs in all OE goroutines.
Expand Down
17 changes: 16 additions & 1 deletion baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"golang.org/x/exp/maps"
protov2 "google.golang.org/protobuf/proto"

"cosmossdk.io/core/header"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
"cosmossdk.io/store"
Expand Down Expand Up @@ -468,11 +469,25 @@ func (app *BaseApp) IsSealed() bool { return app.sealed }
// setState sets the BaseApp's state for the corresponding mode with a branched
// multi-store (i.e. a CacheMultiStore) and a new Context with the same
// multi-store branch, and provided header.
func (app *BaseApp) setState(mode execMode, header cmtproto.Header) {
func (app *BaseApp) setState(mode execMode, h cmtproto.Header) {
ms := app.cms.CacheMultiStore()
headerInfo := header.Info{

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of headerInfo is never used.
Height: h.Height,
Time: h.Time,
ChainID: h.ChainID,
AppHash: h.AppHash,
}
baseState := &state{
<<<<<<< HEAD

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / dependency-review

expected operand, found '<<'

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: unexpected <<, expected expression

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: unexpected <<, expected expression

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected <<, expected expression

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected <<, expected expression

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected <<, expected expression

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected <<, expected expression

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected <<, expected expression

Check failure on line 481 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected <<, expected expression
ms: ms,
ctx: sdk.NewContext(ms, header, false, app.logger).WithStreamingManager(app.streamingManager),

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected ) in composite literal; possibly missing comma or }

Check failure on line 483 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: unexpected ) in composite literal; possibly missing comma or }
=======
ms: ms,
ctx: sdk.NewContext(ms, false, app.logger).
WithStreamingManager(app.streamingManager).
WithBlockHeader(h).
WithHeaderInfo(headerInfo),
>>>>>>> d353f11b9 (fix: Set headerInfo in context on setState (#19338))

Check failure on line 490 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / dependency-review

illegal character U+0023 '#'

Check failure on line 490 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (03)

invalid character U+0023 '#'

Check failure on line 490 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (02)

invalid character U+0023 '#'

Check failure on line 490 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

invalid character U+0023 '#'

Check failure on line 490 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

invalid character U+0023 '#'

Check failure on line 490 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

invalid character U+0023 '#'

Check failure on line 490 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

invalid character U+0023 '#'
}

switch mode {

Check failure on line 493 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / dependency-review

missing ',' in composite literal

Check failure on line 493 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: non-declaration statement outside function body

Check failure on line 493 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: non-declaration statement outside function body

Check failure on line 493 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: non-declaration statement outside function body

Check failure on line 493 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: non-declaration statement outside function body

Check failure on line 493 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: non-declaration statement outside function body

Check failure on line 493 in baseapp/baseapp.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: non-declaration statement outside function body
Expand Down

0 comments on commit 50cb981

Please sign in to comment.