diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index d265bcdbd..000000000 --- a/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[workspace] -members = [ - "bindings/rust/evmc-sys", - "bindings/rust/evmc-vm", - "bindings/rust/evmc-declare", - "bindings/rust/evmc-declare-tests", - "examples/example-rust-vm" -] diff --git a/bindings/rust/evmc-sys/Cargo.toml b/bindings/rust/evmc-sys/Cargo.toml index 7512a617d..a00ed6a1e 100644 --- a/bindings/rust/evmc-sys/Cargo.toml +++ b/bindings/rust/evmc-sys/Cargo.toml @@ -3,11 +3,11 @@ # Licensed under the Apache License, Version 2.0. [package] -name = "evmc-sys" +name = "ssvm-evmc-sys" version = "7.4.0" authors = ["Alex Beregszaszi "] license = "Apache-2.0" -repository = "https://github.com/ethereum/evmc" +repository = "https://github.com/secondstate/evmc" description = "Bindings to EVMC (low-level)" categories = ["external-ffi-bindings"] edition = "2018" diff --git a/bindings/rust/evmc-sys/build.rs b/bindings/rust/evmc-sys/build.rs index 6c2d9112b..a67100b4e 100644 --- a/bindings/rust/evmc-sys/build.rs +++ b/bindings/rust/evmc-sys/build.rs @@ -24,7 +24,7 @@ fn gen_bindings() { .derive_hash(true) // force deriving the PratialEq trait on basic types (address, bytes32) .derive_partialeq(true) - .opaque_type("evmc_host_context") + .blacklist_type("evmc_host_context") .whitelist_type("evmc_.*") .whitelist_function("evmc_.*") .whitelist_var("EVMC_ABI_VERSION") diff --git a/bindings/rust/evmc-sys/src/lib.rs b/bindings/rust/evmc-sys/src/lib.rs index da4751469..21900d30e 100644 --- a/bindings/rust/evmc-sys/src/lib.rs +++ b/bindings/rust/evmc-sys/src/lib.rs @@ -9,6 +9,12 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +// Defining evmc_host_context here, because bindgen cannot create a useful declaration yet. + +pub type evmc_host_context = ::std::os::raw::c_void; + +//pub struct evmc_host_context { } + // TODO: add `.derive_default(true)` to bindgen instead? impl Default for evmc_address { diff --git a/bindings/rust/evmc-vm/Cargo.toml b/bindings/rust/evmc-vm/Cargo.toml index 75c7d1bff..01bf9e0d5 100644 --- a/bindings/rust/evmc-vm/Cargo.toml +++ b/bindings/rust/evmc-vm/Cargo.toml @@ -3,13 +3,13 @@ # Licensed under the Apache License, Version 2.0. [package] -name = "evmc-vm" +name = "ssvm-evmc-vm" version = "7.4.0" authors = ["Alex Beregszaszi ", "Jake Lang "] license = "Apache-2.0" -repository = "https://github.com/ethereum/evmc" +repository = "https://github.com/secondstate/evmc" description = "Bindings to EVMC (VM specific)" edition = "2018" [dependencies] -evmc-sys = { path = "../evmc-sys", version = "7.4.0" } +evmc-sys = { version = "7.4.0", package = "ssvm-evmc-sys" } 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!(