Collator overseer builder unification (#3335)

resolve https://github.com/paritytech/polkadot-sdk/issues/3116

a follow-up on
https://github.com/paritytech/polkadot-sdk/pull/3061#pullrequestreview-1847530265:

- [x] reuse collator overseer builder for polkadot-node and collator
- [x] run zombienet test (0001-parachains-smoke-test.toml)
- [x] make wasm build errors more user-friendly for an easier problem
detection when using different toolchains in Rust

---------

Co-authored-by: ordian <write@reusable.software>
Co-authored-by: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com>
This commit is contained in:
maksimryndin
2024-02-28 05:05:54 +01:00
committed by GitHub
parent 95da658360
commit 7ec0b8741b
15 changed files with 162 additions and 278 deletions
@@ -26,13 +26,13 @@ use polkadot_primitives::{
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
};
use sc_client_api::HeaderBackend;
use sc_client_api::{AuxStore, HeaderBackend};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_api::{ApiError, ApiExt, ProvideRuntimeApi};
use sp_authority_discovery::AuthorityDiscoveryApi;
use sp_blockchain::Info;
use sp_blockchain::{BlockStatus, Info};
use sp_consensus_babe::{BabeApi, Epoch};
use sp_runtime::traits::{Header as HeaderT, NumberFor};
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
use std::{collections::BTreeMap, sync::Arc};
/// Offers header utilities.
@@ -595,3 +595,61 @@ where
self.client.runtime_api().approval_voting_params(at)
}
}
impl<Client, Block> HeaderBackend<Block> for DefaultSubsystemClient<Client>
where
Client: HeaderBackend<Block>,
Block: sp_runtime::traits::Block,
{
fn header(
&self,
hash: Block::Hash,
) -> sc_client_api::blockchain::Result<Option<Block::Header>> {
self.client.header(hash)
}
fn info(&self) -> Info<Block> {
self.client.info()
}
fn status(&self, hash: Block::Hash) -> sc_client_api::blockchain::Result<BlockStatus> {
self.client.status(hash)
}
fn number(
&self,
hash: Block::Hash,
) -> sc_client_api::blockchain::Result<Option<<<Block as BlockT>::Header as HeaderT>::Number>> {
self.client.number(hash)
}
fn hash(
&self,
number: NumberFor<Block>,
) -> sc_client_api::blockchain::Result<Option<Block::Hash>> {
self.client.hash(number)
}
}
impl<Client> AuxStore for DefaultSubsystemClient<Client>
where
Client: AuxStore,
{
fn insert_aux<
'a,
'b: 'a,
'c: 'a,
I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>,
D: IntoIterator<Item = &'a &'b [u8]>,
>(
&self,
insert: I,
delete: D,
) -> sp_blockchain::Result<()> {
self.client.insert_aux(insert, delete)
}
fn get_aux(&self, key: &[u8]) -> sp_blockchain::Result<Option<Vec<u8>>> {
self.client.get_aux(key)
}
}