diff --git a/CMakeLists.txt b/CMakeLists.txt index a3254873b..5848ad533 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,10 @@ if(NOT EXISTS ${CMAKE_SOURCE_DIR}/evmc/.git OR NOT EXISTS ${CMAKE_SOURCE_DIR}/cm endif() include(cmake/cable/bootstrap.cmake) -include(CableBuildInfo) include(CableBuildType) include(CableCompilerSettings) include(CableToolchains) include(CMakePackageConfigHelpers) -include(GNUInstallDirs) include(Hunter/init) @@ -23,6 +21,9 @@ set(CMAKE_DEBUG_POSTFIX "") project(hera) set(PROJECT_VERSION 0.5.0) +include(CableBuildInfo) +include(GNUInstallDirs) + cable_configure_compiler() if(CABLE_COMPILER_GNULIKE) # TODO: fix the warnings instead diff --git a/README.md b/README.md index 571b66f4c..e647fd74f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Hera ![Status](https://circleci.com/gh/ewasm/hera.svg?style=shield&circle-token=:circle-token) -Hera is an [ewasm] (revision 4) virtual machine implemented in C++ conforming to [EVMC] ABIv9. +Hera is an [ewasm] (revision 4) virtual machine implemented in C++ conforming to [EVMC] ABIv10. It is designed to leverage various Wasm backends, both interpreters and AOT/JITs. diff --git a/circle.yml b/circle.yml index b916e3416..09ccd0abb 100644 --- a/circle.yml +++ b/circle.yml @@ -249,12 +249,12 @@ jobs: linux-gcc-shared-coverage: environment: - - BUILD_TYPE: Debug + - BUILD_TYPE: Coverage - CXX: g++ - CC: gcc - GENERATOR: Unix Makefiles - BUILD_PARALLEL_JOBS: 4 - - CMAKE_OPTIONS: -DCOVERAGE=ON -DBUILD_SHARED_LIBS=ON -DHERA_DEBUGGING=ON -DHERA_BINARYEN=ON -DHERA_WABT=ON -DHERA_WAVM=ON + - CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -DHERA_DEBUGGING=ON -DHERA_BINARYEN=ON -DHERA_WABT=ON -DHERA_WAVM=ON - TESTETH_OPTIONS: --evmc benchmark=true docker: - image: ethereum/cpp-build-env:9 diff --git a/cmake/cable b/cmake/cable index 3fb12ab54..ec1ae18d2 160000 --- a/cmake/cable +++ b/cmake/cable @@ -1 +1 @@ -Subproject commit 3fb12ab54d42ecebeedd399f9146f88b1f8fdcbc +Subproject commit ec1ae18d248da75af235f5fa512cfaf2b650ae70 diff --git a/evmc b/evmc index 18bea410e..05819e343 160000 --- a/evmc +++ b/evmc @@ -1 +1 @@ -Subproject commit 18bea410e24929ebd185c789e6255242ea0f426c +Subproject commit 05819e343de23fae05fda0b5a23eeb0da3a320b7 diff --git a/src/eei.cpp b/src/eei.cpp index bfca94726..539c5dafd 100644 --- a/src/eei.cpp +++ b/src/eei.cpp @@ -108,7 +108,7 @@ void WasmEngine::collectBenchmarkingData() HERA_DEBUG << "): " << dec; - evmc::bytes32 result = m_host.get_storage(m_msg.destination, path); + evmc::bytes32 result = m_host.get_storage(m_msg.recipient, path); if (useHex) { @@ -181,7 +181,7 @@ void WasmEngine::collectBenchmarkingData() takeInterfaceGas(GasSchedule::base); - storeAddress(m_msg.destination, resultOffset); + storeAddress(m_msg.recipient, resultOffset); } void EthereumInterface::eeiGetExternalBalance(uint32_t addressOffset, uint32_t resultOffset) @@ -307,7 +307,7 @@ void WasmEngine::collectBenchmarkingData() takeInterfaceGas(GasSchedule::base); - storeUint256(m_host.get_tx_context().block_difficulty, offset); + storeUint256(m_host.get_tx_context().block_prev_randao, offset); } int64_t EthereumInterface::eeiGetBlockGasLimit() @@ -355,7 +355,7 @@ void WasmEngine::collectBenchmarkingData() bytes data(length, '\0'); loadMemory(dataOffset, data, length); - m_host.emit_log(m_msg.destination, data.data(), length, topics.data(), numberOfTopics); + m_host.emit_log(m_msg.recipient, data.data(), length, topics.data(), numberOfTopics); } int64_t EthereumInterface::eeiGetBlockNumber() @@ -405,7 +405,7 @@ void WasmEngine::collectBenchmarkingData() const auto path = loadBytes32(pathOffset); const auto value = loadBytes32(valueOffset); - const auto current = m_host.get_storage(m_msg.destination, path); + const auto current = m_host.get_storage(m_msg.recipient, path); // Charge the right amount in case of the create case. if (is_zero(current) && !is_zero(value)) @@ -413,7 +413,7 @@ void WasmEngine::collectBenchmarkingData() // We do not need to take care about the delete case (gas refund), the client does it. - m_host.set_storage(m_msg.destination, path, value); + m_host.set_storage(m_msg.recipient, path, value); } void EthereumInterface::eeiStorageLoad(uint32_t pathOffset, uint32_t resultOffset) @@ -423,7 +423,7 @@ void WasmEngine::collectBenchmarkingData() takeInterfaceGas(GasSchedule::storageLoad); evmc::bytes32 path = loadBytes32(pathOffset); - evmc::bytes32 result = m_host.get_storage(m_msg.destination, path); + evmc::bytes32 result = m_host.get_storage(m_msg.recipient, path); storeBytes32(result, resultOffset); } @@ -464,7 +464,7 @@ void WasmEngine::collectBenchmarkingData() ensureCondition(gas >= 0, ArgumentOutOfRange, "Negative gas supplied."); evmc_message call_message; - call_message.destination = loadAddress(addressOffset); + call_message.recipient = loadAddress(addressOffset); call_message.flags = m_msg.flags & EVMC_STATIC; call_message.depth = m_msg.depth + 1; @@ -472,7 +472,7 @@ void WasmEngine::collectBenchmarkingData() case EEICallKind::Call: case EEICallKind::CallCode: call_message.kind = (kind == EEICallKind::CallCode) ? EVMC_CALLCODE : EVMC_CALL; - call_message.sender = m_msg.destination; + call_message.sender = m_msg.recipient; call_message.value = loadUint128(valueOffset); if ((kind == EEICallKind::Call) && !evmc::is_zero(call_message.value)) { @@ -487,7 +487,7 @@ void WasmEngine::collectBenchmarkingData() case EEICallKind::CallStatic: call_message.kind = EVMC_CALL; call_message.flags |= EVMC_STATIC; - call_message.sender = m_msg.destination; + call_message.sender = m_msg.recipient; call_message.value = {}; break; } @@ -539,7 +539,7 @@ void WasmEngine::collectBenchmarkingData() return 1; // Only charge callNewAccount gas if the account is new and non-zero value is being transferred per EIP161. - if ((kind == EEICallKind::Call) && !m_host.account_exists(call_message.destination)) + if ((kind == EEICallKind::Call) && !m_host.account_exists(call_message.recipient)) takeInterfaceGas(GasSchedule::callNewAccount); } @@ -587,8 +587,8 @@ void WasmEngine::collectBenchmarkingData() evmc_message create_message; - create_message.destination = {}; - create_message.sender = m_msg.destination; + create_message.recipient = {}; + create_message.sender = m_msg.recipient; create_message.value = loadUint128(valueOffset); if (m_msg.depth >= 1024) @@ -655,7 +655,7 @@ void WasmEngine::collectBenchmarkingData() if (!m_host.account_exists(address)) takeInterfaceGas(GasSchedule::callNewAccount); - m_host.selfdestruct(m_msg.destination, address); + m_host.selfdestruct(m_msg.recipient, address); throw EndExecution{}; } @@ -840,7 +840,7 @@ void WasmEngine::collectBenchmarkingData() bool EthereumInterface::enoughSenderBalanceFor(evmc::uint256be const& value) { - evmc::uint256be balance = m_host.get_balance(m_msg.destination); + evmc::uint256be balance = m_host.get_balance(m_msg.recipient); return safeLoadUint128(balance) >= safeLoadUint128(value); } diff --git a/src/hera.cpp b/src/hera.cpp index 55504a584..9d22f41c7 100644 --- a/src/hera.cpp +++ b/src/hera.cpp @@ -116,15 +116,16 @@ pair callSystemContract( .flags = EVMC_STATIC, .depth = 0, .gas = gas, - .destination = address, + .recipient = address, .sender = {}, .input_data = input.data(), .input_size = input.size(), .value = {}, .create2_salt = {}, + .code_address = address, }; - evmc::result result = context.call(message); + evmc::Result result = context.call(message); bytes ret; if (result.status_code == EVMC_SUCCESS && result.output_data) @@ -148,12 +149,13 @@ pair locallyExecuteSystemContract( .flags = EVMC_STATIC, .depth = 0, .gas = gas, - .destination = address, + .recipient = address, .sender = {}, .input_data = input.data(), .input_size = input.size(), .value = {}, .create2_salt = {}, + .code_address = address, }; unique_ptr engine = wasmEngineCreateFn(); @@ -299,7 +301,7 @@ evmc_result hera_execute( bytes run_code{state_code}; // replace executable code if replacement is supplied - auto preload = hera->contract_preload_list.find(msg->destination); + auto preload = hera->contract_preload_list.find(msg->recipient); if (preload != hera->contract_preload_list.end()) { HERA_DEBUG << "Overriding contract.\n"; run_code = preload->second;