diff --git a/Cargo.lock b/Cargo.lock index 1fe56ab2d..683e472f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -155,13 +155,23 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" +[[package]] +name = "cosmwasm-derive" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de70197a0fe4e402aa260da00ec62d9bf091afe87866e9f3347691d591b60f89" +dependencies = [ + "syn", +] + [[package]] name = "cosmwasm-std" -version = "0.13.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a55b3ed0131c73ecfd4b0f895af4057dcc8a4f54b2691724e37e7a55434143b" +checksum = "02173c4eb78ef76863f5190f60a45278d11e7c8b142327c149e18128b2b97f85" dependencies = [ "base64", + "cosmwasm-derive", "schemars", "serde", "serde-json-wasm", @@ -170,9 +180,9 @@ dependencies = [ [[package]] name = "cosmwasm-vm" -version = "0.13.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20eb7b0b1da641204e4b4fafdb83ef6c91d583033406e3fcceb1e7cfb6f5c9e9" +checksum = "82b69e6ee5fb816fd58796daf2a656b4c1f6b2132e1d189e9de671fe48de4022" dependencies = [ "clru", "cosmwasm-std", @@ -767,17 +777,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "raw-cpuid" -version = "7.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb71f708fe39b2c5e98076204c3cc094ee5a4c12c4cdb119a2b72dc34164f41" -dependencies = [ - "bitflags", - "cc", - "rustc_version", -] - [[package]] name = "rayon" version = "1.5.0" @@ -853,15 +852,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "ryu" version = "1.0.5" @@ -897,21 +887,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.118" @@ -1154,9 +1129,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasmer" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b1ece7c894857344ae93506686ae36ccd867b4ed55819c06d2316d009098d4" +checksum = "a70cfae554988d904d64ca17ab0e7cd652ee5c8a0807094819c1ea93eb9d6866" dependencies = [ "cfg-if 0.1.10", "indexmap", @@ -1178,12 +1153,11 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc85134b257e5fba5870693441e300b601d08f18833ac4fa6934f0b72afc56d2" +checksum = "6b7732a9cab472bd921d5a0c422f45b3d03f62fa2c40a89e0770cef6d47e383e" dependencies = [ "enumset", - "raw-cpuid", "serde", "serde_bytes", "smallvec", @@ -1196,9 +1170,9 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60d68fb05dbe908724901b680070560944d99d04c52c763e98124aa988ac6dd0" +checksum = "48cb9395f094e1d81534f4c5e330ed4cdb424e8df870d29ad585620284f5fddb" dependencies = [ "cranelift-codegen", "cranelift-frontend", @@ -1215,9 +1189,9 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f91c9471113efc731fdd9f54f6fb82fab4c00498281966fcc4a87cdf360ea5" +checksum = "426ae6ef0f606ca815510f3e2ef6f520e217514bfb7a664defe180b9a9e75d07" dependencies = [ "byteorder", "dynasm", @@ -1234,9 +1208,9 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca24205ffdf2d3b1a9c01219f4f3f0a1382658680abe73bc5b146f941adeeb8e" +checksum = "d8b86dcd2c3efdb8390728a2b56f762db07789aaa5aa872a9dc776ba3a7912ed" dependencies = [ "proc-macro-error", "proc-macro2", @@ -1246,9 +1220,9 @@ dependencies = [ [[package]] name = "wasmer-engine" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed16436a9813d92f434e1d40fdf91b45ca30f351a799f793015359acca86b" +checksum = "efe4667d6bd888f26ae8062a63a9379fa697415b4b4e380f33832e8418fd71b5" dependencies = [ "backtrace", "bincode", @@ -1267,9 +1241,9 @@ dependencies = [ [[package]] name = "wasmer-engine-jit" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1e3ca5e34eacd4ab6d9d32edd41b51d2e39cf3d75453611c9c57cee3a64691" +checksum = "26770be802888011b4a3072f2a282fc2faa68aa48c71b3db6252a3937a85f3da" dependencies = [ "bincode", "cfg-if 0.1.10", @@ -1285,9 +1259,9 @@ dependencies = [ [[package]] name = "wasmer-engine-native" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a21d6c5ae0c384ba2f01f598c95b01d4da2eaec3376fb96de2ded38c54143a0" +checksum = "2bb4083a6c69f2cd4b000b82a80717f37c6cc2e536aee3a8ffe9af3edc276a8b" dependencies = [ "bincode", "cfg-if 0.1.10", @@ -1306,9 +1280,9 @@ dependencies = [ [[package]] name = "wasmer-middlewares" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eee5ffe702a61dcbc08d9b2bc899c81f3ccbb77d4e4ef0b65e8913ba582cc6d" +checksum = "547baee2c0733cf436db7d137a8d1f86737a6321fc0fe6cd74caecf6f759c3c4" dependencies = [ "wasmer", "wasmer-types", @@ -1317,9 +1291,9 @@ dependencies = [ [[package]] name = "wasmer-object" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e007e73ec7775aecc61045092dabfcff1e9f228129cd129e76a3e6aae26454" +checksum = "abf8e0c12b82ff81ebecd30d7e118be5fec871d6de885a90eeb105df0a769a7b" dependencies = [ "object", "thiserror", @@ -1329,9 +1303,9 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dbba7a95edb61b40daa43079979fc3212234e1645a15b8c527c36decad59fc6" +checksum = "c7f4ac28c2951cd792c18332f03da523ed06b170f5cf6bb5b1bdd7e36c2a8218" dependencies = [ "cranelift-entity", "serde", @@ -1340,9 +1314,9 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9acd4d53c004a11fcaff17f2a2528ae8f1748c6d5c4aea7d8bed2d9236f0f" +checksum = "a7635ba0b6d2fd325f588d69a950ad9fa04dddbf6ad08b6b2a183146319bf6ae" dependencies = [ "backtrace", "cc", diff --git a/Cargo.toml b/Cargo.toml index 85ecf87ec..6c203abd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,8 +30,8 @@ default = [] backtraces = [] [dependencies] -cosmwasm-std = { version = "0.13.0", features = ["iterator"]} -cosmwasm-vm = { version = "0.13.0", features = ["iterator"] } +cosmwasm-std = { version = "0.13.2", features = ["iterator"]} +cosmwasm-vm = { version = "0.13.2", features = ["iterator"] } errno = "0.2" serde_json = "1.0" thiserror = "1.0" diff --git a/api/libwasmvm.dylib b/api/libwasmvm.dylib index 033ac55df..db916e8a7 100755 Binary files a/api/libwasmvm.dylib and b/api/libwasmvm.dylib differ diff --git a/api/libwasmvm.so b/api/libwasmvm.so index 161b40040..e1e9fb605 100755 Binary files a/api/libwasmvm.so and b/api/libwasmvm.so differ diff --git a/src/iterator.rs b/src/iterator.rs index c7734da9f..c523ead0c 100644 --- a/src/iterator.rs +++ b/src/iterator.rs @@ -78,6 +78,10 @@ impl GoIter { } } + // In this block, we use Buffer::read() for both `key_buf` and `value_buf` + // in order to preserve the behaviour for optional values. Buffer::consume() + // does not return an Option. Since we `return` in none of the cases, we can + // cleanup afterwards. With CosmWasm 0.14 this code is completely refactored. let okey = unsafe { key_buf.read() }; let result = match okey { Some(key) => { @@ -92,6 +96,11 @@ impl GoIter { } None => Ok(None), }; + + // Clean up memory allocations created by us + let _key = unsafe { key_buf.consume() }; + let _value = unsafe { value_buf.consume() }; + (result, gas_info) } }