diff --git a/Cargo.lock b/Cargo.lock index 0de0e603317..6bd767fe549 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -634,7 +634,17 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5a26c53ddf60281f18e7a29b20db7ba3db82a9d81b9650bfaa02d646f50d364" dependencies = [ - "borsh-derive", + "borsh-derive 0.8.1", + "hashbrown", +] + +[[package]] +name = "borsh" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fcabb02816fdadf90866dc9a7824491ccb63d69f55375a266dc03509ac68d36" +dependencies = [ + "borsh-derive 0.9.0", "hashbrown", ] @@ -644,8 +654,21 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b637a47728b78a78cd7f4b85bf06d71ef4221840e059a38f048be2422bf673b2" dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", + "borsh-derive-internal 0.8.1", + "borsh-schema-derive-internal 0.8.1", + "proc-macro-crate", + "proc-macro2 1.0.24", + "syn 1.0.60", +] + +[[package]] +name = "borsh-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd16f0729b89f0a212b0e2e1d19cc6593df63f771161a11863967780e2d033d" +dependencies = [ + "borsh-derive-internal 0.9.0", + "borsh-schema-derive-internal 0.9.0", "proc-macro-crate", "proc-macro2 1.0.24", "syn 1.0.60", @@ -662,6 +685,17 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "borsh-derive-internal" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e321a130a3ac4b88eb59a6d670bde11eec9721a397b77e0f2079060e2a1b785" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.60", +] + [[package]] name = "borsh-schema-derive-internal" version = "0.8.1" @@ -673,6 +707,17 @@ dependencies = [ "syn 1.0.60", ] +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15151a485164b319cc7a5160fe4316dc469a27993f71b73d7617dc9032ff0fd7" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.60", +] + [[package]] name = "brotli-sys" version = "0.3.2" @@ -2040,7 +2085,7 @@ dependencies = [ name = "genesis-populate" version = "0.1.0" dependencies = [ - "borsh", + "borsh 0.8.1", "byteorder", "clap 2.33.3", "indicatif 0.15.0", @@ -2746,7 +2791,7 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" name = "loadtester" version = "0.1.0" dependencies = [ - "borsh", + "borsh 0.8.1", "byteorder", "clap 2.33.3", "env_logger", @@ -3006,7 +3051,7 @@ dependencies = [ name = "near-chain" version = "0.1.0" dependencies = [ - "borsh", + "borsh 0.8.1", "cached", "chrono", "delay-detector", @@ -3063,7 +3108,7 @@ name = "near-chunks" version = "0.1.0" dependencies = [ "actix", - "borsh", + "borsh 0.8.1", "cached", "chrono", "futures", @@ -3087,7 +3132,7 @@ dependencies = [ "actix", "actix-rt", "ansi_term 0.12.1", - "borsh", + "borsh 0.8.1", "cached", "chrono", "delay-detector", @@ -3148,7 +3193,7 @@ version = "0.1.0" dependencies = [ "arrayref", "blake2", - "borsh", + "borsh 0.8.1", "bs58", "c2-chacha", "curve25519-dalek", @@ -3172,7 +3217,7 @@ dependencies = [ name = "near-epoch-manager" version = "0.0.1" dependencies = [ - "borsh", + "borsh 0.8.1", "cached", "chrono", "log", @@ -3195,7 +3240,7 @@ name = "near-evm-runner" version = "0.1.0" dependencies = [ "bn", - "borsh", + "borsh 0.8.1", "byteorder", "criterion", "derivative", @@ -3258,7 +3303,7 @@ dependencies = [ "actix-http", "actix-web", "awc", - "borsh", + "borsh 0.8.1", "easy-ext", "futures", "lazy_static", @@ -3353,7 +3398,7 @@ version = "0.1.0" dependencies = [ "actix", "bencher", - "borsh", + "borsh 0.8.1", "byteorder", "bytes", "bytesize", @@ -3418,7 +3463,7 @@ dependencies = [ name = "near-pool" version = "0.1.0" dependencies = [ - "borsh", + "borsh 0.8.1", "near-crypto", "near-primitives", "rand 0.7.3", @@ -3430,7 +3475,7 @@ version = "0.1.0" dependencies = [ "base64 0.13.0", "bencher", - "borsh", + "borsh 0.8.1", "bs58", "byteorder", "chrono", @@ -3459,7 +3504,7 @@ name = "near-primitives-core" version = "0.1.0" dependencies = [ "base64 0.11.0", - "borsh", + "borsh 0.8.1", "bs58", "derive_more", "hex", @@ -3550,7 +3595,7 @@ name = "near-store" version = "2.2.0" dependencies = [ "bencher", - "borsh", + "borsh 0.8.1", "byteorder", "bytesize", "cached", @@ -3598,7 +3643,7 @@ dependencies = [ name = "near-vm-errors" version = "3.0.0" dependencies = [ - "borsh", + "borsh 0.8.1", "hex", "near-rpc-error-macro", "serde", @@ -3609,7 +3654,7 @@ name = "near-vm-logic" version = "3.0.0" dependencies = [ "base64 0.13.0", - "borsh", + "borsh 0.8.1", "bs58", "byteorder", "near-crypto", @@ -3633,7 +3678,7 @@ dependencies = [ "assert_matches", "base64 0.13.0", "bencher", - "borsh", + "borsh 0.8.1", "cached", "near-evm-runner", "near-primitives", @@ -3686,7 +3731,7 @@ dependencies = [ "actix-rt", "actix_derive", "awc", - "borsh", + "borsh 0.8.1", "byteorder", "chrono", "delay-detector", @@ -3765,7 +3810,7 @@ version = "3.0.0" dependencies = [ "assert_matches", "base64 0.11.0", - "borsh", + "borsh 0.8.1", "byteorder", "ethereum-types 0.11.0", "hex", @@ -4834,7 +4879,7 @@ dependencies = [ name = "runtime-params-estimator" version = "3.0.0" dependencies = [ - "borsh", + "borsh 0.8.1", "cfg-if 1.0.0", "clap 3.0.0-beta.2", "csv", @@ -5287,7 +5332,7 @@ name = "state-viewer" version = "0.1.0" dependencies = [ "ansi_term 0.12.1", - "borsh", + "borsh 0.8.1", "clap 2.33.3", "near-chain", "near-chain-configs", @@ -5543,7 +5588,7 @@ dependencies = [ "actix", "actix-rt", "assert_matches", - "borsh", + "borsh 0.8.1", "byteorder", "clap 2.33.3", "ethabi", @@ -6388,12 +6433,13 @@ dependencies = [ [[package]] name = "wasmer-runtime-core-near" -version = "0.17.4" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08ff9059d479dbff357e1953edbde198453d5421274119230c50754e61e8ec9f" +checksum = "f280f695867a25b7181516167aa660452ffc26772fd5e15c07f6fbbf989d7ba1" dependencies = [ "bincode", "blake3", + "borsh 0.9.0", "cc", "digest 0.8.1", "errno", @@ -6417,9 +6463,9 @@ dependencies = [ [[package]] name = "wasmer-runtime-near" -version = "0.17.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6660e86bc7697fa29bab902214d5b33d394a990826c401b10816bcd285f938f" +checksum = "158e6fff11e5e1ef805af50637374d5bd43d92017beafa18992cdf7f3f7ae3e4" dependencies = [ "lazy_static", "memmap", @@ -6431,11 +6477,12 @@ dependencies = [ [[package]] name = "wasmer-singlepass-backend-near" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3f23543ef8f59667be4945c22eb4b1a50a79ff340555f6f23354223d2695541" +checksum = "5f6edd0ba6c0bcf9b279186d4dbe81649dda3e5ef38f586865943de4dcd653f8" dependencies = [ "bincode", + "borsh 0.9.0", "byteorder", "dynasm", "dynasmrt", @@ -6820,7 +6867,7 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "756e713befb81061c2eb8ad800c9c41ddfa2bbf4ea58da637aff31d47b937bf2" dependencies = [ - "borsh", + "borsh 0.8.1", "byteorder", "crunchy", "lazy_static", diff --git a/core/primitives/src/version.rs b/core/primitives/src/version.rs index 8d0f7ae9292..329d525ad02 100644 --- a/core/primitives/src/version.rs +++ b/core/primitives/src/version.rs @@ -13,7 +13,7 @@ pub struct Version { pub type DbVersion = u32; /// Current version of the database. -pub const DB_VERSION: DbVersion = 25; +pub const DB_VERSION: DbVersion = 26; /// Protocol version type. pub use near_primitives_core::types::ProtocolVersion; diff --git a/core/store/src/migrations.rs b/core/store/src/migrations.rs index 166bd573640..e5749c31b32 100644 --- a/core/store/src/migrations.rs +++ b/core/store/src/migrations.rs @@ -707,6 +707,15 @@ pub fn migrate_21_to_22(path: &String) { set_store_version(&store, 22); } +pub fn migrate_25_to_26(path: &String) { + let store = create_store(path); + let mut store_update = store.store_update(); + store_update.delete_all(DBCol::ColCachedContractCode); + store_update.commit().unwrap(); + + set_store_version(&store, 26); +} + #[cfg(feature = "protocol_feature_block_header_v3")] pub fn migrate_18_to_new_validator_stake(store: &Store) { use near_primitives::epoch_manager::block_info::{BlockInfo, BlockInfoV1}; diff --git a/deny.toml b/deny.toml index 2d8f018c70f..cb536223f00 100644 --- a/deny.toml +++ b/deny.toml @@ -124,6 +124,12 @@ skip = [ # hashbrown uses an older version { name = "ahash", version = "=0.4.7" }, + # zeropool-bn use borsh 0.8.1 + { name = "borsh", version = "=0.8.1" }, + { name = "borsh-derive", version = "=0.8.1" }, + { name = "borsh-derive-internal", version = "=0.8.1" }, + { name = "borsh-schema-derive-internal", version = "=0.8.1" }, + # rocksdb (transitively through clang-sys) uses this as a build # dependency which conflicts with 0.6.7 that wasmer-engine-native # uses. diff --git a/nearcore/src/lib.rs b/nearcore/src/lib.rs index 0f7edd0a12a..95dbb849456 100644 --- a/nearcore/src/lib.rs +++ b/nearcore/src/lib.rs @@ -27,7 +27,8 @@ pub use crate::runtime::NightshadeRuntime; use near_store::migrations::{ fill_col_outcomes_by_hash, fill_col_transaction_refcount, get_store_version, migrate_10_to_11, migrate_11_to_12, migrate_13_to_14, migrate_14_to_15, migrate_17_to_18, migrate_21_to_22, - migrate_6_to_7, migrate_7_to_8, migrate_8_to_9, migrate_9_to_10, set_store_version, + migrate_25_to_26, migrate_6_to_7, migrate_7_to_8, migrate_8_to_9, migrate_9_to_10, + set_store_version, }; #[cfg(feature = "protocol_feature_block_header_v3")] @@ -226,6 +227,10 @@ pub fn apply_store_migrations(path: &String, near_config: &NearConfig) { info!(target: "near", "Migrate DB from version 24 to 25"); migrate_24_to_25(&path); } + if db_version <= 25 { + info!(target: "near", "Migrate DB from version 25 to 26"); + migrate_25_to_26(&path); + } #[cfg(feature = "nightly_protocol")] { let store = create_store(&path); diff --git a/runtime/near-vm-runner-standalone/src/script.rs b/runtime/near-vm-runner-standalone/src/script.rs index 752f6827d09..7ec84db2850 100644 --- a/runtime/near-vm-runner-standalone/src/script.rs +++ b/runtime/near-vm-runner-standalone/src/script.rs @@ -242,6 +242,7 @@ fn test_evm_slow_deserialize_repro() { script.step(contract, "deploy_code").input(input).repeat(3); let res = script.run(); assert_eq!(res.outcomes[0].1, None); + assert_eq!(res.outcomes[1].1, None); } evm_slow_deserialize_repro(VMKind::Wasmer0); diff --git a/runtime/near-vm-runner/Cargo.toml b/runtime/near-vm-runner/Cargo.toml index d2f83753408..354d9885f93 100644 --- a/runtime/near-vm-runner/Cargo.toml +++ b/runtime/near-vm-runner/Cargo.toml @@ -15,8 +15,8 @@ This crate implements the specification of the interface that Near blockchain ex [dependencies] borsh = "0.8.1" serde = { version = "1", features = ["derive"] } -wasmer-runtime = { version="0.17.1", features = ["default-backend-singlepass"], default-features = false, package = "wasmer-runtime-near", optional = true } -wasmer-runtime-core = {version = "0.17.4", package = "wasmer-runtime-core-near", optional = true} +wasmer-runtime = { version = "0.18.0", features = ["default-backend-singlepass"], default-features = false, package = "wasmer-runtime-near", optional = true } +wasmer-runtime-core = { version = "0.18.1", package = "wasmer-runtime-core-near", optional = true} wasmparser = "0.51" wasmer = { version = "1.0.2", optional = true } wasmer-types = { version = "1.0.2", optional = true } diff --git a/runtime/near-vm-runner/src/cache.rs b/runtime/near-vm-runner/src/cache.rs index 3102ee75768..e3388f59056 100644 --- a/runtime/near-vm-runner/src/cache.rs +++ b/runtime/near-vm-runner/src/cache.rs @@ -24,7 +24,10 @@ enum ContractCacheKey { vm_config_non_crypto_hash: u64, vm_kind: VMKind, }, - Version2 { + // unused + _Version2, + // bump to depreciate bincode/serde-bench based wasmer 0.x cache + Version3 { code_hash: CryptoHash, vm_config_non_crypto_hash: u64, vm_kind: VMKind, @@ -52,7 +55,7 @@ pub fn get_contract_cache_key( config: &VMConfig, ) -> CryptoHash { let _span = tracing::debug_span!(target: "vm", "get_key").entered(); - let key = ContractCacheKey::Version2 { + let key = ContractCacheKey::Version3 { code_hash: code.hash, vm_config_non_crypto_hash: config.non_crypto_hash(), vm_kind, diff --git a/runtime/near-vm-runner/src/wasmer_runner.rs b/runtime/near-vm-runner/src/wasmer_runner.rs index 900713c9db0..6b6a68e1afd 100644 --- a/runtime/near-vm-runner/src/wasmer_runner.rs +++ b/runtime/near-vm-runner/src/wasmer_runner.rs @@ -14,7 +14,7 @@ use wasmer_runtime::{ImportObject, Module}; fn check_method(module: &Module, method_name: &str) -> Result<(), VMError> { let info = module.info(); use wasmer_runtime_core::module::ExportIndex::Func; - if let Some(Func(index)) = info.exports.get(method_name) { + if let Some(Func(index)) = info.exports.map.get(method_name) { let func = info.func_assoc.get(index.clone()).unwrap(); let sig = info.signatures.get(func.clone()).unwrap(); if sig.params().is_empty() && sig.returns().is_empty() {