8000 fix(consensus): fix the problem when setting the genesis.json file consensus_params.block.max_gas=-1 by luchenqun · Pull Request #1740 · evmos/evmos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(consensus): fix the problem when setting the genesis.json file consensus_params.block.max_gas=-1 #1740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (ante) [#1693](https://github.com/evmos/evmos/pull/1693) Prevent panic on int64 conversion in EVM fees antehandler.
- (evm) [#1693](https://github.com/evmos/evmos/pull/1703) Prevent panic on uint64 conversion in EVM keeper `ApplyMessageWithConfig` function.
- (deps) [#1718](https://github.com/evmos/evmos/pull/1718) Update rosetta types import.
- (consensus) [#1740](https://github.com/evmos/evmos/pull/1740) Enable setting block gas limit to max by specifying it as -1 in the genesis file.

## [v13.0.2] - 2023-07-05

Expand Down
9 changes: 9 additions & 0 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package types

import (
math "math"

sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand All @@ -24,6 +26,13 @@ func BlockGasLimit(ctx sdk.Context) uint64 {
}

maxGas := cp.Block.MaxGas

// Setting max_gas to -1 in Tendermint means there is no limit on the maximum gas consumption for transactions
// https://github.com/cometbft/cometbft/blob/v0.37.2/proto/tendermint/types/params.proto#L25-L27
if maxGas == -1 {
return math.MaxUint64
}

if maxGas > 0 {
return uint64(maxGas) // #nosec G701 -- maxGas is int64 type. It can never be greater than math.MaxUint64
}
Expand Down
0