#[cfg(feature = "aura")]
pub mod aura;
#[cfg(feature = "parachain")]
pub mod parachain;
#[cfg(feature = "babe")]
pub mod babe;
pub mod timestamp;
use crate::{ChainInfo, SignatureVerificationOverride};
use jsonrpsee::RpcModule;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient};
use sc_telemetry::Telemetry;
use sp_runtime::{generic::UncheckedExtrinsic, MultiAddress, MultiSignature};
use sp_wasm_interface::ExtendedHostFunctions;
pub type Executor = WasmExecutor<
ExtendedHostFunctions<sp_io::SubstrateHostFunctions, SignatureVerificationOverride>,
>;
pub fn new_wasm_executor(config: &Configuration) -> Executor {
let strategy = config
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |p| HeapAllocStrategy::Static { extra_pages: p as _ });
WasmExecutor::builder()
.with_execution_method(config.wasm_method)
.with_onchain_heap_alloc_strategy(strategy)
.with_offchain_heap_alloc_strategy(strategy)
.with_max_runtime_instances(config.max_runtime_instances)
.with_runtime_cache_size(config.runtime_cache_size)
.build()
}
pub type FullClientFor<C> =
TFullClient<<C as ChainInfo>::Block, <C as ChainInfo>::RuntimeApi, Executor>;
pub type UncheckedExtrinsicFor<T> = UncheckedExtrinsic<
MultiAddress<
<<T as ChainInfo>::Runtime as frame_system::Config>::AccountId,
<<T as ChainInfo>::Runtime as frame_system::Config>::Nonce,
>,
<<T as ChainInfo>::Runtime as frame_system::Config>::RuntimeCall,
MultiSignature,
<T as ChainInfo>::SignedExtras,
>;
pub type FullBackendFor<C> = TFullBackend<<C as ChainInfo>::Block>;
pub struct SimnodeParams<Client, Backend, SelectChain, Pool, ImportQueue, BlockImport, U> {
pub components: PartialComponents<
Client,
Backend,
SelectChain,
ImportQueue,
Pool,
(BlockImport, Option<Telemetry>, U),
>,
pub config: Configuration,
pub instant: bool,
pub rpc_builder: Box<
dyn Fn(DenyUnsafe, SubscriptionTaskExecutor) -> Result<RpcModule<()>, sc_service::Error>,
>,
}