Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mku-genesis-build-f…
Browse files Browse the repository at this point in the history
…or-runtime-genesis-config
  • Loading branch information
michalkucharczyk committed Jul 12, 2023
2 parents 849ab13 + 335d7fa commit 595218e
Show file tree
Hide file tree
Showing 84 changed files with 2,848 additions and 1,291 deletions.
780 changes: 403 additions & 377 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ members = [
"pallets/xcmp-queue",
"parachain-template/node",
"parachain-template/runtime",
"primitives/aura",
"primitives/core",
"primitives/parachain-inherent",
"primitives/timestamp",
Expand Down Expand Up @@ -74,3 +75,4 @@ opt-level = 3
inherits = "release"
lto = true
codegen-units = 1

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ cargo build --release --bin polkadot-parachain
./target/release/polkadot-parachain export-genesis-wasm > genesis-wasm

# Collator1
./target/release/polkadot-parachain --collator --alice --force-authoring --tmp --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335
./target/release/polkadot-parachain --collator --alice --force-authoring --tmp --port 40335 --rpc-port 9946 -- --chain ../polkadot/rococo-local-cfde.json --port 30335

# Collator2
./target/release/polkadot-parachain --collator --bob --force-authoring --tmp --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30336
./target/release/polkadot-parachain --collator --bob --force-authoring --tmp --port 40336 --rpc-port 9947 -- --chain ../polkadot/rococo-local-cfde.json --port 30336

# Parachain Full Node 1
./target/release/polkadot-parachain --tmp --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337
./target/release/polkadot-parachain --tmp --port 40337 --rpc-port 9948 -- --chain ../polkadot/rococo-local-cfde.json --port 30337
```

#### Register the parachain
Expand Down Expand Up @@ -267,5 +267,5 @@ docker build --tag $OWNER/$IMAGE_NAME --file ./docker/polkadot-parachain_builder
You may then run your new container:

```bash
docker run --rm -it $OWNER/$IMAGE_NAME --collator --tmp --execution wasm --chain /specs/westmint.json
docker run --rm -it $OWNER/$IMAGE_NAME --collator --tmp --chain /specs/westmint.json
```
2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

[dependencies]
clap = { version = "4.3.10", features = ["derive"] }
clap = { version = "4.3.11", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
url = "2.4.0"

Expand Down
21 changes: 17 additions & 4 deletions client/collator/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ pub trait ServiceInterface<Block: BlockT> {
candidate: ParachainCandidate<Block>,
) -> Option<(Collation, ParachainBlockData<Block>)>;

/// Inform networking systems that the block should be announced after an appropriate
/// signal has been received. This returns the sending half of the signal.
/// Inform networking systems that the block should be announced after a signal has
/// been received to indicate the block has been seconded by a relay-chain validator.
///
/// This sets up the barrier and returns the sending side of a channel, for the signal
/// to be passed through.
fn announce_with_barrier(
&self,
block_hash: Block::Hash,
) -> oneshot::Sender<CollationSecondedSignal>;

/// Directly announce a block on the network.
fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>);
}

/// The [`CollatorService`] provides common utilities for parachain consensus and authoring.
Expand All @@ -74,6 +80,7 @@ pub trait ServiceInterface<Block: BlockT> {
pub struct CollatorService<Block: BlockT, BS, RA> {
block_status: Arc<BS>,
wait_to_announce: Arc<Mutex<WaitToAnnounce<Block>>>,
announce_block: Arc<dyn Fn(Block::Hash, Option<Vec<u8>>) + Send + Sync>,
runtime_api: Arc<RA>,
}

Expand All @@ -82,6 +89,7 @@ impl<Block: BlockT, BS, RA> Clone for CollatorService<Block, BS, RA> {
Self {
block_status: self.block_status.clone(),
wait_to_announce: self.wait_to_announce.clone(),
announce_block: self.announce_block.clone(),
runtime_api: self.runtime_api.clone(),
}
}
Expand All @@ -101,9 +109,10 @@ where
announce_block: Arc<dyn Fn(Block::Hash, Option<Vec<u8>>) + Send + Sync>,
runtime_api: Arc<RA>,
) -> Self {
let wait_to_announce = Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block)));
let wait_to_announce =
Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block.clone())));

Self { block_status, wait_to_announce, runtime_api }
Self { block_status, wait_to_announce, announce_block, runtime_api }
}

/// Checks the status of the given block hash in the Parachain.
Expand Down Expand Up @@ -315,4 +324,8 @@ where
) -> oneshot::Sender<CollationSecondedSignal> {
CollatorService::announce_with_barrier(self, block_hash)
}

fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>) {
(self.announce_block)(block_hash, data)
}
}
5 changes: 4 additions & 1 deletion client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

[dependencies]
async-trait = "0.1.70"
async-trait = "0.1.71"
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
futures = "0.3.28"
tracing = "0.1.37"
lru = "0.10.0"

# Substrate
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand All @@ -35,6 +37,7 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate
cumulus-client-consensus-common = { path = "../common" }
cumulus-relay-chain-interface = { path = "../../relay-chain-interface" }
cumulus-client-consensus-proposer = { path = "../proposer" }
cumulus-primitives-aura = { path = "../../../primitives/aura" }
cumulus-primitives-core = { path = "../../../primitives/core" }
cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent" }
cumulus-client-collator = { path = "../../collator" }
Expand Down
Loading

0 comments on commit 595218e

Please sign in to comment.