Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions cumulus/client/bootnodes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ sc-service = { workspace = true, default-features = true }
sp-consensus-babe = { workspace = true, default-features = true }
sp-runtime = { workspace = true, default-features = true }

# Polkadot

# Cumulus
cumulus-primitives-core = { workspace = true, default-features = true }
cumulus-relay-chain-interface = { workspace = true, default-features = true }
parachains-common = { workspace = true, default-features = true }
7 changes: 3 additions & 4 deletions cumulus/client/bootnodes/src/advertisement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
use futures::{future::Fuse, pin_mut, FutureExt, StreamExt};
use ip_network::IpNetwork;
use log::{debug, error, trace, warn};
use parachains_common::Hash as ParaHash;
use prost::Message;
use sc_network::{
config::OutgoingResponse,
Expand Down Expand Up @@ -63,7 +62,7 @@ pub struct BootnodeAdvertisementParams {
/// Whether to advertise non-global IPs.
pub advertise_non_global_ips: bool,
/// Parachain genesis hash.
pub parachain_genesis_hash: ParaHash,
pub parachain_genesis_hash: Vec<u8>,
/// Parachain fork ID.
pub parachain_fork_id: Option<String>,
/// Parachain side public addresses.
Expand All @@ -83,7 +82,7 @@ pub struct BootnodeAdvertisement {
request_receiver: async_channel::Receiver<IncomingRequest>,
parachain_network: Arc<dyn NetworkService>,
advertise_non_global_ips: bool,
parachain_genesis_hash: ParaHash,
parachain_genesis_hash: Vec<u8>,
parachain_fork_id: Option<String>,
public_addresses: Vec<Multiaddr>,
}
Expand Down Expand Up @@ -408,7 +407,7 @@ impl BootnodeAdvertisement {
let response = crate::schema::Response {
peer_id: self.parachain_network.local_peer_id().to_bytes(),
addrs: self.paranode_addresses().iter().map(|a| a.to_vec()).collect(),
genesis_hash: self.parachain_genesis_hash.clone().as_bytes().to_vec(),
genesis_hash: self.parachain_genesis_hash.clone(),
fork_id: self.parachain_fork_id.clone(),
};

Expand Down
9 changes: 4 additions & 5 deletions cumulus/client/bootnodes/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ use futures::{
FutureExt, StreamExt,
};
use log::{debug, error, info, trace, warn};
use parachains_common::Hash as ParaHash;
use prost::Message;
use sc_network::{
event::{DhtEvent, Event},
Expand All @@ -70,7 +69,7 @@ pub struct BootnodeDiscoveryParams {
/// Parachain node network service.
pub parachain_network: Arc<dyn NetworkService>,
/// Parachain genesis hash.
pub parachain_genesis_hash: ParaHash,
pub parachain_genesis_hash: Vec<u8>,
/// Parachain fork ID.
pub parachain_fork_id: Option<String>,
/// Relay chain interface.
Expand All @@ -85,7 +84,7 @@ pub struct BootnodeDiscoveryParams {
pub struct BootnodeDiscovery {
para_id_scale_compact: Vec<u8>,
parachain_network: Arc<dyn NetworkService>,
parachain_genesis_hash: ParaHash,
parachain_genesis_hash: Vec<u8>,
parachain_fork_id: Option<String>,
relay_chain_interface: Arc<dyn RelayChainInterface>,
relay_chain_network: Arc<dyn NetworkService>,
Expand Down Expand Up @@ -311,7 +310,7 @@ impl BootnodeDiscovery {

match (response.genesis_hash, response.fork_id) {
(genesis_hash, fork_id)
if genesis_hash == self.parachain_genesis_hash.as_ref() &&
if genesis_hash == self.parachain_genesis_hash &&
fork_id == self.parachain_fork_id => {},
(genesis_hash, fork_id) => {
warn!(
Expand All @@ -320,7 +319,7 @@ impl BootnodeDiscovery {
genesis hash {}, fork ID {:?} don't match expected genesis hash {}, fork ID {:?}",
hex::encode(genesis_hash),
fork_id,
hex::encode(self.parachain_genesis_hash),
hex::encode(&self.parachain_genesis_hash),
self.parachain_fork_id,
);
return;
Expand Down
9 changes: 4 additions & 5 deletions cumulus/client/bootnodes/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use cumulus_primitives_core::{relay_chain::BlockId, ParaId};
use cumulus_relay_chain_interface::RelayChainInterface;
use log::{debug, error};
use num_traits::Zero;
use parachains_common::Hash as ParaHash;
use sc_network::{request_responses::IncomingRequest, service::traits::NetworkService, Multiaddr};
use sc_service::TaskManager;
use std::sync::Arc;
Expand Down Expand Up @@ -57,7 +56,7 @@ pub struct StartBootnodeTasksParams<'a> {
/// Whether to advertise non-global IP addresses.
pub advertise_non_global_ips: bool,
/// Parachain genesis hash.
pub parachain_genesis_hash: ParaHash,
pub parachain_genesis_hash: Vec<u8>,
/// Parachain fork ID.
pub parachain_fork_id: Option<String>,
/// Parachain public addresses provided by the operator.
Expand All @@ -71,7 +70,7 @@ async fn bootnode_advertisement(
request_receiver: async_channel::Receiver<IncomingRequest>,
parachain_network: Arc<dyn NetworkService>,
advertise_non_global_ips: bool,
parachain_genesis_hash: ParaHash,
parachain_genesis_hash: Vec<u8>,
parachain_fork_id: Option<String>,
public_addresses: Vec<Multiaddr>,
) {
Expand All @@ -95,7 +94,7 @@ async fn bootnode_advertisement(
async fn bootnode_discovery(
para_id: ParaId,
parachain_network: Arc<dyn NetworkService>,
parachain_genesis_hash: ParaHash,
parachain_genesis_hash: Vec<u8>,
parachain_fork_id: Option<String>,
relay_chain_interface: Arc<dyn RelayChainInterface>,
relay_chain_fork_id: Option<String>,
Expand Down Expand Up @@ -177,7 +176,7 @@ pub fn start_bootnode_tasks(
request_receiver,
parachain_network.clone(),
advertise_non_global_ips,
parachain_genesis_hash,
parachain_genesis_hash.clone(),
parachain_fork_id.clone(),
parachain_public_addresses,
),
Expand Down
3 changes: 2 additions & 1 deletion cumulus/polkadot-omni-node/lib/src/common/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::{
ConstructNodeRuntimeApi, NodeBlock, NodeExtraArgs,
},
};
use codec::Encode;
use cumulus_client_bootnodes::{start_bootnode_tasks, StartBootnodeTasksParams};
use cumulus_client_cli::CollatorOptions;
use cumulus_client_service::{
Expand Down Expand Up @@ -517,7 +518,7 @@ pub(crate) trait NodeSpec: BaseNodeSpec {
request_receiver: paranode_rx,
parachain_network: network,
advertise_non_global_ips,
parachain_genesis_hash: client.chain_info().genesis_hash,
parachain_genesis_hash: client.chain_info().genesis_hash.encode(),
parachain_fork_id,
parachain_public_addresses,
});
Expand Down
10 changes: 10 additions & 0 deletions prdoc/pr_10048.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: 'cumulus-bootnodes: Do not require a specific hash'
doc:
- audience: Node Dev
description: "On the wire the hash is represented as `Vec<u8>` any way. So, there\
\ is no need to take this as an extra type.\r\n"
crates:
- name: cumulus-client-bootnodes
bump: major
- name: polkadot-omni-node-lib
bump: major
1 change: 1 addition & 0 deletions templates/parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build = "build.rs"
workspace = true

[dependencies]
codec = { workspace = true, default-features = true }
clap = { features = ["derive"], workspace = true }
color-print = { workspace = true }
docify = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion templates/parachain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use parachain_template_runtime::{
opaque::{Block, Hash},
};

use codec::Encode;
use polkadot_sdk::{cumulus_client_service::ParachainTracingExecuteBlock, *};

// Cumulus Imports
Expand Down Expand Up @@ -415,7 +416,7 @@ pub async fn start_parachain_node(
request_receiver: paranode_rx,
parachain_network: network,
advertise_non_global_ips,
parachain_genesis_hash: client.chain_info().genesis_hash,
parachain_genesis_hash: client.chain_info().genesis_hash.encode(),
parachain_fork_id,
parachain_public_addresses,
});
Expand Down
Loading