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

Commit 908c356

Browse files
committed
Recent EVMC changes
1 parent df4a074 commit 908c356

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ pub trait HostContext {
2727
buffer_size: &usize,
2828
) -> usize;
2929
fn selfdestruct(&mut self, addr: &Address, beneficiary: &Address);
30-
fn get_tx_context(&mut self) -> (Bytes32, Address, Address, i64, i64, i64, Bytes32, Bytes32);
30+
fn get_tx_context(&mut self) -> (Bytes32, Address, Address, i64, i64, i64, Bytes32, Bytes32, Bytes32);
3131
fn get_block_hash(&mut self, number: i64) -> Bytes32;
3232
fn emit_log(&mut self, addr: &Address, topics: &Vec<Bytes32>, data: &Bytes);
3333
fn call(
3434
&mut self,
3535
kind: MessageKind,
36-
destination: &Address,
36+
recipient: &Address,
3737
sender: &Address,
3838
value: &Bytes32,
3939
input: &Bytes,
@@ -58,6 +58,8 @@ pub(crate) fn get_evmc_host_interface() -> ffi::evmc_host_interface {
5858
get_tx_context: Some(get_tx_context),
5959
get_block_hash: Some(get_block_hash),
6060
emit_log: Some(emit_log),
61+
access_account: None, // TODO
62+
access_storage: None, // TODO
6163
}
6264
}
6365

@@ -152,7 +154,7 @@ unsafe extern "C" fn selfdestruct(
152154
}
153155

154156
unsafe extern "C" fn get_tx_context(context: *mut ffi::evmc_host_context) -> ffi::evmc_tx_context {
155-
let (gas_price, origin, coinbase, number, timestamp, gas_limit, difficulty, chain_id) =
157+
let (gas_price, origin, coinbase, number, timestamp, gas_limit, prev_randao, chain_id, base_fee) =
156158
(*(context as *mut ExtendedContext)).hctx.get_tx_context();
157159
return ffi::evmc_tx_context {
158160
tx_gas_price: evmc_sys::evmc_bytes32 { bytes: gas_price },
@@ -161,8 +163,9 @@ unsafe extern "C" fn get_tx_context(context: *mut ffi::evmc_host_context) -> ffi
161163
block_number: number,
162164
block_timestamp: timestamp,
163165
block_gas_limit: gas_limit,
164-
block_difficulty: evmc_sys::evmc_bytes32 { bytes: difficulty },
166+
block_prev_randao: evmc_sys::evmc_bytes32 { bytes: prev_randao },
165167
chain_id: evmc_sys::evmc_bytes32 { bytes: chain_id },
168+
block_base_fee: evmc_sys::evmc_bytes32 { bytes: base_fee },
166169
};
167170
}
168171

@@ -211,7 +214,7 @@ pub unsafe extern "C" fn call(
211214
let (output, gas_left, create_address, status_code) =
212215
(*(context as *mut ExtendedContext)).hctx.call(
213216
msg.kind,
214-
&msg.destination.bytes,
217+
&msg.recipient.bytes,
215218
&msg.sender.bytes,
216219
&msg.value.bytes,
217220
&std::slice::from_raw_parts(msg.input_data, msg.input_size),

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ impl EvmcVm {
5656
is_static: bool,
5757
depth: i32,
5858
gas: i64,
59-
destination: &Address,
59+
recipient: &Address,
6060
sender: &Address,
6161
input: &Bytes,
6262
value: &Bytes32,
6363
code: &Bytes,
6464
create2_salt: &Bytes32,
65+
code_address: &Address,
6566
) -> (&Bytes, i64, StatusCode) {
6667
let ext_ctx = host::ExtendedContext { hctx: ctx };
6768
let mut evmc_flags: u32 = 0;
@@ -77,8 +78,8 @@ impl EvmcVm {
7778
flags: evmc_flags,
7879
depth: depth,
7980
gas: gas,
80-
destination: ffi::evmc_address {
81-
bytes: *destination,
81+
recipient: ffi::evmc_address {
82+
bytes: *recipient,
8283
},
8384
sender: ffi::evmc_address { bytes: *sender },
8485
input_data: input.as_ptr(),
@@ -87,6 +88,7 @@ impl EvmcVm {
8788
create2_salt: ffi::evmc_bytes32 {
8889
bytes: *create2_salt,
8990
},
91+
code_address: ffi::evmc_address { bytes: *code_address },
9092
}
9193
}));
9294
unsafe {

0 commit comments

Comments
 (0)