mirror of https://github.com/status-im/evmc.git
rust: support evmc_revision in execute()
This commit is contained in:
parent
1d22d68293
commit
61805cf4d2
|
@ -19,6 +19,7 @@ impl EvmcVm for FooVM {
|
|||
|
||||
fn execute(
|
||||
&self,
|
||||
_revision: evmc_sys::evmc_revision,
|
||||
_code: &[u8],
|
||||
_message: &ExecutionMessage,
|
||||
_context: &ExecutionContext,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
//! ExampleVM {}
|
||||
//! }
|
||||
//!
|
||||
//! fn execute(&self, code: &[u8], message: &evmc_vm::ExecutionMessage, context: &evmc_vm::ExecutionContext) -> evmc_vm::ExecutionResult {
|
||||
//! fn execute(&self, revision: evmc_vm::ffi::evmc_revision, code: &[u8], message: &evmc_vm::ExecutionMessage, context: &evmc_vm::ExecutionContext) -> evmc_vm::ExecutionResult {
|
||||
//! evmc_vm::ExecutionResult::success(1337, None)
|
||||
//! }
|
||||
//! }
|
||||
|
@ -329,7 +329,7 @@ fn build_execute_fn(names: &VMNameSet) -> proc_macro2::TokenStream {
|
|||
extern "C" fn __evmc_execute(
|
||||
instance: *mut ::evmc_vm::ffi::evmc_instance,
|
||||
context: *mut ::evmc_vm::ffi::evmc_context,
|
||||
rev: ::evmc_vm::ffi::evmc_revision,
|
||||
revision: ::evmc_vm::ffi::evmc_revision,
|
||||
msg: *const ::evmc_vm::ffi::evmc_message,
|
||||
code: *const u8,
|
||||
code_size: usize
|
||||
|
@ -365,7 +365,7 @@ fn build_execute_fn(names: &VMNameSet) -> proc_macro2::TokenStream {
|
|||
};
|
||||
|
||||
let result = ::std::panic::catch_unwind(|| {
|
||||
container.execute(code_ref, &execution_message, &execution_context)
|
||||
container.execute(revision, code_ref, &execution_message, &execution_context)
|
||||
});
|
||||
|
||||
let result = if result.is_err() {
|
||||
|
|
|
@ -59,6 +59,7 @@ mod tests {
|
|||
}
|
||||
fn execute(
|
||||
&self,
|
||||
_revision: evmc_sys::evmc_revision,
|
||||
_code: &[u8],
|
||||
_message: &ExecutionMessage,
|
||||
_context: &ExecutionContext,
|
||||
|
@ -130,7 +131,12 @@ mod tests {
|
|||
let container = EvmcContainer::<TestVm>::new(instance);
|
||||
assert_eq!(
|
||||
container
|
||||
.execute(&code, &message, &context)
|
||||
.execute(
|
||||
evmc_sys::evmc_revision::EVMC_PETERSBURG,
|
||||
&code,
|
||||
&message,
|
||||
&context
|
||||
)
|
||||
.get_status_code(),
|
||||
::evmc_sys::evmc_status_code::EVMC_FAILURE
|
||||
);
|
||||
|
@ -140,7 +146,12 @@ mod tests {
|
|||
let container = unsafe { EvmcContainer::<TestVm>::from_ffi_pointer(ptr) };
|
||||
assert_eq!(
|
||||
container
|
||||
.execute(&code, &message, &context)
|
||||
.execute(
|
||||
evmc_sys::evmc_revision::EVMC_PETERSBURG,
|
||||
&code,
|
||||
&message,
|
||||
&context
|
||||
)
|
||||
.get_status_code(),
|
||||
::evmc_sys::evmc_status_code::EVMC_FAILURE
|
||||
);
|
||||
|
|
|
@ -20,6 +20,7 @@ pub trait EvmcVm {
|
|||
fn init() -> Self;
|
||||
fn execute(
|
||||
&self,
|
||||
revision: ffi::evmc_revision,
|
||||
code: &[u8],
|
||||
message: &ExecutionMessage,
|
||||
context: &ExecutionContext,
|
||||
|
|
|
@ -16,6 +16,7 @@ impl EvmcVm for ExampleRustVM {
|
|||
|
||||
fn execute(
|
||||
&self,
|
||||
_revision: evmc_sys::evmc_revision,
|
||||
_code: &[u8],
|
||||
message: &ExecutionMessage,
|
||||
_context: &ExecutionContext,
|
||||
|
|
Loading…
Reference in New Issue