mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
Update Substrate/Polkadot/Cumulus references (#1353)
* cumulus: 4e95228291
polkadot: 975e780ae0d988dc033f400ba822d14b326ee5b9
substrate: 89fcb3e4f62d221d4e161a437768e77d6265889e
* fix refs
* sync changes from https://github.com/paritytech/polkadot/pull/3828
* sync changes from https://github.com/paritytech/polkadot/pull/4387
* sync changes from https://github.com/paritytech/polkadot/pull/3940
* sync with changes from https://github.com/paritytech/polkadot/pull/4493
* sync with changes from https://github.com/paritytech/polkadot/pull/4958
* sync with changes from https://github.com/paritytech/polkadot/pull/3889
* sync with changes from https://github.com/paritytech/polkadot/pull/5033
* sync with changes from https://github.com/paritytech/polkadot/pull/5065
* compilation fixes
* fixed prometheus endpoint startup (it now requires to be spawned within tokio context)
This commit is contained in:
committed by
Bastian Köcher
parent
ed2a3082ef
commit
65c2c0ccce
@@ -10,7 +10,7 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "3.0", features = ["derive"] }
|
clap = { version = "3.1", features = ["derive"] }
|
||||||
jsonrpc-core = "18.0"
|
jsonrpc-core = "18.0"
|
||||||
serde_json = "1.0.59"
|
serde_json = "1.0.59"
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ use sc_finality_grandpa::SharedVoterState;
|
|||||||
use sc_keystore::LocalKeystore;
|
use sc_keystore::LocalKeystore;
|
||||||
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
||||||
use sc_telemetry::{Telemetry, TelemetryWorker};
|
use sc_telemetry::{Telemetry, TelemetryWorker};
|
||||||
use sp_consensus::SlotData;
|
|
||||||
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
@@ -141,7 +140,7 @@ pub fn new_partial(
|
|||||||
telemetry.as_ref().map(|x| x.handle()),
|
telemetry.as_ref().map(|x| x.handle()),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let slot_duration = sc_consensus_aura::slot_duration(&*client)?.slot_duration();
|
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
|
||||||
|
|
||||||
let import_queue =
|
let import_queue =
|
||||||
sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams {
|
sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _, _>(ImportQueueParams {
|
||||||
@@ -152,7 +151,7 @@ pub fn new_partial(
|
|||||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
|
|
||||||
let slot =
|
let slot =
|
||||||
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
|
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
|
||||||
*timestamp,
|
*timestamp,
|
||||||
slot_duration,
|
slot_duration,
|
||||||
);
|
);
|
||||||
@@ -349,7 +348,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
|
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
|
||||||
|
|
||||||
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
|
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, _, _, _, _, _, _, _, _, _, _, _>(
|
let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _, _>(
|
||||||
StartAuraParams {
|
StartAuraParams {
|
||||||
@@ -362,9 +360,9 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
|
|
||||||
let slot =
|
let slot =
|
||||||
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
|
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
|
||||||
*timestamp,
|
*timestamp,
|
||||||
raw_slot_duration,
|
slot_duration,
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok((timestamp, slot))
|
Ok((timestamp, slot))
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hex-literal = "0.3"
|
hex-literal = "0.3"
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] }
|
libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
@@ -124,7 +124,7 @@ std = [
|
|||||||
]
|
]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"bridge-runtime-common/runtime-benchmarks",
|
"bridge-runtime-common/runtime-benchmarks",
|
||||||
"frame-benchmarking",
|
"frame-benchmarking/runtime-benchmarks",
|
||||||
"frame-support/runtime-benchmarks",
|
"frame-support/runtime-benchmarks",
|
||||||
"frame-system/runtime-benchmarks",
|
"frame-system/runtime-benchmarks",
|
||||||
"libsecp256k1",
|
"libsecp256k1",
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
// Runtime-generated enums
|
// Runtime-generated enums
|
||||||
#![allow(clippy::large_enum_variant)]
|
#![allow(clippy::large_enum_variant)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
// From construct_runtime macro
|
// From construct_runtime macro
|
||||||
#![allow(clippy::from_over_into)]
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
@@ -543,6 +541,7 @@ pub type SignedBlock = generic::SignedBlock<Block>;
|
|||||||
pub type BlockId = generic::BlockId<Block>;
|
pub type BlockId = generic::BlockId<Block>;
|
||||||
/// The SignedExtension to the basic transaction logic.
|
/// The SignedExtension to the basic transaction logic.
|
||||||
pub type SignedExtra = (
|
pub type SignedExtra = (
|
||||||
|
frame_system::CheckNonZeroSender<Runtime>,
|
||||||
frame_system::CheckSpecVersion<Runtime>,
|
frame_system::CheckSpecVersion<Runtime>,
|
||||||
frame_system::CheckTxVersion<Runtime>,
|
frame_system::CheckTxVersion<Runtime>,
|
||||||
frame_system::CheckGenesis<Runtime>,
|
frame_system::CheckGenesis<Runtime>,
|
||||||
@@ -913,7 +912,6 @@ impl_runtime_apis! {
|
|||||||
add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeRialtoGrandpa);
|
add_benchmark!(params, batches, pallet_bridge_grandpa, BridgeRialtoGrandpa);
|
||||||
add_benchmark!(params, batches, pallet_bridge_token_swap, BridgeRialtoTokenSwap);
|
add_benchmark!(params, batches, pallet_bridge_token_swap, BridgeRialtoTokenSwap);
|
||||||
|
|
||||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
|
||||||
Ok(batches)
|
Ok(batches)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ default = []
|
|||||||
runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks']
|
runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks']
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "3.0", features = ["derive"] }
|
clap = { version = "3.1", features = ["derive"] }
|
||||||
derive_more = '0.99.2'
|
derive_more = '0.99.2'
|
||||||
log = '0.4.14'
|
log = '0.4.14'
|
||||||
codec = { package = 'parity-scale-codec', version = '2.0.0' }
|
codec = { package = 'parity-scale-codec', version = '3.0.0' }
|
||||||
serde = { version = '1.0', features = ['derive'] }
|
serde = { version = '1.0', features = ['derive'] }
|
||||||
hex-literal = '0.3.1'
|
hex-literal = '0.3.1'
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch
|
|||||||
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
||||||
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
||||||
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
||||||
cumulus-relay-chain-local = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
|
||||||
|
|
||||||
# Polkadot dependencies
|
# Polkadot dependencies
|
||||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::chain_spec;
|
use crate::chain_spec;
|
||||||
use clap::{AppSettings, Parser};
|
use clap::Parser;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
/// Sub-commands supported by the collator.
|
/// Sub-commands supported by the collator.
|
||||||
@@ -94,11 +94,11 @@ pub struct ExportGenesisWasmCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
#[clap(setting(
|
#[clap(
|
||||||
AppSettings::PropagateVersion |
|
propagate_version = true,
|
||||||
AppSettings::ArgsNegateSubcommands |
|
args_conflicts_with_subcommands = true,
|
||||||
AppSettings::SubcommandsNegateReqs,
|
subcommand_negates_reqs = true
|
||||||
))]
|
)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
pub subcommand: Option<Subcommand>,
|
pub subcommand: Option<Subcommand>,
|
||||||
|
|||||||
@@ -265,6 +265,7 @@ pub fn run() -> Result<()> {
|
|||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&cli.run.normalize())?;
|
let runner = cli.create_runner(&cli.run.normalize())?;
|
||||||
|
let collator_options = cli.run.collator_options();
|
||||||
|
|
||||||
runner.run_node_until_exit(|config| async move {
|
runner.run_node_until_exit(|config| async move {
|
||||||
let para_id =
|
let para_id =
|
||||||
@@ -278,7 +279,7 @@ pub fn run() -> Result<()> {
|
|||||||
let id = ParaId::from(cli.parachain_id.or(para_id).expect("Missing ParaId"));
|
let id = ParaId::from(cli.parachain_id.or(para_id).expect("Missing ParaId"));
|
||||||
|
|
||||||
let parachain_account =
|
let parachain_account =
|
||||||
AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);
|
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account(&id);
|
||||||
|
|
||||||
let state_version =
|
let state_version =
|
||||||
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
|
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
|
||||||
@@ -298,7 +299,7 @@ pub fn run() -> Result<()> {
|
|||||||
info!("Parachain genesis state: {}", genesis_state);
|
info!("Parachain genesis state: {}", genesis_state);
|
||||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||||
|
|
||||||
crate::service::start_node(config, polkadot_config, id)
|
crate::service::start_node(config, polkadot_config, collator_options, id)
|
||||||
.await
|
.await
|
||||||
.map(|r| r.0)
|
.map(|r| r.0)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ use std::{sync::Arc, time::Duration};
|
|||||||
use rialto_parachain_runtime::RuntimeApi;
|
use rialto_parachain_runtime::RuntimeApi;
|
||||||
|
|
||||||
// Cumulus Imports
|
// Cumulus Imports
|
||||||
|
use cumulus_client_cli::CollatorOptions;
|
||||||
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
|
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
|
||||||
use cumulus_client_consensus_common::ParachainConsensus;
|
use cumulus_client_consensus_common::ParachainConsensus;
|
||||||
use cumulus_client_network::BlockAnnounceValidator;
|
use cumulus_client_network::BlockAnnounceValidator;
|
||||||
@@ -35,8 +36,8 @@ use cumulus_client_service::{
|
|||||||
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
||||||
};
|
};
|
||||||
use cumulus_primitives_core::ParaId;
|
use cumulus_primitives_core::ParaId;
|
||||||
use cumulus_relay_chain_interface::RelayChainInterface;
|
use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
|
||||||
use cumulus_relay_chain_local::build_relay_chain_interface;
|
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface};
|
||||||
|
|
||||||
// Substrate Imports
|
// Substrate Imports
|
||||||
use sc_client_api::ExecutorProvider;
|
use sc_client_api::ExecutorProvider;
|
||||||
@@ -45,7 +46,6 @@ use sc_network::NetworkService;
|
|||||||
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
|
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
|
||||||
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
|
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
|
||||||
use sp_api::ConstructRuntimeApi;
|
use sp_api::ConstructRuntimeApi;
|
||||||
use sp_consensus::SlotData;
|
|
||||||
use sp_keystore::SyncCryptoStorePtr;
|
use sp_keystore::SyncCryptoStorePtr;
|
||||||
use sp_runtime::traits::BlakeTwo256;
|
use sp_runtime::traits::BlakeTwo256;
|
||||||
use substrate_prometheus_endpoint::Registry;
|
use substrate_prometheus_endpoint::Registry;
|
||||||
@@ -195,6 +195,7 @@ where
|
|||||||
async fn start_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
|
async fn start_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
|
||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
id: ParaId,
|
||||||
rpc_ext_builder: RB,
|
rpc_ext_builder: RB,
|
||||||
build_import_queue: BIQ,
|
build_import_queue: BIQ,
|
||||||
@@ -270,12 +271,16 @@ where
|
|||||||
let (mut telemetry, telemetry_worker_handle) = params.other;
|
let (mut telemetry, telemetry_worker_handle) = params.other;
|
||||||
|
|
||||||
let mut task_manager = params.task_manager;
|
let mut task_manager = params.task_manager;
|
||||||
let (relay_chain_interface, collator_key) =
|
let (relay_chain_interface, collator_key) = build_inprocess_relay_chain(
|
||||||
build_relay_chain_interface(polkadot_config, telemetry_worker_handle, &mut task_manager)
|
polkadot_config,
|
||||||
.map_err(|e| match e {
|
¶chain_config,
|
||||||
polkadot_service::Error::Sub(x) => x,
|
telemetry_worker_handle,
|
||||||
s => format!("{}", s).into(),
|
&mut task_manager,
|
||||||
})?;
|
)
|
||||||
|
.map_err(|e| match e {
|
||||||
|
RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x,
|
||||||
|
s => s.to_string().into(),
|
||||||
|
})?;
|
||||||
|
|
||||||
let client = params.client.clone();
|
let client = params.client.clone();
|
||||||
let backend = params.backend.clone();
|
let backend = params.backend.clone();
|
||||||
@@ -350,7 +355,7 @@ where
|
|||||||
spawner,
|
spawner,
|
||||||
parachain_consensus,
|
parachain_consensus,
|
||||||
import_queue,
|
import_queue,
|
||||||
collator_key,
|
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
|
||||||
relay_chain_slot_duration,
|
relay_chain_slot_duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -364,6 +369,7 @@ where
|
|||||||
relay_chain_interface,
|
relay_chain_interface,
|
||||||
relay_chain_slot_duration,
|
relay_chain_slot_duration,
|
||||||
import_queue,
|
import_queue,
|
||||||
|
collator_options,
|
||||||
};
|
};
|
||||||
|
|
||||||
start_full_node(params)?;
|
start_full_node(params)?;
|
||||||
@@ -405,9 +411,9 @@ pub fn parachain_build_import_queue(
|
|||||||
let time = sp_timestamp::InherentDataProvider::from_system_time();
|
let time = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
|
|
||||||
let slot =
|
let slot =
|
||||||
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
|
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
|
||||||
*time,
|
*time,
|
||||||
slot_duration.slot_duration(),
|
slot_duration,
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok((time, slot))
|
Ok((time, slot))
|
||||||
@@ -424,6 +430,7 @@ pub fn parachain_build_import_queue(
|
|||||||
pub async fn start_node(
|
pub async fn start_node(
|
||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
id: ParaId,
|
||||||
) -> sc_service::error::Result<(
|
) -> sc_service::error::Result<(
|
||||||
TaskManager,
|
TaskManager,
|
||||||
@@ -432,6 +439,7 @@ pub async fn start_node(
|
|||||||
start_node_impl::<RuntimeApi, ParachainRuntimeExecutor, _, _, _>(
|
start_node_impl::<RuntimeApi, ParachainRuntimeExecutor, _, _, _>(
|
||||||
parachain_config,
|
parachain_config,
|
||||||
polkadot_config,
|
polkadot_config,
|
||||||
|
collator_options,
|
||||||
id,
|
id,
|
||||||
|deny_unsafe, client, pool| {
|
|deny_unsafe, client, pool| {
|
||||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||||
@@ -481,9 +489,9 @@ pub async fn start_node(
|
|||||||
).await;
|
).await;
|
||||||
let time = sp_timestamp::InherentDataProvider::from_system_time();
|
let time = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
|
|
||||||
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration(
|
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
|
||||||
*time,
|
*time,
|
||||||
slot_duration.slot_duration(),
|
slot_duration,
|
||||||
);
|
);
|
||||||
|
|
||||||
let parachain_inherent = parachain_inherent.ok_or_else(|| {
|
let parachain_inherent = parachain_inherent.ok_or_else(|| {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = 'parity-scale-codec', version = '2.0.0', default-features = false, features = ['derive']}
|
codec = { package = 'parity-scale-codec', version = '3.0.0', default-features = false, features = ['derive']}
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = '1.0', optional = true, features = ['derive'] }
|
serde = { version = '1.0', optional = true, features = ['derive'] }
|
||||||
|
|
||||||
# Bridge depedencies
|
# Bridge depedencies
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ use sp_version::RuntimeVersion;
|
|||||||
|
|
||||||
// A few exports that help ease life for downstream crates.
|
// A few exports that help ease life for downstream crates.
|
||||||
pub use frame_support::{
|
pub use frame_support::{
|
||||||
construct_runtime, match_type, parameter_types,
|
construct_runtime, match_types, parameter_types,
|
||||||
traits::{Everything, IsInVec, Randomness},
|
traits::{Everything, IsInVec, Randomness},
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
||||||
@@ -86,6 +86,7 @@ pub type SignedBlock = generic::SignedBlock<Block>;
|
|||||||
pub type BlockId = generic::BlockId<Block>;
|
pub type BlockId = generic::BlockId<Block>;
|
||||||
/// The SignedExtension to the basic transaction logic.
|
/// The SignedExtension to the basic transaction logic.
|
||||||
pub type SignedExtra = (
|
pub type SignedExtra = (
|
||||||
|
frame_system::CheckNonZeroSender<Runtime>,
|
||||||
frame_system::CheckSpecVersion<Runtime>,
|
frame_system::CheckSpecVersion<Runtime>,
|
||||||
frame_system::CheckGenesis<Runtime>,
|
frame_system::CheckGenesis<Runtime>,
|
||||||
frame_system::CheckEra<Runtime>,
|
frame_system::CheckEra<Runtime>,
|
||||||
@@ -350,7 +351,7 @@ parameter_types! {
|
|||||||
pub const MaxAuthorities: u32 = 100_000;
|
pub const MaxAuthorities: u32 = 100_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
match_type! {
|
match_types! {
|
||||||
pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
|
pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
|
||||||
MultiLocation { parents: 1, interior: Here } |
|
MultiLocation { parents: 1, interior: Here } |
|
||||||
MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
|
MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
|
||||||
@@ -423,6 +424,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
|||||||
type ChannelInfo = ParachainSystem;
|
type ChannelInfo = ParachainSystem;
|
||||||
type VersionWrapper = ();
|
type VersionWrapper = ();
|
||||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||||
|
type ControllerOrigin = EnsureRoot<AccountId>;
|
||||||
|
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||||
|
type WeightInfo = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_pallet_dmp_queue::Config for Runtime {
|
impl cumulus_pallet_dmp_queue::Config for Runtime {
|
||||||
@@ -613,7 +617,6 @@ impl_runtime_apis! {
|
|||||||
add_benchmark!(params, batches, pallet_balances, Balances);
|
add_benchmark!(params, batches, pallet_balances, Balances);
|
||||||
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
||||||
|
|
||||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
|
||||||
Ok(batches)
|
Ok(batches)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "3.0", features = ["derive"] }
|
clap = { version = "3.1", features = ["derive"] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
jsonrpc-core = "18.0"
|
jsonrpc-core = "18.0"
|
||||||
kvdb = "0.10"
|
kvdb = "0.11"
|
||||||
kvdb-rocksdb = "0.12"
|
kvdb-rocksdb = "0.15"
|
||||||
lru = "0.7"
|
lru = "0.7"
|
||||||
serde_json = "1.0.59"
|
serde_json = "1.0.59"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
use beefy_primitives::crypto::AuthorityId as BeefyId;
|
||||||
use bp_rialto::derive_account_from_millau_id;
|
use bp_rialto::derive_account_from_millau_id;
|
||||||
use polkadot_primitives::v1::{AssignmentId, ValidatorId};
|
use polkadot_primitives::v2::{AssignmentId, ValidatorId};
|
||||||
use rialto_runtime::{
|
use rialto_runtime::{
|
||||||
AccountId, BabeConfig, BalancesConfig, BeefyConfig, BridgeMillauMessagesConfig,
|
AccountId, BabeConfig, BalancesConfig, BeefyConfig, BridgeMillauMessagesConfig,
|
||||||
ConfigurationConfig, GenesisConfig, GrandpaConfig, SessionConfig, SessionKeys, Signature,
|
ConfigurationConfig, GenesisConfig, GrandpaConfig, SessionConfig, SessionKeys, Signature,
|
||||||
@@ -253,8 +253,8 @@ fn testnet_genesis(
|
|||||||
validation_upgrade_cooldown: 2u32,
|
validation_upgrade_cooldown: 2u32,
|
||||||
validation_upgrade_delay: 2,
|
validation_upgrade_delay: 2,
|
||||||
code_retention_period: 1200,
|
code_retention_period: 1200,
|
||||||
max_code_size: polkadot_primitives::v1::MAX_CODE_SIZE,
|
max_code_size: polkadot_primitives::v2::MAX_CODE_SIZE,
|
||||||
max_pov_size: polkadot_primitives::v1::MAX_POV_SIZE,
|
max_pov_size: polkadot_primitives::v2::MAX_POV_SIZE,
|
||||||
max_head_data_size: 32 * 1024,
|
max_head_data_size: 32 * 1024,
|
||||||
group_rotation_frequency: 20,
|
group_rotation_frequency: 20,
|
||||||
chain_availability_period: 4,
|
chain_availability_period: 4,
|
||||||
@@ -263,7 +263,7 @@ fn testnet_genesis(
|
|||||||
max_upward_queue_size: 1024 * 1024,
|
max_upward_queue_size: 1024 * 1024,
|
||||||
max_downward_message_size: 1024 * 1024,
|
max_downward_message_size: 1024 * 1024,
|
||||||
ump_service_total_weight: 100_000_000_000,
|
ump_service_total_weight: 100_000_000_000,
|
||||||
max_upward_message_size: 1024 * 1024,
|
max_upward_message_size: 50 * 1024,
|
||||||
max_upward_message_num_per_candidate: 5,
|
max_upward_message_num_per_candidate: 5,
|
||||||
hrmp_sender_deposit: 0,
|
hrmp_sender_deposit: 0,
|
||||||
hrmp_recipient_deposit: 0,
|
hrmp_recipient_deposit: 0,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use clap::{AppSettings, Parser};
|
use clap::Parser;
|
||||||
use sc_cli::RunCmd;
|
use sc_cli::RunCmd;
|
||||||
|
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
@@ -70,11 +70,11 @@ pub enum Subcommand {
|
|||||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||||
|
|
||||||
/// FOR INTERNAL USE: analog of the "prepare-worker" command of the polkadot binary.
|
/// FOR INTERNAL USE: analog of the "prepare-worker" command of the polkadot binary.
|
||||||
#[clap(name = "prepare-worker", setting = AppSettings::Hidden)]
|
#[clap(name = "prepare-worker", hide = true)]
|
||||||
PvfPrepareWorker(ValidationWorkerCommand),
|
PvfPrepareWorker(ValidationWorkerCommand),
|
||||||
|
|
||||||
/// FOR INTERNAL USE: analog of the "execute-worker" command of the polkadot binary.
|
/// FOR INTERNAL USE: analog of the "execute-worker" command of the polkadot binary.
|
||||||
#[clap(name = "execute-worker", setting = AppSettings::Hidden)]
|
#[clap(name = "execute-worker", hide = true)]
|
||||||
PvfExecuteWorker(ValidationWorkerCommand),
|
PvfExecuteWorker(ValidationWorkerCommand),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ pub fn run() -> sc_cli::Result<()> {
|
|||||||
let jaeger_agent = None;
|
let jaeger_agent = None;
|
||||||
let telemetry_worker_handle = None;
|
let telemetry_worker_handle = None;
|
||||||
let program_path = None;
|
let program_path = None;
|
||||||
|
let overseer_enable_anyways = false;
|
||||||
|
|
||||||
polkadot_service::new_full::<rialto_runtime::RuntimeApi, ExecutorDispatch, _>(
|
polkadot_service::new_full::<rialto_runtime::RuntimeApi, ExecutorDispatch, _>(
|
||||||
config,
|
config,
|
||||||
@@ -201,6 +202,7 @@ pub fn run() -> sc_cli::Result<()> {
|
|||||||
jaeger_agent,
|
jaeger_agent,
|
||||||
telemetry_worker_handle,
|
telemetry_worker_handle,
|
||||||
program_path,
|
program_path,
|
||||||
|
overseer_enable_anyways,
|
||||||
overseer_gen,
|
overseer_gen,
|
||||||
)
|
)
|
||||||
.map(|full| full.task_manager)
|
.map(|full| full.task_manager)
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
hex-literal = "0.3"
|
hex-literal = "0.3"
|
||||||
libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] }
|
libsecp256k1 = { version = "0.7", optional = true, default-features = false, features = ["hmac"] }
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
@@ -137,7 +137,7 @@ std = [
|
|||||||
]
|
]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"bridge-runtime-common/runtime-benchmarks",
|
"bridge-runtime-common/runtime-benchmarks",
|
||||||
"frame-benchmarking",
|
"frame-benchmarking/runtime-benchmarks",
|
||||||
"frame-support/runtime-benchmarks",
|
"frame-support/runtime-benchmarks",
|
||||||
"frame-system/runtime-benchmarks",
|
"frame-system/runtime-benchmarks",
|
||||||
"libsecp256k1",
|
"libsecp256k1",
|
||||||
|
|||||||
@@ -21,8 +21,6 @@
|
|||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
// Runtime-generated enums
|
// Runtime-generated enums
|
||||||
#![allow(clippy::large_enum_variant)]
|
#![allow(clippy::large_enum_variant)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
// From construct_runtime macro
|
// From construct_runtime macro
|
||||||
#![allow(clippy::from_over_into)]
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
@@ -534,6 +532,7 @@ pub type SignedBlock = generic::SignedBlock<Block>;
|
|||||||
pub type BlockId = generic::BlockId<Block>;
|
pub type BlockId = generic::BlockId<Block>;
|
||||||
/// The SignedExtension to the basic transaction logic.
|
/// The SignedExtension to the basic transaction logic.
|
||||||
pub type SignedExtra = (
|
pub type SignedExtra = (
|
||||||
|
frame_system::CheckNonZeroSender<Runtime>,
|
||||||
frame_system::CheckSpecVersion<Runtime>,
|
frame_system::CheckSpecVersion<Runtime>,
|
||||||
frame_system::CheckTxVersion<Runtime>,
|
frame_system::CheckTxVersion<Runtime>,
|
||||||
frame_system::CheckGenesis<Runtime>,
|
frame_system::CheckGenesis<Runtime>,
|
||||||
@@ -717,55 +716,55 @@ impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl polkadot_primitives::v2::ParachainHost<Block, Hash, BlockNumber> for Runtime {
|
impl polkadot_primitives::v2::ParachainHost<Block, Hash, BlockNumber> for Runtime {
|
||||||
fn validators() -> Vec<polkadot_primitives::v1::ValidatorId> {
|
fn validators() -> Vec<polkadot_primitives::v2::ValidatorId> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::validators::<Runtime>()
|
polkadot_runtime_parachains::runtime_api_impl::v2::validators::<Runtime>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validator_groups() -> (Vec<Vec<polkadot_primitives::v1::ValidatorIndex>>, polkadot_primitives::v1::GroupRotationInfo<BlockNumber>) {
|
fn validator_groups() -> (Vec<Vec<polkadot_primitives::v2::ValidatorIndex>>, polkadot_primitives::v2::GroupRotationInfo<BlockNumber>) {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::validator_groups::<Runtime>()
|
polkadot_runtime_parachains::runtime_api_impl::v2::validator_groups::<Runtime>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn availability_cores() -> Vec<polkadot_primitives::v1::CoreState<Hash, BlockNumber>> {
|
fn availability_cores() -> Vec<polkadot_primitives::v2::CoreState<Hash, BlockNumber>> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::availability_cores::<Runtime>()
|
polkadot_runtime_parachains::runtime_api_impl::v2::availability_cores::<Runtime>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn persisted_validation_data(para_id: polkadot_primitives::v1::Id, assumption: polkadot_primitives::v1::OccupiedCoreAssumption)
|
fn persisted_validation_data(para_id: polkadot_primitives::v2::Id, assumption: polkadot_primitives::v2::OccupiedCoreAssumption)
|
||||||
-> Option<polkadot_primitives::v1::PersistedValidationData<Hash, BlockNumber>> {
|
-> Option<polkadot_primitives::v2::PersistedValidationData<Hash, BlockNumber>> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::persisted_validation_data::<Runtime>(para_id, assumption)
|
polkadot_runtime_parachains::runtime_api_impl::v2::persisted_validation_data::<Runtime>(para_id, assumption)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assumed_validation_data(
|
fn assumed_validation_data(
|
||||||
para_id: polkadot_primitives::v1::Id,
|
para_id: polkadot_primitives::v2::Id,
|
||||||
expected_persisted_validation_data_hash: Hash,
|
expected_persisted_validation_data_hash: Hash,
|
||||||
) -> Option<(polkadot_primitives::v1::PersistedValidationData<Hash, BlockNumber>, polkadot_primitives::v1::ValidationCodeHash)> {
|
) -> Option<(polkadot_primitives::v2::PersistedValidationData<Hash, BlockNumber>, polkadot_primitives::v2::ValidationCodeHash)> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::assumed_validation_data::<Runtime>(
|
polkadot_runtime_parachains::runtime_api_impl::v2::assumed_validation_data::<Runtime>(
|
||||||
para_id,
|
para_id,
|
||||||
expected_persisted_validation_data_hash,
|
expected_persisted_validation_data_hash,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_validation_outputs(
|
fn check_validation_outputs(
|
||||||
para_id: polkadot_primitives::v1::Id,
|
para_id: polkadot_primitives::v2::Id,
|
||||||
outputs: polkadot_primitives::v1::CandidateCommitments,
|
outputs: polkadot_primitives::v2::CandidateCommitments,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::check_validation_outputs::<Runtime>(para_id, outputs)
|
polkadot_runtime_parachains::runtime_api_impl::v2::check_validation_outputs::<Runtime>(para_id, outputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn session_index_for_child() -> polkadot_primitives::v1::SessionIndex {
|
fn session_index_for_child() -> polkadot_primitives::v2::SessionIndex {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::session_index_for_child::<Runtime>()
|
polkadot_runtime_parachains::runtime_api_impl::v2::session_index_for_child::<Runtime>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validation_code(para_id: polkadot_primitives::v1::Id, assumption: polkadot_primitives::v1::OccupiedCoreAssumption)
|
fn validation_code(para_id: polkadot_primitives::v2::Id, assumption: polkadot_primitives::v2::OccupiedCoreAssumption)
|
||||||
-> Option<polkadot_primitives::v1::ValidationCode> {
|
-> Option<polkadot_primitives::v2::ValidationCode> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::validation_code::<Runtime>(para_id, assumption)
|
polkadot_runtime_parachains::runtime_api_impl::v2::validation_code::<Runtime>(para_id, assumption)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn candidate_pending_availability(para_id: polkadot_primitives::v1::Id) -> Option<polkadot_primitives::v1::CommittedCandidateReceipt<Hash>> {
|
fn candidate_pending_availability(para_id: polkadot_primitives::v2::Id) -> Option<polkadot_primitives::v2::CommittedCandidateReceipt<Hash>> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::candidate_pending_availability::<Runtime>(para_id)
|
polkadot_runtime_parachains::runtime_api_impl::v2::candidate_pending_availability::<Runtime>(para_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn candidate_events() -> Vec<polkadot_primitives::v1::CandidateEvent<Hash>> {
|
fn candidate_events() -> Vec<polkadot_primitives::v2::CandidateEvent<Hash>> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::candidate_events::<Runtime, _>(|ev| {
|
polkadot_runtime_parachains::runtime_api_impl::v2::candidate_events::<Runtime, _>(|ev| {
|
||||||
match ev {
|
match ev {
|
||||||
Event::Inclusion(ev) => {
|
Event::Inclusion(ev) => {
|
||||||
Some(ev)
|
Some(ev)
|
||||||
@@ -775,46 +774,46 @@ impl_runtime_apis! {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn session_info(index: polkadot_primitives::v1::SessionIndex) -> Option<polkadot_primitives::v2::SessionInfo> {
|
fn session_info(index: polkadot_primitives::v2::SessionIndex) -> Option<polkadot_primitives::v2::SessionInfo> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::session_info::<Runtime>(index)
|
polkadot_runtime_parachains::runtime_api_impl::v2::session_info::<Runtime>(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dmq_contents(recipient: polkadot_primitives::v1::Id) -> Vec<polkadot_primitives::v1::InboundDownwardMessage<BlockNumber>> {
|
fn dmq_contents(recipient: polkadot_primitives::v2::Id) -> Vec<polkadot_primitives::v2::InboundDownwardMessage<BlockNumber>> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::dmq_contents::<Runtime>(recipient)
|
polkadot_runtime_parachains::runtime_api_impl::v2::dmq_contents::<Runtime>(recipient)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inbound_hrmp_channels_contents(
|
fn inbound_hrmp_channels_contents(
|
||||||
recipient: polkadot_primitives::v1::Id
|
recipient: polkadot_primitives::v2::Id
|
||||||
) -> BTreeMap<polkadot_primitives::v1::Id, Vec<polkadot_primitives::v1::InboundHrmpMessage<BlockNumber>>> {
|
) -> BTreeMap<polkadot_primitives::v2::Id, Vec<polkadot_primitives::v2::InboundHrmpMessage<BlockNumber>>> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::inbound_hrmp_channels_contents::<Runtime>(recipient)
|
polkadot_runtime_parachains::runtime_api_impl::v2::inbound_hrmp_channels_contents::<Runtime>(recipient)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validation_code_by_hash(hash: polkadot_primitives::v1::ValidationCodeHash) -> Option<polkadot_primitives::v1::ValidationCode> {
|
fn validation_code_by_hash(hash: polkadot_primitives::v2::ValidationCodeHash) -> Option<polkadot_primitives::v2::ValidationCode> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::validation_code_by_hash::<Runtime>(hash)
|
polkadot_runtime_parachains::runtime_api_impl::v2::validation_code_by_hash::<Runtime>(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_chain_votes() -> Option<polkadot_primitives::v1::ScrapedOnChainVotes<Hash>> {
|
fn on_chain_votes() -> Option<polkadot_primitives::v2::ScrapedOnChainVotes<Hash>> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::on_chain_votes::<Runtime>()
|
polkadot_runtime_parachains::runtime_api_impl::v2::on_chain_votes::<Runtime>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn submit_pvf_check_statement(stmt: polkadot_primitives::v2::PvfCheckStatement, signature: polkadot_primitives::v1::ValidatorSignature) {
|
fn submit_pvf_check_statement(stmt: polkadot_primitives::v2::PvfCheckStatement, signature: polkadot_primitives::v2::ValidatorSignature) {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::submit_pvf_check_statement::<Runtime>(stmt, signature)
|
polkadot_runtime_parachains::runtime_api_impl::v2::submit_pvf_check_statement::<Runtime>(stmt, signature)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pvfs_require_precheck() -> Vec<polkadot_primitives::v1::ValidationCodeHash> {
|
fn pvfs_require_precheck() -> Vec<polkadot_primitives::v2::ValidationCodeHash> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::pvfs_require_precheck::<Runtime>()
|
polkadot_runtime_parachains::runtime_api_impl::v2::pvfs_require_precheck::<Runtime>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validation_code_hash(para_id: polkadot_primitives::v1::Id, assumption: polkadot_primitives::v1::OccupiedCoreAssumption)
|
fn validation_code_hash(para_id: polkadot_primitives::v2::Id, assumption: polkadot_primitives::v2::OccupiedCoreAssumption)
|
||||||
-> Option<polkadot_primitives::v1::ValidationCodeHash>
|
-> Option<polkadot_primitives::v2::ValidationCodeHash>
|
||||||
{
|
{
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::validation_code_hash::<Runtime>(para_id, assumption)
|
polkadot_runtime_parachains::runtime_api_impl::v2::validation_code_hash::<Runtime>(para_id, assumption)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
|
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
|
||||||
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
||||||
polkadot_runtime_parachains::runtime_api_impl::v1::relevant_authority_ids::<Runtime>()
|
polkadot_runtime_parachains::runtime_api_impl::v2::relevant_authority_ids::<Runtime>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use crate::{
|
|||||||
|
|
||||||
use frame_support::{parameter_types, weights::Weight};
|
use frame_support::{parameter_types, weights::Weight};
|
||||||
use frame_system::EnsureRoot;
|
use frame_system::EnsureRoot;
|
||||||
use polkadot_primitives::v1::ValidatorIndex;
|
use polkadot_primitives::v2::ValidatorIndex;
|
||||||
use polkadot_runtime_common::{paras_registrar, paras_sudo_wrapper, slots};
|
use polkadot_runtime_common::{paras_registrar, paras_sudo_wrapper, slots};
|
||||||
use polkadot_runtime_parachains::{
|
use polkadot_runtime_parachains::{
|
||||||
configuration as parachains_configuration, dmp as parachains_dmp, hrmp as parachains_hrmp,
|
configuration as parachains_configuration, dmp as parachains_dmp, hrmp as parachains_hrmp,
|
||||||
@@ -108,6 +108,7 @@ impl parachains_ump::Config for Runtime {
|
|||||||
type UmpSink = ();
|
type UmpSink = ();
|
||||||
type FirstMessageFactorPercent = FirstMessageFactorPercent;
|
type FirstMessageFactorPercent = FirstMessageFactorPercent;
|
||||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||||
|
type WeightInfo = parachains_ump::TestWeightInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// required onboarding pallets. We're not going to use auctions or crowdloans, so they're missing
|
// required onboarding pallets. We're not going to use auctions or crowdloans, so they're missing
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
ed25519-dalek = { version = "1.0", default-features = false, optional = true }
|
ed25519-dalek = { version = "1.0", default-features = false, optional = true }
|
||||||
hash-db = { version = "0.15.2", default-features = false }
|
hash-db = { version = "0.15.2", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
static_assertions = { version = "1.1", optional = true }
|
static_assertions = { version = "1.1", optional = true }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
finality-grandpa = { version = "0.14.0", default-features = false }
|
finality-grandpa = { version = "0.15.0", default-features = false }
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
num-traits = { version = "0.2", default-features = false }
|
num-traits = { version = "0.2", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
@@ -58,5 +58,5 @@ std = [
|
|||||||
]
|
]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"bp-test-utils",
|
"bp-test-utils",
|
||||||
"frame-benchmarking",
|
"frame-benchmarking/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitvec = { version = "0.20", default-features = false, features = ["alloc"] }
|
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
num-traits = { version = "0.2", default-features = false }
|
num-traits = { version = "0.2", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
@@ -51,5 +51,5 @@ std = [
|
|||||||
"sp-std/std",
|
"sp-std/std",
|
||||||
]
|
]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"frame-benchmarking",
|
"frame-benchmarking/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ pub fn unrewarded_relayer(
|
|||||||
begin,
|
begin,
|
||||||
end,
|
end,
|
||||||
dispatch_results: if end >= begin {
|
dispatch_results: if end >= begin {
|
||||||
bitvec![Msb0, u8; 1; (end - begin + 1) as _]
|
bitvec![u8, Msb0; 1; (end - begin + 1) as _]
|
||||||
} else {
|
} else {
|
||||||
Default::default()
|
Default::default()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ mod tests {
|
|||||||
DeliveredMessages {
|
DeliveredMessages {
|
||||||
begin: *nonces.start(),
|
begin: *nonces.start(),
|
||||||
end: *nonces.end(),
|
end: *nonces.end(),
|
||||||
dispatch_results: bitvec![Msb0, u8; 1; (nonces.end() - nonces.start() + 1) as _],
|
dispatch_results: bitvec![u8, Msb0; 1; (nonces.end() - nonces.start() + 1) as _],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Substrate Dependencies
|
# Substrate Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
@@ -55,5 +55,5 @@ std = [
|
|||||||
"sp-std/std",
|
"sp-std/std",
|
||||||
]
|
]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"frame-benchmarking",
|
"frame-benchmarking/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
||||||
use frame_support::weights::{
|
use frame_support::weights::{
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ bp-messages = { path = "../messages", default-features = false }
|
|||||||
bp-runtime = { path = "../runtime", default-features = false }
|
bp-runtime = { path = "../runtime", default-features = false }
|
||||||
fixed-hash = { version = "0.7.0", default-features = false }
|
fixed-hash = { version = "0.7.0", default-features = false }
|
||||||
hash256-std-hasher = { version = "0.15.2", default-features = false }
|
hash256-std-hasher = { version = "0.15.2", default-features = false }
|
||||||
impl-codec = { version = "0.5.1", default-features = false }
|
impl-codec = { version = "0.6", default-features = false }
|
||||||
impl-serde = { version = "0.3.1", optional = true }
|
impl-serde = { version = "0.3.1", optional = true }
|
||||||
parity-util-mem = { version = "0.10", default-features = false, features = ["primitive-types"] }
|
parity-util-mem = { version = "0.11", default-features = false, features = ["primitive-types"] }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
# Substrate Based Dependencies
|
# Substrate Based Dependencies
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
mod millau_hash;
|
mod millau_hash;
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
||||||
use frame_support::weights::{
|
use frame_support::weights::{
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
use bp_runtime::Chain;
|
use bp_runtime::Chain;
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
||||||
use bp_runtime::Chain;
|
use bp_runtime::Chain;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] }
|
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
smallvec = "1.7"
|
smallvec = "1.7"
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
||||||
use frame_support::weights::{
|
use frame_support::weights::{
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] }
|
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
smallvec = "1.7"
|
smallvec = "1.7"
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
use frame_support::weights::{
|
use frame_support::weights::{
|
||||||
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] }
|
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
bp-messages = { path = "../messages", default-features = false }
|
bp-messages = { path = "../messages", default-features = false }
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// RuntimeApi generated functions
|
// RuntimeApi generated functions
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_with_depth_limit
|
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
|
||||||
|
|
||||||
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
use bp_messages::{LaneId, MessageDetails, MessageNonce};
|
||||||
use sp_runtime::FixedU128;
|
use sp_runtime::FixedU128;
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
finality-grandpa = { version = "0.14.0", default-features = false }
|
finality-grandpa = { version = "0.15.0", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bp-runtime = { path = "../runtime", default-features = false }
|
bp-runtime = { path = "../runtime", default-features = false }
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Substrate Dependencies
|
# Substrate Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitvec = { version = "0.20", default-features = false, features = ["alloc"] }
|
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive", "bit-vec"] }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "bit-vec"] }
|
||||||
impl-trait-for-tuples = "0.2"
|
impl-trait-for-tuples = "0.2"
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["bit-vec", "derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["bit-vec", "derive"] }
|
||||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ pub struct MessageDetails<OutboundMessageFee> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Bit vector of message dispatch results.
|
/// Bit vector of message dispatch results.
|
||||||
pub type DispatchResultsBitVec = BitVec<Msb0, u8>;
|
pub type DispatchResultsBitVec = BitVec<u8, Msb0>;
|
||||||
|
|
||||||
/// Unrewarded relayer entry stored in the inbound lane data.
|
/// Unrewarded relayer entry stored in the inbound lane data.
|
||||||
///
|
///
|
||||||
@@ -225,11 +225,9 @@ impl DeliveredMessages {
|
|||||||
/// Create new `DeliveredMessages` struct that confirms delivery of single nonce with given
|
/// Create new `DeliveredMessages` struct that confirms delivery of single nonce with given
|
||||||
/// dispatch result.
|
/// dispatch result.
|
||||||
pub fn new(nonce: MessageNonce, dispatch_result: bool) -> Self {
|
pub fn new(nonce: MessageNonce, dispatch_result: bool) -> Self {
|
||||||
DeliveredMessages {
|
let mut dispatch_results = BitVec::with_capacity(1);
|
||||||
begin: nonce,
|
dispatch_results.push(if dispatch_result { true } else { false });
|
||||||
end: nonce,
|
DeliveredMessages { begin: nonce, end: nonce, dispatch_results }
|
||||||
dispatch_results: bitvec![Msb0, u8; if dispatch_result { 1 } else { 0 }],
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return total count of delivered messages.
|
/// Return total count of delivered messages.
|
||||||
@@ -368,7 +366,7 @@ mod tests {
|
|||||||
messages: DeliveredMessages::new(i as _, true),
|
messages: DeliveredMessages::new(i as _, true),
|
||||||
};
|
};
|
||||||
entry.messages.dispatch_results = bitvec![
|
entry.messages.dispatch_results = bitvec![
|
||||||
Msb0, u8;
|
u8, Msb0;
|
||||||
1;
|
1;
|
||||||
(messages_count / relayer_entries) as _
|
(messages_count / relayer_entries) as _
|
||||||
];
|
];
|
||||||
@@ -394,7 +392,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn message_dispatch_result_works() {
|
fn message_dispatch_result_works() {
|
||||||
let delivered_messages =
|
let delivered_messages =
|
||||||
DeliveredMessages { begin: 100, end: 150, dispatch_results: bitvec![Msb0, u8; 1; 151] };
|
DeliveredMessages { begin: 100, end: 150, dispatch_results: bitvec![u8, Msb0; 1; 151] };
|
||||||
|
|
||||||
assert!(!delivered_messages.contains_message(99));
|
assert!(!delivered_messages.contains_message(99));
|
||||||
assert!(delivered_messages.contains_message(100));
|
assert!(delivered_messages.contains_message(100));
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parity-scale-codec = { version = "2.2.0", default-features = false, features = ["derive"] }
|
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -239,11 +239,12 @@ pub type UncheckedExtrinsic<Call> = generic::UncheckedExtrinsic<
|
|||||||
pub type Address = MultiAddress<AccountId, ()>;
|
pub type Address = MultiAddress<AccountId, ()>;
|
||||||
|
|
||||||
/// A type of the data encoded as part of the transaction.
|
/// A type of the data encoded as part of the transaction.
|
||||||
pub type SignedExtra = ((), (), (), sp_runtime::generic::Era, Compact<Nonce>, (), Compact<Balance>);
|
pub type SignedExtra =
|
||||||
|
((), (), (), (), sp_runtime::generic::Era, Compact<Nonce>, (), Compact<Balance>);
|
||||||
|
|
||||||
/// Parameters which are part of the payload used to produce transaction signature,
|
/// Parameters which are part of the payload used to produce transaction signature,
|
||||||
/// but don't end up in the transaction itself (i.e. inherent part of the runtime).
|
/// but don't end up in the transaction itself (i.e. inherent part of the runtime).
|
||||||
pub type AdditionalSigned = (u32, u32, Hash, Hash, (), (), ());
|
pub type AdditionalSigned = ((), u32, u32, Hash, Hash, (), (), ());
|
||||||
|
|
||||||
/// A simplified version of signed extensions meant for producing signed transactions
|
/// A simplified version of signed extensions meant for producing signed transactions
|
||||||
/// and signed payload in the client code.
|
/// and signed payload in the client code.
|
||||||
@@ -287,6 +288,7 @@ impl<Call> SignedExtensions<Call> {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
encode_payload: (
|
encode_payload: (
|
||||||
|
(), // non-zero sender
|
||||||
(), // spec version
|
(), // spec version
|
||||||
(), // tx version
|
(), // tx version
|
||||||
(), // genesis
|
(), // genesis
|
||||||
@@ -296,6 +298,7 @@ impl<Call> SignedExtensions<Call> {
|
|||||||
tip.into(), // transaction payment / tip (compact encoding)
|
tip.into(), // transaction payment / tip (compact encoding)
|
||||||
),
|
),
|
||||||
additional_signed: Some((
|
additional_signed: Some((
|
||||||
|
(),
|
||||||
spec_version,
|
spec_version,
|
||||||
transaction_version,
|
transaction_version,
|
||||||
genesis_hash,
|
genesis_hash,
|
||||||
@@ -312,12 +315,12 @@ impl<Call> SignedExtensions<Call> {
|
|||||||
impl<Call> SignedExtensions<Call> {
|
impl<Call> SignedExtensions<Call> {
|
||||||
/// Return signer nonce, used to craft transaction.
|
/// Return signer nonce, used to craft transaction.
|
||||||
pub fn nonce(&self) -> Nonce {
|
pub fn nonce(&self) -> Nonce {
|
||||||
self.encode_payload.4.into()
|
self.encode_payload.5.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return transaction tip.
|
/// Return transaction tip.
|
||||||
pub fn tip(&self) -> Balance {
|
pub fn tip(&self) -> Balance {
|
||||||
self.encode_payload.6.into()
|
self.encode_payload.7.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
hash-db = { version = "0.15.2", default-features = false }
|
hash-db = { version = "0.15.2", default-features = false }
|
||||||
num-traits = { version = "0.2", default-features = false }
|
num-traits = { version = "0.2", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Substrate Dependencies
|
# Substrate Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,7 @@ pub fn craft_valid_storage_proof() -> (sp_core::H256, StorageProof) {
|
|||||||
let proof = StorageProof::new(
|
let proof = StorageProof::new(
|
||||||
prove_read(backend, &[&b"key1"[..], &b"key2"[..], &b"key22"[..]])
|
prove_read(backend, &[&b"key1"[..], &b"key2"[..], &b"key22"[..]])
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.iter_nodes()
|
.iter_nodes(),
|
||||||
.collect(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
(root, proof)
|
(root, proof)
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bp-header-chain = { path = "../header-chain", default-features = false }
|
bp-header-chain = { path = "../header-chain", default-features = false }
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] }
|
ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] }
|
||||||
finality-grandpa = { version = "0.14.0", default-features = false }
|
finality-grandpa = { version = "0.15.0", default-features = false }
|
||||||
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
async-std = "1.9.0"
|
async-std = "1.9.0"
|
||||||
async-trait = "0.1.42"
|
async-trait = "0.1.42"
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
futures = "0.3.12"
|
futures = "0.3.12"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
@@ -79,4 +79,4 @@ hex-literal = "0.3"
|
|||||||
pallet-bridge-grandpa = { path = "../../modules/grandpa" }
|
pallet-bridge-grandpa = { path = "../../modules/grandpa" }
|
||||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
tempfile = "3.2"
|
tempfile = "3.2"
|
||||||
finality-grandpa = { version = "0.14.0" }
|
finality-grandpa = { version = "0.15.0" }
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ impl RegisterParachain {
|
|||||||
let para_id: ParaId = relay_client
|
let para_id: ParaId = relay_client
|
||||||
.storage_value(StorageKey(para_id_key.to_vec()), None)
|
.storage_value(StorageKey(para_id_key.to_vec()), None)
|
||||||
.await?
|
.await?
|
||||||
.unwrap_or(polkadot_primitives::v1::LOWEST_PUBLIC_ID)
|
.unwrap_or(polkadot_primitives::v2::LOWEST_PUBLIC_ID)
|
||||||
.max(polkadot_primitives::v1::LOWEST_PUBLIC_ID);
|
.max(polkadot_primitives::v2::LOWEST_PUBLIC_ID);
|
||||||
log::info!(target: "bridge", "Going to reserve parachain id: {:?}", para_id);
|
log::info!(target: "bridge", "Going to reserve parachain id: {:?}", para_id);
|
||||||
|
|
||||||
// step 1: reserve a parachain id
|
// step 1: reserve a parachain id
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
relay-substrate-client = { path = "../client-substrate" }
|
relay-substrate-client = { path = "../client-substrate" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
scale-info = { version = "1.0", features = ["derive"] }
|
scale-info = { version = "2.0.1", features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
relay-substrate-client = { path = "../client-substrate" }
|
relay-substrate-client = { path = "../client-substrate" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ impl TransactionSignScheme for Millau {
|
|||||||
let raw_payload = SignedPayload::from_raw(
|
let raw_payload = SignedPayload::from_raw(
|
||||||
param.unsigned.call.clone(),
|
param.unsigned.call.clone(),
|
||||||
(
|
(
|
||||||
|
frame_system::CheckNonZeroSender::<millau_runtime::Runtime>::new(),
|
||||||
frame_system::CheckSpecVersion::<millau_runtime::Runtime>::new(),
|
frame_system::CheckSpecVersion::<millau_runtime::Runtime>::new(),
|
||||||
frame_system::CheckTxVersion::<millau_runtime::Runtime>::new(),
|
frame_system::CheckTxVersion::<millau_runtime::Runtime>::new(),
|
||||||
frame_system::CheckGenesis::<millau_runtime::Runtime>::new(),
|
frame_system::CheckGenesis::<millau_runtime::Runtime>::new(),
|
||||||
@@ -114,6 +115,7 @@ impl TransactionSignScheme for Millau {
|
|||||||
pallet_transaction_payment::ChargeTransactionPayment::<millau_runtime::Runtime>::from(param.unsigned.tip),
|
pallet_transaction_payment::ChargeTransactionPayment::<millau_runtime::Runtime>::from(param.unsigned.tip),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
(),
|
||||||
param.spec_version,
|
param.spec_version,
|
||||||
param.transaction_version,
|
param.transaction_version,
|
||||||
param.genesis_hash,
|
param.genesis_hash,
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
relay-substrate-client = { path = "../client-substrate" }
|
relay-substrate-client = { path = "../client-substrate" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
scale-info = { version = "1.0", features = ["derive"] }
|
scale-info = { version = "2.0.1", features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
relay-substrate-client = { path = "../client-substrate" }
|
relay-substrate-client = { path = "../client-substrate" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ impl TransactionSignScheme for Rialto {
|
|||||||
let raw_payload = SignedPayload::from_raw(
|
let raw_payload = SignedPayload::from_raw(
|
||||||
param.unsigned.call.clone(),
|
param.unsigned.call.clone(),
|
||||||
(
|
(
|
||||||
|
frame_system::CheckNonZeroSender::<rialto_runtime::Runtime>::new(),
|
||||||
frame_system::CheckSpecVersion::<rialto_runtime::Runtime>::new(),
|
frame_system::CheckSpecVersion::<rialto_runtime::Runtime>::new(),
|
||||||
frame_system::CheckTxVersion::<rialto_runtime::Runtime>::new(),
|
frame_system::CheckTxVersion::<rialto_runtime::Runtime>::new(),
|
||||||
frame_system::CheckGenesis::<rialto_runtime::Runtime>::new(),
|
frame_system::CheckGenesis::<rialto_runtime::Runtime>::new(),
|
||||||
@@ -114,6 +115,7 @@ impl TransactionSignScheme for Rialto {
|
|||||||
pallet_transaction_payment::ChargeTransactionPayment::<rialto_runtime::Runtime>::from(param.unsigned.tip),
|
pallet_transaction_payment::ChargeTransactionPayment::<rialto_runtime::Runtime>::from(param.unsigned.tip),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
(),
|
||||||
param.spec_version,
|
param.spec_version,
|
||||||
param.transaction_version,
|
param.transaction_version,
|
||||||
param.genesis_hash,
|
param.genesis_hash,
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
relay-substrate-client = { path = "../client-substrate" }
|
relay-substrate-client = { path = "../client-substrate" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
scale-info = { version = "1.0", features = ["derive"] }
|
scale-info = { version = "2.0.1", features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
async-std = { version = "1.6.5", features = ["attributes"] }
|
async-std = { version = "1.6.5", features = ["attributes"] }
|
||||||
async-trait = "0.1.40"
|
async-trait = "0.1.40"
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
jsonrpsee-proc-macros = "0.3.1"
|
jsonrpsee = { version = "0.8", features = ["macros", "ws-client"] }
|
||||||
jsonrpsee-ws-client = "0.3.1"
|
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
tokio = "1.8"
|
serde = { version = "1.0" }
|
||||||
|
tokio = { version = "1.8", features = ["rt-multi-thread"] }
|
||||||
thiserror = "1.0.26"
|
thiserror = "1.0.26"
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use bp_messages::MessageNonce;
|
|||||||
use bp_runtime::{Chain as ChainBase, EncodedOrDecodedCall, HashOf, TransactionEraOf};
|
use bp_runtime::{Chain as ChainBase, EncodedOrDecodedCall, HashOf, TransactionEraOf};
|
||||||
use codec::{Codec, Encode};
|
use codec::{Codec, Encode};
|
||||||
use frame_support::weights::{Weight, WeightToFeePolynomial};
|
use frame_support::weights::{Weight, WeightToFeePolynomial};
|
||||||
use jsonrpsee_ws_client::types::{DeserializeOwned, Serialize};
|
use jsonrpsee::core::{DeserializeOwned, Serialize};
|
||||||
use num_traits::Zero;
|
use num_traits::Zero;
|
||||||
use sc_transaction_pool_api::TransactionStatus;
|
use sc_transaction_pool_api::TransactionStatus;
|
||||||
use sp_core::{storage::StorageKey, Pair};
|
use sp_core::{storage::StorageKey, Pair};
|
||||||
|
|||||||
@@ -18,8 +18,9 @@
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
chain::{Chain, ChainWithBalances, TransactionStatusOf},
|
chain::{Chain, ChainWithBalances, TransactionStatusOf},
|
||||||
rpc::Substrate,
|
rpc::SubstrateClient,
|
||||||
ConnectionParams, Error, HashOf, HeaderIdOf, Result,
|
AccountIdOf, BlockNumberOf, ConnectionParams, Error, HashOf, HeaderIdOf, HeaderOf, IndexOf,
|
||||||
|
Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
use async_std::sync::{Arc, Mutex};
|
use async_std::sync::{Arc, Mutex};
|
||||||
@@ -27,12 +28,10 @@ use async_trait::async_trait;
|
|||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use frame_system::AccountInfo;
|
use frame_system::AccountInfo;
|
||||||
use futures::{SinkExt, StreamExt};
|
use futures::{SinkExt, StreamExt};
|
||||||
use jsonrpsee_ws_client::{
|
use jsonrpsee::{
|
||||||
types::{
|
core::{client::SubscriptionClientT, DeserializeOwned},
|
||||||
self as jsonrpsee_types, traits::SubscriptionClient, v2::params::JsonRpcParams,
|
types::params::ParamsSer,
|
||||||
DeserializeOwned,
|
ws_client::{WsClient as RpcClient, WsClientBuilder as RpcClientBuilder},
|
||||||
},
|
|
||||||
WsClient as RpcClient, WsClientBuilder as RpcClientBuilder,
|
|
||||||
};
|
};
|
||||||
use num_traits::{Bounded, CheckedSub, One, Zero};
|
use num_traits::{Bounded, CheckedSub, One, Zero};
|
||||||
use pallet_balances::AccountData;
|
use pallet_balances::AccountData;
|
||||||
@@ -154,7 +153,15 @@ impl<C: Chain> Client<C> {
|
|||||||
let genesis_hash_client = client.clone();
|
let genesis_hash_client = client.clone();
|
||||||
let genesis_hash = tokio
|
let genesis_hash = tokio
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
Substrate::<C>::chain_get_block_hash(&*genesis_hash_client, number).await
|
SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::chain_get_block_hash(&*genesis_hash_client, Some(number))
|
||||||
|
.await
|
||||||
})
|
})
|
||||||
.await??;
|
.await??;
|
||||||
|
|
||||||
@@ -210,7 +217,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Returns true if client is connected to at least one peer and is in synced state.
|
/// Returns true if client is connected to at least one peer and is in synced state.
|
||||||
pub async fn ensure_synced(&self) -> Result<()> {
|
pub async fn ensure_synced(&self) -> Result<()> {
|
||||||
self.jsonrpsee_execute(|client| async move {
|
self.jsonrpsee_execute(|client| async move {
|
||||||
let health = Substrate::<C>::system_health(&*client).await?;
|
let health = SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::system_health(&*client)
|
||||||
|
.await?;
|
||||||
let is_synced = !health.is_syncing && (!health.should_have_peers || health.peers > 0);
|
let is_synced = !health.is_syncing && (!health.should_have_peers || health.peers > 0);
|
||||||
if is_synced {
|
if is_synced {
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -229,7 +244,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Return hash of the best finalized block.
|
/// Return hash of the best finalized block.
|
||||||
pub async fn best_finalized_header_hash(&self) -> Result<C::Hash> {
|
pub async fn best_finalized_header_hash(&self) -> Result<C::Hash> {
|
||||||
self.jsonrpsee_execute(|client| async move {
|
self.jsonrpsee_execute(|client| async move {
|
||||||
Ok(Substrate::<C>::chain_get_finalized_head(&*client).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::chain_get_finalized_head(&*client)
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -245,7 +268,15 @@ impl<C: Chain> Client<C> {
|
|||||||
C::Header: DeserializeOwned,
|
C::Header: DeserializeOwned,
|
||||||
{
|
{
|
||||||
self.jsonrpsee_execute(|client| async move {
|
self.jsonrpsee_execute(|client| async move {
|
||||||
Ok(Substrate::<C>::chain_get_header(&*client, None).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::chain_get_header(&*client, None)
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -253,7 +284,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Get a Substrate block from its hash.
|
/// Get a Substrate block from its hash.
|
||||||
pub async fn get_block(&self, block_hash: Option<C::Hash>) -> Result<C::SignedBlock> {
|
pub async fn get_block(&self, block_hash: Option<C::Hash>) -> Result<C::SignedBlock> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::chain_get_block(&*client, block_hash).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::chain_get_block(&*client, block_hash)
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -264,7 +303,15 @@ impl<C: Chain> Client<C> {
|
|||||||
C::Header: DeserializeOwned,
|
C::Header: DeserializeOwned,
|
||||||
{
|
{
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::chain_get_header(&*client, block_hash).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::chain_get_header(&*client, Some(block_hash))
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -272,7 +319,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Get a Substrate block hash by its number.
|
/// Get a Substrate block hash by its number.
|
||||||
pub async fn block_hash_by_number(&self, number: C::BlockNumber) -> Result<C::Hash> {
|
pub async fn block_hash_by_number(&self, number: C::BlockNumber) -> Result<C::Hash> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::chain_get_block_hash(&*client, number).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::chain_get_block_hash(&*client, Some(number))
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -290,7 +345,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Return runtime version.
|
/// Return runtime version.
|
||||||
pub async fn runtime_version(&self) -> Result<RuntimeVersion> {
|
pub async fn runtime_version(&self) -> Result<RuntimeVersion> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::state_runtime_version(&*client).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::state_runtime_version(&*client)
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -316,7 +379,15 @@ impl<C: Chain> Client<C> {
|
|||||||
block_hash: Option<C::Hash>,
|
block_hash: Option<C::Hash>,
|
||||||
) -> Result<Option<StorageData>> {
|
) -> Result<Option<StorageData>> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::state_get_storage(&*client, storage_key, block_hash).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::state_get_storage(&*client, storage_key, block_hash)
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -328,10 +399,16 @@ impl<C: Chain> Client<C> {
|
|||||||
{
|
{
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
let storage_key = C::account_info_storage_key(&account);
|
let storage_key = C::account_info_storage_key(&account);
|
||||||
let encoded_account_data =
|
let encoded_account_data = SubstrateClient::<
|
||||||
Substrate::<C>::state_get_storage(&*client, storage_key, None)
|
AccountIdOf<C>,
|
||||||
.await?
|
BlockNumberOf<C>,
|
||||||
.ok_or(Error::AccountDoesNotExist)?;
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::state_get_storage(&*client, storage_key, None)
|
||||||
|
.await?
|
||||||
|
.ok_or(Error::AccountDoesNotExist)?;
|
||||||
let decoded_account_data = AccountInfo::<C::Index, AccountData<C::Balance>>::decode(
|
let decoded_account_data = AccountInfo::<C::Index, AccountData<C::Balance>>::decode(
|
||||||
&mut &encoded_account_data.0[..],
|
&mut &encoded_account_data.0[..],
|
||||||
)
|
)
|
||||||
@@ -346,7 +423,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Note: It's the caller's responsibility to make sure `account` is a valid SS58 address.
|
/// Note: It's the caller's responsibility to make sure `account` is a valid SS58 address.
|
||||||
pub async fn next_account_index(&self, account: C::AccountId) -> Result<C::Index> {
|
pub async fn next_account_index(&self, account: C::AccountId) -> Result<C::Index> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::system_account_next_index(&*client, account).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::system_account_next_index(&*client, account)
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -356,7 +441,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Note: The given transaction needs to be SCALE encoded beforehand.
|
/// Note: The given transaction needs to be SCALE encoded beforehand.
|
||||||
pub async fn submit_unsigned_extrinsic(&self, transaction: Bytes) -> Result<C::Hash> {
|
pub async fn submit_unsigned_extrinsic(&self, transaction: Bytes) -> Result<C::Hash> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
let tx_hash = Substrate::<C>::author_submit_extrinsic(&*client, transaction).await?;
|
let tx_hash = SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::author_submit_extrinsic(&*client, transaction)
|
||||||
|
.await?;
|
||||||
log::trace!(target: "bridge", "Sent transaction to Substrate node: {:?}", tx_hash);
|
log::trace!(target: "bridge", "Sent transaction to Substrate node: {:?}", tx_hash);
|
||||||
Ok(tx_hash)
|
Ok(tx_hash)
|
||||||
})
|
})
|
||||||
@@ -391,7 +484,15 @@ impl<C: Chain> Client<C> {
|
|||||||
|
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
let extrinsic = prepare_extrinsic(best_header_id, transaction_nonce)?;
|
let extrinsic = prepare_extrinsic(best_header_id, transaction_nonce)?;
|
||||||
let tx_hash = Substrate::<C>::author_submit_extrinsic(&*client, extrinsic).await?;
|
let tx_hash = SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::author_submit_extrinsic(&*client, extrinsic)
|
||||||
|
.await?;
|
||||||
log::trace!(target: "bridge", "Sent transaction to {} node: {:?}", C::NAME, tx_hash);
|
log::trace!(target: "bridge", "Sent transaction to {} node: {:?}", C::NAME, tx_hash);
|
||||||
Ok(tx_hash)
|
Ok(tx_hash)
|
||||||
})
|
})
|
||||||
@@ -416,8 +517,8 @@ impl<C: Chain> Client<C> {
|
|||||||
let subscription = client
|
let subscription = client
|
||||||
.subscribe(
|
.subscribe(
|
||||||
"author_submitAndWatchExtrinsic",
|
"author_submitAndWatchExtrinsic",
|
||||||
JsonRpcParams::Array(vec![jsonrpsee_types::to_json_value(extrinsic)
|
Some(ParamsSer::Array(vec![jsonrpsee::core::to_json_value(extrinsic)
|
||||||
.map_err(|e| Error::RpcError(e.into()))?]),
|
.map_err(|e| Error::RpcError(e.into()))?])),
|
||||||
"author_unwatchExtrinsic",
|
"author_unwatchExtrinsic",
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@@ -438,7 +539,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Returns pending extrinsics from transaction pool.
|
/// Returns pending extrinsics from transaction pool.
|
||||||
pub async fn pending_extrinsics(&self) -> Result<Vec<Bytes>> {
|
pub async fn pending_extrinsics(&self) -> Result<Vec<Bytes>> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Ok(Substrate::<C>::author_pending_extrinsics(&*client).await?)
|
Ok(SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::author_pending_extrinsics(&*client)
|
||||||
|
.await?)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -453,8 +562,15 @@ impl<C: Chain> Client<C> {
|
|||||||
let call = SUB_API_TXPOOL_VALIDATE_TRANSACTION.to_string();
|
let call = SUB_API_TXPOOL_VALIDATE_TRANSACTION.to_string();
|
||||||
let data = Bytes((TransactionSource::External, transaction, at_block).encode());
|
let data = Bytes((TransactionSource::External, transaction, at_block).encode());
|
||||||
|
|
||||||
let encoded_response =
|
let encoded_response = SubstrateClient::<
|
||||||
Substrate::<C>::state_call(&*client, call, data, Some(at_block)).await?;
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::state_call(&*client, call, data, Some(at_block))
|
||||||
|
.await?;
|
||||||
let validity = TransactionValidity::decode(&mut &encoded_response.0[..])
|
let validity = TransactionValidity::decode(&mut &encoded_response.0[..])
|
||||||
.map_err(Error::ResponseParseFailed)?;
|
.map_err(Error::ResponseParseFailed)?;
|
||||||
|
|
||||||
@@ -469,8 +585,15 @@ impl<C: Chain> Client<C> {
|
|||||||
transaction: Bytes,
|
transaction: Bytes,
|
||||||
) -> Result<InclusionFee<C::Balance>> {
|
) -> Result<InclusionFee<C::Balance>> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
let fee_details =
|
let fee_details = SubstrateClient::<
|
||||||
Substrate::<C>::payment_query_fee_details(&*client, transaction, None).await?;
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::payment_query_fee_details(&*client, transaction, None)
|
||||||
|
.await?;
|
||||||
let inclusion_fee = fee_details
|
let inclusion_fee = fee_details
|
||||||
.inclusion_fee
|
.inclusion_fee
|
||||||
.map(|inclusion_fee| InclusionFee {
|
.map(|inclusion_fee| InclusionFee {
|
||||||
@@ -502,8 +625,15 @@ impl<C: Chain> Client<C> {
|
|||||||
let call = SUB_API_GRANDPA_AUTHORITIES.to_string();
|
let call = SUB_API_GRANDPA_AUTHORITIES.to_string();
|
||||||
let data = Bytes(Vec::new());
|
let data = Bytes(Vec::new());
|
||||||
|
|
||||||
let encoded_response =
|
let encoded_response = SubstrateClient::<
|
||||||
Substrate::<C>::state_call(&*client, call, data, Some(block)).await?;
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::state_call(&*client, call, data, Some(block))
|
||||||
|
.await?;
|
||||||
let authority_list = encoded_response.0;
|
let authority_list = encoded_response.0;
|
||||||
|
|
||||||
Ok(authority_list)
|
Ok(authority_list)
|
||||||
@@ -519,9 +649,16 @@ impl<C: Chain> Client<C> {
|
|||||||
at_block: Option<C::Hash>,
|
at_block: Option<C::Hash>,
|
||||||
) -> Result<Bytes> {
|
) -> Result<Bytes> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Substrate::<C>::state_call(&*client, method, data, at_block)
|
SubstrateClient::<
|
||||||
.await
|
AccountIdOf<C>,
|
||||||
.map_err(Into::into)
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::state_call(&*client, method, data, at_block)
|
||||||
|
.await
|
||||||
|
.map_err(Into::into)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -533,10 +670,19 @@ impl<C: Chain> Client<C> {
|
|||||||
at_block: C::Hash,
|
at_block: C::Hash,
|
||||||
) -> Result<StorageProof> {
|
) -> Result<StorageProof> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
Substrate::<C>::state_prove_storage(&*client, keys, Some(at_block))
|
SubstrateClient::<
|
||||||
.await
|
AccountIdOf<C>,
|
||||||
.map(|proof| StorageProof::new(proof.proof.into_iter().map(|b| b.0).collect()))
|
BlockNumberOf<C>,
|
||||||
.map_err(Into::into)
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::state_prove_storage(&*client, keys, Some(at_block))
|
||||||
|
.await
|
||||||
|
.map(|proof| {
|
||||||
|
StorageProof::new(proof.proof.into_iter().map(|b| b.0).collect::<Vec<_>>())
|
||||||
|
})
|
||||||
|
.map_err(Into::into)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -544,7 +690,15 @@ impl<C: Chain> Client<C> {
|
|||||||
/// Return `tokenDecimals` property from the set of chain properties.
|
/// Return `tokenDecimals` property from the set of chain properties.
|
||||||
pub async fn token_decimals(&self) -> Result<Option<u64>> {
|
pub async fn token_decimals(&self) -> Result<Option<u64>> {
|
||||||
self.jsonrpsee_execute(move |client| async move {
|
self.jsonrpsee_execute(move |client| async move {
|
||||||
let system_properties = Substrate::<C>::system_properties(&*client).await?;
|
let system_properties = SubstrateClient::<
|
||||||
|
AccountIdOf<C>,
|
||||||
|
BlockNumberOf<C>,
|
||||||
|
HashOf<C>,
|
||||||
|
HeaderOf<C>,
|
||||||
|
IndexOf<C>,
|
||||||
|
C::SignedBlock,
|
||||||
|
>::system_properties(&*client)
|
||||||
|
.await?;
|
||||||
Ok(system_properties.get("tokenDecimals").and_then(|v| v.as_u64()))
|
Ok(system_properties.get("tokenDecimals").and_then(|v| v.as_u64()))
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@@ -557,7 +711,7 @@ impl<C: Chain> Client<C> {
|
|||||||
Ok(client
|
Ok(client
|
||||||
.subscribe(
|
.subscribe(
|
||||||
"grandpa_subscribeJustifications",
|
"grandpa_subscribeJustifications",
|
||||||
JsonRpcParams::NoParams,
|
None,
|
||||||
"grandpa_unsubscribeJustifications",
|
"grandpa_unsubscribeJustifications",
|
||||||
)
|
)
|
||||||
.await?)
|
.await?)
|
||||||
@@ -597,26 +751,16 @@ impl<T: DeserializeOwned> Subscription<T> {
|
|||||||
async fn background_worker(
|
async fn background_worker(
|
||||||
chain_name: String,
|
chain_name: String,
|
||||||
item_type: String,
|
item_type: String,
|
||||||
mut subscription: jsonrpsee_types::Subscription<T>,
|
mut subscription: jsonrpsee::core::client::Subscription<T>,
|
||||||
mut sender: futures::channel::mpsc::Sender<Option<T>>,
|
mut sender: futures::channel::mpsc::Sender<Option<T>>,
|
||||||
) {
|
) {
|
||||||
loop {
|
loop {
|
||||||
match subscription.next().await {
|
match subscription.next().await {
|
||||||
Ok(Some(item)) =>
|
Some(Ok(item)) =>
|
||||||
if sender.send(Some(item)).await.is_err() {
|
if sender.send(Some(item)).await.is_err() {
|
||||||
break
|
break
|
||||||
},
|
},
|
||||||
Ok(None) => {
|
Some(Err(e)) => {
|
||||||
log::trace!(
|
|
||||||
target: "bridge",
|
|
||||||
"{} {} subscription stream has returned None. Stream needs to be restarted.",
|
|
||||||
chain_name,
|
|
||||||
item_type,
|
|
||||||
);
|
|
||||||
let _ = sender.send(None).await;
|
|
||||||
break
|
|
||||||
},
|
|
||||||
Err(e) => {
|
|
||||||
log::trace!(
|
log::trace!(
|
||||||
target: "bridge",
|
target: "bridge",
|
||||||
"{} {} subscription stream has returned '{:?}'. Stream needs to be restarted.",
|
"{} {} subscription stream has returned '{:?}'. Stream needs to be restarted.",
|
||||||
@@ -627,6 +771,16 @@ impl<T: DeserializeOwned> Subscription<T> {
|
|||||||
let _ = sender.send(None).await;
|
let _ = sender.send(None).await;
|
||||||
break
|
break
|
||||||
},
|
},
|
||||||
|
None => {
|
||||||
|
log::trace!(
|
||||||
|
target: "bridge",
|
||||||
|
"{} {} subscription stream has returned None. Stream needs to be restarted.",
|
||||||
|
chain_name,
|
||||||
|
item_type,
|
||||||
|
);
|
||||||
|
let _ = sender.send(None).await;
|
||||||
|
break
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! Substrate node RPC errors.
|
//! Substrate node RPC errors.
|
||||||
|
|
||||||
use jsonrpsee_ws_client::types::Error as RpcError;
|
use jsonrpsee::core::Error as RpcError;
|
||||||
use relay_utils::MaybeConnectionError;
|
use relay_utils::MaybeConnectionError;
|
||||||
use sc_rpc_api::system::Health;
|
use sc_rpc_api::system::Health;
|
||||||
use sp_runtime::transaction_validity::TransactionValidityError;
|
use sp_runtime::transaction_validity::TransactionValidityError;
|
||||||
|
|||||||
@@ -16,8 +16,7 @@
|
|||||||
|
|
||||||
//! The most generic Substrate node RPC interface.
|
//! The most generic Substrate node RPC interface.
|
||||||
|
|
||||||
use crate::chain::Chain;
|
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
|
||||||
|
|
||||||
use pallet_transaction_payment_rpc_runtime_api::FeeDetails;
|
use pallet_transaction_payment_rpc_runtime_api::FeeDetails;
|
||||||
use sc_rpc_api::{state::ReadProof, system::Health};
|
use sc_rpc_api::{state::ReadProof, system::Health};
|
||||||
use sp_core::{
|
use sp_core::{
|
||||||
@@ -27,35 +26,51 @@ use sp_core::{
|
|||||||
use sp_rpc::number::NumberOrHex;
|
use sp_rpc::number::NumberOrHex;
|
||||||
use sp_version::RuntimeVersion;
|
use sp_version::RuntimeVersion;
|
||||||
|
|
||||||
jsonrpsee_proc_macros::rpc_client_api! {
|
#[rpc(client)]
|
||||||
pub(crate) Substrate<C: Chain> {
|
pub(crate) trait Substrate<AccountId, BlockNumber, Hash, Header, Index, SignedBlock> {
|
||||||
#[rpc(method = "system_health", positional_params)]
|
#[method(name = "system_health", param_kind = array)]
|
||||||
fn system_health() -> Health;
|
async fn system_health(&self) -> RpcResult<Health>;
|
||||||
#[rpc(method = "system_properties", positional_params)]
|
#[method(name = "system_properties", param_kind = array)]
|
||||||
fn system_properties() -> sc_chain_spec::Properties;
|
async fn system_properties(&self) -> RpcResult<sc_chain_spec::Properties>;
|
||||||
#[rpc(method = "chain_getHeader", positional_params)]
|
#[method(name = "chain_getHeader", param_kind = array)]
|
||||||
fn chain_get_header(block_hash: Option<C::Hash>) -> C::Header;
|
async fn chain_get_header(&self, block_hash: Option<Hash>) -> RpcResult<Header>;
|
||||||
#[rpc(method = "chain_getFinalizedHead", positional_params)]
|
#[method(name = "chain_getFinalizedHead", param_kind = array)]
|
||||||
fn chain_get_finalized_head() -> C::Hash;
|
async fn chain_get_finalized_head(&self) -> RpcResult<Hash>;
|
||||||
#[rpc(method = "chain_getBlock", positional_params)]
|
#[method(name = "chain_getBlock", param_kind = array)]
|
||||||
fn chain_get_block(block_hash: Option<C::Hash>) -> C::SignedBlock;
|
async fn chain_get_block(&self, block_hash: Option<Hash>) -> RpcResult<SignedBlock>;
|
||||||
#[rpc(method = "chain_getBlockHash", positional_params)]
|
#[method(name = "chain_getBlockHash", param_kind = array)]
|
||||||
fn chain_get_block_hash(block_number: Option<C::BlockNumber>) -> C::Hash;
|
async fn chain_get_block_hash(&self, block_number: Option<BlockNumber>) -> RpcResult<Hash>;
|
||||||
#[rpc(method = "system_accountNextIndex", positional_params)]
|
#[method(name = "system_accountNextIndex", param_kind = array)]
|
||||||
fn system_account_next_index(account_id: C::AccountId) -> C::Index;
|
async fn system_account_next_index(&self, account_id: AccountId) -> RpcResult<Index>;
|
||||||
#[rpc(method = "author_submitExtrinsic", positional_params)]
|
#[method(name = "author_submitExtrinsic", param_kind = array)]
|
||||||
fn author_submit_extrinsic(extrinsic: Bytes) -> C::Hash;
|
async fn author_submit_extrinsic(&self, extrinsic: Bytes) -> RpcResult<Hash>;
|
||||||
#[rpc(method = "author_pendingExtrinsics", positional_params)]
|
#[method(name = "author_pendingExtrinsics", param_kind = array)]
|
||||||
fn author_pending_extrinsics() -> Vec<Bytes>;
|
async fn author_pending_extrinsics(&self) -> RpcResult<Vec<Bytes>>;
|
||||||
#[rpc(method = "state_call", positional_params)]
|
#[method(name = "state_call", param_kind = array)]
|
||||||
fn state_call(method: String, data: Bytes, at_block: Option<C::Hash>) -> Bytes;
|
async fn state_call(
|
||||||
#[rpc(method = "state_getStorage", positional_params)]
|
&self,
|
||||||
fn state_get_storage(key: StorageKey, at_block: Option<C::Hash>) -> Option<StorageData>;
|
method: String,
|
||||||
#[rpc(method = "state_getReadProof", positional_params)]
|
data: Bytes,
|
||||||
fn state_prove_storage(keys: Vec<StorageKey>, hash: Option<C::Hash>) -> ReadProof<C::Hash>;
|
at_block: Option<Hash>,
|
||||||
#[rpc(method = "state_getRuntimeVersion", positional_params)]
|
) -> RpcResult<Bytes>;
|
||||||
fn state_runtime_version() -> RuntimeVersion;
|
#[method(name = "state_getStorage", param_kind = array)]
|
||||||
#[rpc(method = "payment_queryFeeDetails", positional_params)]
|
async fn state_get_storage(
|
||||||
fn payment_query_fee_details(extrinsic: Bytes, at_block: Option<C::Hash>) -> FeeDetails<NumberOrHex>;
|
&self,
|
||||||
}
|
key: StorageKey,
|
||||||
|
at_block: Option<Hash>,
|
||||||
|
) -> RpcResult<Option<StorageData>>;
|
||||||
|
#[method(name = "state_getReadProof", param_kind = array)]
|
||||||
|
async fn state_prove_storage(
|
||||||
|
&self,
|
||||||
|
keys: Vec<StorageKey>,
|
||||||
|
hash: Option<Hash>,
|
||||||
|
) -> RpcResult<ReadProof<Hash>>;
|
||||||
|
#[method(name = "state_getRuntimeVersion", param_kind = array)]
|
||||||
|
async fn state_runtime_version(&self) -> RpcResult<RuntimeVersion>;
|
||||||
|
#[method(name = "payment_queryFeeDetails", param_kind = array)]
|
||||||
|
async fn payment_query_fee_details(
|
||||||
|
&self,
|
||||||
|
extrinsic: Bytes,
|
||||||
|
at_block: Option<Hash>,
|
||||||
|
) -> RpcResult<FeeDetails<NumberOrHex>>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
relay-substrate-client = { path = "../client-substrate" }
|
relay-substrate-client = { path = "../client-substrate" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
relay-substrate-client = { path = "../client-substrate" }
|
relay-substrate-client = { path = "../client-substrate" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
bridge-runtime-common = { path = "../../bin/runtime-common" }
|
bridge-runtime-common = { path = "../../bin/runtime-common" }
|
||||||
|
|||||||
@@ -10,18 +10,17 @@ anyhow = "1.0"
|
|||||||
thiserror = "1.0.26"
|
thiserror = "1.0.26"
|
||||||
async-std = "1.9.0"
|
async-std = "1.9.0"
|
||||||
async-trait = "0.1.42"
|
async-trait = "0.1.42"
|
||||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
codec = { package = "parity-scale-codec", version = "3.0.0" }
|
||||||
futures = "0.3.12"
|
futures = "0.3.12"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
|
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|
||||||
bp-header-chain = { path = "../../primitives/header-chain" }
|
bp-header-chain = { path = "../../primitives/header-chain" }
|
||||||
bridge-runtime-common = { path = "../../bin/runtime-common" }
|
bridge-runtime-common = { path = "../../bin/runtime-common" }
|
||||||
|
|
||||||
finality-grandpa = { version = "0.14.0" }
|
finality-grandpa = { version = "0.15.0" }
|
||||||
finality-relay = { path = "../finality" }
|
finality-relay = { path = "../finality" }
|
||||||
relay-utils = { path = "../utils" }
|
relay-utils = { path = "../utils" }
|
||||||
messages-relay = { path = "../messages" }
|
messages-relay = { path = "../messages" }
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ num-traits = "0.2"
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
sysinfo = "0.15"
|
sysinfo = "0.15"
|
||||||
time = { version = "0.3", features = ["formatting", "local-offset", "std"] }
|
time = { version = "0.3", features = ["formatting", "local-offset", "std"] }
|
||||||
|
tokio = { version = "1.8", features = ["rt"] }
|
||||||
thiserror = "1.0.26"
|
thiserror = "1.0.26"
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|||||||
@@ -187,12 +187,32 @@ impl<SC, TC, LM> LoopMetrics<SC, TC, LM> {
|
|||||||
|
|
||||||
let registry = self.registry;
|
let registry = self.registry;
|
||||||
async_std::task::spawn(async move {
|
async_std::task::spawn(async move {
|
||||||
let result = init_prometheus(socket_addr, registry).await;
|
let runtime =
|
||||||
log::trace!(
|
match tokio::runtime::Builder::new_current_thread().enable_all().build() {
|
||||||
target: "bridge-metrics",
|
Ok(runtime) => runtime,
|
||||||
"Prometheus endpoint has exited with result: {:?}",
|
Err(err) => {
|
||||||
result,
|
log::trace!(
|
||||||
);
|
target: "bridge-metrics",
|
||||||
|
"Failed to create tokio runtime. Prometheus meterics are not available: {:?}",
|
||||||
|
err,
|
||||||
|
);
|
||||||
|
return
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let _ = runtime.block_on(async move {
|
||||||
|
log::trace!(
|
||||||
|
target: "bridge-metrics",
|
||||||
|
"Starting prometheus endpoint at: {:?}",
|
||||||
|
socket_addr,
|
||||||
|
);
|
||||||
|
let result = init_prometheus(socket_addr, registry).await;
|
||||||
|
log::trace!(
|
||||||
|
target: "bridge-metrics",
|
||||||
|
"Prometheus endpoint has exited with result: {:?}",
|
||||||
|
result,
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user