mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 19:47:59 +00:00
Implement NativeExecutor, which attempts a native execution and falls back on Wasm otherwise.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use primitives::contract::CallData;
|
||||
use state_machine::{Externalities, CodeExecutor};
|
||||
use error::{Error, ErrorKind, Result};
|
||||
use wasm_executor::WasmExecutor;
|
||||
use native_runtime as runtime;
|
||||
use runtime_support;
|
||||
|
||||
@@ -22,13 +23,13 @@ impl CodeExecutor for NativeExecutor {
|
||||
if code == &native_equivalent[..] {
|
||||
runtime_support::with_externalities(ext, || match method {
|
||||
// TODO: Panic handler that comes back with error.
|
||||
"execute_block" => Ok(runtime::execute_block(data.0)),
|
||||
"execute_transaction" => Ok(runtime::execute_transaction(data.0)),
|
||||
"execute_block" => Ok(runtime::execute_block(&data.0)),
|
||||
"execute_transaction" => Ok(runtime::execute_transaction(&data.0)),
|
||||
_ => Err(ErrorKind::MethodNotFound(method.to_owned()).into()),
|
||||
})
|
||||
} else {
|
||||
// call into wasm.
|
||||
unimplemented!()
|
||||
WasmExecutor.call(ext, code, method, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user