Mixnet integration (#1346)

See #1345, <https://github.com/paritytech/substrate/pull/14207>.

This adds all the necessary mixnet components, and puts them together in
the "kitchen-sink" node/runtime. The components added are:

- A pallet (`frame/mixnet`). This is responsible for determining the
current mixnet session and phase, and the mixnodes to use in each
session. It provides a function that validators can call to register a
mixnode for the next session. The logic of this pallet is very similar
to that of the `im-online` pallet.
- A service (`client/mixnet`). This implements the core mixnet logic,
building on the `mixnet` crate. The service communicates with other
nodes using notifications sent over the "mixnet" protocol.
- An RPC interface. This currently only supports sending transactions
over the mixnet.

---------

Co-authored-by: David Emett <dave@sp4m.net>
Co-authored-by: Javier Viola <javier@parity.io>
This commit is contained in:
David Emett
2023-10-09 15:56:30 +02:00
committed by GitHub
parent 1dc935c715
commit a808a3a091
52 changed files with 3010 additions and 109 deletions
+1
View File
@@ -23,6 +23,7 @@ sc-consensus-babe = { path = "../../../client/consensus/babe" }
sc-consensus-babe-rpc = { path = "../../../client/consensus/babe/rpc" }
sc-consensus-grandpa = { path = "../../../client/consensus/grandpa" }
sc-consensus-grandpa-rpc = { path = "../../../client/consensus/grandpa/rpc" }
sc-mixnet = { path = "../../../client/mixnet" }
sc-rpc = { path = "../../../client/rpc" }
sc-rpc-api = { path = "../../../client/rpc-api" }
sc-rpc-spec-v2 = { path = "../../../client/rpc-spec-v2" }
+9
View File
@@ -92,6 +92,8 @@ pub struct FullDeps<C, P, SC, B> {
pub statement_store: Arc<dyn sp_statement_store::StatementStore>,
/// The backend used by the node.
pub backend: Arc<B>,
/// Mixnet API.
pub mixnet_api: Option<sc_mixnet::Api>,
}
/// Instantiate all Full RPC extensions.
@@ -106,6 +108,7 @@ pub fn create_full<C, P, SC, B>(
grandpa,
statement_store,
backend,
mixnet_api,
}: FullDeps<C, P, SC, B>,
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
where
@@ -133,6 +136,7 @@ where
use sc_consensus_grandpa_rpc::{Grandpa, GrandpaApiServer};
use sc_rpc::{
dev::{Dev, DevApiServer},
mixnet::MixnetApiServer,
statement::StatementApiServer,
};
use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer};
@@ -196,5 +200,10 @@ where
sc_rpc::statement::StatementStore::new(statement_store, deny_unsafe).into_rpc();
io.merge(statement_store)?;
if let Some(mixnet_api) = mixnet_api {
let mixnet = sc_rpc::mixnet::Mixnet::new(mixnet_api).into_rpc();
io.merge(mixnet)?;
}
Ok(io)
}