Skip to content

Commit 8369711

Browse files
authored
Merge pull request #260 from CosmWasm/update-1.0-soon
Update to CosmWasm 1.0.0-soon
2 parents 3cf64c2 + 0d68e4e commit 8369711

File tree

12 files changed

+85
-57
lines changed

12 files changed

+85
-57
lines changed

api/lib_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/CosmWasm/wasmvm/types"
1515
)
1616

17-
const TESTING_FEATURES = "staking,stargate"
17+
const TESTING_FEATURES = "staking,stargate,iterator"
1818
const TESTING_PRINT_DEBUG = false
1919
const TESTING_GAS_LIMIT = 100_000_000
2020
const TESTING_MEMORY_LIMIT = 32 // MiB
@@ -208,7 +208,7 @@ func TestGetMetrics(t *testing.T) {
208208
assert.Equal(t, &types.Metrics{
209209
HitsFsCache: 1,
210210
ElementsMemoryCache: 1,
211-
SizeMemoryCache: 4977784,
211+
SizeMemoryCache: 4777334,
212212
}, metrics)
213213

214214
// Instantiate 2
@@ -223,7 +223,7 @@ func TestGetMetrics(t *testing.T) {
223223
HitsMemoryCache: 1,
224224
HitsFsCache: 1,
225225
ElementsMemoryCache: 1,
226-
SizeMemoryCache: 4977784,
226+
SizeMemoryCache: 4777334,
227227
}, metrics)
228228

229229
// Pin
@@ -238,8 +238,8 @@ func TestGetMetrics(t *testing.T) {
238238
HitsFsCache: 1,
239239
ElementsPinnedMemoryCache: 1,
240240
ElementsMemoryCache: 1,
241-
SizePinnedMemoryCache: 4977784,
242-
SizeMemoryCache: 4977784,
241+
SizePinnedMemoryCache: 4777334,
242+
SizeMemoryCache: 4777334,
243243
}, metrics)
244244

245245
// Instantiate 3
@@ -256,8 +256,8 @@ func TestGetMetrics(t *testing.T) {
256256
HitsFsCache: 1,
257257
ElementsPinnedMemoryCache: 1,
258258
ElementsMemoryCache: 1,
259-
SizePinnedMemoryCache: 4977784,
260-
SizeMemoryCache: 4977784,
259+
SizePinnedMemoryCache: 4777334,
260+
SizeMemoryCache: 4777334,
261261
}, metrics)
262262

263263
// Unpin
@@ -274,7 +274,7 @@ func TestGetMetrics(t *testing.T) {
274274
ElementsPinnedMemoryCache: 0,
275275
ElementsMemoryCache: 1,
276276
SizePinnedMemoryCache: 0,
277-
SizeMemoryCache: 4977784,
277+
SizeMemoryCache: 4777334,
278278
}, metrics)
279279

280280
// Instantiate 4
@@ -292,7 +292,7 @@ func TestGetMetrics(t *testing.T) {
292292
ElementsPinnedMemoryCache: 0,
293293
ElementsMemoryCache: 1,
294294
SizePinnedMemoryCache: 0,
295-
SizeMemoryCache: 4977784,
295+
SizeMemoryCache: 4777334,
296296
}, metrics)
297297
}
298298

@@ -319,7 +319,7 @@ func TestInstantiate(t *testing.T) {
319319
res, cost, err := Instantiate(cache, checksum, env, info, msg, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)
320320
require.NoError(t, err)
321321
requireOkResponse(t, res, 0)
322-
assert.Equal(t, uint64(0x85b0), cost)
322+
assert.Equal(t, uint64(0x8d8e), cost)
323323

324324
var result types.ContractResult
325325
err = json.Unmarshal(res, &result)
@@ -350,7 +350,7 @@ func TestExecute(t *testing.T) {
350350
diff := time.Now().Sub(start)
351351
require.NoError(t, err)
352352
requireOkResponse(t, res, 0)
353-
assert.Equal(t, uint64(0x85b0), cost)
353+
assert.Equal(t, uint64(0x8d8e), cost)
354354
t.Logf("Time (%d gas): %s\n", cost, diff)
355355

356356
// execute with the same store
@@ -363,7 +363,7 @@ func TestExecute(t *testing.T) {
363363
res, cost, err = Execute(cache, checksum, env, info, []byte(`{"release":{}}`), &igasMeter2, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)
364364
diff = time.Now().Sub(start)
365365
require.NoError(t, err)
366-
assert.Equal(t, uint64(0xf0fd), cost)
366+
assert.Equal(t, uint64(0xf783), cost)
367367
t.Logf("Time (%d gas): %s\n", cost, diff)
368368

369369
// make sure it read the balance properly and we got 250 atoms
@@ -414,7 +414,7 @@ func TestExecuteCpuLoop(t *testing.T) {
414414
diff := time.Now().Sub(start)
415415
require.NoError(t, err)
416416
requireOkResponse(t, res, 0)
417-
assert.Equal(t, uint64(0x85b0), cost)
417+
assert.Equal(t, uint64(0x8d8e), cost)
418418
t.Logf("Time (%d gas): %s\n", cost, diff)
419419

420420
// execute a cpu loop
@@ -565,7 +565,7 @@ func TestMultipleInstances(t *testing.T) {
565565
require.NoError(t, err)
566566
requireOkResponse(t, res, 0)
567567
// we now count wasm gas charges and db writes
568-
assert.Equal(t, uint64(0x84ad), cost)
568+
assert.Equal(t, uint64(0x8c97), cost)
569569

570570
// instance2 controlled by mary
571571
gasMeter2 := NewMockGasMeter(TESTING_GAS_LIMIT)
@@ -576,14 +576,14 @@ func TestMultipleInstances(t *testing.T) {
576576
res, cost, err = Instantiate(cache, checksum, env, info, msg, &igasMeter2, store2, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)
577577
require.NoError(t, err)
578578
requireOkResponse(t, res, 0)
579-
assert.Equal(t, uint64(0x8541), cost)
579+
assert.Equal(t, uint64(0x8d25), cost)
580580

581581
// fail to execute store1 with mary
582-
resp := exec(t, cache, checksum, "mary", store1, api, querier, 0x75ab)
582+
resp := exec(t, cache, checksum, "mary", store1, api, querier, 0x80a9)
583583
require.Equal(t, "Unauthorized", resp.Err)
584584

585585
// succeed to execute store1 with fred
586-
resp = exec(t, cache, checksum, "fred", store1, api, querier, 0xf089)
586+
resp = exec(t, cache, checksum, "fred", store1, api, querier, 0xf70f)
587587
require.Equal(t, "", resp.Err)
588588
require.Equal(t, 1, len(resp.Ok.Messages))
589589
attributes := resp.Ok.Attributes
@@ -592,7 +592,7 @@ func TestMultipleInstances(t *testing.T) {
592592
require.Equal(t, "bob", attributes[1].Value)
593593

594594
// succeed to execute store2 with mary
595-
resp = exec(t, cache, checksum, "mary", store2, api, querier, 0xf0c3)
595+
resp = exec(t, cache, checksum, "mary", store2, api, querier, 0xf749)
596596
require.Equal(t, "", resp.Err)
597597
require.Equal(t, 1, len(resp.Ok.Messages))
598598
attributes = resp.Ok.Attributes

api/testdata/hackatom.wasm

-4.63 KB
Binary file not shown.

api/testdata/ibc_reflect.wasm

-9.4 KB
Binary file not shown.

api/testdata/queue.wasm

-2.5 KB
Binary file not shown.

api/testdata/reflect.wasm

-9.69 KB
Binary file not shown.

ibc_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,8 @@ func TestIBCPacketDispatch(t *testing.T) {
200200
Result: types.SubcallResult{
201201
Ok: &types.SubcallResponse{
202202
Events: types.Events{{
203-
Type: "message",
203+
Type: "instantiate",
204204
Attributes: types.EventAttributes{
205-
{
206-
Key: "module",
207-
Value: "wasm",
208-
},
209205
{
210206
Key: "_contract_address",
211207
Value: REFLECT_ADDR,
@@ -296,7 +292,7 @@ func TestAnalyzeCode(t *testing.T) {
296292
report2, err := vm.AnalyzeCode(checksum2)
297293
require.NoError(t, err)
298294
require.True(t, report2.HasIBCEntryPoints)
299-
require.Equal(t, "staking,stargate", report2.RequiredFeatures)
295+
require.Equal(t, "iterator,staking,stargate", report2.RequiredFeatures)
300296
}
301297

302298
func TestIBCMsgGetChannel(t *testing.T) {

lib_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"testing"
1111
)
1212

13-
const TESTING_FEATURES = "staking,stargate"
13+
const TESTING_FEATURES = "staking,stargate,iterator"
1414
const TESTING_PRINT_DEBUG = false
1515
const TESTING_GAS_LIMIT = 100_000_000
1616
const TESTING_MEMORY_LIMIT = 32 // MiB
@@ -133,7 +133,7 @@ func TestGetMetrics(t *testing.T) {
133133
assert.Equal(t, &types.Metrics{
134134
HitsFsCache: 1,
135135
ElementsMemoryCache: 1,
136-
SizeMemoryCache: 4977784,
136+
SizeMemoryCache: 4777334,
137137
}, metrics)
138138

139139
// Instantiate 2
@@ -149,7 +149,7 @@ func TestGetMetrics(t *testing.T) {
149149
HitsMemoryCache: 1,
150150
HitsFsCache: 1,
151151
ElementsMemoryCache: 1,
152-
SizeMemoryCache: 4977784,
152+
SizeMemoryCache: 4777334,
153153
}, metrics)
154154

155155
// Pin
@@ -164,8 +164,8 @@ func TestGetMetrics(t *testing.T) {
164164
HitsFsCache: 1,
165165
ElementsPinnedMemoryCache: 1,
166166
ElementsMemoryCache: 1,
167-
SizePinnedMemoryCache: 4977784,
168-
SizeMemoryCache: 4977784,
167+
SizePinnedMemoryCache: 4777334,
168+
SizeMemoryCache: 4777334,
169169
}, metrics)
170170

171171
// Instantiate 3
@@ -183,8 +183,8 @@ func TestGetMetrics(t *testing.T) {
183183
HitsFsCache: 1,
184184
ElementsPinnedMemoryCache: 1,
185185
ElementsMemoryCache: 1,
186-
SizePinnedMemoryCache: 4977784,
187-
SizeMemoryCache: 4977784,
186+
SizePinnedMemoryCache: 4777334,
187+
SizeMemoryCache: 4777334,
188188
}, metrics)
189189

190190
// Unpin
@@ -201,7 +201,7 @@ func TestGetMetrics(t *testing.T) {
201201
ElementsPinnedMemoryCache: 0,
202202
ElementsMemoryCache: 1,
203203
SizePinnedMemoryCache: 0,
204-
SizeMemoryCache: 4977784,
204+
SizeMemoryCache: 4777334,
205205
}, metrics)
206206

207207
// Instantiate 4
@@ -220,6 +220,6 @@ func TestGetMetrics(t *testing.T) {
220220
ElementsPinnedMemoryCache: 0,
221221
ElementsMemoryCache: 1,
222222
SizePinnedMemoryCache: 0,
223-
SizeMemoryCache: 4977784,
223+
SizeMemoryCache: 4777334,
224224
}, metrics)
225225
}

libwasmvm/Cargo.lock

Lines changed: 12 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libwasmvm/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ default = []
2626
backtraces = []
2727

2828
[dependencies]
29-
cosmwasm-std = { git = "https://github.com/CosmWasm/cosmwasm", rev = "v0.16.2", features = ["staking", "stargate"] }
30-
cosmwasm-vm = { git = "https://github.com/CosmWasm/cosmwasm", rev = "v0.16.2", features = ["staking", "stargate"] }
29+
cosmwasm-std = { version = "=1.0.0-soon", features = ["staking", "stargate", "iterator"] }
30+
cosmwasm-vm = { version = "=1.0.0-soon", features = ["staking", "stargate", "iterator"] }
3131
errno = "0.2"
3232
serde_json = "1.0"
3333
thiserror = "1.0"

libwasmvm/src/cache.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ mod tests {
577577
#[test]
578578
fn analyze_code_works() {
579579
let dir: String = TempDir::new().unwrap().path().to_str().unwrap().to_owned();
580-
let features = b"staking, stargate";
580+
let features = b"staking,stargate,iterator";
581581

582582
let mut error_msg = UnmanagedVector::default();
583583
let cache_ptr = init_cache(
@@ -630,7 +630,7 @@ mod tests {
630630
assert_eq!(ibc_reflect_report.has_ibc_entry_points, true);
631631
assert_eq!(
632632
ibc_reflect_report.required_features.consume().unwrap(),
633-
b"staking,stargate"
633+
b"iterator,staking,stargate"
634634
);
635635

636636
release_cache(cache_ptr);
@@ -729,7 +729,7 @@ mod tests {
729729
misses: 0,
730730
elements_pinned_memory_cache: 1,
731731
elements_memory_cache: 0,
732-
size_pinned_memory_cache: 4955952,
732+
size_pinned_memory_cache: 4755566,
733733
size_memory_cache: 0,
734734
}
735735
);

0 commit comments

Comments
 (0)