Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethereum RPC Data Providers #680

Merged
merged 22 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 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 client/node-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ serde = { workspace = true, features = [ "derive" ] }

# Local
tc-consensus = { workspace = true }
tp-traits = { workspace = true }

# Nimbus
nimbus-consensus = { workspace = true }
Expand Down
46 changes: 34 additions & 12 deletions client/node-common/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,36 @@ use {
#[allow(deprecated)]
use sc_executor::NativeElseWasmExecutor;

tp_traits::alias!(
pub trait MinimalRuntimeApi<
Block: (cumulus_primitives_core::BlockT),
Client: (sp_api::CallApiAt<Block>),
> :
ConstructRuntimeApi<
Block,
Client,
RuntimeApi:
TaggedTransactionQueue<Block>
+ BlockBuilder<Block> + OffchainWorkerApi<Block>
+ sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block>,
> + Send + Sync + 'static
);

tp_traits::alias!(
pub trait MinimalCumulusRuntimeApi<
Block: (cumulus_primitives_core::BlockT),
Client: (sp_api::CallApiAt<Block>),
> :
MinimalRuntimeApi<Block, Client> +
ConstructRuntimeApi<
Block,
Client,
RuntimeApi:
cumulus_primitives_core::CollectCollationInfo<Block>,
>
);

/// Trait to configure the main types the builder rely on, bundled in a single
/// type to reduce verbosity and the amount of type parameters.
pub trait NodeBuilderConfig {
Expand All @@ -83,10 +113,7 @@ pub trait NodeBuilderConfig {
BlockOf<Self>: cumulus_primitives_core::BlockT,
ExecutorOf<Self>:
Clone + CodeExecutor + RuntimeVersionOf + TanssiExecutorExt + Sync + Send + 'static,
RuntimeApiOf<Self>:
ConstructRuntimeApi<BlockOf<Self>, ClientOf<Self>> + Sync + Send + 'static,
ConstructedRuntimeApiOf<Self>:
TaggedTransactionQueue<BlockOf<Self>> + BlockBuilder<BlockOf<Self>>,
RuntimeApiOf<Self>: MinimalRuntimeApi<BlockOf<Self>, ClientOf<Self>>,
{
NodeBuilder::<Self>::new(parachain_config, hwbench)
}
Expand Down Expand Up @@ -137,8 +164,7 @@ pub struct NodeBuilder<
> where
BlockOf<T>: cumulus_primitives_core::BlockT,
ExecutorOf<T>: Clone + CodeExecutor + RuntimeVersionOf + Sync + Send + 'static,
RuntimeApiOf<T>: ConstructRuntimeApi<BlockOf<T>, ClientOf<T>> + Sync + Send + 'static,
ConstructedRuntimeApiOf<T>: TaggedTransactionQueue<BlockOf<T>> + BlockBuilder<BlockOf<T>>,
RuntimeApiOf<T>: MinimalRuntimeApi<BlockOf<T>, ClientOf<T>>,
{
pub client: Arc<ClientOf<T>>,
pub backend: Arc<BackendOf<T>>,
Expand Down Expand Up @@ -198,8 +224,7 @@ where
BlockOf<T>: cumulus_primitives_core::BlockT,
ExecutorOf<T>:
Clone + CodeExecutor + RuntimeVersionOf + TanssiExecutorExt + Sync + Send + 'static,
RuntimeApiOf<T>: ConstructRuntimeApi<BlockOf<T>, ClientOf<T>> + Sync + Send + 'static,
ConstructedRuntimeApiOf<T>: TaggedTransactionQueue<BlockOf<T>> + BlockBuilder<BlockOf<T>>,
RuntimeApiOf<T>: MinimalRuntimeApi<BlockOf<T>, ClientOf<T>>,
{
/// Create a new `NodeBuilder` which prepare objects required to launch a
/// node. However it only starts telemetry, and doesn't provide any
Expand Down Expand Up @@ -293,10 +318,7 @@ impl<T: NodeBuilderConfig, SNetwork, STxHandler, SImportQueueService>
where
BlockOf<T>: cumulus_primitives_core::BlockT,
ExecutorOf<T>: Clone + CodeExecutor + RuntimeVersionOf + Sync + Send + 'static,
RuntimeApiOf<T>: ConstructRuntimeApi<BlockOf<T>, ClientOf<T>> + Sync + Send + 'static,
ConstructedRuntimeApiOf<T>: TaggedTransactionQueue<BlockOf<T>>
+ BlockBuilder<BlockOf<T>>
+ cumulus_primitives_core::CollectCollationInfo<BlockOf<T>>,
RuntimeApiOf<T>: MinimalCumulusRuntimeApi<BlockOf<T>, ClientOf<T>>,
{
pub async fn build_relay_chain_interface(
&mut self,
Expand Down
7 changes: 7 additions & 0 deletions client/service-container-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ pallet-data-preservers = { workspace = true, features = [ "std" ] }
services-payment-rpc = { workspace = true }
stream-payment-rpc = { workspace = true }
tc-consensus = { workspace = true }
tp-traits = { workspace = true }

# Dancekit
dc-orchestrator-chain-interface = { workspace = true }
dp-container-chain-genesis-data = { workspace = true, features = [ "json", "std" ] }
dp-slot-duration-runtime-api = { workspace = true }

# Substrate
frame-support = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
sc-cli = { workspace = true }
Expand All @@ -56,6 +58,7 @@ sc-transaction-pool = { workspace = true }
sc-transaction-pool-api = { workspace = true }
sp-blockchain = { workspace = true }
sp-consensus = { workspace = true }
sp-transaction-pool = { workspace = true }
substrate-frame-rpc-system = { workspace = true }
substrate-prometheus-endpoint = { workspace = true }

Expand All @@ -81,6 +84,7 @@ cumulus-primitives-core = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }

# Nimbus
async-backing-primitives = { workspace = true }
nimbus-consensus = { workspace = true }
nimbus-primitives = { workspace = true }

Expand All @@ -96,14 +100,17 @@ default = []
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"dancebox-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"nimbus-primitives/runtime-benchmarks",
"pallet-data-preservers/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"tp-traits/runtime-benchmarks",
]
try-runtime = [
"dancebox-runtime/try-runtime",
"frame-support/try-runtime",
"nimbus-primitives/try-runtime",
"pallet-data-preservers/try-runtime",
"sp-runtime/try-runtime",
Expand Down
10 changes: 6 additions & 4 deletions client/service-container-chain/src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

use {
crate::{
service::{ContainerChainBackend, ContainerChainClient},
service::ContainerChainBackend,
spawner::{CcSpawnMsg, ContainerChainSpawnerState},
},
cumulus_primitives_core::ParaId,
frame_support::DefaultNoBound,
std::{
any::Any,
cell::Cell,
collections::VecDeque,
sync::{Arc, Mutex},
Expand All @@ -32,7 +34,7 @@ use {
},
};

#[derive(Default)]
#[derive(DefaultNoBound)]
pub struct SpawnedContainersMonitor {
/// List of the N most recently started container chains, with some statistics related to
/// stopping time and reference count.
Expand All @@ -59,7 +61,7 @@ pub struct SpawnedContainer {
/// Used to check the reference count, if it's 0 it means the database has been closed
pub backend: std::sync::Weak<ContainerChainBackend>,
/// Used to check the reference count, if it's 0 it means that the client has been closed.
pub client: std::sync::Weak<ContainerChainClient>,
nanocryk marked this conversation as resolved.
Show resolved Hide resolved
pub client: std::sync::Weak<dyn Any + Send + Sync>,
}

impl SpawnedContainer {
Expand Down Expand Up @@ -295,7 +297,7 @@ mod tests {
stop_task_manager_time: Default::default(),
stop_refcount_time: Default::default(),
backend: Default::default(),
client: Default::default(),
client: std::sync::Weak::<()>::new(),
};

// Truncating empty list does not panic
Expand Down
Loading
Loading