mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
Implement basic upward & downward messages (#118)
* Start by replacing branch names and set `DownwardMessage` * Add the upward-message crate * Add Kusama & Polkadot * More work on getting the upward messages working * Fix build * Begin to integrate it into the test Parachain * Update * Make everything compile again * Switch to westend and print parachain account on startup * Use MultiSignature etc * Fix validate block * Some downward messages work * Update git reference * More downward messages integration * Update test runtime for downward messages * Enable downward message handler and withdraw send tokens * Add some docs * Begin to implement simple XCMP * More work * Fixes and make parachain id configurable * Make parachain ID be part of the genesis * Finishing the XCMP message demo * Update and fixes tests * Update branch
This commit is contained in:
@@ -15,15 +15,17 @@
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use ansi_term::Color;
|
||||
use std::sync::Arc;
|
||||
use sc_executor::native_executor_instance;
|
||||
use sc_service::{AbstractService, Configuration};
|
||||
use sc_finality_grandpa::{FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider};
|
||||
use polkadot_primitives::parachain::CollatorPair;
|
||||
use cumulus_collator::{CollatorBuilder, prepare_collator_config};
|
||||
use futures::FutureExt;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
use cumulus_collator::{prepare_collator_config, CollatorBuilder};
|
||||
use cumulus_network::DelayedBlockAnnounceValidator;
|
||||
use futures::FutureExt;
|
||||
use polkadot_primitives::parachain::CollatorPair;
|
||||
use sc_executor::native_executor_instance;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
use sc_finality_grandpa::{
|
||||
FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider,
|
||||
};
|
||||
use sc_service::{AbstractService, Configuration};
|
||||
use std::sync::Arc;
|
||||
|
||||
// Our native executor instance.
|
||||
native_executor_instance!(
|
||||
@@ -47,9 +49,8 @@ macro_rules! new_full_start {
|
||||
>($config)?
|
||||
.with_select_chain(|_config, backend| Ok(sc_consensus::LongestChain::new(backend.clone())))?
|
||||
.with_transaction_pool(|builder| {
|
||||
let pool_api = Arc::new(sc_transaction_pool::FullChainApi::new(
|
||||
builder.client().clone(),
|
||||
));
|
||||
let client = builder.client();
|
||||
let pool_api = Arc::new(sc_transaction_pool::FullChainApi::new(client.clone()));
|
||||
let pool = sc_transaction_pool::BasicPool::new(
|
||||
builder.config().transaction_pool.clone(),
|
||||
pool_api,
|
||||
@@ -57,19 +58,12 @@ macro_rules! new_full_start {
|
||||
);
|
||||
Ok(pool)
|
||||
})?
|
||||
.with_import_queue(|
|
||||
_config,
|
||||
client,
|
||||
_,
|
||||
_,
|
||||
spawn_task_handle,
|
||||
registry,
|
||||
| {
|
||||
.with_import_queue(|_config, client, _, _, spawner, registry| {
|
||||
let import_queue = cumulus_consensus::import_queue::import_queue(
|
||||
client.clone(),
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
spawn_task_handle,
|
||||
spawner,
|
||||
registry,
|
||||
)?;
|
||||
|
||||
@@ -87,6 +81,7 @@ pub fn run_collator(
|
||||
parachain_config: Configuration,
|
||||
key: Arc<CollatorPair>,
|
||||
polkadot_config: polkadot_collator::Configuration,
|
||||
id: polkadot_primitives::parachain::Id,
|
||||
) -> sc_service::error::Result<impl AbstractService> {
|
||||
let parachain_config = prepare_collator_config(parachain_config);
|
||||
|
||||
@@ -104,9 +99,7 @@ pub fn run_collator(
|
||||
let provider = client as Arc<dyn StorageAndProofProvider<_, _>>;
|
||||
Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _)
|
||||
})?
|
||||
.with_block_announce_validator(|_client| {
|
||||
Box::new(block_announce_validator_copy)
|
||||
})?
|
||||
.with_block_announce_validator(|_client| Box::new(block_announce_validator_copy))?
|
||||
.build_full()?;
|
||||
|
||||
let registry = service.prometheus_registry();
|
||||
@@ -120,14 +113,12 @@ pub fn run_collator(
|
||||
let block_import = service.client();
|
||||
let client = service.client();
|
||||
let network = service.network();
|
||||
let announce_block = Arc::new(move |hash, data| {
|
||||
network.announce_block(hash, data)
|
||||
});
|
||||
let announce_block = Arc::new(move |hash, data| network.announce_block(hash, data));
|
||||
let builder = CollatorBuilder::new(
|
||||
proposer_factory,
|
||||
inherent_data_providers,
|
||||
block_import,
|
||||
crate::PARA_ID,
|
||||
id,
|
||||
client,
|
||||
announce_block,
|
||||
block_announce_validator,
|
||||
@@ -135,11 +126,12 @@ pub fn run_collator(
|
||||
|
||||
let polkadot_future = polkadot_collator::start_collator(
|
||||
builder,
|
||||
crate::PARA_ID,
|
||||
id,
|
||||
key,
|
||||
polkadot_config,
|
||||
Some(format!("[{}] ", Color::Blue.bold().paint("Relaychain"))),
|
||||
).map(|_| ());
|
||||
)
|
||||
.map(|_| ());
|
||||
service.spawn_essential_task("polkadot", polkadot_future);
|
||||
|
||||
Ok(service)
|
||||
|
||||
Reference in New Issue
Block a user