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

0.1: Upgrade EVMC to 6.3.1 #171

Merged
merged 1 commit into from
Sep 11, 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
2 changes: 1 addition & 1 deletion evmc
Submodule evmc updated 71 files
+11 −4 .bumpversion.cfg
+26 −5 .clang-format
+304 −128 CHANGELOG.md
+32 −25 CMakeLists.txt
+2 −0 Cargo.toml
+1 −1 Doxyfile
+1 −1 README.md
+9 −3 appveyor.yml
+20 −0 bindings/go/evmc/evmc.go
+15 −1 bindings/go/evmc/evmc_test.go
+0 −7 bindings/go/evmc/host.c
+5 −12 bindings/go/evmc/host.go
+25 −2 bindings/go/evmc/host_test.go
+3 −0 bindings/rust/evmc-declare-tests/.gitignore
+18 −0 bindings/rust/evmc-declare-tests/Cargo.toml
+29 −0 bindings/rust/evmc-declare-tests/src/lib.rs
+3 −0 bindings/rust/evmc-declare/.gitignore
+27 −0 bindings/rust/evmc-declare/Cargo.toml
+400 −0 bindings/rust/evmc-declare/src/lib.rs
+2 −2 bindings/rust/evmc-sys/Cargo.toml
+2 −0 bindings/rust/evmc-sys/build.rs
+27 −0 bindings/rust/evmc-sys/src/lib.rs
+2 −2 bindings/rust/evmc-vm/Cargo.toml
+166 −0 bindings/rust/evmc-vm/src/container.rs
+522 −175 bindings/rust/evmc-vm/src/lib.rs
+37 −0 bindings/rust/evmc-vm/src/types.rs
+128 −70 circle.yml
+3 −1 cmake/Config.cmake.in
+18 −0 cmake/EVMC.cmake
+1 −0 cmake/cable/CableBuildInfo.cmake
+1 −1 cmake/cable/CableCompilerSettings.cmake
+28 −0 cmake/cable/CablePackage.cmake
+4 −4 cmake/cable/bootstrap.cmake
+5 −2 cmake/cable/buildinfo/buildinfo.cmake
+14 −0 cmake/cable/buildinfo/version.h.in
+4 −4 cmake/cable/toolchains/cxx11-32bit.cmake
+10 −0 cmake/cable/toolchains/cxx14-32bit.cmake
+10 −0 cmake/cable/toolchains/cxx17-32bit.cmake
+5 −18 examples/CMakeLists.txt
+4 −2 examples/example-rust-vm/Cargo.toml
+44 −55 examples/example-rust-vm/src/lib.rs
+42 −8 examples/example.c
+31 −35 examples/example_host.cpp
+1 −1 examples/example_host.h
+9 −1 examples/example_precompiles_vm/CMakeLists.txt
+1 −1 examples/example_precompiles_vm/example_precompiles_vm.cpp
+20 −0 examples/example_vm/CMakeLists.txt
+42 −15 examples/example_vm/example_vm.c
+0 −0 examples/example_vm/example_vm.h
+7 −0 examples/use_evmc_in_cmake/CMakeLists.txt
+30 −13 include/evmc/evmc.h
+361 −34 include/evmc/evmc.hpp
+55 −0 include/evmc/helpers.h
+41 −23 include/evmc/helpers.hpp
+64 −13 include/evmc/loader.h
+3 −1 lib/instructions/CMakeLists.txt
+260 −0 lib/instructions/instruction_metrics.c
+260 −0 lib/instructions/instruction_names.c
+3 −1 lib/loader/CMakeLists.txt
+122 −16 lib/loader/loader.c
+9 −0 test/integration/compilation/compilation_test.cxx
+1 −0 test/unittests/CMakeLists.txt
+313 −9 test/unittests/test_cpp.cpp
+50 −0 test/unittests/test_deprecated.cpp
+4 −40 test/unittests/test_helpers.cpp
+139 −15 test/unittests/test_instructions.cpp
+382 −7 test/unittests/test_loader.cpp
+7 −3 test/vmtester/CMakeLists.txt
+61 −11 test/vmtester/tests.cpp
+10 −19 test/vmtester/vmtester.cpp
+11 −11 test/vmtester/vmtester.hpp
2 changes: 1 addition & 1 deletion lib/evmone/instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ void op_log(execution_state& state, instr_argument arg) noexcept
state.stack.pop_back();
state.stack.pop_back();

std::array<evmc_bytes32, 4> topics;
std::array<evmc::bytes32, 4> topics;
for (auto i = 0; i < arg.p.number; ++i)
{
intx::be::store(topics[i].bytes, state.item(0));
Expand Down
39 changes: 19 additions & 20 deletions test/utils/host_mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include <evmc/evmc.hpp>
#include <evmc/helpers.hpp>
#include <intx/intx.hpp>
#include <test/utils/utils.hpp>
#include <unordered_map>
Expand All @@ -14,19 +13,19 @@
class MockedHost : public evmc::Host
{
public:
evmc_address last_accessed_account = {};
evmc::address last_accessed_account = {};

std::unordered_map<evmc_bytes32, evmc_bytes32> storage;
std::unordered_map<evmc::bytes32, evmc::bytes32> storage;
bool storage_cold = true;

evmc_tx_context tx_context = {};

bytes log_data;
std::vector<evmc_bytes32> log_topics;
std::vector<evmc::bytes32> log_topics;

evmc_address selfdestruct_beneficiary = {};
evmc::address selfdestruct_beneficiary = {};

evmc_bytes32 blockhash = {};
evmc::bytes32 blockhash = {};

bool exists = false;
intx::uint256 balance = {};
Expand All @@ -35,19 +34,19 @@ class MockedHost : public evmc::Host
evmc_message call_msg = {}; ///< Recorded call message.
evmc_result call_result = {};

bool account_exists(const evmc_address& addr) noexcept override
bool account_exists(const evmc::address& addr) noexcept override
{
last_accessed_account = addr;
return exists;
}

evmc_bytes32 get_storage(const evmc_address&, const evmc_bytes32& key) noexcept override
evmc::bytes32 get_storage(const evmc::address&, const evmc::bytes32& key) noexcept override
{
return storage[key];
}

evmc_storage_status set_storage(
const evmc_address&, const evmc_bytes32& key, const evmc_bytes32& value) noexcept override
evmc_storage_status set_storage(const evmc::address&, const evmc::bytes32& key,
const evmc::bytes32& value) noexcept override
{
auto& old = storage[key];

Expand All @@ -67,29 +66,29 @@ class MockedHost : public evmc::Host
return status;
}

evmc_uint256be get_balance(const evmc_address& addr) noexcept override
evmc::uint256be get_balance(const evmc::address& addr) noexcept override
{
last_accessed_account = addr;
evmc_uint256be b = {};
evmc::uint256be b = {};
intx::be::store(b.bytes, balance);
return b;
}

size_t get_code_size(const evmc_address& addr) noexcept override
size_t get_code_size(const evmc::address& addr) noexcept override
{
last_accessed_account = addr;
return extcode.size();
}

evmc_bytes32 get_code_hash(const evmc_address& addr) noexcept override
evmc::bytes32 get_code_hash(const evmc::address& addr) noexcept override
{
last_accessed_account = addr;
auto hash = evmc_bytes32{};
auto hash = evmc::bytes32{};
std::fill(std::begin(hash.bytes), std::end(hash.bytes), uint8_t{0xee});
return hash;
}

size_t copy_code(const evmc_address& addr, size_t code_offset, uint8_t* buffer_data,
size_t copy_code(const evmc::address& addr, size_t code_offset, uint8_t* buffer_data,
size_t buffer_size) noexcept override
{
last_accessed_account = addr;
Expand All @@ -99,7 +98,7 @@ class MockedHost : public evmc::Host
return n;
}

void selfdestruct(const evmc_address&, const evmc_address& beneficiary) noexcept override
void selfdestruct(const evmc::address&, const evmc::address& beneficiary) noexcept override
{
selfdestruct_beneficiary = beneficiary;
}
Expand All @@ -112,10 +111,10 @@ class MockedHost : public evmc::Host

evmc_tx_context get_tx_context() noexcept override { return tx_context; }

evmc_bytes32 get_block_hash(int64_t) noexcept override { return blockhash; }
evmc::bytes32 get_block_hash(int64_t) noexcept override { return blockhash; }

void emit_log(const evmc_address&, const uint8_t* data, size_t data_size,
const evmc_bytes32 topics[], size_t topics_count) noexcept override
void emit_log(const evmc::address&, const uint8_t* data, size_t data_size,
const evmc::bytes32 topics[], size_t topics_count) noexcept override
{
log_data.assign(data, data_size);
log_topics.clear();
Expand Down