Bump xcm v3 + substrate

* Bumping substrate/polkadot/cumulus

* Update Cargo.lock

* Fixes

* Fixes for mmr

* Bump clap

* Fix for millau - added CompatibilityMode

* Fixes for rialto-parachain

* Align everywhere branch='master' and just use overrides from main Cargo.toml
This commit is contained in:
Branislav Kontur
2022-11-08 09:40:04 +01:00
committed by Bastian Köcher
parent a979340e49
commit 2c0b6b73e0
18 changed files with 115 additions and 89 deletions
+1 -1
View File
@@ -9,7 +9,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.1", features = ["derive"] } clap = { version = "4.0.9", features = ["derive"] }
jsonrpsee = { version = "0.15.1", features = ["server"] } jsonrpsee = { version = "0.15.1", features = ["server"] }
serde_json = "1.0.79" serde_json = "1.0.79"
+3 -1
View File
@@ -19,7 +19,7 @@
use jsonrpsee::RpcModule; use jsonrpsee::RpcModule;
use millau_runtime::{self, opaque::Block, RuntimeApi}; use millau_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::BlockBackend; use sc_client_api::BlockBackend;
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_consensus_aura::{CompatibilityMode, ImportQueueParams, SlotProportion, StartAuraParams};
pub use sc_executor::NativeElseWasmExecutor; pub use sc_executor::NativeElseWasmExecutor;
use sc_finality_grandpa::SharedVoterState; use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore; use sc_keystore::LocalKeystore;
@@ -159,6 +159,7 @@ pub fn new_partial(
registry: config.prometheus_registry(), registry: config.prometheus_registry(),
check_for_equivocation: Default::default(), check_for_equivocation: Default::default(),
telemetry: telemetry.as_ref().map(|x| x.handle()), telemetry: telemetry.as_ref().map(|x| x.handle()),
compatibility_mode: CompatibilityMode::None,
})?; })?;
Ok(sc_service::PartialComponents { Ok(sc_service::PartialComponents {
@@ -374,6 +375,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32), block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32),
max_block_proposal_slot_portion: None, max_block_proposal_slot_portion: None,
telemetry: telemetry.as_ref().map(|x| x.handle()), telemetry: telemetry.as_ref().map(|x| x.handle()),
compatibility_mode: CompatibilityMode::None,
}, },
)?; )?;
+4 -5
View File
@@ -64,11 +64,10 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
# Polkadot Dependencies # Polkadot Dependencies
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false }
[dev-dependencies] [dev-dependencies]
bridge-runtime-common = { path = "../../runtime-common", features = ["integrity-test"] } bridge-runtime-common = { path = "../../runtime-common", features = ["integrity-test"] }
+8 -8
View File
@@ -785,11 +785,11 @@ impl_runtime_apis! {
} }
} }
impl sp_mmr_primitives::MmrApi<Block, mmr::Hash> for Runtime { impl sp_mmr_primitives::MmrApi<Block, mmr::Hash, BlockNumber> for Runtime {
fn generate_proof(leaf_index: u64) fn generate_proof(block_number: BlockNumber)
-> Result<(EncodableOpaqueLeaf, MmrProof<mmr::Hash>), MmrError> -> Result<(EncodableOpaqueLeaf, MmrProof<mmr::Hash>), MmrError>
{ {
Mmr::generate_batch_proof(vec![leaf_index]) Mmr::generate_batch_proof(vec![block_number])
.and_then(|(leaves, proof)| Ok(( .and_then(|(leaves, proof)| Ok((
mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]), mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]),
mmr::BatchProof::into_single_leaf_proof(proof)? mmr::BatchProof::into_single_leaf_proof(proof)?
@@ -823,18 +823,18 @@ impl_runtime_apis! {
Ok(Mmr::mmr_root()) Ok(Mmr::mmr_root())
} }
fn generate_batch_proof(leaf_indices: Vec<pallet_mmr::primitives::LeafIndex>) fn generate_batch_proof(block_numbers: Vec<BlockNumber>)
-> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<mmr::Hash>), mmr::Error> -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<mmr::Hash>), mmr::Error>
{ {
Mmr::generate_batch_proof(leaf_indices) Mmr::generate_batch_proof(block_numbers)
.map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof)) .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof))
} }
fn generate_historical_batch_proof( fn generate_historical_batch_proof(
leaf_indices: Vec<mmr::LeafIndex>, block_numbers: Vec<BlockNumber>,
leaves_count: mmr::LeafIndex, best_known_block_number: BlockNumber
) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<mmr::Hash>), mmr::Error> { ) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<mmr::Hash>), mmr::Error> {
Mmr::generate_historical_batch_proof(leaf_indices, leaves_count).map( Mmr::generate_historical_batch_proof(block_numbers, best_known_block_number).map(
|(leaves, proof)| { |(leaves, proof)| {
( (
leaves leaves
+15 -13
View File
@@ -17,7 +17,7 @@ default = []
runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks'] runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks']
[dependencies] [dependencies]
clap = { version = "3.1", features = ["derive"] } clap = { version = "4.0.9", features = ["derive"] }
log = '0.4.17' log = '0.4.17'
codec = { package = 'parity-scale-codec', version = '3.1.5' } codec = { package = 'parity-scale-codec', version = '3.1.5' }
serde = { version = '1.0', features = ['derive'] } serde = { version = '1.0', features = ['derive'] }
@@ -48,6 +48,7 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "master
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", features = ['wasmtime'] } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", features = ['wasmtime'] }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -66,17 +67,18 @@ sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "mast
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Cumulus dependencies # Cumulus dependencies
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3" } cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/cumulus", branch = "master" }
# Polkadot dependencies # Polkadot dependencies
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
@@ -30,14 +30,16 @@ use rialto_parachain_runtime::RuntimeApi;
// Cumulus Imports // Cumulus Imports
use cumulus_client_cli::CollatorOptions; 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::{ParachainBlockImport, ParachainConsensus};
use cumulus_client_network::BlockAnnounceValidator; use cumulus_client_network::BlockAnnounceValidator;
use cumulus_client_service::{ 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_inprocess_interface::build_inprocess_relay_chain; use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface}; use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult};
use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;
use polkadot_service::CollatorPair;
// Substrate Imports // Substrate Imports
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch}; use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};
@@ -187,6 +189,27 @@ where
Ok(params) Ok(params)
} }
async fn build_relay_chain_interface(
polkadot_config: Configuration,
parachain_config: &Configuration,
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
task_manager: &mut TaskManager,
collator_options: CollatorOptions,
hwbench: Option<sc_sysinfo::HwBench>,
) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option<CollatorPair>)> {
match collator_options.relay_chain_rpc_url {
Some(relay_chain_url) =>
build_minimal_relay_chain_node(polkadot_config, task_manager, relay_chain_url).await,
None => build_inprocess_relay_chain(
polkadot_config,
parachain_config,
telemetry_worker_handle,
task_manager,
hwbench,
),
}
}
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`. /// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
/// ///
/// This is the actual implementation that is abstract over the executor and the runtime api. /// This is the actual implementation that is abstract over the executor and the runtime api.
@@ -267,13 +290,15 @@ 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) = build_inprocess_relay_chain( let (relay_chain_interface, collator_key) = build_relay_chain_interface(
polkadot_config, polkadot_config,
&parachain_config, &parachain_config,
telemetry_worker_handle, telemetry_worker_handle,
&mut task_manager, &mut task_manager,
collator_options,
None, None,
) )
.await
.map_err(|e| match e { .map_err(|e| match e {
RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x, RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x,
s => s.to_string().into(), s => s.to_string().into(),
@@ -367,7 +392,6 @@ 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)?;
@@ -402,7 +426,7 @@ pub fn parachain_build_import_queue(
_, _,
_, _,
>(cumulus_client_consensus_aura::ImportQueueParams { >(cumulus_client_consensus_aura::ImportQueueParams {
block_import: client.clone(), block_import: ParachainBlockImport::new(client.clone()),
client, client,
create_inherent_data_providers: move |_, _| async move { create_inherent_data_providers: move |_, _| async move {
let time = sp_timestamp::InherentDataProvider::from_system_time(); let time = sp_timestamp::InherentDataProvider::from_system_time();
@@ -497,7 +521,7 @@ pub async fn start_node(
Ok((slot, time, parachain_inherent)) Ok((slot, time, parachain_inherent))
} }
}, },
block_import: client.clone(), block_import: ParachainBlockImport::new(client.clone()),
para_client: client, para_client: client,
backoff_authoring_blocks: Option::<()>::None, backoff_authoring_blocks: Option::<()>::None,
sync_oracle, sync_oracle,
+13 -13
View File
@@ -60,21 +60,21 @@ pallet-transaction-payment = { git = "https://github.com/paritytech/substrate",
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
# Cumulus Dependencies # Cumulus Dependencies
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "gav-xcm-v3", default-features = false } parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "master", default-features = false }
# Polkadot Dependencies # Polkadot Dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
[features] [features]
default = ['std'] default = ['std']
+5 -6
View File
@@ -9,7 +9,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.1", features = ["derive"] } clap = { version = "4.0.9", features = ["derive"] }
serde_json = "1.0.79" serde_json = "1.0.79"
# Bridge dependencies # Bridge dependencies
@@ -33,11 +33,10 @@ sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot Dependencies # Polkadot Dependencies
polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, features = [ "full-node", "polkadot-native" ] }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false, features = [ "full-node", "polkadot-native" ] }
[build-dependencies] [build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
+7 -8
View File
@@ -60,14 +60,13 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
# Polkadot (parachain) Dependencies # Polkadot (parachain) Dependencies
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false }
[dev-dependencies] [dev-dependencies]
bridge-runtime-common = { path = "../../runtime-common", features = ["integrity-test"] } bridge-runtime-common = { path = "../../runtime-common", features = ["integrity-test"] }
+8 -8
View File
@@ -637,11 +637,11 @@ impl_runtime_apis! {
} }
} }
impl sp_mmr_primitives::MmrApi<Block, Hash> for Runtime { impl sp_mmr_primitives::MmrApi<Block, Hash, BlockNumber> for Runtime {
fn generate_proof(leaf_index: u64) fn generate_proof(block_number: BlockNumber)
-> Result<(EncodableOpaqueLeaf, MmrProof<Hash>), MmrError> -> Result<(EncodableOpaqueLeaf, MmrProof<Hash>), MmrError>
{ {
Mmr::generate_batch_proof(vec![leaf_index]) Mmr::generate_batch_proof(vec![block_number])
.and_then(|(leaves, proof)| Ok(( .and_then(|(leaves, proof)| Ok((
mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]), mmr::EncodableOpaqueLeaf::from_leaf(&leaves[0]),
mmr::BatchProof::into_single_leaf_proof(proof)? mmr::BatchProof::into_single_leaf_proof(proof)?
@@ -679,18 +679,18 @@ impl_runtime_apis! {
Ok(Mmr::mmr_root()) Ok(Mmr::mmr_root())
} }
fn generate_batch_proof(leaf_indices: Vec<pallet_mmr::primitives::LeafIndex>) fn generate_batch_proof(block_numbers: Vec<BlockNumber>)
-> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<MmrHash>), mmr::Error> -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<MmrHash>), mmr::Error>
{ {
Mmr::generate_batch_proof(leaf_indices) Mmr::generate_batch_proof(block_numbers)
.map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof)) .map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof))
} }
fn generate_historical_batch_proof( fn generate_historical_batch_proof(
leaf_indices: Vec<mmr::LeafIndex>, block_numbers: Vec<BlockNumber>,
leaves_count: mmr::LeafIndex, best_known_block_number: BlockNumber
) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<MmrHash>), mmr::Error> { ) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<MmrHash>), mmr::Error> {
Mmr::generate_historical_batch_proof(leaf_indices, leaves_count).map( Mmr::generate_historical_batch_proof(block_numbers, best_known_block_number).map(
|(leaves, proof)| { |(leaves, proof)| {
( (
leaves leaves
@@ -186,6 +186,12 @@ impl polkadot_runtime_common::paras_registrar::WeightInfo for ZeroWeights {
fn swap() -> Weight { fn swap() -> Weight {
Weight::from_ref_time(0) Weight::from_ref_time(0)
} }
fn schedule_code_upgrade(_: u32) -> Weight {
Weight::from_ref_time(0)
}
fn set_current_head(_: u32) -> Weight {
Weight::from_ref_time(0)
}
} }
impl polkadot_runtime_common::slots::WeightInfo for ZeroWeights { impl polkadot_runtime_common::slots::WeightInfo for ZeroWeights {
+4 -5
View File
@@ -36,11 +36,10 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
# Polkadot dependencies # Polkadot dependencies
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false }
[dev-dependencies] [dev-dependencies]
millau-runtime = { path = "../millau/runtime" } millau-runtime = { path = "../millau/runtime" }
@@ -118,11 +118,8 @@ pub fn craft_valid_storage_proof() -> (sp_core::H256, StorageProof) {
state_version, state_version,
)); ));
let root = backend.storage_root(std::iter::empty(), state_version).0; let root = backend.storage_root(std::iter::empty(), state_version).0;
let proof = StorageProof::new( let proof =
prove_read(backend, &[&b"key1"[..], &b"key2"[..], &b"key4"[..], &b"key22"[..]]) prove_read(backend, &[&b"key1"[..], &b"key2"[..], &b"key4"[..], &b"key22"[..]]).unwrap();
.unwrap()
.iter_nodes(),
);
(root, proof) (root, proof)
} }
+5 -6
View File
@@ -51,12 +51,11 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot Dependencies # Polkadot Dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3" } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "gav-xcm-v3", default-features = false }
[dev-dependencies] [dev-dependencies]
@@ -62,7 +62,7 @@ impl<C: Chain> StorageProofOverheadMetric<C> {
.client .client
.prove_storage(vec![StorageKey(CODE.to_vec())], best_header_hash) .prove_storage(vec![StorageKey(CODE.to_vec())], best_header_hash)
.await?; .await?;
let storage_proof_size: usize = storage_proof.clone().iter_nodes().map(|n| n.len()).sum(); let storage_proof_size: usize = storage_proof.iter_nodes().map(|n| n.len()).sum();
let storage_value_reader = bp_runtime::StorageProofChecker::<C::Hasher>::new( let storage_value_reader = bp_runtime::StorageProofChecker::<C::Hasher>::new(
*best_header.state_root(), *best_header.state_root(),
@@ -322,7 +322,7 @@ where
.source_client .source_client
.prove_storage(storage_keys, id.1) .prove_storage(storage_keys, id.1)
.await? .await?
.iter_nodes() .into_iter_nodes()
.collect(); .collect();
let proof = FromBridgedChainMessagesProof { let proof = FromBridgedChainMessagesProof {
bridged_header_hash: id.1, bridged_header_hash: id.1,
@@ -230,7 +230,7 @@ where
.target_client .target_client
.prove_storage(vec![inbound_data_key], id.1) .prove_storage(vec![inbound_data_key], id.1)
.await? .await?
.iter_nodes() .into_iter_nodes()
.collect(); .collect();
let proof = FromBridgedChainMessagesDeliveryProof { let proof = FromBridgedChainMessagesDeliveryProof {
bridged_header_hash: id.1, bridged_header_hash: id.1,
@@ -159,7 +159,7 @@ where
.client .client
.prove_storage(vec![storage_key.clone()], at_block.1) .prove_storage(vec![storage_key.clone()], at_block.1)
.await? .await?
.iter_nodes() .into_iter_nodes()
.collect(); .collect();
// why we're reading parachain head here once again (it has already been read at the // why we're reading parachain head here once again (it has already been read at the