diff --git a/Cargo.toml b/Cargo.toml index 371d1f8a..853ef0cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,6 +77,7 @@ sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } +sp-wasm-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0" } substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0" } substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0" } diff --git a/template/node/Cargo.toml b/template/node/Cargo.toml index 601e1239..460a0067 100644 --- a/template/node/Cargo.toml +++ b/template/node/Cargo.toml @@ -48,10 +48,12 @@ sp-block-builder = { workspace = true } sp-core = { workspace = true } sp-consensus-aura = { workspace = true } sp-consensus-grandpa = { workspace = true } +sp-io = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } sp-timestamp = { workspace = true } sp-transaction-pool = { workspace = true } +sp-wasm-interface = { workspace = true } substrate-frame-rpc-system = { workspace = true } # Horizon diff --git a/template/node/src/chain_spec.rs b/template/node/src/chain_spec.rs index 8df14957..fb28807c 100644 --- a/template/node/src/chain_spec.rs +++ b/template/node/src/chain_spec.rs @@ -17,6 +17,7 @@ // along with this program. If not, see . use horizon_template_runtime::{AccountId, RuntimeGenesisConfig, Signature, WASM_BINARY}; +use sc_chain_spec::NoExtension; use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_consensus_grandpa::AuthorityId as GrandpaId; @@ -27,7 +28,8 @@ use sp_runtime::traits::{IdentifyAccount, Verify}; // const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. -pub type ChainSpec = sc_service::GenericChainSpec; +pub type ChainSpec = + sc_service::GenericChainSpec; /// Generate a crypto pair from seed. pub fn get_from_seed(seed: &str) -> ::Public { @@ -107,15 +109,10 @@ fn testnet_genesis( _enable_println: bool, ) -> serde_json::Value { serde_json::json!({ - // Configure endowed accounts with initial balance of (1 << 52) - (1 << 50). "balances": { - "balances": endowed_accounts - .iter() - .cloned() - .map(|k| (k, (1u64 << 52) - (1u64 << 50))) - .collect::>(), + "balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::>(), }, - "cosmos_accounts": { + "cosmosAccounts": { "accounts": endowed_accounts.iter().cloned().map(|k| k.clone()).collect::>(), }, "aura": { diff --git a/template/node/src/service.rs b/template/node/src/service.rs index 53370fd6..e0a2c819 100644 --- a/template/node/src/service.rs +++ b/template/node/src/service.rs @@ -21,30 +21,18 @@ use horizon_template_runtime::{self, opaque::Block, RuntimeApi}; use sc_client_api::{Backend, BlockBackend}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_consensus_grandpa::SharedVoterState; -pub use sc_executor::NativeElseWasmExecutor; +use sc_executor::WasmExecutor; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; use std::{sync::Arc, time::Duration}; -// Our native executor instance. -pub struct ExecutorDispatch; - -impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { - type ExtendHostFunctions = hp_io::crypto::HostFunctions; - - fn dispatch(method: &str, data: &[u8]) -> Option> { - horizon_template_runtime::api::dispatch(method, data) - } - - fn native_version() -> sc_executor::NativeVersion { - horizon_template_runtime::native_version() - } -} - -pub(crate) type FullClient = - sc_service::TFullClient>; +pub(crate) type FullClient = sc_service::TFullClient< + Block, + RuntimeApi, + WasmExecutor<(sp_io::SubstrateHostFunctions, hp_io::crypto::HostFunctions)>, +>; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; @@ -85,7 +73,7 @@ pub fn new_partial( }) .transpose()?; - let executor = sc_service::new_native_or_wasm_executor(config); + let executor = sc_service::new_wasm_executor(config); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::(