From 5766c9fda5529a00bd3b170868a4ef468cdaf405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 7 Sep 2021 16:07:07 +0200 Subject: [PATCH] Rename evmc_message::{destination -> recipient} --- bindings/go/evmc/evmc.go | 10 +++--- bindings/go/evmc/host.go | 4 +-- bindings/go/evmc/host_test.go | 2 +- .../java/org/ethereum/evmc/HostContext.java | 2 +- .../test/java/org/ethereum/evmc/EvmcTest.java | 24 ++++++------- .../java/org/ethereum/evmc/TestMessage.java | 10 +++--- bindings/rust/evmc-vm/src/container.rs | 2 +- bindings/rust/evmc-vm/src/lib.rs | 34 +++++++++---------- examples/example-rust-vm/src/lib.rs | 2 +- examples/example.c | 4 +-- examples/example_vm/example_vm.cpp | 8 ++--- include/evmc/evmc.h | 6 ++-- include/evmc/mocked_host.hpp | 8 ++--- lib/tooling/run.cpp | 4 +-- test/unittests/example_vm_test.cpp | 7 ++-- 15 files changed, 63 insertions(+), 64 deletions(-) diff --git a/bindings/go/evmc/evmc.go b/bindings/go/evmc/evmc.go index 9f2e4536a..1c86a2e94 100644 --- a/bindings/go/evmc/evmc.go +++ b/bindings/go/evmc/evmc.go @@ -28,7 +28,7 @@ extern const struct evmc_host_interface evmc_go_host; static struct evmc_result execute_wrapper(struct evmc_vm* vm, uintptr_t context_index, enum evmc_revision rev, enum evmc_call_kind kind, uint32_t flags, int32_t depth, int64_t gas, - const evmc_address* destination, const evmc_address* sender, + const evmc_address* recipient, const evmc_address* sender, const uint8_t* input_data, size_t input_size, const evmc_uint256be* value, const uint8_t* code, size_t code_size) { @@ -37,7 +37,7 @@ static struct evmc_result execute_wrapper(struct evmc_vm* vm, flags, depth, gas, - *destination, + *recipient, *sender, input_data, input_size, @@ -194,7 +194,7 @@ func (vm *VM) SetOption(name string, value string) (err error) { func (vm *VM) Execute(ctx HostContext, rev Revision, kind CallKind, static bool, depth int, gas int64, - destination Address, sender Address, input []byte, value Hash, + recipient Address, sender Address, input []byte, value Hash, code []byte) (output []byte, gasLeft int64, err error) { flags := C.uint32_t(0) @@ -204,12 +204,12 @@ func (vm *VM) Execute(ctx HostContext, rev Revision, ctxId := addHostContext(ctx) // FIXME: Clarify passing by pointer vs passing by value. - evmcDestination := evmcAddress(destination) + evmcRecipient := evmcAddress(recipient) evmcSender := evmcAddress(sender) evmcValue := evmcBytes32(value) result := C.execute_wrapper(vm.handle, C.uintptr_t(ctxId), uint32(rev), C.enum_evmc_call_kind(kind), flags, C.int32_t(depth), C.int64_t(gas), - &evmcDestination, &evmcSender, bytesPtr(input), C.size_t(len(input)), &evmcValue, + &evmcRecipient, &evmcSender, bytesPtr(input), C.size_t(len(input)), &evmcValue, bytesPtr(code), C.size_t(len(code))) removeHostContext(ctxId) diff --git a/bindings/go/evmc/host.go b/bindings/go/evmc/host.go index e78fbe46e..15ca59452 100644 --- a/bindings/go/evmc/host.go +++ b/bindings/go/evmc/host.go @@ -92,7 +92,7 @@ type HostContext interface { GetBlockHash(number int64) Hash EmitLog(addr Address, topics []Hash, data []byte) Call(kind CallKind, - destination Address, sender Address, value Hash, input []byte, gas int64, depth int, + recipient Address, sender Address, value Hash, input []byte, gas int64, depth int, static bool, salt Hash, codeAddress Address) (output []byte, gasLeft int64, createAddr Address, err error) AccessAccount(addr Address) AccessStatus AccessStorage(addr Address, key Hash) AccessStatus @@ -207,7 +207,7 @@ func call(pCtx unsafe.Pointer, msg *C.struct_evmc_message) C.struct_evmc_result ctx := getHostContext(uintptr(pCtx)) kind := CallKind(msg.kind) - output, gasLeft, createAddr, err := ctx.Call(kind, goAddress(msg.destination), goAddress(msg.sender), goHash(msg.value), + output, gasLeft, createAddr, err := ctx.Call(kind, goAddress(msg.recipient), goAddress(msg.sender), goHash(msg.value), goByteSlice(msg.input_data, msg.input_size), int64(msg.gas), int(msg.depth), msg.flags != 0, goHash(msg.create2_salt), goAddress(msg.code_address)) diff --git a/bindings/go/evmc/host_test.go b/bindings/go/evmc/host_test.go index 4d7c2c11b..edb00715c 100644 --- a/bindings/go/evmc/host_test.go +++ b/bindings/go/evmc/host_test.go @@ -56,7 +56,7 @@ func (host *testHostContext) EmitLog(addr Address, topics []Hash, data []byte) { } func (host *testHostContext) Call(kind CallKind, - destination Address, sender Address, value Hash, input []byte, gas int64, depth int, + recipient Address, sender Address, value Hash, input []byte, gas int64, depth int, static bool, salt Hash, codeAddress Address) (output []byte, gasLeft int64, createAddr Address, err error) { output = []byte("output from testHostContext.Call()") return output, gas, Address{}, nil diff --git a/bindings/java/java/src/main/java/org/ethereum/evmc/HostContext.java b/bindings/java/java/src/main/java/org/ethereum/evmc/HostContext.java index 313816c06..0b4af4439 100644 --- a/bindings/java/java/src/main/java/org/ethereum/evmc/HostContext.java +++ b/bindings/java/java/src/main/java/org/ethereum/evmc/HostContext.java @@ -62,7 +62,7 @@ public interface HostContext { *

This function is used by a VM to update the given account storage entry. The VM MUST make * sure that the account exists. This requirement is only a formality because VM implementations * only modify storage of the account of the current execution context (i.e. referenced by - * evmc_message::destination). + * evmc_message::recipient). * * @param address The address of the account. * @param key The index of the storage entry. diff --git a/bindings/java/java/src/test/java/org/ethereum/evmc/EvmcTest.java b/bindings/java/java/src/test/java/org/ethereum/evmc/EvmcTest.java index 562545124..26687d182 100644 --- a/bindings/java/java/src/test/java/org/ethereum/evmc/EvmcTest.java +++ b/bindings/java/java/src/test/java/org/ethereum/evmc/EvmcTest.java @@ -68,13 +68,13 @@ void testExecute_returnAddress() throws Exception { int EVMC_CALL = 0; int kind = EVMC_CALL; char[] sender = "39bf71de1b7d7be3b51\0".toCharArray(); - char[] destination = "53cf77204eEef952e25\0".toCharArray(); + char[] recipient = "53cf77204eEef952e25\0".toCharArray(); char[] value = "1\0".toCharArray(); char[] inputData = "hello w\0".toCharArray(); long gas = 200000; int depth = 0; ByteBuffer msg = - new TestMessage(kind, sender, destination, value, inputData, gas, depth).toByteBuffer(); + new TestMessage(kind, sender, recipient, value, inputData, gas, depth).toByteBuffer(); byte[] code = {0x30, 0x60, 0x00, 0x52, 0x59, 0x60, 0x00, (byte) 0xf3}; // return_address ByteBuffer bbcode = ByteBuffer.allocateDirect(code.length).put(code); @@ -98,13 +98,13 @@ void testExecute_counter() throws Exception { int EVMC_CALL = 0; int kind = EVMC_CALL; char[] sender = "39bf71de1b7d7be3b51\0".toCharArray(); - char[] destination = "53cf77204eEef952e25\0".toCharArray(); + char[] recipient = "53cf77204eEef952e25\0".toCharArray(); char[] value = "1\0".toCharArray(); char[] inputData = "hello w\0".toCharArray(); long gas = 200000; int depth = 0; ByteBuffer msg = - new TestMessage(kind, sender, destination, value, inputData, gas, depth).toByteBuffer(); + new TestMessage(kind, sender, recipient, value, inputData, gas, depth).toByteBuffer(); byte[] code = {0x60, 0x01, 0x60, 0x00, 0x54, 0x01, 0x60, 0x00, 0x55}; // counter ByteBuffer bbcode = ByteBuffer.allocateDirect(code.length).put(code); @@ -128,13 +128,13 @@ void testExecute_returnBlockNumber() throws Exception { int EVMC_CALL = 0; int kind = EVMC_CALL; char[] sender = "39bf71de1b7d7be3b51\0".toCharArray(); - char[] destination = "53cf77204eEef952e25\0".toCharArray(); + char[] recipient = "53cf77204eEef952e25\0".toCharArray(); char[] value = "1\0".toCharArray(); char[] inputData = "hello w\0".toCharArray(); long gas = 200000; int depth = 0; ByteBuffer msg = - new TestMessage(kind, sender, destination, value, inputData, gas, depth).toByteBuffer(); + new TestMessage(kind, sender, recipient, value, inputData, gas, depth).toByteBuffer(); byte[] code = {0x43, 0x60, 0x00, 0x52, 0x59, 0x60, 0x00, (byte) 0xf3}; // return_block_number( ByteBuffer bbcode = ByteBuffer.allocateDirect(code.length).put(code); @@ -158,13 +158,13 @@ void testExecute_saveReturnBlockNumber() throws Exception { int EVMC_CALL = 0; int kind = EVMC_CALL; char[] sender = "39bf71de1b7d7be3b51\0".toCharArray(); - char[] destination = "53cf77204eEef952e25\0".toCharArray(); + char[] recipient = "53cf77204eEef952e25\0".toCharArray(); char[] value = "1\0".toCharArray(); char[] inputData = "hello w\0".toCharArray(); long gas = 200000; int depth = 0; ByteBuffer msg = - new TestMessage(kind, sender, destination, value, inputData, gas, depth).toByteBuffer(); + new TestMessage(kind, sender, recipient, value, inputData, gas, depth).toByteBuffer(); byte[] code = { 0x43, 0x60, 0x00, 0x55, 0x43, 0x60, 0x00, 0x52, 0x59, 0x60, 0x00, (byte) 0xf3 @@ -190,13 +190,13 @@ void testExecute_makeCall() throws Exception { int EVMC_CALL = 0; int kind = EVMC_CALL; char[] sender = "39bf71de1b7d7be3b51\0".toCharArray(); - char[] destination = "53cf77204eEef952e25\0".toCharArray(); + char[] recipient = "53cf77204eEef952e25\0".toCharArray(); char[] value = "1\0".toCharArray(); char[] inputData = "hello w\0".toCharArray(); long gas = 200000; int depth = 0; ByteBuffer msg = - new TestMessage(kind, sender, destination, value, inputData, gas, depth).toByteBuffer(); + new TestMessage(kind, sender, recipient, value, inputData, gas, depth).toByteBuffer(); byte[] code = { 0x60, 0x00, @@ -228,13 +228,13 @@ void testExecute_EVMC_CREATE() throws Exception { int EVMC_CREATE = 3; int kind = EVMC_CREATE; char[] sender = "39bf71de1b7d7be3b51\\0".toCharArray(); - char[] destination = "53cf77204eEef952e25\0".toCharArray(); + char[] recipient = "53cf77204eEef952e25\0".toCharArray(); char[] value = "1\0".toCharArray(); char[] inputData = "hello w\0".toCharArray(); long gas = 200000; int depth = 0; ByteBuffer msg = - new TestMessage(kind, sender, destination, value, inputData, gas, depth).toByteBuffer(); + new TestMessage(kind, sender, recipient, value, inputData, gas, depth).toByteBuffer(); byte[] code = {0x00}; ByteBuffer bbcode = ByteBuffer.allocateDirect(code.length).put(code); diff --git a/bindings/java/java/src/test/java/org/ethereum/evmc/TestMessage.java b/bindings/java/java/src/test/java/org/ethereum/evmc/TestMessage.java index f63635dd7..6a652f332 100644 --- a/bindings/java/java/src/test/java/org/ethereum/evmc/TestMessage.java +++ b/bindings/java/java/src/test/java/org/ethereum/evmc/TestMessage.java @@ -13,7 +13,7 @@ public class TestMessage { int flags; int depth; long gas; - char[] destination; + char[] recipient; char[] sender; char[] inputData; long inputSize; @@ -24,7 +24,7 @@ public class TestMessage { public TestMessage( int kind, char[] sender, - char[] destination, + char[] recipient, char[] value, char[] inputData, long gas, @@ -33,7 +33,7 @@ public TestMessage( this.flags = 0; this.depth = depth; this.gas = gas; - this.destination = destination; + this.recipient = recipient; this.sender = sender; this.inputData = inputData; this.inputSize = (long) inputData.length; @@ -49,7 +49,7 @@ public TestMessage(ByteBuffer msg) { msg.getInt(); // padding this.gas = msg.getLong(); ByteBuffer tmpbuf = msg.get(new byte[20]); - this.destination = StandardCharsets.ISO_8859_1.decode(tmpbuf).array(); + this.recipient = StandardCharsets.ISO_8859_1.decode(tmpbuf).array(); tmpbuf = msg.get(new byte[20]); this.sender = StandardCharsets.ISO_8859_1.decode(tmpbuf).array(); tmpbuf = msg.get(new byte[8]); @@ -70,7 +70,7 @@ public ByteBuffer toByteBuffer() { .putInt(depth) // 4 .put(new byte[4]) // 4 (padding) .putLong(gas) // 8 - .put(StandardCharsets.ISO_8859_1.encode(CharBuffer.wrap(destination))) // 20 + .put(StandardCharsets.ISO_8859_1.encode(CharBuffer.wrap(recipient))) // 20 .put(StandardCharsets.ISO_8859_1.encode(CharBuffer.wrap(sender))) // 20 .put(StandardCharsets.ISO_8859_1.encode(CharBuffer.wrap(inputData))) // 8 .putLong(inputSize) // 8 diff --git a/bindings/rust/evmc-vm/src/container.rs b/bindings/rust/evmc-vm/src/container.rs index 759bd9682..fdb83c725 100644 --- a/bindings/rust/evmc-vm/src/container.rs +++ b/bindings/rust/evmc-vm/src/container.rs @@ -116,7 +116,7 @@ mod tests { flags: 0, depth: 0, gas: 0, - destination: ::evmc_sys::evmc_address::default(), + recipient: ::evmc_sys::evmc_address::default(), sender: ::evmc_sys::evmc_address::default(), input_data: std::ptr::null(), input_size: 0, diff --git a/bindings/rust/evmc-vm/src/lib.rs b/bindings/rust/evmc-vm/src/lib.rs index 54e5fa68a..8010d4479 100644 --- a/bindings/rust/evmc-vm/src/lib.rs +++ b/bindings/rust/evmc-vm/src/lib.rs @@ -45,7 +45,7 @@ pub struct ExecutionMessage { flags: u32, depth: i32, gas: i64, - destination: Address, + recipient: Address, sender: Address, input: Option>, value: Uint256, @@ -122,7 +122,7 @@ impl ExecutionMessage { flags: u32, depth: i32, gas: i64, - destination: Address, + recipient: Address, sender: Address, input: Option<&[u8]>, value: Uint256, @@ -134,7 +134,7 @@ impl ExecutionMessage { flags, depth, gas, - destination, + recipient, sender, input: if let Some(input) = input { Some(input.to_vec()) @@ -167,9 +167,9 @@ impl ExecutionMessage { self.gas } - /// Read the destination address of the message. - pub fn destination(&self) -> &Address { - &self.destination + /// Read the recipient address of the message. + pub fn recipient(&self) -> &Address { + &self.recipient } /// Read the sender address of the message. @@ -328,7 +328,7 @@ impl<'a> ExecutionContext<'a> { flags: message.flags(), depth: message.depth(), gas: message.gas(), - destination: *message.destination(), + recipient: *message.recipient(), sender: *message.sender(), input_data: input_data, input_size: input_size, @@ -492,7 +492,7 @@ impl From<&ffi::evmc_message> for ExecutionMessage { flags: message.flags, depth: message.depth, gas: message.gas, - destination: message.destination, + recipient: message.recipient, sender: message.sender, input: if message.input_data.is_null() { assert_eq!(message.input_size, 0); @@ -659,7 +659,7 @@ mod tests { #[test] fn message_new_with_input() { let input = vec![0xc0, 0xff, 0xee]; - let destination = Address { bytes: [32u8; 20] }; + let recipient = Address { bytes: [32u8; 20] }; let sender = Address { bytes: [128u8; 20] }; let value = Uint256 { bytes: [0u8; 32] }; let create2_salt = Bytes32 { bytes: [255u8; 32] }; @@ -670,7 +670,7 @@ mod tests { 44, 66, 4466, - destination, + recipient, sender, Some(&input), value, @@ -682,7 +682,7 @@ mod tests { assert_eq!(ret.flags(), 44); assert_eq!(ret.depth(), 66); assert_eq!(ret.gas(), 4466); - assert_eq!(*ret.destination(), destination); + assert_eq!(*ret.recipient(), recipient); assert_eq!(*ret.sender(), sender); assert!(ret.input().is_some()); assert_eq!(*ret.input().unwrap(), input); @@ -693,7 +693,7 @@ mod tests { #[test] fn message_from_ffi() { - let destination = Address { bytes: [32u8; 20] }; + let recipient = Address { bytes: [32u8; 20] }; let sender = Address { bytes: [128u8; 20] }; let value = Uint256 { bytes: [0u8; 32] }; let create2_salt = Bytes32 { bytes: [255u8; 32] }; @@ -704,7 +704,7 @@ mod tests { flags: 44, depth: 66, gas: 4466, - destination: destination, + recipient: recipient, sender: sender, input_data: std::ptr::null(), input_size: 0, @@ -719,7 +719,7 @@ mod tests { assert_eq!(ret.flags(), msg.flags); assert_eq!(ret.depth(), msg.depth); assert_eq!(ret.gas(), msg.gas); - assert_eq!(*ret.destination(), msg.destination); + assert_eq!(*ret.recipient(), msg.recipient); assert_eq!(*ret.sender(), msg.sender); assert!(ret.input().is_none()); assert_eq!(*ret.value(), msg.value); @@ -730,7 +730,7 @@ mod tests { #[test] fn message_from_ffi_with_input() { let input = vec![0xc0, 0xff, 0xee]; - let destination = Address { bytes: [32u8; 20] }; + let recipient = Address { bytes: [32u8; 20] }; let sender = Address { bytes: [128u8; 20] }; let value = Uint256 { bytes: [0u8; 32] }; let create2_salt = Bytes32 { bytes: [255u8; 32] }; @@ -741,7 +741,7 @@ mod tests { flags: 44, depth: 66, gas: 4466, - destination: destination, + recipient: recipient, sender: sender, input_data: input.as_ptr(), input_size: input.len(), @@ -756,7 +756,7 @@ mod tests { assert_eq!(ret.flags(), msg.flags); assert_eq!(ret.depth(), msg.depth); assert_eq!(ret.gas(), msg.gas); - assert_eq!(*ret.destination(), msg.destination); + assert_eq!(*ret.recipient(), msg.recipient); assert_eq!(*ret.sender(), msg.sender); assert!(ret.input().is_some()); assert_eq!(*ret.input().unwrap(), input); diff --git a/examples/example-rust-vm/src/lib.rs b/examples/example-rust-vm/src/lib.rs index cfe29e3d7..fbb5301db 100644 --- a/examples/example-rust-vm/src/lib.rs +++ b/examples/example-rust-vm/src/lib.rs @@ -50,7 +50,7 @@ impl EvmcVm for ExampleRustVM { let storage_key = Bytes32::default(); let mut storage_value = Bytes32::default(); storage_value.bytes[31] = block_number; - _context.set_storage(&message.destination(), &storage_key, &storage_value); + _context.set_storage(&message.recipient(), &storage_key, &storage_value); let ret = format!("{}", block_number).into_bytes(); ExecutionResult::success(message.gas() / 2, Some(&ret)) diff --git a/examples/example.c b/examples/example.c index 3ee30af35..f76fe4751 100644 --- a/examples/example.c +++ b/examples/example.c @@ -53,7 +53,7 @@ int main(int argc, char* argv[]) struct evmc_message msg; msg.kind = EVMC_CALL; msg.sender = addr; - msg.destination = addr; + msg.recipient = addr; msg.value = value; msg.input_data = input; msg.input_size = sizeof(input); @@ -78,7 +78,7 @@ int main(int argc, char* argv[]) printf("%02x", result.output_data[i]); printf("\n"); const evmc_bytes32 storage_key = {{0}}; - evmc_bytes32 storage_value = host->get_storage(ctx, &msg.destination, &storage_key); + evmc_bytes32 storage_value = host->get_storage(ctx, &msg.recipient, &storage_key); printf(" Storage at 0x00..00: "); for (i = 0; i < sizeof(storage_value.bytes) / sizeof(storage_value.bytes[0]); i++) printf("%02x", storage_value.bytes[i]); diff --git a/examples/example_vm/example_vm.cpp b/examples/example_vm/example_vm.cpp index bc94b9378..6e461b176 100644 --- a/examples/example_vm/example_vm.cpp +++ b/examples/example_vm/example_vm.cpp @@ -202,7 +202,7 @@ evmc_result execute(evmc_vm* instance, case OP_ADDRESS: { - evmc_uint256be value = to_uint256(msg->destination); + evmc_uint256be value = to_uint256(msg->recipient); stack.push(value); break; } @@ -242,7 +242,7 @@ evmc_result execute(evmc_vm* instance, case OP_SLOAD: { evmc_uint256be index = stack.pop(); - evmc_uint256be value = host->get_storage(context, &msg->destination, &index); + evmc_uint256be value = host->get_storage(context, &msg->recipient, &index); stack.push(value); break; } @@ -251,7 +251,7 @@ evmc_result execute(evmc_vm* instance, { evmc_uint256be index = stack.pop(); evmc_uint256be value = stack.pop(); - host->set_storage(context, &msg->destination, &index, &value); + host->set_storage(context, &msg->recipient, &index, &value); break; } @@ -316,7 +316,7 @@ evmc_result execute(evmc_vm* instance, { evmc_message call_msg = {}; call_msg.gas = to_uint32(stack.pop()); - call_msg.destination = to_address(stack.pop()); + call_msg.recipient = to_address(stack.pop()); call_msg.value = stack.pop(); uint32_t call_input_offset = to_uint32(stack.pop()); diff --git a/include/evmc/evmc.h b/include/evmc/evmc.h index 027f887e5..4e19fdfad 100644 --- a/include/evmc/evmc.h +++ b/include/evmc/evmc.h @@ -129,7 +129,7 @@ struct evmc_message * * Defined as `r` in the Yellow Paper. */ - evmc_address destination; + evmc_address recipient; /** * The sender of the message. @@ -177,7 +177,7 @@ struct evmc_message * The address of the code to be executed. * * For ::EVMC_CALLCODE or ::EVMC_DELEGATECALL this may be different from - * the evmc_message::destination (recipient). + * the evmc_message::recipient. * Not required when invoking evmc_execute_fn(), only when invoking evmc_call_fn(). * Ignored if kind is ::EVMC_CREATE or ::EVMC_CREATE2. * @@ -542,7 +542,7 @@ enum evmc_storage_status * This callback function is used by a VM to update the given account storage entry. * The VM MUST make sure that the account exists. This requirement is only a formality because * VM implementations only modify storage of the account of the current execution context - * (i.e. referenced by evmc_message::destination). + * (i.e. referenced by evmc_message::recipient). * * @param context The pointer to the Host execution context. * @param address The address of the account. diff --git a/include/evmc/mocked_host.hpp b/include/evmc/mocked_host.hpp index 2a12f1dde..2a54154c0 100644 --- a/include/evmc/mocked_host.hpp +++ b/include/evmc/mocked_host.hpp @@ -280,7 +280,7 @@ class MockedHost : public Host /// Call/create other contract (EVMC host method). result call(const evmc_message& msg) noexcept override { - record_account_access(msg.destination); + record_account_access(msg.recipient); if (recorded_calls.empty()) { @@ -327,11 +327,11 @@ class MockedHost : public Host /// This method is required by EIP-2929 introduced in ::EVMC_BERLIN. It will record the account /// access in MockedHost::recorded_account_accesses and return previous access status. /// This methods returns ::EVMC_ACCESS_WARM for known addresses of precompiles. - /// The EIP-2929 specifies that evmc_message::sender and evmc_message::destination are always + /// The EIP-2929 specifies that evmc_message::sender and evmc_message::recipient are always /// ::EVMC_ACCESS_WARM. Therefore, you should init the MockedHost with: /// /// mocked_host.access_account(msg.sender); - /// mocked_host.access_account(msg.destination); + /// mocked_host.access_account(msg.recipient); /// /// The same way you can mock transaction access list (EIP-2930) for account addresses. /// @@ -362,7 +362,7 @@ class MockedHost : public Host /// To mock storage access list (EIP-2930), you can pre-init account's storage values with /// the ::EVMC_ACCESS_WARM flag: /// - /// mocked_host.accounts[msg.destination].storage[key] = {value, EVMC_ACCESS_WARM}; + /// mocked_host.accounts[msg.recipient].storage[key] = {value, EVMC_ACCESS_WARM}; /// /// @param addr The account address. /// @param key The account's storage key. diff --git a/lib/tooling/run.cpp b/lib/tooling/run.cpp index 5fae9bfcd..8eceb6abf 100644 --- a/lib/tooling/run.cpp +++ b/lib/tooling/run.cpp @@ -86,7 +86,7 @@ int run(evmc::VM& vm, { evmc_message create_msg{}; create_msg.kind = EVMC_CREATE; - create_msg.destination = create_address; + create_msg.recipient = create_address; create_msg.gas = create_gas; const auto create_result = vm.execute(host, rev, create_msg, code.data(), code.size()); @@ -99,7 +99,7 @@ int run(evmc::VM& vm, auto& created_account = host.accounts[create_address]; created_account.code = bytes(create_result.output_data, create_result.output_size); - msg.destination = create_address; + msg.recipient = create_address; exec_code = created_account.code; } out << "\n"; diff --git a/test/unittests/example_vm_test.cpp b/test/unittests/example_vm_test.cpp index 47fa95554..97fe2e036 100644 --- a/test/unittests/example_vm_test.cpp +++ b/test/unittests/example_vm_test.cpp @@ -38,7 +38,7 @@ class example_vm : public testing::Test example_vm() noexcept { msg.sender = 0x5000000000000000000000000000000000000005_address; - msg.destination = 0xd00000000000000000000000000000000000000d_address; + msg.recipient = 0xd00000000000000000000000000000000000000d_address; } evmc::result execute_in_example_vm(int64_t gas, @@ -90,7 +90,7 @@ TEST_F(example_vm, return_address) TEST_F(example_vm, counter_in_storage) { // Yul: sstore(0, add(sload(0), 1)) stop() - auto& storage_value = host.accounts[msg.destination].storage[{}].value; + auto& storage_value = host.accounts[msg.recipient].storage[{}].value; storage_value = 0x00000000000000000000000000000000000000000000000000000000000000bb_bytes32; const auto r = execute_in_example_vm(10, "60016000540160005500"); EXPECT_EQ(r.status_code, EVMC_SUCCESS); @@ -162,8 +162,7 @@ TEST_F(example_vm, call) EXPECT_EQ(host.recorded_calls[0].gas, 3); EXPECT_EQ(host.recorded_calls[0].value, 0x0000000000000000000000000000000000000000000000000000000000000003_bytes32); - EXPECT_EQ(host.recorded_calls[0].destination, - 0x0000000000000000000000000000000000000003_address); + EXPECT_EQ(host.recorded_calls[0].recipient, 0x0000000000000000000000000000000000000003_address); EXPECT_EQ(host.recorded_calls[0].input_size, size_t{3}); }