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 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* (build) [\#195](https://github.com/line/lfb-sdk/pull/195) Build properly when using libsecp256k1
* (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
* (store) [\#202](https://github.com/line/lfb-sdk/pull/202) Param store doesn't use gas kv
* (store) [\#203](https://github.com/line/lfb-sdk/pull/203) Remove transient store that is not used now
* (perf) [\#204](https://github.com/line/lfb-sdk/pull/204) Apply rw mutex to cachekv
Expand All @@ -46,6 +47,7 @@
* (global) [\#230](https://github.com/line/lfb-sdk/pull/230) Modify module name to lfb-sdk
* (bump-up) [\#246](https://github.com/line/lfb-sdk/pull/246) Bump up ostracon to not flush wal when receive consensus msgs
* (wasm) [\#250](https://github.com/line/lfb-sdk/pull/250) Migrate linkwasmd to the latest commit
* (wasm) [\#253](https://github.com/line/lfb-sdk/pull/253) remove MaxGas const
* (wasm) [\#254](https://github.com/line/lfb-sdk/pull/254) Specify wasm event types
* (x) [\#255](https://github.com/line/lfb-sdk/pull/255) Remove legacy from modules

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