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§
sourcefn balance_of(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
id: AccountId,
) -> Result<u64, ApiError>
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.
sourcefn benchmark_add_one(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
val: &u64,
) -> Result<u64, ApiError>
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.
sourcefn benchmark_vector_add_one(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
vec: &Vec<u64>,
) -> Result<Vec<u64>, ApiError>
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.
sourcefn function_signature_changed_before_version_2(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Vec<u64>, ApiError>
👎Deprecated
fn function_signature_changed_before_version_2( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Vec<u64>, ApiError>
A function for that the signature changed in version 2
.
sourcefn function_signature_changed(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<u64, ApiError>
fn function_signature_changed( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError>
The new signature.
sourcefn use_trie(
&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>
trie no_std testing
sourcefn benchmark_indirect_call(
&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>
Calls function in the loop using never-inlined function pointer
sourcefn benchmark_direct_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>
Calls function in the loop
sourcefn vec_with_capacity(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
size: u32,
) -> Result<Vec<u8>, ApiError>
fn vec_with_capacity( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, size: u32, ) -> Result<Vec<u8>, ApiError>
Allocates vector with given capacity.
sourcefn get_block_number(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<u64, ApiError>
fn get_block_number( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u64, ApiError>
Returns the initialized block number.
sourcefn test_ed25519_crypto(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<(AppSignature, AppPublic), ApiError>
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.
sourcefn test_sr25519_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>
Test that sr25519
crypto works in the runtime.
Returns the signature generated for the message sr25519
.
sourcefn test_ecdsa_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>
Test that ecdsa
crypto works in the runtime.
Returns the signature generated for the message ecdsa
.
sourcefn test_storage(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<(), ApiError>
fn test_storage( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(), ApiError>
Run various tests against storage.
sourcefn test_witness(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
proof: StorageProof,
root: Hash,
) -> Result<(), ApiError>
fn test_witness( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, proof: StorageProof, root: Hash, ) -> Result<(), ApiError>
Check a witness.
sourcefn test_multiple_arguments(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
data: Vec<u8>,
other: Vec<u8>,
num: u32,
) -> 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>
Test that ensures that we can call a function that takes multiple arguments.
sourcefn do_trace_log(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<(), ApiError>
fn do_trace_log( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<(), ApiError>
Traces log “Hey I’m runtime.”