Files
pezkuwi-sdk/bizinikiwi/client/transaction-pool/src/transaction_pool_wrapper.rs
T
pezkuwichain 1c0e57d984 feat: Rebrand Polkadot/Substrate references to PezkuwiChain
This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
2025-12-14 00:04:10 +03:00

191 lines
6.2 KiB
Rust

// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Transaction pool wrapper. Provides a type for wrapping object providing actual implementation of
//! transaction pool.
use crate::{
builder::FullClientTransactionPool,
graph::{base_pool::Transaction, ExtrinsicFor, ExtrinsicHash},
ChainApi, FullChainApi, ReadyIteratorFor,
};
use async_trait::async_trait;
use pezsc_transaction_pool_api::{
ChainEvent, ImportNotificationStream, LocalTransactionFor, LocalTransactionPool,
MaintainedTransactionPool, PoolStatus, ReadyTransactions, TransactionFor, TransactionPool,
TransactionSource, TransactionStatusStreamFor, TxHash, TxInvalidityReportMap,
};
use pezsp_runtime::traits::Block as BlockT;
use std::{collections::HashMap, pin::Pin, sync::Arc};
/// The wrapper for actual object providing implementation of TransactionPool.
///
/// This wraps actual implementation of the TransactionPool, e.g. fork-aware or single-state.
pub struct TransactionPoolWrapper<Block, Client>(
pub Box<dyn FullClientTransactionPool<Block, Client>>,
)
where
Block: BlockT,
Client: pezsp_api::ProvideRuntimeApi<Block>
+ pezsc_client_api::BlockBackend<Block>
+ pezsc_client_api::blockchain::HeaderBackend<Block>
+ pezsp_runtime::traits::BlockIdTo<Block>
+ pezsp_blockchain::HeaderMetadata<Block, Error = pezsp_blockchain::Error>
+ 'static,
Client::Api: pezsp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>;
#[async_trait]
impl<Block, Client> TransactionPool for TransactionPoolWrapper<Block, Client>
where
Block: BlockT,
Client: pezsp_api::ProvideRuntimeApi<Block>
+ pezsc_client_api::BlockBackend<Block>
+ pezsc_client_api::blockchain::HeaderBackend<Block>
+ pezsp_runtime::traits::BlockIdTo<Block>
+ pezsp_blockchain::HeaderMetadata<Block, Error = pezsp_blockchain::Error>
+ 'static,
Client::Api: pezsp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
{
type Block = Block;
type Hash = ExtrinsicHash<FullChainApi<Client, Block>>;
type InPoolTransaction = Transaction<
ExtrinsicHash<FullChainApi<Client, Block>>,
ExtrinsicFor<FullChainApi<Client, Block>>,
>;
type Error = <FullChainApi<Client, Block> as ChainApi>::Error;
async fn submit_at(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xts: Vec<TransactionFor<Self>>,
) -> Result<Vec<Result<TxHash<Self>, Self::Error>>, Self::Error> {
self.0.submit_at(at, source, xts).await
}
async fn submit_one(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xt: TransactionFor<Self>,
) -> Result<TxHash<Self>, Self::Error> {
self.0.submit_one(at, source, xt).await
}
async fn submit_and_watch(
&self,
at: <Self::Block as BlockT>::Hash,
source: TransactionSource,
xt: TransactionFor<Self>,
) -> Result<Pin<Box<TransactionStatusStreamFor<Self>>>, Self::Error> {
self.0.submit_and_watch(at, source, xt).await
}
async fn ready_at(
&self,
at: <Self::Block as BlockT>::Hash,
) -> ReadyIteratorFor<FullChainApi<Client, Block>> {
self.0.ready_at(at).await
}
fn ready(&self) -> Box<dyn ReadyTransactions<Item = Arc<Self::InPoolTransaction>> + Send> {
self.0.ready()
}
async fn report_invalid(
&self,
at: Option<<Self::Block as BlockT>::Hash>,
invalid_tx_errors: TxInvalidityReportMap<TxHash<Self>>,
) -> Vec<Arc<Self::InPoolTransaction>> {
self.0.report_invalid(at, invalid_tx_errors).await
}
fn futures(&self) -> Vec<Self::InPoolTransaction> {
self.0.futures()
}
fn status(&self) -> PoolStatus {
self.0.status()
}
fn import_notification_stream(&self) -> ImportNotificationStream<TxHash<Self>> {
self.0.import_notification_stream()
}
fn on_broadcasted(&self, propagations: HashMap<TxHash<Self>, Vec<String>>) {
self.0.on_broadcasted(propagations)
}
fn hash_of(&self, xt: &TransactionFor<Self>) -> TxHash<Self> {
self.0.hash_of(xt)
}
fn ready_transaction(&self, hash: &TxHash<Self>) -> Option<Arc<Self::InPoolTransaction>> {
self.0.ready_transaction(hash)
}
async fn ready_at_with_timeout(
&self,
at: <Self::Block as BlockT>::Hash,
timeout: std::time::Duration,
) -> ReadyIteratorFor<FullChainApi<Client, Block>> {
self.0.ready_at_with_timeout(at, timeout).await
}
}
#[async_trait]
impl<Block, Client> MaintainedTransactionPool for TransactionPoolWrapper<Block, Client>
where
Block: BlockT,
Client: pezsp_api::ProvideRuntimeApi<Block>
+ pezsc_client_api::BlockBackend<Block>
+ pezsc_client_api::blockchain::HeaderBackend<Block>
+ pezsp_runtime::traits::BlockIdTo<Block>
+ pezsp_blockchain::HeaderMetadata<Block, Error = pezsp_blockchain::Error>
+ 'static,
Client::Api: pezsp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
{
async fn maintain(&self, event: ChainEvent<Self::Block>) {
self.0.maintain(event).await;
}
}
impl<Block, Client> LocalTransactionPool for TransactionPoolWrapper<Block, Client>
where
Block: BlockT,
Client: pezsp_api::ProvideRuntimeApi<Block>
+ pezsc_client_api::BlockBackend<Block>
+ pezsc_client_api::blockchain::HeaderBackend<Block>
+ pezsp_runtime::traits::BlockIdTo<Block>
+ pezsp_blockchain::HeaderMetadata<Block, Error = pezsp_blockchain::Error>
+ 'static,
Client::Api: pezsp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
{
type Block = Block;
type Hash = ExtrinsicHash<FullChainApi<Client, Block>>;
type Error = <FullChainApi<Client, Block> as ChainApi>::Error;
fn submit_local(
&self,
at: <Self::Block as BlockT>::Hash,
xt: LocalTransactionFor<Self>,
) -> Result<Self::Hash, Self::Error> {
self.0.submit_local(at, xt)
}
}