referrerpolicy=no-referrer-when-downgrade

Trait substrate_test_runtime::TestAPI

source ·
pub trait TestAPI<Block: BlockT>: Core<Block> {
Show 19 methods // Provided methods fn balance_of( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, id: AccountId, ) -> Result<u64, ApiError> { ... } fn benchmark_add_one( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, val: &u64, ) -> Result<u64, ApiError> { ... } fn benchmark_vector_add_one( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, vec: &Vec<u64>, ) -> Result<Vec<u64>, ApiError> { ... } fn function_signature_changed_before_version_2( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Vec<u64>, ApiError> { ... } fn function_signature_changed( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError> { ... } fn use_trie( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError> { ... } fn benchmark_indirect_call( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError> { ... } fn benchmark_direct_call( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError> { ... } fn vec_with_capacity( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, size: u32, ) -> Result<Vec<u8>, ApiError> { ... } fn get_block_number( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError> { ... } fn test_ed25519_crypto( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(AppSignature, AppPublic), ApiError> { ... } fn test_sr25519_crypto( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(AppSignature, AppPublic), ApiError> { ... } fn test_ecdsa_crypto( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(AppSignature, AppPublic), ApiError> { ... } fn test_storage( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(), ApiError> { ... } fn test_witness( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, proof: StorageProof, root: Hash, ) -> Result<(), ApiError> { ... } fn test_multiple_arguments( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, data: Vec<u8>, other: Vec<u8>, num: u32, ) -> Result<(), ApiError> { ... } fn do_trace_log( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(), ApiError> { ... } fn verify_ed25519( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, sig: Signature, public: Public, message: Vec<u8>, ) -> Result<bool, ApiError> { ... } fn write_key_value( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, key: Vec<u8>, value: Vec<u8>, panic: bool, ) -> Result<(), ApiError> { ... }
}

Provided Methods§

source

fn balance_of( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, id: AccountId, ) -> Result<u64, ApiError>

Return the balance of the given account id.

source

fn benchmark_add_one( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, val: &u64, ) -> Result<u64, ApiError>

A benchmark function that adds one to the given value and returns the result.

source

fn benchmark_vector_add_one( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, vec: &Vec<u64>, ) -> Result<Vec<u64>, ApiError>

A benchmark function that adds one to each value in the given vector and returns the result.

source

fn function_signature_changed_before_version_2( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Vec<u64>, ApiError>

👎Deprecated

A function for that the signature changed in version 2.

source

fn function_signature_changed( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError>

The new signature.

source

fn use_trie( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError>

trie no_std testing

source

fn benchmark_indirect_call( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError>

Calls function in the loop using never-inlined function pointer

source

fn benchmark_direct_call( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError>

Calls function in the loop

source

fn vec_with_capacity( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, size: u32, ) -> Result<Vec<u8>, ApiError>

Allocates vector with given capacity.

source

fn get_block_number( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError>

Returns the initialized block number.

source

fn test_ed25519_crypto( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(AppSignature, AppPublic), ApiError>

Test that ed25519 crypto works in the runtime.

Returns the signature generated for the message ed25519 and the public key.

source

fn test_sr25519_crypto( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(AppSignature, AppPublic), ApiError>

Test that sr25519 crypto works in the runtime.

Returns the signature generated for the message sr25519.

source

fn test_ecdsa_crypto( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(AppSignature, AppPublic), ApiError>

Test that ecdsa crypto works in the runtime.

Returns the signature generated for the message ecdsa.

source

fn test_storage( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(), ApiError>

Run various tests against storage.

source

fn test_witness( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, proof: StorageProof, root: Hash, ) -> Result<(), ApiError>

Check a witness.

source

fn test_multiple_arguments( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, data: Vec<u8>, other: Vec<u8>, num: u32, ) -> Result<(), ApiError>

Test that ensures that we can call a function that takes multiple arguments.

source

fn do_trace_log( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(), ApiError>

Traces log “Hey I’m runtime.”

source

fn verify_ed25519( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, sig: Signature, public: Public, message: Vec<u8>, ) -> Result<bool, ApiError>

Verify the given signature, public & message bundle.

source

fn write_key_value( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, key: Vec<u8>, value: Vec<u8>, panic: bool, ) -> Result<(), ApiError>

Write the given value under the given key into the storage and then optional panic.

Trait Implementations§

source§

impl<Block: BlockT> RuntimeApiInfo for dyn TestAPI<Block>

source§

const ID: [u8; 8] = _

The identifier of the runtime api.
source§

const VERSION: u32 = 2u32

The version of the runtime api.

Implementors§

source§

impl<__SrApiBlock__: BlockT, RuntimeApiImplCall: CallApiAt<__SrApiBlock__> + 'static> TestAPI<__SrApiBlock__> for RuntimeApiImpl<__SrApiBlock__, RuntimeApiImplCall>
where RuntimeApiImplCall::StateBackend: StateBackend<HashingFor<__SrApiBlock__>>, &'static RuntimeApiImplCall: Send,