Skip to content

Commit

Permalink
fix: tx context gas meter is shared at the beginning
Browse files Browse the repository at this point in the history
ref: cosmos#19613

Before the ante handler set the gas meter using tx gas-wanted, the gas meter in
ctx remains a globally shared one, although it don't have bad effect right now,
but it's a race condition when executing in parallel.
  • Loading branch information
yihuang committed Mar 1, 2024
1 parent 3d59013 commit 6a5158f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ func (app *BaseApp) getContextForTx(mode execMode, txBytes []byte) sdk.Context {
panic(fmt.Sprintf("state is nil for mode %v", mode))
}
ctx := modeState.Context().
WithTxBytes(txBytes)
WithTxBytes(txBytes).
WithGasMeter(storetypes.NewInfiniteGasMeter())
// WithVoteInfos(app.voteInfos) // TODO: identify if this is needed

ctx = ctx.WithIsSigverifyTx(app.sigverifyTx)
Expand Down

0 comments on commit 6a5158f

Please sign in to comment.