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

Rename keccak library -> ethash library #229

Merged
merged 8 commits into from
Apr 29, 2021
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
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ endif()
if(SILKWORM_WASM_API)
add_compile_definitions(EVMC_LOADER_MOCK)
endif()

add_subdirectory(evmone/evmc)
add_subdirectory(keccak)
add_subdirectory(ethash)

find_package(intx CONFIG REQUIRED)

add_library(evmone evmone/lib/evmone/analysis.cpp
Expand All @@ -181,7 +183,7 @@ add_library(evmone evmone/lib/evmone/analysis.cpp
evmone/lib/evmone/opcodes_helpers.h)

target_include_directories(evmone PUBLIC evmone/lib)
target_link_libraries(evmone PUBLIC evmc intx::intx PRIVATE evmc::instructions keccak)
target_link_libraries(evmone PUBLIC evmc intx::intx PRIVATE evmc::instructions ethash)

if(MSVC)
target_compile_options(evmone PRIVATE /EHsc)
Expand Down
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ list(FILTER SILKWORM_CORE_SRC EXCLUDE REGEX "_test\.cpp$")
add_library(silkworm_core ${SILKWORM_CORE_SRC})
target_include_directories(silkworm_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

set(SILKWORM_CORE_PUBLIC_LIBS evmc intx::intx keccak ff Microsoft.GSL::GSL nlohmann_json)
set(SILKWORM_CORE_PUBLIC_LIBS evmc intx::intx ethash ff Microsoft.GSL::GSL nlohmann_json)
set(SILKWORM_CORE_PRIVATE_LIBS evmone secp256k1 gmp)

if(NOT SILKWORM_WASM_API)
Expand Down
3 changes: 3 additions & 0 deletions ethash/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file(GLOB_RECURSE ETHASH_SRC CONFIGURE_DEPENDS "*.cpp" "*.hpp" "*.c" "*.h")
add_library(ethash ${ETHASH_SRC})
target_include_directories(ethash PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
48 changes: 48 additions & 0 deletions ethash/ethash/hash_types.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
// Copyright 2018-2019 Pawel Bylica.
// Licensed under the Apache License, Version 2.0.

// Modified by Andrea Lanfranchi for Silkworm 2021:
// type aliasing removed

// #pragma once
#ifndef ETHASH_HASH_TYPES_HPP_
#define ETHASH_HASH_TYPES_HPP_

#include <stdint.h>

namespace ethash {

union hash256 {
uint64_t word64s[4];
uint32_t word32s[8];
uint8_t bytes[32];
char str[32];
};

union hash512 {
uint64_t word64s[8];
uint32_t word32s[16];
uint8_t bytes[64];
char str[64];
};

union hash1024 {
union hash512 hash512s[2];
uint64_t word64s[16];
uint32_t word32s[32];
uint8_t bytes[128];
char str[128];
};

union hash2048 {
union hash512 hash512s[4];
uint64_t word64s[32];
uint32_t word32s[64];
uint8_t bytes[256];
char str[256];
};

} // namespace ethash

#endif // !ETHASH_HASH_TYPES_HPP_
Loading