Skip to content

Commit e76eb20

Browse files
committed
chore: Update tests
1 parent e6f879a commit e76eb20

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

internal/api/lib_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ func TestInstantiate(t *testing.T) {
580580
res, cost, err := Instantiate(cache, checksum, env, info, msg, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)
581581
require.NoError(t, err)
582582
requireOkResponse(t, res, 0)
583-
require.Equal(t, uint64(0xd35950), cost.UsedInternally)
583+
require.Equal(t, uint64(0xd915fc), cost.UsedInternally)
584584

585585
var result types.ContractResult
586586
err = json.Unmarshal(res, &result)
@@ -611,7 +611,7 @@ func TestExecute(t *testing.T) {
611611
diff := time.Since(start)
612612
require.NoError(t, err)
613613
requireOkResponse(t, res, 0)
614-
require.Equal(t, uint64(0xd35950), cost.UsedInternally)
614+
require.Equal(t, uint64(0xd915fc), cost.UsedInternally)
615615
t.Logf("Time (%d gas): %s\n", cost.UsedInternally, diff)
616616

617617
// execute with the same store
@@ -624,7 +624,7 @@ func TestExecute(t *testing.T) {
624624
res, cost, err = Execute(cache, checksum, env, info, []byte(`{"release":{}}`), &igasMeter2, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)
625625
diff = time.Since(start)
626626
require.NoError(t, err)
627-
require.Equal(t, uint64(0x16057d3), cost.UsedInternally)
627+
require.Equal(t, uint64(0x1669008), cost.UsedInternally)
628628
t.Logf("Time (%d gas): %s\n", cost.UsedInternally, diff)
629629

630630
// make sure it read the balance properly and we got 250 atoms
@@ -731,7 +731,7 @@ func TestExecuteCpuLoop(t *testing.T) {
731731
diff := time.Since(start)
732732
require.NoError(t, err)
733733
requireOkResponse(t, res, 0)
734-
require.Equal(t, uint64(0x895c33), cost.UsedInternally)
734+
require.Equal(t, uint64(0x8f2a64), cost.UsedInternally)
735735
t.Logf("Time (%d gas): %s\n", cost.UsedInternally, diff)
736736

737737
// execute a cpu loop
@@ -973,7 +973,7 @@ func TestMultipleInstances(t *testing.T) {
973973
require.NoError(t, err)
974974
requireOkResponse(t, res, 0)
975975
// we now count wasm gas charges and db writes
976-
assert.Equal(t, uint64(0xd2189c), cost.UsedInternally)
976+
assert.Equal(t, uint64(0xd7d548), cost.UsedInternally)
977977

978978
// instance2 controlled by mary
979979
gasMeter2 := NewMockGasMeter(TESTING_GAS_LIMIT)
@@ -984,14 +984,14 @@ func TestMultipleInstances(t *testing.T) {
984984
res, cost, err = Instantiate(cache, checksum, env, info, msg, &igasMeter2, store2, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)
985985
require.NoError(t, err)
986986
requireOkResponse(t, res, 0)
987-
assert.Equal(t, uint64(0xd2ce86), cost.UsedInternally)
987+
assert.Equal(t, uint64(0xd88b32), cost.UsedInternally)
988988

989989
// fail to execute store1 with mary
990-
resp := exec(t, cache, checksum, "mary", store1, api, querier, 0xbe8534)
990+
resp := exec(t, cache, checksum, "mary", store1, api, querier, 0xc441e0)
991991
require.Equal(t, "Unauthorized", resp.Err)
992992

993993
// succeed to execute store1 with fred
994-
resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x15fce67)
994+
resp = exec(t, cache, checksum, "fred", store1, api, querier, 0x166069c)
995995
require.Empty(t, resp.Err)
996996
require.Len(t, resp.Ok.Messages, 1)
997997
attributes := resp.Ok.Attributes
@@ -1000,7 +1000,7 @@ func TestMultipleInstances(t *testing.T) {
10001000
require.Equal(t, "bob", attributes[1].Value)
10011001

10021002
// succeed to execute store2 with mary
1003-
resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x160131d)
1003+
resp = exec(t, cache, checksum, "mary", store2, api, querier, 0x1664b52)
10041004
require.Empty(t, resp.Err)
10051005
require.Len(t, resp.Ok.Messages, 1)
10061006
attributes = resp.Ok.Attributes

lib_libwasmvm_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ func TestEnv(t *testing.T) {
264264
Address: "wasm10dyr9899g6t0pelew4nvf4j5c3jcgv0r5d3a5l",
265265
},
266266
Transaction: &types.TransactionInfo{
267-
Index: 18,
267+
Index: 18,
268+
Checksum: types.ForceNewChecksum("AABBCCDDEEFF0011AABBCCDDEEFF0011AABBCCDDEEFF0011AABBCCDDEEFF0011"),
268269
},
269270
}
270271
info = api.MockInfo("creator", nil)

0 commit comments

Comments
 (0)