diff --git a/bindings/rust/evmc-client/Cargo.toml b/bindings/rust/evmc-client/Cargo.toml index 7ee5c48e6..7e252a227 100644 --- a/bindings/rust/evmc-client/Cargo.toml +++ b/bindings/rust/evmc-client/Cargo.toml @@ -13,4 +13,5 @@ edition = "2018" [dependencies] evmc-sys = { path = "../evmc-sys", version = "7.4.0" } -libloading = "0.5" \ No newline at end of file +evmc-vm = { path = "../evmc-vm", version = "7.4.0" } +libloading = "0.5" diff --git a/bindings/rust/evmc-client/src/host.rs b/bindings/rust/evmc-client/src/host.rs index d8c65754f..728525348 100644 --- a/bindings/rust/evmc-client/src/host.rs +++ b/bindings/rust/evmc-client/src/host.rs @@ -27,7 +27,7 @@ pub trait HostInterface { fn emit_log(&mut self, addr: &Address, topics: &Vec, data: &Bytes); fn call( &mut self, - kind: CallKind, + kind: MessageKind, destination: &Address, sender: &Address, value: &Bytes32, diff --git a/bindings/rust/evmc-client/src/lib.rs b/bindings/rust/evmc-client/src/lib.rs index d74585f21..666d2d1cd 100644 --- a/bindings/rust/evmc-client/src/lib.rs +++ b/bindings/rust/evmc-client/src/lib.rs @@ -73,7 +73,7 @@ impl EvmcVm { &self, host_interface: Box, rev: Revision, - kind: CallKind, + kind: MessageKind, is_static: bool, depth: i32, gas: i64, diff --git a/bindings/rust/evmc-client/src/types.rs b/bindings/rust/evmc-client/src/types.rs index ea95d976a..5489ba52b 100644 --- a/bindings/rust/evmc-client/src/types.rs +++ b/bindings/rust/evmc-client/src/types.rs @@ -3,16 +3,10 @@ * Licensed under the Apache License, Version 2.0. */ -pub use evmc_sys as ffi; +pub use evmc_vm::{Capabilities, MessageKind, Revision, StatusCode, StorageStatus}; pub const ADDRESS_LENGTH: usize = 20; pub const BYTES32_LENGTH: usize = 32; pub type Address = [u8; ADDRESS_LENGTH]; pub type Bytes32 = [u8; BYTES32_LENGTH]; pub type Bytes = [u8]; - -pub type StorageStatus = ffi::evmc_storage_status; -pub type CallKind = ffi::evmc_call_kind; -pub type Revision = ffi::evmc_revision; -pub type StatusCode = ffi::evmc_status_code; -pub type Capabilities = ffi::evmc_capabilities; diff --git a/bindings/rust/evmc-vm/src/types.rs b/bindings/rust/evmc-vm/src/types.rs index 3b7ba601d..8290efd45 100644 --- a/bindings/rust/evmc-vm/src/types.rs +++ b/bindings/rust/evmc-vm/src/types.rs @@ -15,6 +15,9 @@ pub type MessageKind = ffi::evmc_call_kind; /// EVMC message (call) flags. pub type MessageFlags = ffi::evmc_flags; +/// EVMC VM capabilities. +pub type Capabilities = ffi::evmc_capabilities; + /// EVMC status code. pub type StatusCode = ffi::evmc_status_code; @@ -69,6 +72,22 @@ mod tests { assert_eq!(MessageFlags::EVMC_STATIC, ffi::evmc_flags::EVMC_STATIC); } + #[test] + fn capabilities() { + assert_eq!( + Capabilities::EVMC_CAPABILITY_EVM1, + ffi::evmc_capabilities::EVMC_CAPABILITY_EVM1 + ); + assert_eq!( + Capabilities::EVMC_CAPABILITY_EWASM, + ffi::evmc_capabilities::EVMC_CAPABILITY_EWASM + ); + assert_eq!( + Capabilities::EVMC_CAPABILITY_PRECOMPILES, + ffi::evmc_capabilities::EVMC_CAPABILITY_PRECOMPILES + ); + } + #[test] fn status_code() { assert_eq!(