mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
Merge commit 'f9c24ef0db390c355241445af37a5c7999a7dc66' into hc-bump-bridges-subtree-take-2
This commit is contained in:
@@ -12,6 +12,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
[dependencies]
|
||||
jsonrpc-core = "15.1.0"
|
||||
structopt = "0.3.21"
|
||||
serde_json = "1.0.59"
|
||||
|
||||
# Bridge dependencies
|
||||
|
||||
@@ -47,6 +48,7 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
@@ -19,6 +19,7 @@ use rialto_runtime::{
|
||||
AccountId, AuraConfig, BalancesConfig, BridgeKovanConfig, BridgeRialtoPoAConfig, GenesisConfig, GrandpaConfig,
|
||||
SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
|
||||
};
|
||||
use serde_json::json;
|
||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
use sp_core::{sr25519, Pair, Public};
|
||||
use sp_finality_grandpa::AuthorityId as GrandpaId;
|
||||
@@ -67,6 +68,18 @@ pub fn get_authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) {
|
||||
impl Alternative {
|
||||
/// Get an actual chain config from one of the alternatives.
|
||||
pub(crate) fn load(self) -> ChainSpec {
|
||||
let properties = Some(
|
||||
json!({
|
||||
"tokenDecimals": 9,
|
||||
"tokenSymbol": "RLT",
|
||||
"bridgeIds": {
|
||||
"Millau": bp_runtime::MILLAU_BRIDGE_INSTANCE,
|
||||
}
|
||||
})
|
||||
.as_object()
|
||||
.expect("Map given; qed")
|
||||
.clone(),
|
||||
);
|
||||
match self {
|
||||
Alternative::Development => ChainSpec::from_genesis(
|
||||
"Development",
|
||||
@@ -81,6 +94,9 @@ impl Alternative {
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
)),
|
||||
],
|
||||
true,
|
||||
)
|
||||
@@ -88,7 +104,7 @@ impl Alternative {
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
properties,
|
||||
None,
|
||||
),
|
||||
Alternative::LocalTestnet => ChainSpec::from_genesis(
|
||||
@@ -126,9 +142,15 @@ impl Alternative {
|
||||
rialto_runtime::Runtime,
|
||||
pallet_bridge_messages::DefaultInstance,
|
||||
>::relayer_fund_account_id(),
|
||||
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
)),
|
||||
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
)),
|
||||
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
|
||||
)),
|
||||
],
|
||||
true,
|
||||
)
|
||||
@@ -136,7 +158,7 @@ impl Alternative {
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
properties,
|
||||
None,
|
||||
),
|
||||
}
|
||||
@@ -155,11 +177,11 @@ fn testnet_genesis(
|
||||
) -> GenesisConfig {
|
||||
GenesisConfig {
|
||||
frame_system: SystemConfig {
|
||||
code: WASM_BINARY.to_vec(),
|
||||
code: WASM_BINARY.expect("Rialto development WASM not available").to_vec(),
|
||||
changes_trie_config: Default::default(),
|
||||
},
|
||||
pallet_balances: BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 40)).collect(),
|
||||
},
|
||||
pallet_aura: AuraConfig {
|
||||
authorities: Vec::new(),
|
||||
|
||||
@@ -63,7 +63,7 @@ pub enum Subcommand {
|
||||
Revert(sc_cli::RevertCmd),
|
||||
|
||||
/// Inspect blocks or extrinsics.
|
||||
Inspect(node_inspect::cli::InspectCmd),
|
||||
Inspect(node_inspect::cli::InspectKeyCmd),
|
||||
|
||||
/// Benchmark runtime pallets.
|
||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||
|
||||
@@ -37,8 +37,8 @@ use sc_finality_grandpa::SharedVoterState;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
||||
use sc_telemetry::{Telemetry, TelemetryWorker};
|
||||
use sp_consensus::SlotData;
|
||||
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
||||
use sp_inherents::InherentDataProviders;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -80,7 +80,6 @@ pub fn new_partial(
|
||||
if config.keystore_remote.is_some() {
|
||||
return Err(ServiceError::Other("Remote Keystores are not supported.".to_string()));
|
||||
}
|
||||
let inherent_data_providers = InherentDataProviders::new();
|
||||
|
||||
let telemetry = config
|
||||
.telemetry_endpoints
|
||||
@@ -124,14 +123,24 @@ pub fn new_partial(
|
||||
let aura_block_import =
|
||||
sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(grandpa_block_import.clone(), client.clone());
|
||||
|
||||
let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(ImportQueueParams {
|
||||
let slot_duration = sc_consensus_aura::slot_duration(&*client)?.slot_duration();
|
||||
|
||||
let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams {
|
||||
block_import: aura_block_import.clone(),
|
||||
justification_import: Some(Box::new(grandpa_block_import)),
|
||||
client: client.clone(),
|
||||
inherent_data_providers: inherent_data_providers.clone(),
|
||||
create_inherent_data_providers: move |_, ()| async move {
|
||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||
|
||||
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
|
||||
*timestamp,
|
||||
slot_duration,
|
||||
);
|
||||
|
||||
Ok((timestamp, slot))
|
||||
},
|
||||
spawner: &task_manager.spawn_essential_handle(),
|
||||
can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
|
||||
slot_duration: sc_consensus_aura::slot_duration(&*client)?,
|
||||
registry: config.prometheus_registry(),
|
||||
check_for_equivocation: Default::default(),
|
||||
telemetry: telemetry.as_ref().map(|x| x.handle()),
|
||||
@@ -145,7 +154,6 @@ pub fn new_partial(
|
||||
keystore_container,
|
||||
select_chain,
|
||||
transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (aura_block_import, grandpa_link, telemetry),
|
||||
})
|
||||
}
|
||||
@@ -167,7 +175,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
mut keystore_container,
|
||||
select_chain,
|
||||
transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (block_import, grandpa_link, mut telemetry),
|
||||
} = new_partial(&config)?;
|
||||
|
||||
@@ -278,13 +285,24 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
|
||||
let can_author_with = sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
|
||||
|
||||
let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _>(StartAuraParams {
|
||||
slot_duration: sc_consensus_aura::slot_duration(&*client)?,
|
||||
client: client.clone(),
|
||||
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
|
||||
let raw_slot_duration = slot_duration.slot_duration();
|
||||
let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _>(StartAuraParams {
|
||||
slot_duration,
|
||||
client,
|
||||
select_chain,
|
||||
block_import,
|
||||
proposer_factory,
|
||||
inherent_data_providers,
|
||||
create_inherent_data_providers: move |_, ()| async move {
|
||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||
|
||||
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
|
||||
*timestamp,
|
||||
raw_slot_duration,
|
||||
);
|
||||
|
||||
Ok((timestamp, slot))
|
||||
},
|
||||
force_authoring,
|
||||
backoff_authoring_blocks,
|
||||
keystore: keystore_container.sync_keystore(),
|
||||
@@ -395,14 +413,23 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
let aura_block_import =
|
||||
sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(grandpa_block_import.clone(), client.clone());
|
||||
|
||||
let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(ImportQueueParams {
|
||||
let slot_duration = sc_consensus_aura::slot_duration(&*client)?.slot_duration();
|
||||
let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams {
|
||||
block_import: aura_block_import,
|
||||
justification_import: Some(Box::new(grandpa_block_import)),
|
||||
client: client.clone(),
|
||||
inherent_data_providers: InherentDataProviders::new(),
|
||||
create_inherent_data_providers: move |_, ()| async move {
|
||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||
|
||||
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
|
||||
*timestamp,
|
||||
slot_duration,
|
||||
);
|
||||
|
||||
Ok((timestamp, slot))
|
||||
},
|
||||
spawner: &task_manager.spawn_essential_handle(),
|
||||
can_author_with: sp_consensus::NeverCanAuthor,
|
||||
slot_duration: sc_consensus_aura::slot_duration(&*client)?,
|
||||
registry: config.prometheus_registry(),
|
||||
check_for_equivocation: Default::default(),
|
||||
telemetry: telemetry.as_ref().map(|x| x.handle()),
|
||||
|
||||
Reference in New Issue
Block a user