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

chore: update backend to latest substrate #2169

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2,901 changes: 1,891 additions & 1,010 deletions rust/Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions rust/db_handling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ definitions = {path = "../definitions", default-features = false}
qrcode_rtx = {path = "../qrcode_rtx", default-features = false}
hex = {version = "0.4.3"}
lazy_static = "1.4.0"
parity-scale-codec = {version = "3.6.8", features = ["derive"]}
parity-scale-codec = {version = "3.6.5", features = ["derive"]}
regex = "1.10.2"
sled = "0.34.6"
sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"], optional = true}
sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false, optional = true}
sp-core = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"], optional = true}
sp-runtime = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false, optional = true}
thiserror = "1.0.50"
time = {version = "0.3.30", features = ["formatting", "macros"]}
tiny-bip39 = {version = "1.0.0", default-features = false, optional = true}
Expand Down
4 changes: 2 additions & 2 deletions rust/defaults/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ edition = "2021"
definitions = {path = "../definitions", default-features = false, optional = true}
lazy_static = {version = "1.4.0", optional = true}
regex = {version = "1.10.2", optional = true}
sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"]}
sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false}
sp-core = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"]}
sp-runtime = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false}
thiserror = "1.0.50"

[features]
Expand Down
18 changes: 8 additions & 10 deletions rust/definitions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,22 @@ edition = "2021"
frame-metadata = {version = "16.0.0", features = ["std", "legacy"]}
hex = "0.4.3"
libsecp256k1 = "0.7.1"
parity-scale-codec = {version = "3.6.8", features = ["derive"]}
sc-executor-common = {git = "https://github.com/paritytech/substrate"}
sc-executor-wasmi = {git = "https://github.com/paritytech/substrate", optional = true}
parity-scale-codec = {version = "3.6.5", features = ["derive"]}
sc-executor-common = {git = "https://github.com/paritytech/polkadot-sdk"}
sc-executor-wasmtime = {git = "https://github.com/paritytech/polkadot-sdk", optional = true}
sled = "0.34.6"
sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"]}
sp-io = {git = "https://github.com/paritytech/substrate", optional = true}
sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false}
sp-version = {git = "https://github.com/paritytech/substrate"}
sp-wasm-interface = {git = "https://github.com/paritytech/substrate", optional = true}
sp-core = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"]}
sp-io = {git = "https://github.com/paritytech/polkadot-sdk", optional = true}
sp-runtime = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false}
sp-version = {git = "https://github.com/paritytech/polkadot-sdk"}
thiserror = "1.0.50"
constants = {path = "../constants"}

[features]
default = []
active = [
"sc-executor-wasmi",
"sc-executor-wasmtime",
"sp-io",
"sp-wasm-interface",
]

[lib]
Expand Down
26 changes: 19 additions & 7 deletions rust/definitions/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@

use frame_metadata::{decode_different::DecodeDifferent, v14::RuntimeMetadataV14, RuntimeMetadata};
use parity_scale_codec::{Decode, Encode};
use sc_executor_common::wasm_runtime::DEFAULT_HEAP_ALLOC_STRATEGY;
#[cfg(feature = "active")]
use sc_executor_common::{
runtime_blob::RuntimeBlob,
wasm_runtime::{InvokeMethod, WasmModule},
};
#[cfg(feature = "active")]
use sc_executor_wasmi::create_runtime;
use sc_executor_wasmtime::create_runtime;
use sc_executor_wasmtime::{Config, InstantiationStrategy, Semantics};
use sled::IVec;
#[cfg(feature = "active")]
use sp_core::H256;
#[cfg(feature = "active")]
use sp_io::SubstrateHostFunctions;
use sp_version::RuntimeVersion;
#[cfg(feature = "active")]
use sp_wasm_interface::HostFunctions;
use std::collections::HashMap;

#[cfg(feature = "active")]
Expand Down Expand Up @@ -171,11 +171,23 @@ impl MetaValues {
pub fn convert_wasm_into_metadata(filename: &str) -> Result<Vec<u8>> {
let buffer = std::fs::read(filename).map_err(Wasm::File)?;
let runtime_blob = RuntimeBlob::uncompress_if_needed(&buffer).map_err(Wasm::WasmError)?;
let wasmi_runtime = create_runtime(
let wasmi_runtime = create_runtime::<SubstrateHostFunctions>(
runtime_blob,
64,
SubstrateHostFunctions::host_functions(),
false,
Config {
allow_missing_func_imports: false,
cache_path: None,
semantics: Semantics {
instantiation_strategy: InstantiationStrategy::PoolingCopyOnWrite,
heap_alloc_strategy: DEFAULT_HEAP_ALLOC_STRATEGY,
deterministic_stack_limit: None,
canonicalize_nans: false,
parallel_compilation: true,
wasm_multi_value: false,
wasm_bulk_memory: false,
wasm_reference_types: false,
wasm_simd: false,
},
},
)
.map_err(Wasm::WasmError)?;
let mut wasmi_instance = wasmi_runtime.new_instance().map_err(Wasm::Executor)?;
Expand Down
8 changes: 4 additions & 4 deletions rust/generate_message/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ definitions = {path = "../definitions", default-features = false, features = ["a
hex = "0.4.3"
jsonrpsee = {version = "0.20.3", features = ["ws-client"]}
lazy_static = "1.4.0"
parity-scale-codec = "3.6.8"
parity-scale-codec = "3.6.5"
qrcode_rtx = {path = "../qrcode_rtx"}
regex = "1.10.2"
serde_json = "1.0.108"
sled = "0.34.6"
sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"]}
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false }
sp-keyring = { git = "https://github.com/paritytech/substrate", default-features = false }
sp-core = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"]}
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false }
sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false }
thiserror = "1.0.50"
tokio = { version = "1", features = ["full"] }

Expand Down
6 changes: 3 additions & 3 deletions rust/navigator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ db_handling = {path = "../db_handling", default-features = false }
definitions = {path = "../definitions", default-features = false }
hex = "0.4.3"
lazy_static = "1.4.0"
sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false}
sp-runtime = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false}
thiserror = "1.0.50"
transaction_parsing = {path = "../transaction_parsing"}
transaction_signing = {path = "../transaction_signing"}
zeroize = { version = "1.6.0", features = ["std"] }
qrcode_rtx = { path = "../qrcode_rtx" }
parity-scale-codec = "3.6.8"
parity-scale-codec = "3.6.5"
sled = "0.34"
log = "0.4"

Expand All @@ -25,7 +25,7 @@ pretty_assertions = "1"
tempfile = "3.8"
regex = { version = "1.10.2" }

sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"] }

constants = { path = "../constants" }
parser = { path = "../parser", default-features = false }
Expand Down
8 changes: 4 additions & 4 deletions rust/parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ frame-metadata = { version = "16.0.0", default-features = false, features = ["st
hex = "0.4.3"
lazy_static = "1.4.0"
num-bigint = "0.4.4"
parity-scale-codec = {version = "3.6.8", features = ["derive", "bit-vec"]}
parity-scale-codec = {version = "3.6.5", features = ["derive", "bit-vec"]}
printing_balance = {path = "../printing_balance"}
regex = "1.10.2"
scale-info = "2.10.0"
sp-arithmetic = {git = "https://github.com/paritytech/substrate"}
sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"]}
sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false}
sp-arithmetic = {git = "https://github.com/paritytech/polkadot-sdk"}
sp-core = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"]}
sp-runtime = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false}
thiserror = "1.0.50"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions rust/signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ uniffi = { version = "0.22.0" }
lazy_static = "1.4.0"
sled = "0.34"

sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"] }

db_handling = { path = "../db_handling", default-features = false }
definitions = { path = "../definitions", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions rust/transaction_parsing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ db_handling = {path = "../db_handling", default-features = false }
definitions = {path = "../definitions", default-features = false }
frame-metadata = {version = "16.0.0", default-features = false}
hex = "0.4.3"
parity-scale-codec = "3.6.8"
parity-scale-codec = "3.6.5"
parser = {path = "../parser", default-features = false}
sled = "0.34.6"
sp-core = {git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"]}
sp-runtime = {git = "https://github.com/paritytech/substrate", default-features = false}
sp-core = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"]}
sp-runtime = {git = "https://github.com/paritytech/polkadot-sdk", default-features = false}
thiserror = "1.0.50"
nom = "7.1.3"
log = "0.4"
Expand Down
6 changes: 3 additions & 3 deletions rust/transaction_signing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ edition = "2021"

[dependencies]
hex = "0.4.3"
parity-scale-codec = "3.6.8"
parity-scale-codec = "3.6.5"
zeroize = { version = "1.6.0", features = ["std"] }

definitions = { path = "../definitions", default-features = false }
db_handling = { path = "../db_handling", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false }
thiserror = "1.0.50"
anyhow = "1.0.75"
sled = "0.34"
Expand Down
Loading