Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 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 cumulus/polkadot-omni-node/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ sc-network-statement = { workspace = true, default-features = true }
sc-network-sync = { workspace = true, default-features = true }
sc-offchain = { workspace = true, default-features = true }
sc-rpc = { workspace = true, default-features = true }
sc-rpc-spec-v2 = { workspace = true, default-features = true }
sc-runtime-utilities = { workspace = true, default-features = true }
sc-service = { workspace = true, default-features = false }
sc-statement-store = { workspace = true, default-features = true }
Expand Down
6 changes: 5 additions & 1 deletion cumulus/polkadot-omni-node/lib/src/common/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use sc_rpc::{
dev::{Dev, DevApiServer},
statement::{StatementApiServer, StatementStore},
};
use sc_rpc_spec_v2::statement::{StatementSpec, StatementSpecApiServer};
use sp_runtime::traits::Block as BlockT;
use std::{marker::PhantomData, sync::Arc};
use substrate_frame_rpc_system::{System, SystemApiServer};
Expand Down Expand Up @@ -76,7 +77,10 @@ where
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(StateMigration::new(client.clone(), backend).into_rpc())?;
if let Some(statement_store) = statement_store {
module.merge(StatementStore::new(statement_store, spawn_handle).into_rpc())?;
module.merge(
StatementStore::new(statement_store.clone(), spawn_handle.clone()).into_rpc(),
)?;
module.merge(StatementSpec::new(statement_store, spawn_handle).into_rpc())?;
}
module.merge(Dev::new(client).into_rpc())?;

Expand Down
1 change: 1 addition & 0 deletions cumulus/zombienet/zombienet-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cumulus-zombienet-sdk-helpers = { workspace = true }
sp-rpc = { workspace = true, default-features = true }
sp-statement-store = { workspace = true, default-features = true, features = ["serde"] }
sc-network-statement = { workspace = true, default-features = true }
sc-rpc-spec-v2 = { workspace = true, default-features = true }
sc-statement-store = { workspace = true, default-features = true, features = ["test-helpers"] }
sp-keyring = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ use log::info;
use sc_statement_store::test_utils::get_keypair;
use sp_core::{hexdisplay::HexDisplay, Bytes, Pair};
use sp_statement_store::{
statement_allowance_key, StatementAllowance, StatementEvent, SubmitResult, Topic, TopicFilter,
statement_allowance_key, StatementAllowance, StatementEvent, SubmitOutcome, SubmitResult,
Topic, TopicFilter,
};
use std::{
path::{Path, PathBuf},
Expand All @@ -33,6 +34,11 @@ pub(super) const COLLATOR_INFO_LOG_FILTER: &str = "info,statement-store=info,sta
pub(super) const COLLATOR_TRACE_LOG_FILTER: &str =
"info,statement-store=trace,statement-gossip=trace";

pub(super) use sc_rpc_spec_v2::statement::{
event::NewStatementEntry as UnstableNewStatement,
AddFilterResponse as UnstableAddFilterResponse, SubscribeEvent as UnstableStatementEvent,
};

pub(super) async fn submit_statement(
rpc: &RpcClient,
statement: &sp_statement_store::Statement,
Expand All @@ -42,6 +48,59 @@ pub(super) async fn submit_statement(
Ok(result)
}

pub(super) async fn submit_statement_unstable(
rpc: &RpcClient,
statement: &sp_statement_store::Statement,
) -> Result<SubmitOutcome, anyhow::Error> {
let encoded: Bytes = statement.encode().into();
let result: SubmitOutcome =
rpc.request("statement_unstable_submit", rpc_params![encoded]).await?;
Ok(result)
}

pub(super) async fn subscribe_unstable(
rpc: &RpcClient,
) -> Result<RpcSubscription<UnstableStatementEvent>, anyhow::Error> {
let subscription = rpc
.subscribe::<UnstableStatementEvent>(
"statement_unstable_subscribe",
rpc_params![],
"statement_unstable_unsubscribe",
)
.await?;
Ok(subscription)
}

pub(super) fn unstable_subscription_id(
subscription: &RpcSubscription<UnstableStatementEvent>,
) -> Result<String, anyhow::Error> {
subscription
.subscription_id()
.map(ToOwned::to_owned)
.ok_or_else(|| anyhow!("Subscription was accepted without an id"))
}

pub(super) async fn add_filter_unstable(
rpc: &RpcClient,
subscription_id: &str,
filter: TopicFilter,
) -> Result<UnstableAddFilterResponse, anyhow::Error> {
let response = rpc
.request("statement_unstable_add_filter", rpc_params![subscription_id, filter])
.await?;
Ok(response)
}

pub(super) async fn remove_filter_unstable(
rpc: &RpcClient,
subscription_id: &str,
filter_id: &str,
) -> Result<(), anyhow::Error> {
rpc.request::<()>("statement_unstable_remove_filter", rpc_params![subscription_id, filter_id])
.await?;
Ok(())
}

pub(super) async fn expect_one_statement(
subscription: &mut RpcSubscription<StatementEvent>,
timeout_secs: u64,
Expand Down
Loading
Loading