referrerpolicy=no-referrer-when-downgrade
substrate_test_runtime_client

Type Alias TestClientBuilder

Source
pub type TestClientBuilder<E, B> = TestClientBuilder<Block, E, B, GenesisParameters>;
Expand description

A TestClient with test-runtime builder.

Aliased Type§

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

Implementations

Source§

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

Source

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

Create new TestClientBuilder with default backend.

Source

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

Create new TestClientBuilder with default backend and pruning window size

Source

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

Create new TestClientBuilder with default backend and storage chain mode

Source§

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

Source

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

Create a new instance of the test client builder.

Source

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

Alter the genesis storage parameters.

Source

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

Give access to the underlying backend of these clients

Source

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

Source

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.

Source

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

Enable the offchain indexing api.

Source

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

Enable proof recording on import.

Source

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

Disable writing genesis.

Source

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.

Source§

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

Source

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§

Source§

impl DefaultTestClientBuilderExt for TestClientBuilder<ExecutorDispatch, Backend>

Source§

fn new() -> Self

Create new TestClientBuilder
Source§

impl<B> TestClientBuilderExt<B> for TestClientBuilder<LocalCallExecutor<Block, B, WasmExecutor>, B>
where B: Backend<Block> + 'static,

Source§

fn genesis_init_mut(&mut self) -> &mut GenesisParameters

Returns a mutable reference to the genesis parameters.
Source§

fn build_with_longest_chain(self) -> (Client<B>, LongestChain<B, Block>)

Build the test client and longest chain selector.
Source§

fn build_with_backend(self) -> (Client<B>, Arc<B>)

Build the test client and the backend.
Source§

fn set_heap_pages(self, heap_pages: u64) -> Self

Override the default value for Wasm heap pages.
Source§

fn add_extra_child_storage<K: Into<Vec<u8>>, V: Into<Vec<u8>>>( self, child_info: &ChildInfo, key: K, value: V, ) -> Self

Add an extra value into the genesis storage. Read more
Source§

fn add_extra_storage<K: Into<Vec<u8>>, V: Into<Vec<u8>>>( self, key: K, value: V, ) -> Self

Add an extra child value into the genesis storage. Read more
Source§

fn build(self) -> Client<B>

Build the test client.
Source§

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

Source§

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

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