referrerpolicy=no-referrer-when-downgrade
sc_network_test

Type Alias TestClientBuilder

pub type TestClientBuilder<E, B> = TestClientBuilder<Block<Header<u64, BlakeTwo256>, UncheckedExtrinsic<CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, RuntimeCall, CryptoBytes<sp_core::::sr25519::Signature::{constant#0}, (SignatureTag, Sr25519Tag)>, ((CheckNonce<Runtime>, CheckWeight<Runtime>), CheckSubstrateCall, CheckMetadataHash<Runtime>, WeightReclaim<Runtime>)>>, E, B, GenesisParameters>;
Expand description

A TestClient with test-runtime builder.

Aliased Type§

struct TestClientBuilder<E, B> { /* private fields */ }

Implementations

§

impl<Block, ExecutorDispatch, G> TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>
where Block: Block, G: GenesisInit,

pub fn with_default_backend() -> TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>

Create new TestClientBuilder with default backend.

pub fn with_pruning_window( blocks_pruning: u32, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>

Create new TestClientBuilder with default backend and pruning window size

pub fn with_tx_storage( blocks_pruning: u32, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>

Create new TestClientBuilder with default backend and storage chain mode

§

impl<Block, ExecutorDispatch, Backend, G> TestClientBuilder<Block, ExecutorDispatch, Backend, G>
where Block: Block, G: GenesisInit,

pub fn with_backend( backend: Arc<Backend>, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend, G>

Create a new instance of the test client builder.

pub fn genesis_init_mut(&mut self) -> &mut G

Alter the genesis storage parameters.

pub fn backend(&self) -> Arc<Backend>

Give access to the underlying backend of these clients

pub fn add_child_storage( self, child_info: &ChildInfo, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend, G>

Extend child storage

pub fn set_block_rules( self, fork_blocks: Option<Vec<(<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash)>>, bad_blocks: Option<HashSet<<Block as Block>::Hash>>, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend, G>

Sets custom block rules.

pub fn enable_offchain_indexing_api( self, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend, G>

Enable the offchain indexing api.

pub fn enable_import_proof_recording( self, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend, G>

Enable proof recording on import.

pub fn set_no_genesis( self, ) -> TestClientBuilder<Block, ExecutorDispatch, Backend, G>

Disable writing genesis.

pub fn build_with_executor<RuntimeApi>( self, executor: ExecutorDispatch, ) -> (Client<Backend, ExecutorDispatch, Block, RuntimeApi>, LongestChain<Backend, Block>)
where ExecutorDispatch: CallExecutor<Block> + RuntimeVersionOf + Clone + 'static, Backend: Backend<Block>, <Backend as Backend<Block>>::OffchainStorage: 'static,

Build the test client with the given native executor.

§

impl<Block, H, Backend, G> TestClientBuilder<Block, LocalCallExecutor<Block, Backend, WasmExecutor<H>>, Backend, G>
where Block: Block, G: GenesisInit,

pub fn build_with_native_executor<RuntimeApi, I>( self, executor: I, ) -> (Client<Backend, LocalCallExecutor<Block, Backend, WasmExecutor<H>>, Block, RuntimeApi>, LongestChain<Backend, Block>)
where I: Into<Option<WasmExecutor<H>>>, Backend: Backend<Block> + 'static, H: HostFunctions,

Build the test client with the given native executor.

Trait Implementations

§

impl<Block, ExecutorDispatch, G> Default for TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>
where Block: Block, G: GenesisInit,

§

fn default() -> TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>

Returns the “default value” for a type. Read more