Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MockedHost from EVMC 7.1.0 #212

Merged
merged 2 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog],
and this project adheres to [Semantic Versioning].


## [0.4.0] — unreleased

### Changed

- [EVMC] has been upgraded to version [7.1.0][EVMC 7.1.0].
[#212](https://github.com/ethereum/evmone/pull/212)

## [0.3.0] — 2019-11-14

This release of evmone adds changes for **Istanbul** EVM revision.
Expand Down Expand Up @@ -132,6 +139,7 @@ It delivers fully-compatible and high-speed EVM implementation.
- The [intx 0.2.0](https://github.com/chfast/intx/releases/tag/v0.2.0) library is used for 256-bit precision arithmetic.


[0.4.0]: https://github.com/ethereum/evmone/compare/v0.3.0...master
[0.3.0]: https://github.com/ethereum/evmone/releases/tag/v0.3.0
[0.2.0]: https://github.com/ethereum/evmone/releases/tag/v0.2.0
[0.1.1]: https://github.com/ethereum/evmone/releases/tag/v0.1.1
Expand All @@ -142,6 +150,7 @@ It delivers fully-compatible and high-speed EVM implementation.
[EIP-1344]: https://eips.ethereum.org/EIPS/eip-1344
[EIP-2200]: https://eips.ethereum.org/EIPS/eip-2200
[EVMC]: https://github.com/ethereum/evmc
[EVMC 7.1.0]: https://github.com/ethereum/evmc/releases/tag/v7.1.0
[EVMC 7.0.0]: https://github.com/ethereum/evmc/releases/tag/v7.0.0
[intx]: https://github.com/chfast/intx
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endif()
hunter_add_package(ethash)
find_package(ethash CONFIG REQUIRED)

option(EVMC_TEST_TOOLS "Build EVMC test tools" ${EVMONE_TESTING})
option(EVMC_TOOLS "Build EVMC test tools" ${EVMONE_TESTING})
add_subdirectory(evmc)

cable_configure_compiler()
Expand Down
2 changes: 1 addition & 1 deletion evmc
Submodule evmc updated 42 files
+1 −1 .bumpversion.cfg
+44 −0 .clang-tidy
+26 −0 CHANGELOG.md
+21 −21 CMakeLists.txt
+1 −1 README.md
+1 −1 bindings/rust/evmc-declare-tests/Cargo.toml
+4 −8 bindings/rust/evmc-declare/Cargo.toml
+5 −6 bindings/rust/evmc-declare/src/lib.rs
+2 −2 bindings/rust/evmc-sys/Cargo.toml
+1 −1 bindings/rust/evmc-vm/Cargo.toml
+49 −53 bindings/rust/evmc-vm/src/lib.rs
+64 −0 bindings/rust/evmc-vm/src/types.rs
+10 −3 circle.yml
+3 −9 examples/CMakeLists.txt
+2 −2 examples/example-rust-vm/src/lib.rs
+17 −12 examples/example_host.cpp
+2 −2 examples/example_precompiles_vm/CMakeLists.txt
+5 −21 examples/example_precompiles_vm/example_precompiles_vm.cpp
+2 −2 examples/example_vm/CMakeLists.txt
+1 −1 include/evmc/evmc.h
+25 −19 include/evmc/evmc.hpp
+315 −0 include/evmc/mocked_host.hpp
+14 −0 lib/CMakeLists.txt
+8 −3 lib/instructions/CMakeLists.txt
+1 −4 lib/loader/CMakeLists.txt
+6 −0 lib/loader/loader.c
+13 −0 lib/mocked_host/CMakeLists.txt
+3 −17 test/CMakeLists.txt
+0 −0 test/cmake_package/CMakeLists.txt
+0 −0 test/compilation/CMakeLists.txt
+0 −0 test/compilation/compilation_test.c
+2 −0 test/compilation/compilation_test.cxx
+0 −6 test/integration/CMakeLists.txt
+8 −3 test/unittests/CMakeLists.txt
+78 −31 test/unittests/test_cpp.cpp
+39 −5 test/unittests/test_loader.cpp
+7 −19 test/vmtester/CMakeLists.txt
+5 −0 tools/CMakeLists.txt
+21 −0 tools/vmtester/CMakeLists.txt
+14 −23 tools/vmtester/tests.cpp
+1 −1 tools/vmtester/vmtester.cpp
+0 −0 tools/vmtester/vmtester.hpp
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the Apache License, Version 2.0.

include(GoogleTest)
include(${PROJECT_SOURCE_DIR}/evmc/cmake/EVMC.cmake)

set(evmone_private_include_dir ${PROJECT_SOURCE_DIR}/lib)

Expand Down
2 changes: 1 addition & 1 deletion test/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else()
endif()

add_executable(evmone-fuzzer fuzzer.cpp)
target_link_libraries(evmone-fuzzer PRIVATE evmone testutils)
target_link_libraries(evmone-fuzzer PRIVATE evmone testutils evmc::mocked_host)

if(NOT fuzzing_coverage)
# TODO: Aleth reports undefined behaviors, disable it for fuzzing.
Expand Down
5 changes: 3 additions & 2 deletions test/fuzzer/fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Copyright 2019 The evmone Authors.
// Licensed under the Apache License, Version 2.0.

#include <evmc/mocked_host.hpp>
#include <evmone/evmone.h>
#include <test/utils/bytecode.hpp>
#include <test/utils/host_mock.hpp>
#include <test/utils/utils.hpp>

#include <cstring>
#include <iostream>

Expand Down Expand Up @@ -68,7 +69,7 @@ static evmc::VM external_vms[] = {
};


class FuzzHost : public MockedHost
class FuzzHost : public evmc::MockedHost
{
public:
uint8_t gas_left_factor = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ add_library(evm-unittests OBJECT
evm_state_test.cpp
evm_other_test.cpp
)
target_link_libraries(evm-unittests PRIVATE testutils evmc::evmc GTest::gtest)
target_link_libraries(evm-unittests PRIVATE testutils evmc::mocked_host GTest::gtest)
target_include_directories(evm-unittests PRIVATE ${evmone_private_include_dir})

# The internal evmone unit tests. The generic EVM ones are also built in.
Expand Down
5 changes: 3 additions & 2 deletions test/unittests/evm_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
#pragma once

#include "vm_loader.hpp"

#include <evmc/mocked_host.hpp>
#include <gtest/gtest.h>
#include <intx/intx.hpp>
#include <test/utils/bytecode.hpp>
#include <test/utils/host_mock.hpp>

#define EXPECT_STATUS(STATUS_CODE) \
EXPECT_EQ(result.status_code, STATUS_CODE); \
Expand Down Expand Up @@ -56,7 +57,7 @@ class evm : public testing::Test
/// The total amount of gas used during execution.
int64_t gas_used = 0;

MockedHost host;
evmc::MockedHost host;

evm() noexcept : vm{get_vm()} {}

Expand Down
2 changes: 1 addition & 1 deletion test/unittests/evm_state_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ TEST_F(evm_state, selfdestruct_with_balance)

TEST_F(evm_state, blockhash)
{
host.blockhash.bytes[13] = 0x13;
host.block_hash.bytes[13] = 0x13;

host.tx_context.block_number = 0;
auto code = "60004060005260206000f3";
Expand Down
1 change: 0 additions & 1 deletion test/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ find_package(intx CONFIG REQUIRED)

add_library(testutils STATIC
bytecode.hpp
host_mock.hpp
utils.cpp
utils.hpp
)
Expand Down
251 changes: 0 additions & 251 deletions test/utils/host_mock.hpp

This file was deleted.