Remove assumption that there is a local bootnode in RPC collator (#2091)

* Remove assumption that there is a local bootnode

* Bump zombienet to 1.3.29

* Separate "--"
This commit is contained in:
Sebastian Kunert
2023-01-24 15:07:18 +01:00
committed by GitHub
parent 2098caefca
commit ad453c556b
5 changed files with 4 additions and 37 deletions
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use std::{pin::Pin, str::FromStr};
use std::pin::Pin;
use cumulus_relay_chain_interface::{RelayChainError, RelayChainResult};
use cumulus_relay_chain_rpc_interface::RelayChainRpcClient;
@@ -24,12 +24,9 @@ use polkadot_overseer::RuntimeApiSubsystemClient;
use polkadot_service::{AuxStore, HeaderBackend};
use sc_authority_discovery::AuthorityDiscovery;
use sc_network_common::config::MultiaddrWithPeerId;
use sp_api::{ApiError, RuntimeApiInfo};
use sp_blockchain::Info;
const LOG_TARGET: &str = "blockchain-rpc-client";
#[derive(Clone)]
pub struct BlockChainRpcClient {
rpc_client: RelayChainRpcClient,
@@ -338,27 +335,6 @@ impl AuthorityDiscovery<Block> for BlockChainRpcClient {
}
impl BlockChainRpcClient {
pub async fn local_listen_addresses(
&self,
) -> Result<Vec<MultiaddrWithPeerId>, RelayChainError> {
let addresses = self.rpc_client.system_local_listen_addresses().await?;
tracing::debug!(target: LOG_TARGET, ?addresses, "Fetched listen address from RPC node.");
let mut result_vec = Vec::new();
for address in addresses {
match MultiaddrWithPeerId::from_str(&address) {
Ok(addr) => result_vec.push(addr),
Err(err) =>
return Err(RelayChainError::GenericError(format!(
"Failed to parse a local listen addresses from the RPC node: {}",
err
))),
}
}
Ok(result_vec)
}
pub async fn import_notification_stream(
&self,
) -> RelayChainResult<Pin<Box<dyn Stream<Item = Header> + Send>>> {
@@ -127,10 +127,6 @@ async fn new_minimal_relay_chain(
) -> Result<NewMinimalNode, RelayChainError> {
let role = config.role.clone();
// Use the given RPC node as bootnode, since we do not have a chain spec with valid boot nodes
let mut boot_node_address = relay_chain_rpc_client.local_listen_addresses().await?;
config.network.boot_nodes.append(&mut boot_node_address);
let task_manager = {
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
TaskManager::new(config.tokio_handle.clone(), registry)?