From 5f7d0c279defa8238e2eab4b68eb258562994717 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 29 Nov 2024 22:58:45 +0700 Subject: [PATCH] Fix gas tests --- x/wasm/keeper/keeper_test.go | 4 ++-- x/wasm/keeper/recurse_test.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index a8f069bf77..f5eb7fd2c6 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -422,7 +422,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x1bc8f), gasAfter-gasBefore) + require.Equal(t, uint64(0x1bca5), gasAfter-gasBefore) } // ensure it is stored properly @@ -959,7 +959,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(0x1acb4), gasAfter-gasBefore) + require.Equal(t, uint64(0x1acdb), gasAfter-gasBefore) } // ensure bob now exists and got both payments released bobAcct = accKeeper.GetAccount(ctx, bob) diff --git a/x/wasm/keeper/recurse_test.go b/x/wasm/keeper/recurse_test.go index 9cc93ebef5..e9c0540e08 100644 --- a/x/wasm/keeper/recurse_test.go +++ b/x/wasm/keeper/recurse_test.go @@ -56,12 +56,12 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, ctx sdk.Context func TestGasCostOnQuery(t *testing.T) { const ( - GasNoWork uint64 = 63_983 + GasNoWork uint64 = 0xfa02 // Note: about 100 SDK gas (10k CosmWasm gas) for each round of sha256 - GasWork50 uint64 = 64_222 // this is a little shy of 50k gas - to keep an eye on the limit + GasWork50 uint64 = 0xfaf9 - GasReturnUnhashed uint64 = 55 - GasReturnHashed uint64 = 46 + GasReturnUnhashed uint64 = 70 + GasReturnHashed uint64 = 59 ) cases := map[string]struct { @@ -211,9 +211,9 @@ func TestLimitRecursiveQueryGas(t *testing.T) { const ( // Note: about 100 SDK gas (10k CosmWasm gas) for each round of sha256 - GasWork2k uint64 = 76_279 // = SetupContractCost + x // we have 6x gas used in cpu than in the instance + GasWork2k uint64 = 0x12c20 // = SetupContractCost + x // we have 6x gas used in cpu than in the instance // This is overhead for calling into a sub-contract - GasReturnHashed uint64 = 48 + GasReturnHashed uint64 = 0x3B ) cases := map[string]struct { @@ -263,7 +263,7 @@ func TestLimitRecursiveQueryGas(t *testing.T) { expectQueriesFromContract: 10, expectOutOfGas: false, expectError: "query wasm contract failed", // Error we get from the contract instance doing the failing query, not wasmd - expectedGas: 10*(GasWork2k+GasReturnHashed) + 3279, // lots of additional gas for long error message + expectedGas: 10*(GasWork2k+GasReturnHashed) + 3400, // lots of additional gas for long error message }, }