Struct tetcore_test_client::client::Client[][src]

pub struct Client<B, E, Block, RA> where
    Block: Block
{ /* fields omitted */ }

Tetcore Client

Implementations

impl<B, E, Block, RA> Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>,
    <Block as Block>::Header: Clone
[src]

pub fn new(
    backend: Arc<B>,
    executor: E,
    build_genesis_storage: &dyn BuildStorage,
    fork_blocks: Option<Vec<(<<Block as Block>::Header as Header>::Number, <Block as Block>::Hash), Global>>,
    bad_blocks: Option<HashSet<<Block as Block>::Hash, RandomState>>,
    execution_extensions: ExecutionExtensions<Block>,
    prometheus_registry: Option<Registry>,
    config: ClientConfig
) -> Result<Client<B, E, Block, RA>, Error>
[src]

Creates new Tetcore Client with given blockchain and code executor.

pub fn import_notification_sinks(
    &self
) -> &Mutex<RawMutex, Vec<TracingUnboundedSender<BlockImportNotification<Block>>, Global>>
[src]

returns a reference to the block import notification sinks useful for test environments.

pub fn finality_notification_sinks(
    &self
) -> &Mutex<RawMutex, Vec<TracingUnboundedSender<FinalityNotification<Block>>, Global>>
[src]

returns a reference to the finality notification sinks useful for test environments.

pub fn state_at(
    &self,
    block: &BlockId<Block>
) -> Result<<B as Backend<Block>>::State, Error>
[src]

Get a reference to the state at a given block.

pub fn code_at(&self, id: &BlockId<Block>) -> Result<Vec<u8, Global>, Error>[src]

Get the code at a given block.

pub fn runtime_version_at(
    &self,
    id: &BlockId<Block>
) -> Result<RuntimeVersion, Error>
[src]

Get the RuntimeVersion at a given block.

pub fn header_proof_with_cht_size(
    &self,
    id: &BlockId<Block>,
    cht_size: <<Block as Block>::Header as Header>::Number
) -> Result<(<Block as Block>::Header, StorageProof), Error>
[src]

Reads given header and generates CHT-based header proof for CHT of given size.

pub fn key_changes_proof_with_cht_size(
    &self,
    first: <Block as Block>::Hash,
    last: <Block as Block>::Hash,
    min: <Block as Block>::Hash,
    max: <Block as Block>::Hash,
    storage_key: Option<&PrefixedStorageKey>,
    key: &StorageKey,
    cht_size: <<Block as Block>::Header as Header>::Number
) -> Result<ChangesProof<<Block as Block>::Header>, Error>
[src]

Does the same work as key_changes_proof, but assumes that CHTs are of passed size.

pub fn revert(
    &self,
    n: <<Block as Block>::Header as Header>::Number
) -> Result<<<Block as Block>::Header as Header>::Number, Error>
[src]

Attempts to revert the chain by n blocks guaranteeing that no block is reverted past the last finalized block. Returns the number of blocks that were successfully reverted.

pub fn unsafe_revert(
    &mut self,
    n: <<Block as Block>::Header as Header>::Number,
    blacklist: bool
) -> Result<<<Block as Block>::Header as Header>::Number, Error>
[src]

Attempts to revert the chain by n blocks disregarding finality. This method will revert any finalized blocks as requested and can potentially leave the node in an inconsistent state. Other modules in the system that persist data and that rely on finality (e.g. consensus parts) will be unaffected by the revert. Use this method with caution and making sure that no other data needs to be reverted for consistency aside from the block data. If blacklist is set to true, will also blacklist reverted blocks from finalizing again. The blacklist is reset upon client restart.

Returns the number of blocks that were successfully reverted.

pub fn chain_info(&self) -> Info<Block>[src]

Get blockchain info.

pub fn block_status(&self, id: &BlockId<Block>) -> Result<BlockStatus, Error>[src]

Get block status.

pub fn header(
    &self,
    id: &BlockId<Block>
) -> Result<Option<<Block as Block>::Header>, Error>
[src]

Get block header by id.

pub fn body(
    &self,
    id: &BlockId<Block>
) -> Result<Option<Vec<<Block as Block>::Extrinsic, Global>>, Error>
[src]

Get block body by id.

pub fn uncles(
    &self,
    target_hash: <Block as Block>::Hash,
    max_generation: <<Block as Block>::Header as Header>::Number
) -> Result<Vec<<Block as Block>::Hash, Global>, Error>
[src]

Gets the uncles of the block with target_hash going back max_generation ancestors.

Trait Implementations

impl<B, E, Block, RA> AuxStore for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>,
    Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiErrorExt>::Error == Error
[src]

pub fn insert_aux<'a, 'b, 'c, I, D>(
    &self,
    insert: I,
    delete: D
) -> Result<(), Error> where
    'b: 'a,
    'c: 'a,
    I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>,
    D: IntoIterator<Item = &'a &'b [u8]>, 
[src]

Insert auxiliary data into key-value store.

pub fn get_aux(&self, key: &[u8]) -> Result<Option<Vec<u8, Global>>, Error>[src]

Query auxiliary data from key-value store.

impl<'_, B, E, Block, RA> AuxStore for &'_ Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>,
    Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiErrorExt>::Error == Error
[src]

impl<B, E, Block, RA> BlockBackend<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> BlockBuilderProvider<B, Block, Client<B, E, Block, RA>> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block> + Send + Sync + 'static,
    B: Backend<Block> + Send + Sync + 'static,
    Client<B, E, Block, RA>: HeaderBackend<Block>,
    Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: BlockBuilder<Block>,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiErrorExt>::Error == Error
[src]

impl<B, E, Block, RA> BlockIdTo<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block> + Send + Sync,
    B: Backend<Block>,
    RA: Send + Sync
[src]

type Error = Error

The error type that will be returned by the functions.

impl<'_, B, E, Block, RA> BlockImport<Block> for &'_ Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block> + Send + Sync,
    B: Backend<Block>,
    Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiErrorExt>::Error == Error,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State
[src]

NOTE: only use this implementation when you are sure there are NO consensus-level BlockImport objects. Otherwise, importing blocks directly into the client would be bypassing important verification work.

type Error = Error

The error type.

type Transaction = <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction

The transaction type used by the backend.

pub fn import_block(
    &mut self,
    import_block: BlockImportParams<Block, <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction>,
    new_cache: HashMap<[u8; 4], Vec<u8, Global>, RandomState>
) -> Result<ImportResult, <&'_ Client<B, E, Block, RA> as BlockImport<Block>>::Error>
[src]

Import a checked and validated block. If a justification is provided in BlockImportParams then finalized must be true.

NOTE: only use this implementation when there are NO consensus-level BlockImport objects. Otherwise, importing blocks directly into the client would be bypassing important verification work.

If you are not sure that there are no BlockImport objects provided by the consensus algorithm, don’t use this function.

pub fn check_block(
    &mut self,
    block: BlockCheckParams<Block>
) -> Result<ImportResult, <&'_ Client<B, E, Block, RA> as BlockImport<Block>>::Error>
[src]

Check block preconditions.

impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block> + Send + Sync,
    B: Backend<Block>,
    Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block>,
    <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: ApiExt<Block>,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiErrorExt>::Error == Error,
    <<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api as ApiExt<Block>>::StateBackend == <B as Backend<Block>>::State
[src]

type Error = Error

The error type.

type Transaction = <<B as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction

The transaction type used by the backend.

impl<B, E, Block, RA> BlockOf for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

type Type = Block

The type of the block.

impl<B, E, Block, RA> BlockchainEvents<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>, 
[src]

pub fn import_notification_stream(
    &self
) -> TracingUnboundedReceiver<BlockImportNotification<Block>>
[src]

Get block import event stream.

pub fn storage_changes_notification_stream(
    &self,
    filter_keys: Option<&[StorageKey]>,
    child_filter_keys: Option<&[(StorageKey, Option<Vec<StorageKey, Global>>)]>
) -> Result<TracingUnboundedReceiver<(<Block as Block>::Hash, StorageChangeSet)>, Error>
[src]

Get storage changes event stream.

impl<B, E, Block, RA> CallApiAt<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block, Backend = B> + Send + Sync,
    B: Backend<Block>, 
[src]

type Error = Error

Error type used by the implementation.

type StateBackend = <B as Backend<Block>>::State

The state backend that is used to store the block states.

impl<BE, E, B, RA> Chain<B> for Client<BE, E, B, RA> where
    E: CallExecutor<B>,
    B: Block,
    BE: Backend<B>, 
[src]

impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block, RA> where
    Self: BlockImport<Block, Error = ConsensusError>, 
[src]

impl<B, E, RA, Block> ClientExt<Block> for Client<B, E, Block, RA> where
    B: Backend<Block>,
    E: CallExecutor<Block> + 'static,
    Self: BlockImport<Block, Error = ConsensusError>,
    Block: BlockT
[src]

impl<B, E, Block, RA> ExecutorProvider<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

type Executor = E

executor instance

impl<B, E, Block, RA> Finalizer<Block, B> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<'_, B, E, Block, RA> Finalizer<Block, B> for &'_ Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> HeaderBackend<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block> + Send + Sync,
    B: Backend<Block>,
    RA: Send + Sync
[src]

impl<'_, B, E, Block, RA> HeaderBackend<Block> for &'_ Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block> + Send + Sync,
    B: Backend<Block>,
    RA: Send + Sync
[src]

impl<B, E, Block, RA> HeaderMetadata<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

type Error = Error

Error used in case the header metadata is not found.

impl<'_, B, E, Block, RA> LockImportRun<Block, B> for &'_ Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> LockImportRun<Block, B> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> ProofProvider<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> ProvideCache<Block> for Client<B, E, Block, RA> where
    Block: Block,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> ProvideRuntimeApi<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block, Backend = B> + Send + Sync,
    B: Backend<Block>,
    RA: ConstructRuntimeApi<Block, Client<B, E, Block, RA>>, 
[src]

type Api = <RA as ConstructRuntimeApi<Block, Client<B, E, Block, RA>>>::RuntimeApi

The concrete type that provides the api.

impl<B, E, Block, RA> ProvideUncles<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> StorageProvider<Block, B> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

impl<B, E, Block, RA> UsageProvider<Block> for Client<B, E, Block, RA> where
    Block: Block,
    E: CallExecutor<Block>,
    B: Backend<Block>, 
[src]

pub fn usage_info(&self) -> ClientInfo<Block>[src]

Get usage info about current client.

Auto Trait Implementations

impl<B, E, Block, RA> !RefUnwindSafe for Client<B, E, Block, RA>

impl<B, E, Block, RA> Send for Client<B, E, Block, RA> where
    B: Send + Sync,
    E: Send,
    RA: Send

impl<B, E, Block, RA> Sync for Client<B, E, Block, RA> where
    B: Send + Sync,
    E: Sync,
    RA: Sync

impl<B, E, Block, RA> Unpin for Client<B, E, Block, RA> where
    E: Unpin,
    RA: Unpin,
    <Block as Block>::Hash: Unpin,
    <<Block as Block>::Header as Header>::Number: Unpin

impl<B, E, Block, RA> !UnwindSafe for Client<B, E, Block, RA>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<C, B> BlockchainEventsExt<C, B> for C where
    C: BlockchainEvents<B>,
    B: Block
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<Block, T> Client<Block> for T where
    Block: Block,
    T: HeaderBackend<Block> + ProofProvider<Block> + BlockIdTo<Block, Error = Error> + BlockBackend<Block> + HeaderMetadata<Block, Error = Error> + Send + Sync

impl<Block, BE, T> ClientForGrandpa<Block, BE> for T where
    Block: Block,
    T: LockImportRun<Block, BE> + Finalizer<Block, BE> + AuxStore + HeaderMetadata<Block, Error = Error> + HeaderBackend<Block> + BlockchainEvents<Block> + ProvideRuntimeApi<Block> + ExecutorProvider<Block> + BlockImport<Block, Transaction = <<BE as Backend<Block>>::State as Backend<<<Block as Block>::Header as Header>::Hashing>>::Transaction, Error = Error>,
    BE: Backend<Block>, 

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]