From bc437b3b23b884feba93d56427955b70b94616e4 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 21 Jun 2023 23:13:29 +0800 Subject: [PATCH 1/2] avoid invalid consensus params when set unlimited max gas for sim test --- x/simulation/params.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/simulation/params.go b/x/simulation/params.go index 73b520a0fd74..6f31d3eb4cb2 100644 --- a/x/simulation/params.go +++ b/x/simulation/params.go @@ -3,6 +3,7 @@ package simulation import ( "encoding/json" "fmt" + "math" "math/rand" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -187,7 +188,7 @@ func randomConsensusParams(r *rand.Rand, appState json.RawMessage, cdc codec.JSO consensusParams := &cmtproto.ConsensusParams{ Block: &cmtproto.BlockParams{ MaxBytes: int64(simulation.RandIntBetween(r, 20000000, 30000000)), - MaxGas: -1, + MaxGas: math.MaxInt64, }, Validator: &cmtproto.ValidatorParams{ PubKeyTypes: []string{types.ABCIPubKeyTypeEd25519}, From 6a64baca37b2e1c5f58841d446e1daa0c2878041 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 21 Jun 2023 23:17:53 +0800 Subject: [PATCH 2/2] add change doc --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c796a584801f..bfdc0fde0a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes * [#16547](https://github.com/cosmos/cosmos-sdk/pull/16547) Ensure a transaction's gas limit cannot exceed the block gas limit. +* (sims) [#16636](https://github.com/cosmos/cosmos-sdk/pull/16636) Avoid invalid consensus params when set unlimited max gas for sim test. ### Improvements