Skip to content

Commit

Permalink
chore: remove MaxGas const (#253)
Browse files Browse the repository at this point in the history
* chore: remove MaxGas const

* docs: add this PR to CHANGELOG

* fix: fix relay_test to pass
  • Loading branch information
loloicci authored Jul 16, 2021
1 parent 7ecb96e commit af78aa4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
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

0 comments on commit af78aa4

Please sign in to comment.