Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 7dbcfe0

Browse files
rust: reorganize alias types
1. remove duplicate types 2. add an alias type Capabilities in evmc-vm
1 parent b87db19 commit 7dbcfe0

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

bindings/rust/evmc-client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ edition = "2018"
1313

1414
[dependencies]
1515
evmc-sys = { path = "../evmc-sys", version = "7.4.0" }
16+
evmc-vm = { path = "../evmc-vm", version = "7.4.0" }
1617
libloading = "0.5"

bindings/rust/evmc-client/src/host.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait HostInterface {
2727
fn emit_log(&mut self, addr: &Address, topics: &Vec<Bytes32>, data: &Bytes);
2828
fn call(
2929
&mut self,
30-
kind: CallKind,
30+
kind: MessageKind,
3131
destination: &Address,
3232
sender: &Address,
3333
value: &Bytes32,

bindings/rust/evmc-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl EvmcVm {
7373
&self,
7474
host_interface: Box<dyn host::HostInterface>,
7575
rev: Revision,
76-
kind: CallKind,
76+
kind: MessageKind,
7777
is_static: bool,
7878
depth: i32,
7979
gas: i64,

bindings/rust/evmc-client/src/types.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@
33
* Licensed under the Apache License, Version 2.0.
44
*/
55

6-
pub use evmc_sys as ffi;
6+
pub use evmc_vm::{Capabilities, MessageKind, Revision, StatusCode, StorageStatus};
77

88
pub const ADDRESS_LENGTH: usize = 20;
99
pub const BYTES32_LENGTH: usize = 32;
1010
pub type Address = [u8; ADDRESS_LENGTH];
1111
pub type Bytes32 = [u8; BYTES32_LENGTH];
1212
pub type Bytes = [u8];
13-
14-
pub type StorageStatus = ffi::evmc_storage_status;
15-
pub type CallKind = ffi::evmc_call_kind;
16-
pub type Revision = ffi::evmc_revision;
17-
pub type StatusCode = ffi::evmc_status_code;
18-
pub type Capabilities = ffi::evmc_capabilities;

bindings/rust/evmc-vm/src/types.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ pub type MessageKind = ffi::evmc_call_kind;
1515
/// EVMC message (call) flags.
1616
pub type MessageFlags = ffi::evmc_flags;
1717

18+
/// EVMC VM capabilities.
19+
pub type Capabilities = ffi::evmc_capabilities;
20+
1821
/// EVMC status code.
1922
pub type StatusCode = ffi::evmc_status_code;
2023

@@ -69,6 +72,22 @@ mod tests {
6972
assert_eq!(MessageFlags::EVMC_STATIC, ffi::evmc_flags::EVMC_STATIC);
7073
}
7174

75+
#[test]
76+
fn capabilities() {
77+
assert_eq!(
78+
Capabilities::EVMC_CAPABILITY_EVM1,
79+
ffi::evmc_capabilities::EVMC_CAPABILITY_EVM1
80+
);
81+
assert_eq!(
82+
Capabilities::EVMC_CAPABILITY_EWASM,
83+
ffi::evmc_capabilities::EVMC_CAPABILITY_EWASM
84+
);
85+
assert_eq!(
86+
Capabilities::EVMC_CAPABILITY_PRECOMPILES,
87+
ffi::evmc_capabilities::EVMC_CAPABILITY_PRECOMPILES
88+
);
89+
}
90+
7291
#[test]
7392
fn status_code() {
7493
assert_eq!(

0 commit comments

Comments
 (0)