From de105920a01e0048393317a570c28d1fe0bdd3a2 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 23 Sep 2024 17:28:44 +0700 Subject: [PATCH] Fix tests --- internal/api/iterator_test.go | 4 ++-- internal/api/lib_test.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/api/iterator_test.go b/internal/api/iterator_test.go index de14b0f20..5f0f0df75 100644 --- a/internal/api/iterator_test.go +++ b/internal/api/iterator_test.go @@ -265,7 +265,7 @@ func TestQueueIteratorLimit(t *testing.T) { var gasLimit uint64 // Open 5000 iterators - gasLimit = 2 * TESTING_GAS_LIMIT + gasLimit = 3 * TESTING_GAS_LIMIT gasMeter := NewMockGasMeter(gasLimit) igasMeter := types.GasMeter(gasMeter) store := setup.Store(gasMeter) @@ -279,7 +279,7 @@ func TestQueueIteratorLimit(t *testing.T) { require.Equal(t, `{}`, string(qres.Ok)) // Open 35000 iterators - gasLimit = TESTING_GAS_LIMIT * 7 + gasLimit = TESTING_GAS_LIMIT * 8 gasMeter = NewMockGasMeter(gasLimit) igasMeter = types.GasMeter(gasMeter) store = setup.Store(gasMeter) diff --git a/internal/api/lib_test.go b/internal/api/lib_test.go index c9456c135..ac44e5835 100644 --- a/internal/api/lib_test.go +++ b/internal/api/lib_test.go @@ -363,7 +363,7 @@ func TestInstantiate(t *testing.T) { res, cost, err := Instantiate(cache, checksum, env, info, msg, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x252528f74), cost.UsedInternally) + assert.Equal(t, uint64(0x2d4998b04), cost.UsedInternally) var result types.ContractResult err = json.Unmarshal(res, &result) @@ -394,7 +394,7 @@ func TestExecute(t *testing.T) { diff := time.Since(start) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x252528f74), cost.UsedInternally) + assert.Equal(t, uint64(0x2d4998b04), cost.UsedInternally) t.Logf("Time (%d gas): %s\n", cost.UsedInternally, diff) // execute with the same store @@ -407,7 +407,7 @@ func TestExecute(t *testing.T) { res, cost, err = Execute(cache, checksum, env, info, []byte(`{"release":{}}`), &igasMeter2, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) diff = time.Since(start) require.NoError(t, err) - assert.Equal(t, uint64(0x3ffe1e058), cost.UsedInternally) + assert.Equal(t, uint64(0x4f2816338), cost.UsedInternally) t.Logf("Time (%d gas): %s\n", cost.UsedInternally, diff) // make sure it read the balance properly and we got 250 atoms @@ -515,7 +515,7 @@ func TestExecuteCpuLoop(t *testing.T) { diff := time.Since(start) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x18a753768), cost.UsedInternally) + assert.Equal(t, uint64(0x1dc65a058), cost.UsedInternally) t.Logf("Time (%d gas): %s\n", cost.UsedInternally, diff) // execute a cpu loop @@ -666,7 +666,7 @@ func TestMultipleInstances(t *testing.T) { require.NoError(t, err) requireOkResponse(t, res, 0) // we now count wasm gas charges and db writes - assert.Equal(t, uint64(0x24e474064), cost.UsedInternally) + assert.Equal(t, uint64(0x2cfaf612c), cost.UsedInternally) // instance2 controlled by mary gasMeter2 := NewMockGasMeter(TESTING_GAS_LIMIT) @@ -677,14 +677,14 @@ func TestMultipleInstances(t *testing.T) { res, cost, err = Instantiate(cache, checksum, env, info, msg, &igasMeter2, store2, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) requireOkResponse(t, res, 0) - assert.Equal(t, uint64(0x250a66614), cost.UsedInternally) + assert.Equal(t, uint64(0x2d2895c2c), cost.UsedInternally) // fail to execute store1 with mary - resp := exec(t, cache, checksum, "mary", store1, api, querier, 0x220d6e990) + resp := exec(t, cache, checksum, "mary", store1, api, querier, 0x28d306a58) require.Equal(t, "Unauthorized", resp.Err) // succeed to execute store1 with fred - resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x3fe0b99b8) + resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x4f07d7ce8) require.Equal(t, "", resp.Err) require.Equal(t, 1, len(resp.Ok.Messages)) attributes := resp.Ok.Attributes @@ -693,7 +693,7 @@ func TestMultipleInstances(t *testing.T) { require.Equal(t, "bob", attributes[1].Value) // succeed to execute store2 with mary - resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x3fef6bd08) + resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x4f17f7010) require.Equal(t, "", resp.Err) require.Equal(t, 1, len(resp.Ok.Messages)) attributes = resp.Ok.Attributes