Adjust gas prices for new contracts
This commit is contained in:
@@ -307,7 +307,7 @@ func TestInstantiate(t *testing.T) {
|
||||
|
||||
gasAfter := ctx.GasMeter().GasConsumed()
|
||||
if types.EnableGasVerification {
|
||||
require.Equal(t, uint64(0x12206), gasAfter-gasBefore)
|
||||
require.Equal(t, uint64(0x12215), gasAfter-gasBefore)
|
||||
}
|
||||
|
||||
// ensure it is stored properly
|
||||
@@ -541,7 +541,7 @@ func TestExecute(t *testing.T) {
|
||||
// make sure gas is properly deducted from ctx
|
||||
gasAfter := ctx.GasMeter().GasConsumed()
|
||||
if types.EnableGasVerification {
|
||||
require.Equal(t, uint64(0x12af1), gasAfter-gasBefore)
|
||||
require.Equal(t, uint64(0x12af8), gasAfter-gasBefore)
|
||||
}
|
||||
// ensure bob now exists and got both payments released
|
||||
bobAcct = accKeeper.GetAccount(ctx, bob)
|
||||
|
||||
@@ -52,12 +52,12 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, creator sdk.Acc
|
||||
|
||||
func TestGasCostOnQuery(t *testing.T) {
|
||||
const (
|
||||
GasNoWork uint64 = 44_149
|
||||
GasNoWork uint64 = 44_162
|
||||
// Note: about 100 SDK gas (10k wasmer gas) for each round of sha256
|
||||
GasWork50 uint64 = 49_809 // this is a little shy of 50k gas - to keep an eye on the limit
|
||||
GasWork50 uint64 = 48_846 // this is a little shy of 50k gas - to keep an eye on the limit
|
||||
|
||||
GasReturnUnhashed uint64 = 256
|
||||
GasReturnHashed uint64 = 232
|
||||
GasReturnUnhashed uint64 = 253
|
||||
GasReturnHashed uint64 = 228
|
||||
)
|
||||
|
||||
cases := map[string]struct {
|
||||
@@ -216,9 +216,9 @@ func TestLimitRecursiveQueryGas(t *testing.T) {
|
||||
|
||||
const (
|
||||
// Note: about 100 SDK gas (10k wasmer gas) for each round of sha256
|
||||
GasWork2k uint64 = 273_076 // = NewContractInstanceCosts + x // we have 6x gas used in cpu than in the instance
|
||||
GasWork2k uint64 = 233_971 // = NewContractInstanceCosts + x // we have 6x gas used in cpu than in the instance
|
||||
// This is overhead for calling into a sub-contract
|
||||
GasReturnHashed uint64 = 236
|
||||
GasReturnHashed uint64 = 231
|
||||
)
|
||||
|
||||
cases := map[string]struct {
|
||||
@@ -244,15 +244,14 @@ func TestLimitRecursiveQueryGas(t *testing.T) {
|
||||
Work: 2000,
|
||||
},
|
||||
expectQueriesFromContract: 5,
|
||||
// FIXME: why -3 ... confused a bit by calculations, seems like rounding issues
|
||||
expectedGas: GasWork2k + 5*(GasWork2k+GasReturnHashed) - 3,
|
||||
// FIXME: why +2 ... confused a bit by calculations, seems like rounding issues
|
||||
expectedGas: GasWork2k + 5*(GasWork2k+GasReturnHashed) + 2,
|
||||
},
|
||||
// this is where we expect an error...
|
||||
// it has enough gas to run 4 times and die on the 5th (4th time dispatching to sub-contract)
|
||||
// however, if we don't charge the cpu gas before sub-dispatching, we can recurse over 20 times
|
||||
// TODO: figure out how to asset how deep it went
|
||||
"deep recursion, should die on 5th level": {
|
||||
gasLimit: 1_200_000,
|
||||
gasLimit: 1_000_000,
|
||||
msg: Recurse{
|
||||
Depth: 50,
|
||||
Work: 2000,
|
||||
|
||||
Reference in New Issue
Block a user