difftreelog
fix node for release
in: master
5 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6304,7 +6304,7 @@
[[package]]
name = "opal-runtime"
-version = "1.3.0"
+version = "1.9.0"
dependencies = [
"app-promotion-rpc",
"cumulus-pallet-aura-ext",
@@ -10188,7 +10188,7 @@
[[package]]
name = "quartz-runtime"
-version = "1.3.0"
+version = "1.9.0"
dependencies = [
"app-promotion-rpc",
"cumulus-pallet-aura-ext",
@@ -14976,7 +14976,7 @@
[[package]]
name = "unique-node"
-version = "1.3.0"
+version = "1.9.0"
dependencies = [
"app-promotion-rpc",
"clap",
@@ -15063,7 +15063,7 @@
[[package]]
name = "unique-runtime"
-version = "1.3.0"
+version = "1.9.0"
dependencies = [
"app-promotion-rpc",
"cumulus-pallet-aura-ext",
@@ -15210,7 +15210,7 @@
[[package]]
name = "up-common"
-version = "1.3.0"
+version = "1.9.0"
dependencies = [
"cumulus-primitives-core",
"fp-rpc",
node/cli/src/chain_spec.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use default_runtime::WASM_BINARY;18#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]19pub use opal_runtime as default_runtime;20#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]21pub use quartz_runtime as default_runtime;22use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};23use sc_service::ChainType;24use serde::{Deserialize, Serialize};25use serde_json::{json, map::Map};26use sp_core::{sr25519, Pair, Public};27use sp_runtime::traits::{IdentifyAccount, Verify};28#[cfg(feature = "unique-runtime")]29pub use unique_runtime as default_runtime;30use up_common::types::opaque::*;3132/// The `ChainSpec` parameterized for the unique runtime.33#[cfg(feature = "unique-runtime")]34pub type UniqueChainSpec =35 sc_service::GenericChainSpec<unique_runtime::RuntimeGenesisConfig, Extensions>;3637/// The `ChainSpec` parameterized for the quartz runtime.38#[cfg(feature = "quartz-runtime")]39pub type QuartzChainSpec =40 sc_service::GenericChainSpec<quartz_runtime::RuntimeGenesisConfig, Extensions>;4142/// The `ChainSpec` parameterized for the opal runtime.43pub type OpalChainSpec =44 sc_service::GenericChainSpec<opal_runtime::RuntimeGenesisConfig, Extensions>;4546#[cfg(feature = "unique-runtime")]47pub type DefaultChainSpec = UniqueChainSpec;4849#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]50pub type DefaultChainSpec = QuartzChainSpec;5152#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]53pub type DefaultChainSpec = OpalChainSpec;5455#[cfg(not(feature = "unique-runtime"))]56/// PARA_ID for Opal/Sapphire/Quartz57const PARA_ID: u32 = 2095;5859#[cfg(feature = "unique-runtime")]60/// PARA_ID for Unique61const PARA_ID: u32 = 2037;6263pub trait RuntimeIdentification {64 fn runtime_id(&self) -> RuntimeId;65}6667impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {68 fn runtime_id(&self) -> RuntimeId {69 #[cfg(feature = "unique-runtime")]70 if self.id().starts_with("unique") || self.id().starts_with("unq") {71 return RuntimeId::Unique;72 }7374 #[cfg(feature = "quartz-runtime")]75 if self.id().starts_with("quartz")76 || self.id().starts_with("qtz")77 || self.id().starts_with("sapphire")78 {79 return RuntimeId::Quartz;80 }8182 if self.id().starts_with("opal") || self.id() == "dev" || self.id() == "local_testnet" {83 return RuntimeId::Opal;84 }8586 RuntimeId::Unknown(self.id().into())87 }88}8990pub enum ServiceId {91 Prod,92 Dev,93}9495pub trait ServiceIdentification {96 fn service_id(&self) -> ServiceId;97}9899impl ServiceIdentification for Box<dyn sc_service::ChainSpec> {100 fn service_id(&self) -> ServiceId {101 if self.id().ends_with("dev") {102 ServiceId::Dev103 } else {104 ServiceId::Prod105 }106 }107}108109/// Helper function to generate a crypto pair from seed110pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {111 TPublic::Pair::from_string(&format!("//{seed}"), None)112 .expect("static values are valid; qed")113 .public()114}115116/// The extensions for the [`DefaultChainSpec`].117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]118#[serde(deny_unknown_fields)]119pub struct Extensions {120 /// The relay chain of the Parachain.121 pub relay_chain: String,122 /// The id of the Parachain.123 pub para_id: u32,124}125126impl Extensions {127 /// Try to get the extension from the given `ChainSpec`.128 pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {129 sc_chain_spec::get_extension(chain_spec.extensions())130 }131}132133type AccountPublic = <Signature as Verify>::Signer;134135/// Helper function to generate an account ID from seed136pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId137where138 AccountPublic: From<<TPublic::Pair as Pair>::Public>,139{140 AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()141}142143pub fn test_config(chain_id: &str, relay_chain: &str) -> DefaultChainSpec {144 DefaultChainSpec::builder(145 WASM_BINARY.expect("WASM binary was not build, please build it!"),146 Extensions {147 relay_chain: relay_chain.into(),148 para_id: PARA_ID,149 },150 )151 .with_id(&format!(152 "{}_{}",153 default_runtime::VERSION.spec_name,154 chain_id155 ))156 .with_name(&format!(157 "{}{}",158 default_runtime::VERSION.spec_name.to_uppercase(),159 if cfg!(feature = "unique-runtime") {160 ""161 } else {162 " by UNIQUE"163 }164 ))165 .with_properties(chain_properties())166 .with_chain_type(ChainType::Development)167 .with_genesis_config_patch(genesis_patch())168 .build()169}170171fn genesis_patch() -> serde_json::Value {172 use default_runtime::*;173174 let invulnerables = ["Alice", "Bob"];175176 #[allow(unused_mut)]177 let mut patch = json!({178 "parachainInfo": {179 "parachainId": PARA_ID,180 },181182 "aura": {183 "authorities": invulnerables.into_iter()184 .map(get_from_seed::<AuraId>)185 .collect::<Vec<_>>(),186 },187188 // We don't have Session pallet in production anywhere,189 // Adding this config makes baedeker think we have pallet-session, and it tries to190 // reconfigure chain using it, which makes no sense, because then aura knows no191 // authority, as baedeker expects them to be configured by session pallet.192 // "session": {193 // "keys": invulnerables.into_iter()194 // .map(|name| {195 // let account = get_account_id_from_seed::<sr25519::Public>(name);196 // let aura = get_from_seed::<AuraId>(name);197 //198 // (199 // /* account id: */ account.clone(),200 // /* validator id: */ account,201 // /* session keys: */ SessionKeys { aura },202 // )203 // })204 // .collect::<Vec<_>>()205 // },206207 "sudo": {208 "key": get_account_id_from_seed::<sr25519::Public>("Alice"),209 },210211 "balances": {212 "balances": &[213 get_account_id_from_seed::<sr25519::Public>("Alice"),214 get_account_id_from_seed::<sr25519::Public>("Bob"),215 get_account_id_from_seed::<sr25519::Public>("Charlie"),216 get_account_id_from_seed::<sr25519::Public>("Dave"),217 get_account_id_from_seed::<sr25519::Public>("Eve"),218 get_account_id_from_seed::<sr25519::Public>("Ferdie"),219 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),220 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),221 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),222 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),223 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),224 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),225 ].into_iter()226 .map(|k| (k, /* ~1.2e+12 UNQ */ 1u128 << 100))227 .collect::<Vec<_>>(),228 },229 });230231 #[cfg(feature = "unique-runtime")]232 {233 patch234 .as_object_mut()235 .expect("the genesis patch is always an object; qed")236 .remove("session");237 }238239 patch240}241242fn chain_properties() -> sc_chain_spec::Properties {243 let mut properties = Map::new();244 properties.insert("tokenSymbol".into(), default_runtime::TOKEN_SYMBOL.into());245 properties.insert("tokenDecimals".into(), default_runtime::DECIMALS.into());246 properties.insert(247 "ss58Format".into(),248 default_runtime::SS58Prefix::get().into(),249 );250251 properties252}node/cli/src/rpc.rsdiffbeforeafterboth--- a/node/cli/src/rpc.rs
+++ b/node/cli/src/rpc.rs
@@ -43,18 +43,13 @@
type FullBackend = sc_service::TFullBackend<Block>;
/// Full client dependencies.
-pub struct FullDeps<C, P, SC> {
+pub struct FullDeps<C, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
- /// The SelectChain Strategy
- pub select_chain: SC,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
-
- /// Runtime identification (read from the chain spec)
- pub runtime_id: RuntimeId,
/// Executor params for PoV estimating
#[cfg(feature = "pov-estimate")]
pub exec_params: uc_rpc::pov_estimate::ExecutorParams,
@@ -64,9 +59,9 @@
}
/// Instantiate all Full RPC extensions.
-pub fn create_full<C, P, SC, R, B>(
+pub fn create_full<C, P, R, B>(
io: &mut RpcModule<()>,
- deps: FullDeps<C, P, SC>,
+ deps: FullDeps<C, P>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>
where
C: ProvideRuntimeApi<Block> + StorageProvider<Block, B> + AuxStore,
@@ -93,10 +88,7 @@
let FullDeps {
client,
pool,
- select_chain: _,
deny_unsafe,
-
- runtime_id: _,
#[cfg(feature = "pov-estimate")]
exec_params,
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -36,8 +36,8 @@
use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
use cumulus_client_consensus_proposer::Proposer;
use cumulus_client_service::{
- build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, DARecoveryProfile,
- StartRelayChainTasksParams,
+ build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,
+ CollatorSybilResistance, DARecoveryProfile, StartRelayChainTasksParams,
};
use cumulus_primitives_core::ParaId;
use cumulus_primitives_parachain_inherent::ParachainInherentData;
@@ -85,10 +85,7 @@
use cumulus_primitives_core::PersistedValidationData;
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
-use crate::{
- chain_spec::RuntimeIdentification,
- rpc::{create_eth, create_full, EthDeps, FullDeps},
-};
+use crate::rpc::{create_eth, create_full, EthDeps, FullDeps};
/// Unique native executor instance.
#[cfg(feature = "unique-runtime")]
@@ -238,7 +235,7 @@
pub trait LookaheadApiDep: cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> {}
);
-fn ethereum_parachain_inherent() -> ParachainInherentData {
+fn ethereum_parachain_inherent() -> (sp_timestamp::InherentDataProvider, ParachainInherentData) {
let (relay_parent_storage_root, relay_chain_state) =
RelayStateSproofBuilder::default().into_state_root_and_proof();
let vfp = PersistedValidationData {
@@ -249,12 +246,15 @@
..Default::default()
};
- ParachainInherentData {
- validation_data: vfp,
- relay_chain_state,
- downward_messages: Default::default(),
- horizontal_messages: Default::default(),
- }
+ (
+ sp_timestamp::InherentDataProvider::from_system_time(),
+ ParachainInherentData {
+ validation_data: vfp,
+ relay_chain_state,
+ downward_messages: Default::default(),
+ horizontal_messages: Default::default(),
+ },
+ )
}
/// Starts a `ServiceBuilder` for a full service.
@@ -426,34 +426,26 @@
.await
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;
- // Aura is sybil-resistant, collator-selection is generally too.
- let block_announce_validator =
- cumulus_client_network::AssumeSybilResistance::allow_seconded_messages();
-
let validator = parachain_config.role.is_authority();
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
- sc_service::build_network(sc_service::BuildNetworkParams {
- config: ¶chain_config,
+ cumulus_client_service::build_network(cumulus_client_service::BuildNetworkParams {
+ parachain_config: ¶chain_config,
net_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
+ para_id,
spawn_handle: task_manager.spawn_handle(),
+ relay_chain_interface: relay_chain_interface.clone(),
import_queue: params.import_queue,
- block_announce_validator_builder: Some(Box::new(|_| {
- Box::new(block_announce_validator)
- })),
- warp_sync_params: None,
- block_relay: None,
- })?;
-
- let select_chain = params.select_chain.clone();
+ // Aura is sybil-resistant, collator-selection is generally too.
+ sybil_resistance_level: CollatorSybilResistance::Resistant,
+ })
+ .await?;
- let runtime_id = parachain_config.chain_spec.runtime_id();
-
// Frontier
let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));
let fee_history_limit = 2048;
@@ -505,9 +497,7 @@
fee_history_cache,
eth_block_data_cache,
network,
- runtime_id,
transaction_pool,
- select_chain,
overrides,
);
@@ -518,7 +508,6 @@
let full_deps = FullDeps {
client: client.clone(),
- runtime_id,
#[cfg(feature = "pov-estimate")]
exec_params: uc_rpc::pov_estimate::ExecutorParams {
@@ -533,10 +522,9 @@
deny_unsafe,
pool: transaction_pool.clone(),
- select_chain,
};
- create_full::<_, _, _, Runtime, _>(&mut rpc_handle, full_deps)?;
+ create_full::<_, _, Runtime, _>(&mut rpc_handle, full_deps)?;
let eth_deps = EthDeps {
client,
@@ -557,7 +545,7 @@
overrides,
sync: sync_service.clone(),
pending_create_inherent_data_providers: |_, ()| async move {
- Ok((ethereum_parachain_inherent(),))
+ Ok(ethereum_parachain_inherent())
},
};
@@ -1040,8 +1028,6 @@
#[cfg(feature = "pov-estimate")]
let rpc_backend = backend.clone();
-
- let runtime_id = config.chain_spec.runtime_id();
// Frontier
let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));
@@ -1094,9 +1080,7 @@
fee_history_cache,
eth_block_data_cache,
network,
- runtime_id,
transaction_pool,
- select_chain,
overrides,
);
@@ -1106,8 +1090,6 @@
let mut rpc_module = RpcModule::new(());
let full_deps = FullDeps {
- runtime_id,
-
#[cfg(feature = "pov-estimate")]
exec_params: uc_rpc::pov_estimate::ExecutorParams {
wasm_method: config.wasm_method,
@@ -1122,10 +1104,9 @@
deny_unsafe,
client: client.clone(),
pool: transaction_pool.clone(),
- select_chain,
};
- create_full::<_, _, _, Runtime, _>(&mut rpc_module, full_deps)?;
+ create_full::<_, _, Runtime, _>(&mut rpc_module, full_deps)?;
let eth_deps = EthDeps {
client,
@@ -1147,7 +1128,7 @@
sync: sync_service.clone(),
// We don't have any inherents except parachain built-ins, which we can't even extract from inside `run_aura`.
pending_create_inherent_data_providers: |_, ()| async move {
- Ok((ethereum_parachain_inherent(),))
+ Ok(ethereum_parachain_inherent())
},
};
runtime/common/config/substrate.rsdiffbeforeafterboth--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -15,6 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use frame_support::{
+ derive_impl,
dispatch::DispatchClass,
ord_parameter_types, parameter_types,
traits::{
@@ -42,8 +43,8 @@
use crate::{
runtime_common::DealWithFees, Balances, Block, OriginCaller, PalletInfo, Runtime, RuntimeCall,
- RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, SS58Prefix, System,
- Treasury, Version,
+ RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, SS58Prefix,
+ System, Treasury, Version,
};
parameter_types! {
@@ -72,13 +73,12 @@
.build_or_panic();
}
+#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
- /// The basic call filter to use in dispatchable.
- type BaseCallFilter = Everything;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = BlockHashCount;
/// The block type.
@@ -87,12 +87,8 @@
type BlockLength = RuntimeBlockLength;
/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.
type BlockWeights = RuntimeBlockWeights;
- /// The aggregated dispatch type that is available for extrinsics.
- type RuntimeCall = RuntimeCall;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
- /// The ubiquitous event type.
- type RuntimeEvent = RuntimeEvent;
/// The type for hashing blocks and tries.
type Hash = Hash;
/// The hashing algorithm used.
@@ -101,10 +97,6 @@
type Nonce = Nonce;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
- /// What to do if an account is fully reaped from the system.
- type OnKilledAccount = ();
- /// What to do if a new account is created.
- type OnNewAccount = ();
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
/// The ubiquitous origin type.
type RuntimeOrigin = RuntimeOrigin;
@@ -117,14 +109,6 @@
/// Version of the runtime.
type Version = Version;
type MaxConsumers = ConstU32<16>;
-
- type RuntimeTask = ();
-
- type SingleBlockMigrations = ();
- type MultiBlockMigrator = ();
- type PreInherents = ();
- type PostInherents = ();
- type PostTransactions = ();
}
parameter_types! {