[companion] Get rid of Peerset compatibility layer (#2739)

* Init `PeerStore` in `build_collator_network`

* kick CI

* Update Cargo.lock for substrate

* Companion for substrate 14373

* Companion for paritytech/substrate#14020

* update lockfile for {"substrate", "polkadot"}

---------

Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: parity-processbot <>
This commit is contained in:
Dmitry Markin
2023-08-02 18:58:13 +03:00
committed by GitHub
parent ff3803503a
commit 0dc2812c38
5 changed files with 293 additions and 272 deletions
+267 -265
View File
File diff suppressed because it is too large Load Diff
@@ -21,6 +21,7 @@ use sc_network::{
config::{ config::{
NonDefaultSetConfig, NonReservedPeerMode, NotificationHandshake, ProtocolId, SetConfig, NonDefaultSetConfig, NonReservedPeerMode, NotificationHandshake, ProtocolId, SetConfig,
}, },
peer_store::PeerStore,
NetworkService, NetworkService,
}; };
@@ -52,6 +53,17 @@ pub(crate) fn build_collator_network(
genesis_hash, genesis_hash,
); );
let peer_store = PeerStore::new(
network_config
.network_config
.boot_nodes
.iter()
.map(|bootnode| bootnode.peer_id)
.collect(),
);
let peer_store_handle = peer_store.handle();
spawn_handle.spawn("peer-store", Some("networking"), peer_store.run());
// RX is not used for anything because syncing is not started for the minimal node // RX is not used for anything because syncing is not started for the minimal node
let (tx, _rx) = tracing_unbounded("mpsc_syncing_engine_protocol", 100_000); let (tx, _rx) = tracing_unbounded("mpsc_syncing_engine_protocol", 100_000);
let network_params = sc_network::config::Params::<Block> { let network_params = sc_network::config::Params::<Block> {
@@ -64,6 +76,7 @@ pub(crate) fn build_collator_network(
}, },
fork_id: None, fork_id: None,
network_config, network_config,
peer_store: peer_store_handle,
genesis_hash, genesis_hash,
protocol_id, protocol_id,
metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()), metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()),
@@ -1,4 +1,4 @@
use beefy_primitives::crypto::AuthorityId as BeefyId; use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId;
use grandpa::AuthorityId as GrandpaId; use grandpa::AuthorityId as GrandpaId;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance, BlockNumber}; use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance, BlockNumber};
@@ -1,14 +1,15 @@
use crate::{ use crate::{
constants::currency::deposit, Balance, Balances, RandomnessCollectiveFlip, Runtime, constants::currency::deposit, Balance, Balances, RandomnessCollectiveFlip, Runtime,
RuntimeCall, RuntimeEvent, Timestamp, RuntimeCall, RuntimeEvent, RuntimeHoldReason, Timestamp,
}; };
use frame_support::{ use frame_support::{
parameter_types, parameter_types,
traits::{ConstBool, ConstU32, Nothing}, traits::{ConstBool, ConstU32, Nothing},
}; };
use pallet_contracts::{ use pallet_contracts::{
migration::v12, weights::SubstrateWeight, Config, DebugInfo, DefaultAddressGenerator, Frame, migration::{v12, v13, v14},
Schedule, weights::SubstrateWeight,
Config, DebugInfo, DefaultAddressGenerator, Frame, Schedule,
}; };
use sp_runtime::Perbill; use sp_runtime::Perbill;
@@ -54,5 +55,10 @@ impl Config for Runtime {
type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>;
type MaxDelegateDependencies = ConstU32<32>; type MaxDelegateDependencies = ConstU32<32>;
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type Migrations = (v12::Migration<Runtime>,); type Migrations = (
v12::Migration<Runtime, Balances>,
v13::Migration<Runtime>,
v14::Migration<Runtime, Balances>,
);
type RuntimeHoldReason = RuntimeHoldReason;
} }
@@ -220,7 +220,7 @@ impl pallet_balances::Config for Runtime {
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type RuntimeHoldReason = RuntimeHoldReason; type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = (); type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>; type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>; type MaxFreezes = ConstU32<0>;
} }
@@ -365,7 +365,7 @@ construct_runtime!(
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,
// Smart Contracts. // Smart Contracts.
Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 40, Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>, HoldReason} = 40,
// Handy utilities. // Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 50, Utility: pallet_utility::{Pallet, Call, Event} = 50,