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

Commit 86bb3b1

Browse files
committed
f
1 parent bddce3b commit 86bb3b1

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ pub type Bytes32 = ffi::evmc_bytes32;
1010
pub type Uint256 = ffi::evmc_uint256be;
1111

1212
/// EVMC message (call) kind.
13-
pub type MessageKind = ffi::evmc_call_kind;
13+
#[derive(Debug, PartialEq)]
14+
pub enum MessageKind {
15+
Call,
16+
CallCode,
17+
DelegateCall,
18+
Create,
19+
}
1420

1521
/// EVMC message (call) flags.
1622
pub type MessageFlags = ffi::evmc_flags;
@@ -24,6 +30,14 @@ pub type StorageStatus = ffi::evmc_storage_status;
2430
/// EVMC VM revision.
2531
pub type Revision = ffi::evmc_revision;
2632

33+
impl From<ffi::evmc_call_kind> for MessageKind {
34+
fn from(kind: ffi::evmc_call_kind) -> Self {
35+
match kind {
36+
EVM_CALL => MessageKind::Call,
37+
}
38+
}
39+
}
40+
2741
#[cfg(test)]
2842
mod tests {
2943
use super::*;
@@ -52,16 +66,16 @@ mod tests {
5266

5367
#[test]
5468
fn message_kind() {
55-
assert_eq!(MessageKind::EVMC_CALL, ffi::evmc_call_kind::EVMC_CALL);
69+
assert_eq!(MessageKind::Call, ffi::evmc_call_kind::EVMC_CALL);
5670
assert_eq!(
57-
MessageKind::EVMC_CALLCODE,
71+
MessageKind::CallCode,
5872
ffi::evmc_call_kind::EVMC_CALLCODE
5973
);
6074
assert_eq!(
61-
MessageKind::EVMC_DELEGATECALL,
75+
MessageKind::DelegateCall,
6276
ffi::evmc_call_kind::EVMC_DELEGATECALL
6377
);
64-
assert_eq!(MessageKind::EVMC_CREATE, ffi::evmc_call_kind::EVMC_CREATE);
78+
assert_eq!(MessageKind::Create, ffi::evmc_call_kind::EVMC_CREATE);
6579
}
6680

6781
#[test]

0 commit comments

Comments
 (0)