pub trait BlockchainRuntime: Send + Sync {
Show 16 methods
// Required methods
fn blockchain_id(&self) -> &str;
fn create_environment<'life0, 'async_trait>(
&'life0 self,
config: RuntimeConfig,
) -> Pin<Box<dyn Future<Output = Result<RuntimeEnvironment>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
code_path: &'life2 Path,
inputs: &'life3 ExecutionInputs,
) -> Pin<Box<dyn Future<Output = Result<ExecutionResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn deploy_contract<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
bytecode: &'life2 [u8],
constructor_args: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn call_function<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
contract_address: &'life2 str,
function: &'life3 str,
args: &'life4 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn metrics_definition(&self) -> Vec<RuntimeMetricDefinition>;
fn monitor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
execution_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RuntimeEvent>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn destroy<'life0, 'async_trait>(
&'life0 self,
env: RuntimeEnvironment,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn capabilities(&self) -> RuntimeCapabilities;
fn execute_secure<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
code_path: &'life2 Path,
inputs: &'life3 ExecutionInputs,
security_config: &'life4 SecurityConfig,
) -> Pin<Box<dyn Future<Output = Result<ExecutionResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn check_reentrancy<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
function_name: &'life2 str,
caller: &'life3 str,
call_stack: &'life4 [String],
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn detect_overflow<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
operation: &'life2 str,
operands: &'life3 [i64],
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn verify_access_control<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
function_name: &'life2 str,
caller: &'life3 str,
required_role: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn enforce_resource_limits<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
gas_used: u64,
memory_used: u64,
call_depth: u32,
external_calls: u32,
security_config: &'life2 SecurityConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityViolation>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_security_report<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
execution_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Main blockchain runtime trait
Required Methods§
Sourcefn blockchain_id(&self) -> &str
fn blockchain_id(&self) -> &str
Get the blockchain identifier
Sourcefn create_environment<'life0, 'async_trait>(
&'life0 self,
config: RuntimeConfig,
) -> Pin<Box<dyn Future<Output = Result<RuntimeEnvironment>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_environment<'life0, 'async_trait>(
&'life0 self,
config: RuntimeConfig,
) -> Pin<Box<dyn Future<Output = Result<RuntimeEnvironment>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a runtime environment
Sourcefn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
code_path: &'life2 Path,
inputs: &'life3 ExecutionInputs,
) -> Pin<Box<dyn Future<Output = Result<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
code_path: &'life2 Path,
inputs: &'life3 ExecutionInputs,
) -> Pin<Box<dyn Future<Output = Result<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Execute code in the runtime
Sourcefn deploy_contract<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
bytecode: &'life2 [u8],
constructor_args: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn deploy_contract<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
bytecode: &'life2 [u8],
constructor_args: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Deploy a contract to the runtime
Sourcefn call_function<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
contract_address: &'life2 str,
function: &'life3 str,
args: &'life4 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn call_function<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
contract_address: &'life2 str,
function: &'life3 str,
args: &'life4 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Call a contract function
Sourcefn metrics_definition(&self) -> Vec<RuntimeMetricDefinition>
fn metrics_definition(&self) -> Vec<RuntimeMetricDefinition>
Get runtime metrics
Sourcefn monitor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
execution_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RuntimeEvent>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn monitor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
execution_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RuntimeEvent>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Monitor runtime events
Sourcefn destroy<'life0, 'async_trait>(
&'life0 self,
env: RuntimeEnvironment,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn destroy<'life0, 'async_trait>(
&'life0 self,
env: RuntimeEnvironment,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Destroy the environment
Sourcefn is_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if runtime is available
Sourcefn capabilities(&self) -> RuntimeCapabilities
fn capabilities(&self) -> RuntimeCapabilities
Get runtime capabilities
Sourcefn execute_secure<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
code_path: &'life2 Path,
inputs: &'life3 ExecutionInputs,
security_config: &'life4 SecurityConfig,
) -> Pin<Box<dyn Future<Output = Result<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn execute_secure<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
code_path: &'life2 Path,
inputs: &'life3 ExecutionInputs,
security_config: &'life4 SecurityConfig,
) -> Pin<Box<dyn Future<Output = Result<ExecutionResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Execute code with security checks
Sourcefn check_reentrancy<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
function_name: &'life2 str,
caller: &'life3 str,
call_stack: &'life4 [String],
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn check_reentrancy<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
function_name: &'life2 str,
caller: &'life3 str,
call_stack: &'life4 [String],
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Check for reentrancy attacks
Sourcefn detect_overflow<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
operation: &'life2 str,
operands: &'life3 [i64],
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn detect_overflow<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
operation: &'life2 str,
operands: &'life3 [i64],
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Detect integer overflow
Sourcefn verify_access_control<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
function_name: &'life2 str,
caller: &'life3 str,
required_role: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn verify_access_control<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
function_name: &'life2 str,
caller: &'life3 str,
required_role: Option<&'life4 str>,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Verify access control
Sourcefn enforce_resource_limits<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
gas_used: u64,
memory_used: u64,
call_depth: u32,
external_calls: u32,
security_config: &'life2 SecurityConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityViolation>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn enforce_resource_limits<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
gas_used: u64,
memory_used: u64,
call_depth: u32,
external_calls: u32,
security_config: &'life2 SecurityConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityViolation>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Enforce resource limits
Sourcefn get_security_report<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
execution_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_security_report<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 RuntimeEnvironment,
execution_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get security report for execution