Skip to content

Commit b99ca2c

Browse files
mergify[bot]damiannolanjulienrbrttac0turtle
authored
fix: correctly assign execModeSimulate to context for simulateTx (backport #20342) (#20346)
Co-authored-by: Damian Nolan <damiannolan@gmail.com> Co-authored-by: Julien Robert <julien@rbrt.fr> Co-authored-by: marbar3778 <marbar3778@yahoo.com>
1 parent 83747c5 commit b99ca2c

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4646

4747
### Bug Fixes
4848

49+
* (baseapp) [#20346](https://github.com/cosmos/cosmos-sdk/pull/20346) Correctly assign `execModeSimulate` to context for `simulateTx`.
4950
* (baseapp) [#20144](https://github.com/cosmos/cosmos-sdk/pull/20144) Remove txs from mempool when antehandler fails in recheck.
5051
* (baseapp) [#20107](https://github.com/cosmos/cosmos-sdk/pull/20107) Avoid header height overwrite block height.
5152
* (cli) [#20020](https://github.com/cosmos/cosmos-sdk/pull/20020) Make bootstrap-state command support both new and legacy genesis format.

baseapp/abci_utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"slices"
7+
"slices" //nolint: gci // ignore this line for this linter
88

99
"github.com/cockroachdb/errors"
1010
abci "github.com/cometbft/cometbft/abci/types"
1111
cryptoenc "github.com/cometbft/cometbft/crypto/encoding"
1212
cmtprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto"
1313
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
1414
protoio "github.com/cosmos/gogoproto/io"
15-
"github.com/cosmos/gogoproto/proto"
15+
"github.com/cosmos/gogoproto/proto" //nolint: gci // ignore this line for this linter
1616

1717
"cosmossdk.io/core/comet"
1818

baseapp/baseapp.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ func (app *BaseApp) getContextForTx(mode execMode, txBytes []byte) sdk.Context {
675675

676676
if mode == execModeSimulate {
677677
ctx, _ = ctx.CacheContext()
678+
ctx = ctx.WithExecMode(sdk.ExecMode(execModeSimulate))
678679
}
679680

680681
return ctx
@@ -719,7 +720,7 @@ func (app *BaseApp) preBlock(req *abci.RequestFinalizeBlock) error {
719720
return nil
720721
}
721722

722-
func (app *BaseApp) beginBlock(req *abci.RequestFinalizeBlock) (sdk.BeginBlock, error) {
723+
func (app *BaseApp) beginBlock(_ *abci.RequestFinalizeBlock) (sdk.BeginBlock, error) {
723724
var (
724725
resp sdk.BeginBlock
725726
err error
@@ -784,7 +785,7 @@ func (app *BaseApp) deliverTx(tx []byte) *abci.ExecTxResult {
784785

785786
// endBlock is an application-defined function that is called after transactions
786787
// have been processed in FinalizeBlock.
787-
func (app *BaseApp) endBlock(ctx context.Context) (sdk.EndBlock, error) {
788+
func (app *BaseApp) endBlock(_ context.Context) (sdk.EndBlock, error) {
788789
var endblock sdk.EndBlock
789790

790791
if app.endBlocker != nil {

0 commit comments

Comments
 (0)