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

Enable collation via RPC relay chain node #1585

Merged
merged 123 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from 105 commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
7562963
Add minimal overseer gen with dummy subsystems
skunert Mar 3, 2022
ba681d2
Fix dependencies
skunert Mar 4, 2022
6375cdc
no-compile: only client transaction pool missing
skunert Mar 10, 2022
fa91617
Remove unused imports
skunert Mar 10, 2022
c9be61c
Continue to hack towards PoC
skunert Mar 15, 2022
55433bf
Continue
skunert Mar 15, 2022
2d6b45a
Make mini node compile
skunert Mar 17, 2022
7a6ca34
Compiling version with blockchainevents trait
skunert Mar 24, 2022
c0a1f19
Continue
skunert Apr 4, 2022
3288dd0
Check in lockfile
skunert Apr 4, 2022
2b2c902
Block with tokio
skunert Apr 5, 2022
a12c870
Merge branch 'master' into skunert-minimal-overseer-node
skunert Apr 11, 2022
a149420
update patches
skunert Apr 11, 2022
d86d45e
Update polkadot patches
skunert Apr 11, 2022
bcede94
Use polkadot-primitives v2
skunert Apr 25, 2022
1c461e4
Merge branch 'master' into skunert-minimal-overseer-node
skunert Apr 25, 2022
c157722
Fix build problems
skunert May 2, 2022
5940268
First working version
skunert May 9, 2022
e3e8ba8
Adjust cargo.lock
skunert May 9, 2022
b6055bd
Add integration test
skunert May 10, 2022
b19e9d8
Merge branch 'master' into skunert-minimal-overseer-node
skunert May 11, 2022
4784f5f
Make integration test work
skunert May 17, 2022
f22c70e
Allow startinc collator without relay-chain args
skunert May 18, 2022
592bfc8
Make OverseerRuntimeClient async
skunert May 18, 2022
ec0130f
Create separate integration test
skunert May 23, 2022
a5e63b0
Remove unused ChainSelection code
skunert May 23, 2022
30e0273
Remove unused parameters on new-mini
skunert May 25, 2022
0638e66
Connect collator node in test to relay chain nodes
skunert May 25, 2022
c7c5fd4
Make BlockChainRPCClient obsolete
skunert May 25, 2022
b08c1c9
Clean up
skunert May 27, 2022
454348c
Merge branch 'master' into skunert-minimal-overseer-node
skunert May 30, 2022
b37bda5
Clean up
skunert Jun 1, 2022
fd2e80a
Reimplement blockchain-rpc-events
skunert Jun 20, 2022
12bb197
Revert "Allow startinc collator without relay-chain args"
skunert Jun 20, 2022
a69993f
Merge branch 'master' into collator-rpc-poc
skunert Jun 20, 2022
e92c7dd
Add `strict_record_validation` to AuthorityDiscovery
skunert Jun 21, 2022
8aeb05c
Move network to cumulus
skunert Jun 22, 2022
0b4aa99
Remove BlockchainRPCEvents
skunert Jun 23, 2022
300eec0
Remove `BlockIdTo` and `BlockchainEvents`
skunert Jun 23, 2022
d5b1e4d
Make AuthorityDiscovery async
skunert Jun 23, 2022
5a4a18e
Use hash in OverseerRuntime
skunert Jun 28, 2022
c07be4d
Merge branch 'master' into collator-rpc-poc
skunert Jul 11, 2022
597c3f4
Adjust naming of runtime client trait
skunert Jul 14, 2022
e4e98e3
Merge branch 'master' into collator-rpc-poc
skunert Jul 26, 2022
86fc321
Implement more rpc-client methods
skunert Jul 29, 2022
18eb21e
Improve error handling for `ApiError`
skunert Jul 29, 2022
8712354
Extract authority-discovery creationand cleanup
skunert Jul 29, 2022
a46d22f
Merge branch 'master' into collator-rpc-poc
skunert Aug 3, 2022
af245af
RPC -> Rpc
skunert Aug 3, 2022
7cc26e5
Extract bitswap
skunert Aug 9, 2022
122d449
Merge branch 'master' into collator-rpc-poc
skunert Aug 12, 2022
d8ac26f
Adjust to changes on master
skunert Aug 12, 2022
aae466f
Implement `hash` method
skunert Aug 12, 2022
42d9223
Introduce DummyChainSync, remove ProofProvider and BlockBackend
skunert Aug 12, 2022
3f4adaa
Remove `HeaderMetadata` from blockchain-rpc-client
skunert Aug 12, 2022
f5f7094
Make ChainSync work
skunert Aug 17, 2022
67a2202
Implement NetworkHeaderBackend
skunert Aug 18, 2022
ab19e8a
Cleanup
skunert Aug 22, 2022
dda50d6
Merge branch 'master' into collator-rpc-poc
skunert Aug 22, 2022
41335cc
Adjustments after master merge
skunert Aug 24, 2022
45442fd
Remove ImportQueue from network parameters
skunert Aug 24, 2022
76f2079
Remove cargo patches
skunert Aug 26, 2022
162576e
Eliminate warnings
skunert Aug 26, 2022
df9875c
Revert to HeaderBackend
skunert Aug 30, 2022
28e1867
Add zombienet test
skunert Aug 30, 2022
a6c3ccd
Implement `status()` method
skunert Aug 30, 2022
54c3e84
Add more comments, improve readability
skunert Aug 30, 2022
80cc98a
Remove patches from Cargo.toml
skunert Aug 31, 2022
abb12e3
Remove integration test in favor of zombienet
skunert Aug 31, 2022
92f5dcf
Remove unused dependencies, rename minimal node crate
skunert Aug 31, 2022
96c9c6d
Merge branch 'master' into collator-rpc-poc
skunert Aug 31, 2022
74b30bc
Adjust to latest master changes
skunert Aug 31, 2022
5956e72
fmt
skunert Aug 31, 2022
f4b8949
Execute zombienet test on gitlab ci
skunert Sep 1, 2022
f472743
Reuse network metrics
skunert Sep 1, 2022
8144680
Chainsync metrics
skunert Sep 1, 2022
217f05d
fmt
skunert Sep 1, 2022
6ba48c1
Feed RPC node as boot node to the relay chain minimal node
skunert Sep 2, 2022
1109f26
Merge branch 'master' into collator-rpc-poc
skunert Sep 2, 2022
e822b46
fmt
skunert Sep 2, 2022
ca0abb2
Add bootnodes to zombienet collators
skunert Sep 2, 2022
cf4763e
Allow specification of relay chain args
skunert Sep 2, 2022
3c06ece
Merge branch 'master' into collator-rpc-poc
skunert Sep 2, 2022
ee7e84b
Merge branch 'master' into collator-rpc-poc
skunert Sep 14, 2022
10e602c
Merge branch 'master' into collator-rpc-poc
skunert Sep 15, 2022
a3aa0ea
Apply review suggestions
skunert Sep 15, 2022
ba5ef94
Remove unnecessary casts
skunert Sep 15, 2022
976c529
Enable PoV recovery for rpc full nodes
skunert Sep 16, 2022
b1cd618
Merge branch 'master' into collator-rpc-poc
skunert Sep 16, 2022
8dc7ddc
Revert unwanted changes
skunert Sep 19, 2022
8301c28
Make overseerHandle non-optional
skunert Sep 19, 2022
760a127
Add availability-store subsystem
skunert Sep 19, 2022
49c5652
Merge branch 'master' into pov-recovery-rpc
skunert Sep 20, 2022
659dd58
Add AuxStore and ChainApiSubsystem
skunert Sep 20, 2022
1a00dce
Add availability distribution subsystem
skunert Sep 20, 2022
1a56dd5
Improve pov-recovery logging and add RPC nodes to tests
skunert Sep 21, 2022
33a059a
fmt
skunert Sep 21, 2022
9ef29ed
Merge branch 'master' into collator-rpc-poc
skunert Sep 21, 2022
a9610d0
Make availability config const
skunert Sep 22, 2022
95377d2
Merge branch 'master' into collator-rpc-poc
skunert Sep 22, 2022
00c745a
lock
skunert Sep 22, 2022
5de1bf3
Enable debug logs for pov-recovery in zombienet
skunert Sep 22, 2022
7d24629
Add log filters to test binary
skunert Sep 22, 2022
3c591ae
Allow wss
skunert Sep 23, 2022
3e944b3
Merge branch 'master' into collator-rpc-poc
skunert Sep 23, 2022
694db8d
Address review comments
skunert Sep 26, 2022
2bd96d9
Merge branch 'master' into collator-rpc-poc
skunert Sep 26, 2022
ac4ede3
Apply reviewer comments
skunert Sep 30, 2022
09272e8
Merge branch 'master' into collator-rpc-poc
skunert Sep 30, 2022
4bfdc6f
Adjust to master changes
skunert Sep 30, 2022
603ddcb
Apply reviewer suggestions
skunert Oct 4, 2022
7f5ccc5
Bump polkadot
skunert Oct 4, 2022
11a23e2
Add builder method for minimal node
skunert Oct 4, 2022
c67379b
Merge branch 'master' into collator-rpc-poc
skunert Oct 4, 2022
50c7cc1
Bump substrate and polkadot
skunert Oct 4, 2022
ea09b5b
Clean up overseer building
skunert Oct 4, 2022
e58174e
Add bootnode to two in pov_recovery test
skunert Oct 4, 2022
6115bae
Fix missing quote in pov recovery zombienet test
skunert Oct 4, 2022
d5f36d3
Improve zombienet pov test
skunert Oct 5, 2022
5f7347d
Merge branch 'master' into collator-rpc-poc
skunert Oct 6, 2022
393eb10
More debug logs for pov-recovery
skunert Oct 6, 2022
1027520
Remove reserved nodes like on original test
skunert Oct 7, 2022
c5003b5
Revert zombienet test to master
skunert Oct 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,35 @@ zombienet-0005-migrate_solo_to_para:
tags:
- zombienet-polkadot-integration-test

0006-rpc_collator_builds_blocks:
stage: integration-test
image: "${ZOMBIENET_IMAGE}"
<<: *zombienet-refs
needs:
- job: build-push-image-test-parachain
variables:
POLKADOT_IMAGE: "docker.io/paritypr/polkadot-debug:master"
GH_DIR: "https://github.com/paritytech/cumulus/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests"
COL_IMAGE: "docker.io/paritypr/test-parachain:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
before_script:
- echo "Zombie-net Tests Config"
- echo "${ZOMBIENET_IMAGE}"
- echo "${RELAY_IMAGE}"
- echo "${COL_IMAGE}"
- echo "${GH_DIR}"
- export DEBUG=zombie
- export RELAY_IMAGE=${POLKADOT_IMAGE}
- export COL_IMAGE=${COL_IMAGE}
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0006-rpc_collator_builds_blocks.feature"
allow_failure: true
retry: 2
tags:
- zombienet-polkadot-integration-test

#### stage: .post

# This job cancels the whole pipeline if any of provided jobs fail.
Expand Down
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"client/relay-chain-interface",
"client/relay-chain-inprocess-interface",
"client/relay-chain-rpc-interface",
"client/relay-chain-minimal-node",
"pallets/aura-ext",
"pallets/collator-selection",
"pallets/dmp-queue",
Expand Down
10 changes: 5 additions & 5 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl PurgeChainCmd {
Some('y') | Some('Y') => {},
_ => {
println!("Aborted");
return Ok(())
return Ok(());
},
}
}
Expand Down Expand Up @@ -264,7 +264,8 @@ impl sc_cli::CliConfiguration for ExportGenesisWasmCommand {
fn validate_relay_chain_url(arg: &str) -> Result<Url, String> {
let url = Url::parse(arg).map_err(|e| e.to_string())?;

if url.scheme() == "ws" {
let scheme = url.scheme();
if scheme == "ws" || scheme == "wss" {
Ok(url)
} else {
Err(format!(
Expand All @@ -290,9 +291,8 @@ pub struct RunCmd {
/// EXPERIMENTAL: Specify an URL to a relay chain full node to communicate with.
#[clap(
long,
value_parser = validate_relay_chain_url,
conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "ferdie", "one", "two"] )
]
value_parser = validate_relay_chain_url
)]
pub relay_chain_rpc_url: Option<Url>,
}

Expand Down
2 changes: 1 addition & 1 deletion client/network/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl RelayChainInterface for DummyRelayChainInterface {
Ok(false)
}

fn overseer_handle(&self) -> RelayChainResult<Option<Handle>> {
fn overseer_handle(&self) -> RelayChainResult<Handle> {
unimplemented!("Not needed for test")
}

Expand Down
1 change: 1 addition & 0 deletions client/pov-recovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ cumulus-relay-chain-interface = {path = "../relay-chain-interface"}

[dev-dependencies]
tokio = { version = "1.21.1", features = ["macros"] }
portpicker = "0.1.1"

# Cumulus
cumulus-test-service = { path = "../../test/service" }
Expand Down
10 changes: 6 additions & 4 deletions client/pov-recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ where
Ok(_) => return,
Err(e) => {
tracing::debug!(
target: "cumulus-consensus",
target: LOG_TARGET,
error = ?e,
block_hash = ?hash,
"Failed to get block status",
Expand Down Expand Up @@ -301,7 +301,7 @@ where
Ok(BlockStatus::Unknown) => {
if self.active_candidate_recovery.is_being_recovered(&parent) {
tracing::debug!(
target: "cumulus-consensus",
target: LOG_TARGET,
?block_hash,
parent_hash = ?parent,
"Parent is still being recovered, waiting.",
Expand All @@ -311,7 +311,7 @@ where
return
} else {
tracing::debug!(
target: "cumulus-consensus",
target: LOG_TARGET,
?block_hash,
parent_hash = ?parent,
"Parent not found while trying to import recovered block.",
Expand All @@ -324,7 +324,7 @@ where
},
Err(error) => {
tracing::debug!(
target: "cumulus-consensus",
target: LOG_TARGET,
block_hash = ?parent,
?error,
"Error while checking block status",
Expand All @@ -346,6 +346,8 @@ where
/// This will also recursivley drain `waiting_for_parent` and import them as well.
async fn import_block(&mut self, block: Block) {
let mut blocks = VecDeque::new();

tracing::debug!(target: LOG_TARGET, hash = ?block.hash(), "Importing block retrieved using pov_recovery");
blocks.push_back(block);

let mut incoming_blocks = Vec::new();
Expand Down
41 changes: 38 additions & 3 deletions client/pov-recovery/tests/pov_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use cumulus_primitives_core::ParaId;
use cumulus_test_service::{initial_head_data, Keyring::*};
use futures::join;
use std::sync::Arc;

/// Tests the PoV recovery.
Expand All @@ -34,12 +35,13 @@ async fn pov_recovery() {
let tokio_handle = tokio::runtime::Handle::current();

// Start alice
let ws_port = portpicker::pick_unused_port().expect("No free ports");
let alice = cumulus_test_service::run_relay_chain_validator_node(
tokio_handle.clone(),
Alice,
|| {},
Vec::new(),
None,
Some(ws_port),
);

// Start bob
Expand Down Expand Up @@ -90,16 +92,49 @@ async fn pov_recovery() {
.build()
.await;

let eve = cumulus_test_service::TestNodeBuilder::new(para_id, tokio_handle, Eve)
let eve = cumulus_test_service::TestNodeBuilder::new(para_id, tokio_handle.clone(), Eve)
.use_null_consensus()
.connect_to_parachain_node(&charlie)
.connect_to_relay_chain_nodes(vec![&alice, &bob])
.wrap_announce_block(|_| {
// Never announce any block
Arc::new(|_, _| {})
})
.build()
.await;

// Run ferdie as parachain RPC collator and one as parachain RPC full node
//
// They will need to recover the pov blocks through availability recovery.
let ferdie = cumulus_test_service::TestNodeBuilder::new(para_id, tokio_handle.clone(), Ferdie)
.use_null_consensus()
.connect_to_parachain_node(&charlie)
.connect_to_relay_chain_nodes(vec![&alice, &bob])
.use_external_relay_chain_node_at_port(ws_port)
.wrap_announce_block(|_| {
// Never announce any block
Arc::new(|_, _| {})
})
.build()
.await;

futures::future::join(dave.wait_for_blocks(7), eve.wait_for_blocks(7)).await;
let one = cumulus_test_service::TestNodeBuilder::new(para_id, tokio_handle, One)
.enable_collator()
.use_null_consensus()
.connect_to_parachain_node(&charlie)
.connect_to_relay_chain_nodes(vec![&alice, &bob])
.use_external_relay_chain_node_at_port(ws_port)
.wrap_announce_block(|_| {
// Never announce any block
Arc::new(|_, _| {})
})
.build()
.await;

join!(
dave.wait_for_blocks(7),
eve.wait_for_blocks(7),
ferdie.wait_for_blocks(7),
one.wait_for_blocks(7)
);
}
1 change: 1 addition & 0 deletions client/relay-chain-inprocess-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, features = ["cli"] }
polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
prioritized-metered-channel = { git = "https://github.com/paritytech/polkadot", branch = "master" }
skunert marked this conversation as resolved.
Show resolved Hide resolved

# Cumulus
cumulus-primitives-core = { path = "../../primitives/core" }
Expand Down
16 changes: 10 additions & 6 deletions client/relay-chain-inprocess-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct RelayChainInProcessInterface<Client> {
full_client: Arc<Client>,
backend: Arc<FullBackend>,
sync_oracle: Arc<dyn SyncOracle + Send + Sync>,
overseer_handle: Option<Handle>,
overseer_handle: Handle,
}

impl<Client> RelayChainInProcessInterface<Client> {
Expand All @@ -59,7 +59,7 @@ impl<Client> RelayChainInProcessInterface<Client> {
full_client: Arc<Client>,
backend: Arc<FullBackend>,
sync_oracle: Arc<dyn SyncOracle + Send + Sync>,
overseer_handle: Option<Handle>,
overseer_handle: Handle,
) -> Self {
Self { full_client, backend, sync_oracle, overseer_handle }
}
Expand Down Expand Up @@ -171,7 +171,7 @@ where
Ok(self.sync_oracle.is_major_syncing())
}

fn overseer_handle(&self) -> RelayChainResult<Option<Handle>> {
fn overseer_handle(&self) -> RelayChainResult<Handle> {
Ok(self.overseer_handle.clone())
}

Expand Down Expand Up @@ -288,7 +288,7 @@ struct RelayChainInProcessInterfaceBuilder {
polkadot_client: polkadot_client::Client,
backend: Arc<FullBackend>,
sync_oracle: Arc<dyn SyncOracle + Send + Sync>,
overseer_handle: Option<Handle>,
overseer_handle: Handle,
}

impl RelayChainInProcessInterfaceBuilder {
Expand Down Expand Up @@ -378,7 +378,9 @@ pub fn build_inprocess_relay_chain(
polkadot_client: full_node.client.clone(),
backend: full_node.backend.clone(),
sync_oracle,
overseer_handle: full_node.overseer_handle.clone(),
overseer_handle: full_node.overseer_handle.clone().ok_or(RelayChainError::GenericError(
"Overseer not running in full node.".to_string(),
))?,
};

task_manager.add_child(full_node.task_manager);
Expand Down Expand Up @@ -425,10 +427,12 @@ mod tests {
let block = block_builder.build().expect("Finalizes the block").block;
let dummy_network: Arc<dyn SyncOracle + Sync + Send> = Arc::new(DummyNetwork {});

let (tx, _rx) = prioritized_metered_channel::channel(30);
let mock_handle = Handle::new(tx);
(
client.clone(),
block,
RelayChainInProcessInterface::new(client, backend.clone(), dummy_network, None),
RelayChainInProcessInterface::new(client, backend.clone(), dummy_network, mock_handle),
)
}

Expand Down
Loading