Skip to content
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

chore: remove MaxGas const #253

Merged
merged 4 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -32,6 +32,7 @@
* (perf) [\#198](https://github.com/line/lfb-sdk/pull/198) Caching paramset
* (global) [\#200](https://github.com/line/lfb-sdk/pull/200) Add a env prefix
* (store) [\#202](https://github.com/line/lfb-sdk/pull/202) param store doesn't use gas kv
* (x/wasm) [\#253](https://github.com/line/lfb-sdk/pull/253) remove MaxGas const

### Bug Fixes
* (test) [\#92](https://github.com/line/lfb-sdk/pull/92) Fix SendToModuleAccountTest
Expand Down
1 change: 0 additions & 1 deletion x/wasm/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const (
ProposalTypeMigrateContract = types.ProposalTypeMigrateContract
ProposalTypeUpdateAdmin = types.ProposalTypeUpdateAdmin
ProposalTypeClearAdmin = types.ProposalTypeClearAdmin
MaxGas = keeper.MaxGas
QueryListContractByCode = keeper.QueryListContractByCode
QueryGetContract = keeper.QueryGetContract
QueryGetContractState = keeper.QueryGetContractState
Expand Down
7 changes: 0 additions & 7 deletions x/wasm/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ import (
wasmvmtypes "github.com/line/wasmvm/types"
)

// MaxGas was restriction is increased to 0x7FFFFFFFFFFFFFFF in CosmWasm 0.10.
// This const is not needed now and we can manage it in another way.
const MaxGas = 10_000_000_000

// contractMemoryLimit is the memory limit of each contract execution (in MiB)
// constant value so all nodes run with the same limit.
const contractMemoryLimit = 32
Expand Down Expand Up @@ -957,9 +953,6 @@ func gasForContract(ctx sdk.Context, gasMultiplier uint64) uint64 {
return 0
}
remaining := (meter.Limit() - meter.GasConsumedToLimit()) * gasMultiplier
if remaining > MaxGas {
return MaxGas
}
return remaining
}

Expand Down
3 changes: 2 additions & 1 deletion x/wasm/internal/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"encoding/json"
"errors"
"math"
"testing"

sdk "github.com/line/lfb-sdk/types"
Expand Down Expand Up @@ -32,7 +33,7 @@ func TestOnOpenChannel(t *testing.T) {
},
"consume max gas": {
contractAddr: example.Contract,
contractGas: MaxGas,
contractGas: math.MaxUint64 / types.DefaultGasMultiplier,
},
"consume gas on error": {
contractAddr: example.Contract,
Expand Down