Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
3d7d222
Initial network interface preparations
skunert Dec 21, 2021
b23547c
Implement get_storage_by_key
skunert Jan 4, 2022
cfaa211
Implement `validators` and `session_index_for_child`
skunert Jan 6, 2022
af362b4
Implement persisted_validation_data and candidate_pending_availability
skunert Jan 7, 2022
a8d80d5
Fix method name for persisted_validation_data and add encoded params
skunert Jan 7, 2022
482ecd4
Implement `retrieve_dmq_contents` and `retrieve_all_inbound_hrmp_chan…
skunert Jan 10, 2022
c03ba54
Implement `prove_read`
skunert Jan 10, 2022
b4ca285
Introduce separate RPC client, expose JsonRpSee errors
skunert Jan 10, 2022
f0d6c18
Simplify closure in call_remote_runtime_function
skunert Jan 10, 2022
d4dada5
Implement import stream, upgrade JsonRpSee
skunert Jan 12, 2022
dc5de78
Implement finality stream
skunert Jan 12, 2022
2675a7d
Remove unused method from interface
skunert Jan 12, 2022
f9a228d
Implement `is_major_syncing`
skunert Jan 12, 2022
7a89c73
Implement `wait_on_block`
skunert Jan 13, 2022
b92f204
Merge branch 'master' into network-interface-master
skunert Jan 13, 2022
532ba1d
Fix tests
skunert Jan 13, 2022
d49e25b
Unify error handling `ApiError`
skunert Jan 13, 2022
051068f
Replace WaitError with RelayChainError
skunert Jan 13, 2022
4b664a7
Wrap BlockChainError in RelayChainError
skunert Jan 13, 2022
40432e8
Unify error handling in relay chain intefaces
skunert Jan 17, 2022
5e03777
Fix return type of proof method
skunert Jan 17, 2022
d916d69
Improve error handling of new methods
skunert Jan 17, 2022
ee60f31
Improve error handling and move logging outside of interface
skunert Jan 18, 2022
0a1dd44
Clean up
skunert Jan 18, 2022
68fa074
Remove unwanted changes, clean up
skunert Jan 18, 2022
2764ea2
Remove unused import
skunert Jan 18, 2022
3be8d65
Add format for StatemachineError and remove nused From trait
skunert Jan 19, 2022
4c9b8ea
Use 'thiserror' crate to simplify error handling
skunert Jan 24, 2022
f2caf4b
Expose error for overseer, further simplify error handling
skunert Jan 24, 2022
7c95a65
Merge branch 'master' into relay-chain-interface-error-handling
skunert Jan 24, 2022
af4c50c
Reintroduce network interface
skunert Jan 19, 2022
f0212f9
Implement cli option
skunert Jan 20, 2022
c4fd3ae
Adjust call_state method to use hashes
skunert Jan 24, 2022
3a5e69b
Merge branch 'master' into skunert-network-interface
skunert Jan 28, 2022
2bf24bb
Disable PoV recovery when RPC is used
skunert Jan 28, 2022
3a4766b
Add integration test for network full node
skunert Feb 1, 2022
156f453
Use Hash instead of BlockId to ensure compatibility with RPC interface
skunert Feb 1, 2022
b2f5163
Fix cargo check warnings
skunert Feb 1, 2022
bf9293e
Implement retries
skunert Feb 3, 2022
cc8862f
Remove `expect` statements from code
skunert Feb 3, 2022
99535a0
Update jsonrpsee to 0.8.0 and make collator keys optional
skunert Feb 4, 2022
fcbd51e
Make cli arguments conflicting
skunert Feb 4, 2022
31e2ebf
Remove unused `block_status` method
skunert Feb 4, 2022
277a584
Add clippy fixes
skunert Feb 4, 2022
7af8820
Merge branch 'master' into skunert-network-interface
skunert Feb 7, 2022
8bd395d
Cargo fmt
skunert Feb 7, 2022
389777f
Validate relay chain rpc url
skunert Feb 7, 2022
53324c5
Clean up dependencies and add one more integration test
skunert Feb 7, 2022
470ce99
Clean up
skunert Feb 7, 2022
e39bc18
Clean up dependencies of relay-chain-network
skunert Feb 7, 2022
8bd74d5
Use hash instead of blockid for rpc methods
skunert Feb 7, 2022
a968c70
Fix tests
skunert Feb 7, 2022
332013b
Update client/cli/src/lib.rs
skunert Feb 8, 2022
f61cd81
Improve error message of cli validation
skunert Feb 8, 2022
ce0bd74
Add rpc client constructor
skunert Feb 8, 2022
2140165
Do not use debug formatting for errors
skunert Feb 9, 2022
2862b22
Merge branch 'master' into skunert-network-interface
skunert Feb 9, 2022
6c88d44
Improve logging for remote runtime methods
skunert Feb 17, 2022
1dc0e01
Merge branch 'master' into skunert-network-interface
skunert Feb 17, 2022
874dfb7
Only retry on transport problems
skunert Feb 21, 2022
28df792
Use PHash by value, rename test
skunert Feb 21, 2022
b6236a1
Improve tracing, return error on relay-chain-interface build
skunert Feb 21, 2022
c763d46
Fix naming, use generics instead of deserializing manually
skunert Feb 21, 2022
c502ae8
Rename RelayChainLocal and RelayChainNetwork
skunert Feb 21, 2022
43eb056
lock
skunert Feb 21, 2022
f15097c
Merge branch 'master' into skunert-network-interface
skunert Feb 21, 2022
ac455e9
Format
skunert Feb 21, 2022
69e5a38
Use impl trait for encodable runtime payload
skunert Feb 28, 2022
8d851cf
Only instantiate full node in tests when we need it
skunert Feb 28, 2022
f6965a2
Merge branch 'master' into skunert-network-interface
skunert Feb 28, 2022
f9aa4f0
Upgrade scale-codec to 3.0.0
skunert Mar 1, 2022
3587259
Improve expect log
skunert Mar 1, 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
Prev Previous commit
Next Next commit
Rename RelayChainLocal and RelayChainNetwork
  • Loading branch information
skunert committed Feb 21, 2022
commit c502ae8511c558d318e90244e950a2f6e2c21a77
56 changes: 28 additions & 28 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ members = [
"client/pov-recovery",
"client/service",
"client/relay-chain-interface",
"client/relay-chain-local",
"client/relay-chain-network",
"client/relay-chain-inprocess-interface",
"client/relay-chain-rpc-interface",
"pallets/aura-ext",
"pallets/collator-selection",
"pallets/dmp-queue",
Expand Down
2 changes: 1 addition & 1 deletion client/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ url = "2.2.2"
# Cumulus deps
cumulus-test-service = { path = "../../test/service" }
cumulus-primitives-core = { path = "../../primitives/core" }
cumulus-relay-chain-local = { path = "../relay-chain-local" }
cumulus-relay-chain-inprocess-interface = { path = "../relay-chain-inprocess-interface" }

# Polkadot deps
polkadot-test-client = { git = "https://github.com/paritytech/polkadot", branch = "master" }
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 @@ -17,7 +17,7 @@
use super::*;
use async_trait::async_trait;
use cumulus_relay_chain_interface::{RelayChainError, RelayChainResult};
use cumulus_relay_chain_local::{check_block_in_chain, BlockCheckStatus};
use cumulus_relay_chain_inprocess_interface::{check_block_in_chain, BlockCheckStatus};
use cumulus_test_service::runtime::{Block, Hash, Header};
use futures::{executor::block_on, poll, task::Poll, FutureExt, Stream, StreamExt};
use parking_lot::Mutex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Parity Technologies <admin@parity.io>"]
name = "cumulus-relay-chain-local"
name = "cumulus-relay-chain-inprocess-interface"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ use sp_state_machine::{Backend as StateBackend, StorageValue};
const TIMEOUT_IN_SECONDS: u64 = 6;

/// Provides an implementation of the [`RelayChainInterface`] using a local in-process relay chain node.
pub struct RelayChainLocal<Client> {
pub struct RelayChainInProcessInterface<Client> {
full_client: Arc<Client>,
backend: Arc<FullBackend>,
sync_oracle: Arc<Mutex<Box<dyn SyncOracle + Send + Sync>>>,
overseer_handle: Option<Handle>,
}

impl<Client> RelayChainLocal<Client> {
/// Create a new instance of [`RelayChainLocal`]
impl<Client> RelayChainInProcessInterface<Client> {
/// Create a new instance of [`RelayChainInProcessInterface`]
pub fn new(
full_client: Arc<Client>,
backend: Arc<FullBackend>,
Expand All @@ -65,7 +65,7 @@ impl<Client> RelayChainLocal<Client> {
}
}

impl<T> Clone for RelayChainLocal<T> {
impl<T> Clone for RelayChainInProcessInterface<T> {
fn clone(&self) -> Self {
Self {
full_client: self.full_client.clone(),
Expand All @@ -77,7 +77,7 @@ impl<T> Clone for RelayChainLocal<T> {
}

#[async_trait]
impl<Client> RelayChainInterface for RelayChainLocal<Client>
impl<Client> RelayChainInterface for RelayChainInProcessInterface<Client>
where
Client: ProvideRuntimeApi<PBlock>
+ BlockchainEvents<PBlock>
Expand Down Expand Up @@ -280,25 +280,25 @@ where
}

/// Builder for a concrete relay chain interface, created from a full node. Builds
/// a [`RelayChainLocal`] to access relay chain data necessary for parachain operation.
/// a [`RelayChainInProcessInterface`] to access relay chain data necessary for parachain operation.
///
/// The builder takes a [`polkadot_client::Client`]
/// that wraps a concrete instance. By using [`polkadot_client::ExecuteWithClient`]
/// the builder gets access to this concrete instance and instantiates a [`RelayChainLocal`] with it.
struct RelayChainLocalBuilder {
/// the builder gets access to this concrete instance and instantiates a [`RelayChainInProcessInterface`] with it.
struct RelayChainInProcessInterfaceBuilder {
polkadot_client: polkadot_client::Client,
backend: Arc<FullBackend>,
sync_oracle: Arc<Mutex<Box<dyn SyncOracle + Send + Sync>>>,
overseer_handle: Option<Handle>,
}

impl RelayChainLocalBuilder {
impl RelayChainInProcessInterfaceBuilder {
pub fn build(self) -> Arc<dyn RelayChainInterface> {
self.polkadot_client.clone().execute_with(self)
}
}

impl ExecuteWithClient for RelayChainLocalBuilder {
impl ExecuteWithClient for RelayChainInProcessInterfaceBuilder {
type Output = Arc<dyn RelayChainInterface>;

fn execute_with_client<Client, Api, Backend>(self, client: Arc<Client>) -> Self::Output
Expand All @@ -312,7 +312,12 @@ impl ExecuteWithClient for RelayChainLocalBuilder {
+ Send,
Client::Api: ParachainHost<PBlock> + BabeApi<PBlock>,
{
Arc::new(RelayChainLocal::new(client, self.backend, self.sync_oracle, self.overseer_handle))
Arc::new(RelayChainInProcessInterface::new(
client,
self.backend,
self.sync_oracle,
self.overseer_handle,
))
}
}

Expand Down Expand Up @@ -344,7 +349,7 @@ fn build_polkadot_full_node(
}

/// Builds a relay chain interface by constructing a full relay chain node
pub fn build_relay_chain_local(
pub fn build_inprocess_relay_chain(
polkadot_config: Configuration,
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
task_manager: &mut TaskManager,
Expand All @@ -359,7 +364,7 @@ pub fn build_relay_chain_local(

let sync_oracle: Box<dyn SyncOracle + Send + Sync> = Box::new(full_node.network.clone());
let sync_oracle = Arc::new(Mutex::new(sync_oracle));
let relay_chain_interface_builder = RelayChainLocalBuilder {
let relay_chain_interface_builder = RelayChainInProcessInterfaceBuilder {
polkadot_client: full_node.client.clone(),
backend: full_node.backend.clone(),
sync_oracle,
Expand Down Expand Up @@ -400,7 +405,8 @@ mod tests {
}
}

fn build_client_backend_and_block() -> (Arc<Client>, PBlock, RelayChainLocal<Client>) {
fn build_client_backend_and_block(
) -> (Arc<Client>, PBlock, RelayChainInProcessInterface<Client>) {
let builder =
TestClientBuilder::new().set_execution_strategy(ExecutionStrategy::NativeWhenPossible);
let backend = builder.backend();
Expand All @@ -413,7 +419,7 @@ mod tests {
(
client.clone(),
block,
RelayChainLocal::new(
RelayChainInProcessInterface::new(
client,
backend.clone(),
Arc::new(Mutex::new(dummy_network)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Parity Technologies <admin@parity.io>"]
name = "cumulus-relay-chain-network"
name = "cumulus-relay-chain-rpc-interface"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use std::{pin::Pin, sync::Arc};

pub use url::Url;

const LOG_TARGET: &str = "relay-chain-network";
const LOG_TARGET: &str = "relay-chain-external-interface";
const TIMEOUT_IN_SECONDS: u64 = 6;

/// Client that maps RPC methods and deserializes results
Expand Down Expand Up @@ -278,21 +278,21 @@ impl RelayChainRPCClient {
}
}

/// RelayChainNetwork is used to interact with a full node that is running locally
/// RelayChainRPCInterface is used to interact with a full node that is running locally
/// in the same process.
#[derive(Clone)]
pub struct RelayChainNetwork {
pub struct RelayChainRPCInterface {
rpc_client: RelayChainRPCClient,
}

impl RelayChainNetwork {
impl RelayChainRPCInterface {
pub async fn new(url: Url) -> RelayChainResult<Self> {
Ok(Self { rpc_client: RelayChainRPCClient::new(url).await? })
}
}

#[async_trait]
impl RelayChainInterface for RelayChainNetwork {
impl RelayChainInterface for RelayChainRPCInterface {
async fn retrieve_dmq_contents(
&self,
para_id: ParaId,
Expand Down Expand Up @@ -388,7 +388,7 @@ impl RelayChainInterface for RelayChainNetwork {
}

fn overseer_handle(&self) -> RelayChainResult<Option<Handle>> {
unimplemented!("Overseer handle is not available on relay-chain-network");
unimplemented!("Overseer handle is not available on relay-chain-rpc-interface");
}

async fn get_storage_by_key(
Expand Down
4 changes: 2 additions & 2 deletions parachain-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ cumulus-client-service = { path = "../../client/service" }
cumulus-primitives-core = { path = "../../primitives/core" }
cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" }
cumulus-relay-chain-interface = { path = "../../client/relay-chain-interface" }
cumulus-relay-chain-local = { path = "../../client/relay-chain-local" }
cumulus-relay-chain-network = { path = "../../client/relay-chain-network" }
cumulus-relay-chain-inprocess-interface = { path = "../../client/relay-chain-inprocess-interface" }
cumulus-relay-chain-rpc-interface = { path = "../../client/relay-chain-rpc-interface" }

# Polkadot dependencies
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
Expand Down
13 changes: 8 additions & 5 deletions parachain-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use cumulus_client_service::{
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
};
use cumulus_primitives_core::ParaId;
use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult};
use cumulus_relay_chain_local::build_relay_chain_local;
use cumulus_relay_chain_network::RelayChainNetwork;
use cumulus_relay_chain_rpc_interface::RelayChainRPCInterface;

// Substrate Imports
use sc_client_api::ExecutorProvider;
Expand Down Expand Up @@ -173,10 +173,13 @@ async fn build_relay_chain_interface(
) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option<CollatorPair>)> {
match collator_options.relay_chain_rpc_url {
Some(relay_chain_url) =>
Ok((Arc::new(RelayChainNetwork::new(relay_chain_url).await?) as Arc<_>, None)),
Ok((Arc::new(RelayChainRPCInterface::new(relay_chain_url).await?) as Arc<_>, None)),
None => {
let relay_chain_local =
build_relay_chain_local(polkadot_config, telemetry_worker_handle, task_manager)?;
let relay_chain_local = build_inprocess_relay_chain(
polkadot_config,
telemetry_worker_handle,
task_manager,
)?;
Ok((relay_chain_local.0, Some(relay_chain_local.1)))
},
}
Expand Down
5 changes: 3 additions & 2 deletions polkadot-parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ cumulus-client-network = { path = "../client/network" }
cumulus-primitives-core = { path = "../primitives/core" }
cumulus-primitives-parachain-inherent = { path = "../primitives/parachain-inherent" }
cumulus-relay-chain-interface = { path = "../client/relay-chain-interface" }
cumulus-relay-chain-local = { path = "../client/relay-chain-local" }
cumulus-relay-chain-network = { path = "../client/relay-chain-network" }
cumulus-relay-chain-inprocess-interface = { path = "../client/relay-chain-inprocess-interface" }
cumulus-relay-chain-rpc-interface = { path = "../client/relay-chain-rpc-interface" }


# Polkadot dependencies
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
Expand Down
Loading