diff --git a/CHANGELOG.md b/CHANGELOG.md index 84fe644400..69affee629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - (app) [#1739](https://github.com/evmos/ethermint/pull/1739) Remove distribution module perms - (ante) [#1741](https://github.com/evmos/ethermint/pull/1741) Add authz ante handler - (eip712) [#1746](https://github.com/evmos/ethermint/pull/1746) Add EIP712 support for multiple messages and schemas +- (feemarket) [#1790](https://github.com/evmos/ethermint/pull/1790) Raise error when get invalid consensus params ### Bug Fixes diff --git a/app/utils.go b/app/utils.go index b2f4f181e5..d5e7c79a0b 100644 --- a/app/utils.go +++ b/app/utils.go @@ -42,8 +42,8 @@ import ( // EthermintApp testing. var DefaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ - MaxBytes: 200000, - MaxGas: -1, // no limit + MaxBytes: 1048576, + MaxGas: 81500000, // default limit }, Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 302400, diff --git a/gomod2nix.toml b/gomod2nix.toml index f5b91071dd..0e3d07aa46 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -409,8 +409,8 @@ schema = 3 version = "v0.9.1" hash = "sha256-YLGNrHHM+mN4ElW/XWuylOnFrA/VjSY+eBuC4LN//5c=" [mod."github.com/rs/cors"] - version = "v1.8.3" - hash = "sha256-VgVB4HKAhPSjNg96mIEUN1bt5ZQng8Fi3ZABy3CDWQE=" + version = "v1.9.0" + hash = "sha256-CNBCGXOydU6MIEZ0B5eXBjBm3smH2ryYHvgRJA2udBM=" [mod."github.com/rs/zerolog"] version = "v1.27.0" hash = "sha256-BxQtP2TROeSSpj9l1irocuSfxn55UL4ugzB/og7r8eE=" @@ -512,8 +512,8 @@ schema = 3 version = "v0.0.0-20230131160201-f062dba9d201" hash = "sha256-sxLT/VOe93v0h3miChJSHS9gscTZS/B71+390ju/e20=" [mod."golang.org/x/net"] - version = "v0.8.0" - hash = "sha256-2cOtqa7aJ5mn64kZ+8+PVjJ4uGbhpXTpC1vm/+iaZzM=" + version = "v0.9.0" + hash = "sha256-EG5GRDq282twyce8uugsDTjMz1pNn6zPcyVTZmSiJ14=" [mod."golang.org/x/oauth2"] version = "v0.4.0" hash = "sha256-Dj9wHbSbs0Ghr9Hef0hSfanaR8L0GShI18jGBT3yNn8=" @@ -521,14 +521,14 @@ schema = 3 version = "v0.1.0" hash = "sha256-Hygjq9euZ0qz6TvHYQwOZEjNiTbTh1nSLRAWZ6KFGR8=" [mod."golang.org/x/sys"] - version = "v0.6.0" - hash = "sha256-zAgxiTuL24sGhbXrna9R1UYqLQh46ldztpumOScmduY=" + version = "v0.7.0" + hash = "sha256-GotRHJaas/q3L+tFam0q3oQ1rc8GDStt7wnz9h8MTEU=" [mod."golang.org/x/term"] - version = "v0.6.0" - hash = "sha256-Ao0yXpwY8GyG+/23dVfJUYrfEfNUTES3RF45v1VhUAk=" + version = "v0.7.0" + hash = "sha256-VYnXZ50OXTsylzncIMceVC2ZBKdbyp+V367Qbq3Vlqk=" [mod."golang.org/x/text"] - version = "v0.8.0" - hash = "sha256-hgWFnT01DRmywBEXKYEVaOee7i6z8Ydz7zGbjcWwOgI=" + version = "v0.9.0" + hash = "sha256-tkhDeMsSQZr3jo7vmKehWs3DvWetwXR0IB+DCLbQ4nk=" [mod."golang.org/x/tools"] version = "v0.7.0" hash = "sha256-ZEjfFulQd6U9r4mEJ5RZOnW49NZnQnrCFLMKCgLg7go=" diff --git a/x/feemarket/keeper/eip1559.go b/x/feemarket/keeper/eip1559.go index ef931f0e0a..2f58f70651 100644 --- a/x/feemarket/keeper/eip1559.go +++ b/x/feemarket/keeper/eip1559.go @@ -16,6 +16,7 @@ package keeper import ( + "fmt" "math/big" sdk "github.com/cosmos/cosmos-sdk/types" @@ -56,13 +57,11 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int { parentGasUsed := k.GetBlockGasWanted(ctx) - gasLimit := new(big.Int).SetUint64(math.MaxUint64) - // NOTE: a MaxGas equal to -1 means that block gas is unlimited - if consParams != nil && consParams.Block.MaxGas > -1 { - gasLimit = big.NewInt(consParams.Block.MaxGas) + if consParams == nil || consParams.Block == nil || consParams.Block.MaxGas <= -1 { + panic(fmt.Sprintf("get invalid consensus params: %s", consParams)) } - + gasLimit := big.NewInt(consParams.Block.MaxGas) // CONTRACT: ElasticityMultiplier cannot be 0 as it's checked in the params // validation parentGasTargetBig := new(big.Int).Div(gasLimit, new(big.Int).SetUint64(uint64(params.ElasticityMultiplier)))