Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime): borsh deserialized wasmer 0.x #4448

Merged
merged 23 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 79 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/primitives/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Version {
pub type DbVersion = u32;

/// Current version of the database.
pub const DB_VERSION: DbVersion = 23;
pub const DB_VERSION: DbVersion = 24;

/// Protocol version type.
pub use near_primitives_core::types::ProtocolVersion;
Expand Down
9 changes: 9 additions & 0 deletions core/store/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,15 @@ pub fn migrate_21_to_22(path: &String) {
set_store_version(&store, 22);
}

pub fn migrate_23_to_24(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, 24);
}
Copy link
Contributor

@matklad matklad Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to just completely bust the precompilation cache at this time, as we haven't yet deployed compilation on contract deployment to the main net, and the code is written in such a way that empty cache causes slowdowns, rather then errors, so testnet should be fine.

That is, it's fine to land this without tackling #4473 first. @bowenwang1996 please veto this if I am mistaken in my assumptions here.

You've already approved this, so I'll auto-merge, but wanted to call this out just in case.


#[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};
Expand Down
6 changes: 6 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,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.
Expand Down
7 changes: 6 additions & 1 deletion nearcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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_23_to_24, 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")]
Expand Down Expand Up @@ -215,6 +216,10 @@ pub fn apply_store_migrations(path: &String, near_config: &NearConfig) {
info!(target: "near", "Migrate DB from version 22 to 23");
migrate_22_to_23(&path, &near_config);
}
if db_version <= 23 {
info!(target: "near", "Migrate DB from version 23 to 24");
migrate_23_to_24(&path);
}
#[cfg(feature = "nightly_protocol")]
{
let store = create_store(&path);
Expand Down
4 changes: 2 additions & 2 deletions runtime/near-vm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ 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 = { version = "0.18.0-pre.1", features = ["default-backend-singlepass"], default-features = false, package = "wasmer-runtime-near", optional = true }
# Always used even for wasmer 1.0 for validating wasm, will be replaced when refactor prepare.rs
wasmer-runtime-core = {version = "0.17.4", package = "wasmer-runtime-core-near" }
wasmer-runtime-core = { version = "0.18.0-pre.1", package = "wasmer-runtime-core-near" }
wasmer = { version = "1.0.2", optional = true }
wasmer-types = { version = "1.0.2", optional = true }
wasmer-compiler-singlepass = { version = "1.0.2", optional = true, default-features = false, features = ["std", "enable-serde"] } # disable `rayon` feature.
Expand Down
Loading