diff --git a/polkadot/network/src/lib.rs b/polkadot/network/src/lib.rs index 91c53338e6571..eef8c8192e251 100644 --- a/polkadot/network/src/lib.rs +++ b/polkadot/network/src/lib.rs @@ -393,8 +393,7 @@ impl Specialization for PolkadotProtocol { let local_status = match Status::decode(&mut &status.chain_status[..]) { Some(status) => status, None => { - ctx.disable_peer(peer_id); - return; + Status { collating_for: None } } }; diff --git a/polkadot/network/src/tests.rs b/polkadot/network/src/tests.rs index 5c5dcf508ec4c..19db9890ccb97 100644 --- a/polkadot/network/src/tests.rs +++ b/polkadot/network/src/tests.rs @@ -78,6 +78,9 @@ fn make_status(status: &Status, roles: Vec) -> FullStatus { best_hash: Default::default(), genesis_hash: Default::default(), chain_status: status.encode(), + parachain_id: None, + validator_id: None, + validator_signature: None, } } diff --git a/substrate/network/src/message.rs b/substrate/network/src/message.rs index a6992ff8e430d..5063e7e54c1df 100644 --- a/substrate/network/src/message.rs +++ b/substrate/network/src/message.rs @@ -95,6 +95,8 @@ pub enum Role { Light, /// Parachain validator. Authority, + /// Same as `Authority` + Validator, } impl Role { @@ -105,7 +107,7 @@ impl Role { match *r { Role::Full => flags = flags | RoleFlags::FULL, Role::Light => flags = flags | RoleFlags::LIGHT, - Role::Authority => flags = flags | RoleFlags::AUTHORITY, + Role::Authority | Role::Validator => flags = flags | RoleFlags::AUTHORITY, } } flags @@ -122,7 +124,7 @@ impl From for Vec where { roles.push(Role::Light); } if !(flags & RoleFlags::AUTHORITY).is_empty() { - roles.push(Role::Authority); + roles.push(Role::Validator); } roles } @@ -371,7 +373,14 @@ pub mod generic { /// Genesis block hash. pub genesis_hash: Hash, /// Chain-specific status. + #[serde(skip)] pub chain_status: Vec, + /// Signatue of `best_hash` made with validator address. Required for the validator role. + pub validator_signature: Option, + /// Validator address. Required for the validator role. + pub validator_id: Option, + /// Parachain id. Required for the collator role. + pub parachain_id: Option, } /// Request block data from a peer. diff --git a/substrate/network/src/protocol.rs b/substrate/network/src/protocol.rs index e77ad6307e9be..4a897c9b44a83 100644 --- a/substrate/network/src/protocol.rs +++ b/substrate/network/src/protocol.rs @@ -38,7 +38,7 @@ use error; const REQUEST_TIMEOUT_SEC: u64 = 40; /// Current protocol version. -pub (crate) const CURRENT_VERSION: u32 = 1; +pub (crate) const CURRENT_VERSION: u32 = 0; /// Current packet count. pub (crate) const CURRENT_PACKET_COUNT: u8 = 1; @@ -526,6 +526,10 @@ impl> Protocol where B::Header: HeaderT