Change request-response protocol names to include genesis hash & fork id (#5870)

This commit is contained in:
Dmitry Markin
2022-08-12 15:07:13 +03:00
committed by GitHub
parent 596b5df747
commit 4def0da0dc
17 changed files with 206 additions and 72 deletions
+8 -3
View File
@@ -25,12 +25,13 @@ use std::{borrow::Cow, collections::HashSet};
use sc_network::{Event as NetworkEvent, IfDisconnected};
use polkadot_node_network_protocol::{
request_response::outgoing::Requests, ObservedRole, Versioned,
request_response::{outgoing::Requests, ReqProtocolNames},
ObservedRole, Versioned,
};
use polkadot_node_subsystem::{FromOrchestra, OverseerSignal};
use polkadot_node_subsystem_test_helpers::TestSubsystemContextHandle;
use polkadot_node_subsystem_util::metered;
use polkadot_primitives::v2::AuthorityDiscoveryId;
use polkadot_primitives::v2::{AuthorityDiscoveryId, Hash};
use polkadot_primitives_test_helpers::dummy_collator_signature;
use sc_network::Multiaddr;
use sp_keyring::Sr25519Keyring;
@@ -104,6 +105,7 @@ impl Network for TestNetwork {
&self,
_: &mut AD,
_: Requests,
_: &ReqProtocolNames,
_: IfDisconnected,
) {
}
@@ -182,7 +184,10 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(test: impl FnOnce(TestHarne
let (context, virtual_overseer) =
polkadot_node_subsystem_test_helpers::make_subsystem_context(pool);
let bridge_out = NetworkBridgeTx::new(network, discovery, Metrics(None));
let genesis_hash = Hash::repeat_byte(0xff);
let protocol_names = ReqProtocolNames::new(genesis_hash, None);
let bridge_out = NetworkBridgeTx::new(network, discovery, Metrics(None), protocol_names);
let network_bridge_out_fut = run_network_out(bridge_out, context)
.map_err(|e| panic!("bridge-out subsystem execution failed {:?}", e))