mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
collator-protocol: add message authentication (#2635)
* collator: authenticate collator protocol messages * fix tests compilation * node: verify collator protocol signatures in tests * collator: fix tests * implementers-guide: update CollatorProtocol messages * collator: add test for verification of collator protocol signatures * node: remove fixmes * node: remove signature from advertisecollation message * node: add magic constant to Declare message signature payload
This commit is contained in:
@@ -60,7 +60,7 @@ pub use self::client::{AbstractClient, Client, ClientHandle, ExecuteWithClient,
|
||||
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec, RococoChainSpec};
|
||||
pub use consensus_common::{Proposal, SelectChain, BlockImport, block_validation::Chain};
|
||||
pub use polkadot_parachain::wasm_executor::IsolationStrategy;
|
||||
pub use polkadot_primitives::v1::{Block, BlockId, CollatorId, Hash, Id as ParaId};
|
||||
pub use polkadot_primitives::v1::{Block, BlockId, CollatorPair, Hash, Id as ParaId};
|
||||
pub use sc_client_api::{Backend, ExecutionStrategy, CallExecutor};
|
||||
pub use sc_consensus::LongestChain;
|
||||
pub use sc_executor::NativeExecutionDispatch;
|
||||
@@ -502,7 +502,11 @@ where
|
||||
),
|
||||
collator_protocol: {
|
||||
let side = match is_collator {
|
||||
IsCollator::Yes(id) => ProtocolSide::Collator(id, Metrics::register(registry)?),
|
||||
IsCollator::Yes(collator_pair) => ProtocolSide::Collator(
|
||||
network_service.local_peer_id().clone(),
|
||||
collator_pair,
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
IsCollator::No => ProtocolSide::Validator(Default::default(),Metrics::register(registry)?),
|
||||
};
|
||||
CollatorProtocolSubsystem::new(
|
||||
@@ -578,14 +582,25 @@ impl<C> NewFull<C> {
|
||||
|
||||
/// Is this node a collator?
|
||||
#[cfg(feature = "full-node")]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[derive(Clone)]
|
||||
pub enum IsCollator {
|
||||
/// This node is a collator.
|
||||
Yes(CollatorId),
|
||||
Yes(CollatorPair),
|
||||
/// This node is not a collator.
|
||||
No,
|
||||
}
|
||||
|
||||
#[cfg(feature = "full-node")]
|
||||
impl std::fmt::Debug for IsCollator {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
use sp_core::Pair;
|
||||
match self {
|
||||
IsCollator::Yes(pair) => write!(fmt, "Yes({})", pair.public()),
|
||||
IsCollator::No => write!(fmt, "No"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "full-node")]
|
||||
impl IsCollator {
|
||||
/// Is this a collator?
|
||||
|
||||
Reference in New Issue
Block a user