Remove max gas limit

This commit is contained in:
Alex Peters
2021-06-07 10:46:26 +02:00
parent bbb1669ada
commit c637add01c
3 changed files with 2 additions and 10 deletions

View File

@@ -30,7 +30,6 @@ const (
ProposalTypeUpdateAdmin = types.ProposalTypeUpdateAdmin
ProposalTypeClearAdmin = types.ProposalTypeClearAdmin
GasMultiplier = keeper.GasMultiplier
MaxGas = keeper.MaxGas
QueryListContractByCode = keeper.QueryListContractByCode
QueryGetContract = keeper.QueryGetContract
QueryGetContractState = keeper.QueryGetContractState

View File

@@ -28,11 +28,6 @@ import (
// Please note that all gas prices returned to the wasmer engine should have this multiplied
const GasMultiplier uint64 = 100
// MaxGas for a contract is 10 billion wasmer gas (enforced in rust to prevent overflow)
// The limit for v0.9.3 is defined here: https://github.com/CosmWasm/cosmwasm/blob/v0.9.3/packages/vm/src/backends/singlepass.rs#L15-L23
// (this will be increased in future releases)
const MaxGas = 10_000_000_000
// InstanceCost is how much SDK gas we charge each time we load a WASM instance.
// Creating a new instance is costly, and this helps put a recursion limit to contracts calling contracts.
const InstanceCost uint64 = 40_000
@@ -823,9 +818,6 @@ func gasForContract(ctx sdk.Context) uint64 {
return 0
}
remaining := (meter.Limit() - meter.GasConsumedToLimit()) * GasMultiplier
if remaining > MaxGas {
return MaxGas
}
return remaining
}

View File

@@ -9,6 +9,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"math"
"testing"
)
@@ -31,7 +32,7 @@ func TestOnOpenChannel(t *testing.T) {
},
"consume max gas": {
contractAddr: example.Contract,
contractGas: MaxGas,
contractGas: math.MaxUint64 / GasMultiplier,
},
"consume gas on error": {
contractAddr: example.Contract,