multiversx_chain_vm/host/context/
failing_executor.rs

1use multiversx_chain_vm_executor::Executor;
2
3/// Dummy executor that fails whenever called.
4///
5/// Used in dummy contexts.
6///
7/// TODO: either remove, or move to vm-executor repo.
8pub struct FailingExecutor;
9
10impl Executor for FailingExecutor {
11    fn new_instance(
12        &self,
13        _wasm_bytes: &[u8],
14        _compilation_options: &multiversx_chain_vm_executor::CompilationOptions,
15    ) -> Result<
16        Box<dyn multiversx_chain_vm_executor::Instance>,
17        multiversx_chain_vm_executor::ExecutorError,
18    > {
19        panic!("called FailingExecutor")
20    }
21
22    fn new_instance_from_cache(
23        &self,
24        _cache_bytes: &[u8],
25        _compilation_options: &multiversx_chain_vm_executor::CompilationOptions,
26    ) -> Result<
27        Box<dyn multiversx_chain_vm_executor::Instance>,
28        multiversx_chain_vm_executor::ExecutorError,
29    > {
30        panic!("called FailingExecutor")
31    }
32}