git.delta.rocks / unique-network / refs/commits / 4657e257e343

difftreelog

Adjust node to new runtimes

Daniel Shiposha2022-03-05parent: #1f97da5.patch.diff
in: master

6 files changed

modifiednode/cli/Cargo.tomldiffbeforeafterboth
239# Local dependencies239# Local dependencies
240240
241[dependencies.unique-runtime]241[dependencies.unique-runtime]
242path = '../../runtime'242path = '../../runtime/unique'
243optional = true
244
245[dependencies.quartz-runtime]
246path = '../../runtime/quartz'
247optional = true
248
249[dependencies.opal-runtime]
250path = '../../runtime/opal'
251optional = true
243252
244[dependencies.up-data-structs]253[dependencies.up-data-structs]
245path = "../../primitives/data-structs"254path = "../../primitives/data-structs"
283fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }292fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
284pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }293pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
285294
286unique-rpc = { path = "../rpc" }295unique-rpc = { default-features = false, path = "../rpc" }
287296
288[features]297[features]
289default = []298default = ["unique-runtime"]
290runtime-benchmarks = [299runtime-benchmarks = [
291 'unique-runtime/runtime-benchmarks',300 'unique-runtime/runtime-benchmarks',
292 'polkadot-service/runtime-benchmarks',301 'polkadot-service/runtime-benchmarks',
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17use cumulus_primitives_core::ParaId;17use cumulus_primitives_core::ParaId;
18use unique_runtime::*;
19use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};18use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
20use sc_service::ChainType;19use sc_service::ChainType;
21use sp_core::{sr25519, Pair, Public};20use sp_core::{sr25519, Pair, Public};
25use serde::{Deserialize, Serialize};24use serde::{Deserialize, Serialize};
26use serde_json::map::Map;25use serde_json::map::Map;
26
27#[cfg(feature = "unique-runtime")]
28use unique_runtime as runtime;
29
30#[cfg(feature = "quartz-runtime")]
31use quartz_runtime as runtime;
32
33#[cfg(feature = "opal-runtime")]
34use opal_runtime as runtime;
35
36use runtime::{*, opaque::*};
2737
28/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.38/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
29pub type ChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;39pub type ChainSpec = sc_service::GenericChainSpec<runtime::GenesisConfig, Extensions>;
3040
31/// Helper function to generate a crypto pair from seed41/// Helper function to generate a crypto pair from seed
32pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {42pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
217 id: ParaId,227 id: ParaId,
218) -> GenesisConfig {228) -> GenesisConfig {
219 GenesisConfig {229 GenesisConfig {
220 system: unique_runtime::SystemConfig {230 system: runtime::SystemConfig {
221 code: unique_runtime::WASM_BINARY231 code: runtime::WASM_BINARY
222 .expect("WASM binary was not build, please build it!")232 .expect("WASM binary was not build, please build it!")
223 .to_vec(),233 .to_vec(),
224 },234 },
235 key: Some(root_key),245 key: Some(root_key),
236 },246 },
237 vesting: VestingConfig { vesting: vec![] },247 vesting: VestingConfig { vesting: vec![] },
238 parachain_info: unique_runtime::ParachainInfoConfig { parachain_id: id },248 parachain_info: runtime::ParachainInfoConfig { parachain_id: id },
239 parachain_system: Default::default(),249 parachain_system: Default::default(),
240 aura: unique_runtime::AuraConfig {250 aura: runtime::AuraConfig {
241 authorities: initial_authorities,251 authorities: initial_authorities,
242 },252 },
243 aura_ext: Default::default(),253 aura_ext: Default::default(),
modifiednode/cli/src/command.rsdiffbeforeafterboth
41use cumulus_primitives_core::ParaId;41use cumulus_primitives_core::ParaId;
42use cumulus_client_service::genesis::generate_genesis_block;42use cumulus_client_service::genesis::generate_genesis_block;
43use log::info;43use log::info;
44use unique_runtime::Block;
45use polkadot_parachain::primitives::AccountIdConversion;44use polkadot_parachain::primitives::AccountIdConversion;
46use sc_cli::{45use sc_cli::{
47 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,46 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
54use sp_runtime::traits::Block as BlockT;53use sp_runtime::traits::Block as BlockT;
55use std::{io::Write, net::SocketAddr};54use std::{io::Write, net::SocketAddr};
55
56#[cfg(feature = "unique-runtime")]
57use unique_runtime as runtime;
58
59#[cfg(feature = "quartz-runtime")]
60use quartz_runtime as runtime;
61
62#[cfg(feature = "opal-runtime")]
63use opal_runtime as runtime;
64
65use runtime::Block;
5666
57fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {67fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
58 Ok(match id {68 Ok(match id {
104 }114 }
105115
106 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {116 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
107 &unique_runtime::VERSION117 &runtime::VERSION
108 }118 }
109}119}
110120
modifiednode/cli/src/service.rsdiffbeforeafterboth
2626
27use unique_rpc::overrides_handle;27use unique_rpc::overrides_handle;
28// Local Runtime Types28// Local Runtime Types
29#[cfg(feature = "unique-runtime")]
30use unique_runtime as runtime;
31
32#[cfg(feature = "quartz-runtime")]
33use quartz_runtime as runtime;
34
35#[cfg(feature = "opal-runtime")]
36use opal_runtime as runtime;
37
29use unique_runtime::RuntimeApi;38use runtime::RuntimeApi;
3039
31// Cumulus Imports40// Cumulus Imports
32use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};41use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
69 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;78 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
7079
71 fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {80 fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
72 unique_runtime::api::dispatch(method, data)81 runtime::api::dispatch(method, data)
73 }82 }
7483
75 fn native_version() -> sc_executor::NativeVersion {84 fn native_version() -> sc_executor::NativeVersion {
76 unique_runtime::native_version()85 runtime::native_version()
77 }86 }
78}87}
7988
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
51pallet-unique = { path = "../../pallets/unique" }51pallet-unique = { path = "../../pallets/unique" }
52uc-rpc = { path = "../../client/rpc" }52uc-rpc = { path = "../../client/rpc" }
53up-rpc = { path = "../../primitives/rpc" }53up-rpc = { path = "../../primitives/rpc" }
54unique-runtime = { path = "../../runtime" }54unique-runtime = { path = "../../runtime/unique", optional = true }
55quartz-runtime = { path = "../../runtime/quartz", optional = true }
56opal-runtime = { path = "../../runtime/opal", optional = true }
5557
56[features]58[features]
59default = ["unique-runtime"]
57std = []60std = []
5861
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17use sp_runtime::traits::BlakeTwo256;17use sp_runtime::traits::BlakeTwo256;
18use unique_runtime::{Hash, AccountId, CrossAccountId, Index, opaque::Block, BlockNumber, Balance};
19use fc_rpc::{18use fc_rpc::{
20 EthBlockDataCache, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,19 EthBlockDataCache, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,
21 StorageOverride, SchemaV2Override, SchemaV3Override,20 StorageOverride, SchemaV2Override, SchemaV3Override,
41use sc_service::TransactionPool;40use sc_service::TransactionPool;
42use std::{collections::BTreeMap, marker::PhantomData, sync::Arc};41use std::{collections::BTreeMap, marker::PhantomData, sync::Arc};
42
43#[cfg(feature = "unique-runtime")]
44use unique_runtime as runtime;
45
46#[cfg(feature = "quartz-runtime")]
47use quartz_runtime as runtime;
48
49#[cfg(feature = "opal-runtime")]
50use opal_runtime as runtime;
51
52use runtime::opaque::{Hash, AccountId, CrossAccountId, Index, Block, BlockNumber, Balance};
4353
44/// Public io handler for exporting into other modules54/// Public io handler for exporting into other modules
45pub type IoHandler = jsonrpc_core::IoHandler<sc_rpc::Metadata>;55pub type IoHandler = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
231 client.clone(),241 client.clone(),
232 pool.clone(),242 pool.clone(),
233 graph,243 graph,
234 unique_runtime::TransactionConverter,244 runtime::TransactionConverter,
235 network.clone(),245 network.clone(),
236 signers,246 signers,
237 overrides.clone(),247 overrides.clone(),