Skip to content

Commit

Permalink
Update libraries intx to v0.11.0 and ethash to v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed Sep 2, 2024
1 parent 8b387d5 commit 47d426e
Show file tree
Hide file tree
Showing 115 changed files with 3,040 additions and 4,853 deletions.
18 changes: 7 additions & 11 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -897,25 +897,21 @@ libbitcoin_common_a_SOURCES = \
eth_client/libevm/VMFactory.h \
eth_client/utils/ethash/include/ethash/ethash.h \
eth_client/utils/ethash/include/ethash/ethash.hpp \
eth_client/utils/ethash/include/ethash/global_context.h \
eth_client/utils/ethash/include/ethash/global_context.hpp \
eth_client/utils/ethash/include/ethash/hash_types.h \
eth_client/utils/ethash/include/ethash/hash_types.hpp \
eth_client/utils/ethash/include/ethash/keccak.h \
eth_client/utils/ethash/include/ethash/keccak.hpp \
eth_client/utils/ethash/include/ethash/progpow.hpp \
eth_client/utils/ethash/lib/ethash/bit_manipulation.h \
eth_client/utils/ethash/lib/ethash/builtins.h \
eth_client/utils/ethash/include/ethash/version.h \
eth_client/utils/ethash/lib/ethash/endianness.hpp \
eth_client/utils/ethash/lib/ethash/ethash-internal.hpp \
eth_client/utils/ethash/lib/ethash/ethash.cpp \
eth_client/utils/ethash/lib/ethash/keccak.c \
eth_client/utils/ethash/lib/ethash/keccakf1600.c \
eth_client/utils/ethash/lib/ethash/keccakf800.c \
eth_client/utils/ethash/lib/ethash/kiss99.hpp \
eth_client/utils/ethash/lib/ethash/managed.cpp \
eth_client/utils/ethash/lib/ethash/ethash-internal.hpp \
eth_client/utils/ethash/lib/ethash/primes.c \
eth_client/utils/ethash/lib/ethash/primes.h \
eth_client/utils/ethash/lib/ethash/progpow.cpp \
eth_client/utils/ethash/lib/ethash/support/attributes.h \
eth_client/utils/ethash/lib/global_context/global_context.cpp \
eth_client/utils/ethash/lib/keccak/keccak.c \
eth_client/utils/ethash/lib/support/attributes.h \
eth_client/utils/intx/intx.hpp \
eth_client/utils/json_spirit/JsonSpiritHeaders.h \
eth_client/utils/json_spirit/json_spirit.h \
Expand Down
171 changes: 171 additions & 0 deletions src/eth_client/utils/ethash/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Changelog

## [1.0.1] — 2023-04-03

- CMake and build improvements.
[#230](https://github.com/chfast/ethash/pull/230)
[#231](https://github.com/chfast/ethash/pull/231)

## [1.0.0] — 2022-08-25

- Removed: Deprecated function `ethash_verify()` has been removed.
Use `ethash_verify_against_boundary()`.
[#226](https://github.com/chfast/ethash/pull/226)

## [0.9.0] — 2022-04-05

- Added: The constant `ETHASH_MAX_EPOCH_NUMBER = 32639` representing
the maximum supported Ethash epoch.
[#212](https://github.com/chfast/ethash/pull/212)
- Removed: Previously deprecated ProgPoW implementation.
[#207](https://github.com/chfast/ethash/pull/207)
[#209](https://github.com/chfast/ethash/pull/209)
[#210](https://github.com/chfast/ethash/pull/210)
- Removed: Support for using custom hash function for light cache generation.
[#213](https://github.com/chfast/ethash/pull/213)
- Removed: The internal header builtins.h.
[#208](https://github.com/chfast/ethash/pull/208)

## [0.8.0] — 2021-11-09

- Added: The new set of functions which verify Ethash hashes against difficulty
has been added to the library: `verify_against_difficulty()` and
`verify_final_hash_against_difficulty()`. These functions improve usability
by omitting previously required difficulty to boundary conversion.
The old verification function is still available under
the `verify_against_boundary()` name but its usage is discouraged.
[#195](https://github.com/chfast/ethash/pull/195)
- Added: The dedicated procedure to convert difficulty to boundary
`ethash_difficulty_to_boundary()` has been added to the testing infrastructure
but can be promoted to the public API if requested.
[#191](https://github.com/chfast/ethash/pull/191)
- Deprecated: `verify()` has been deprecated and replaced with
`verify_against_boundary()`.
[#193](https://github.com/chfast/ethash/pull/193)
- Deprecated: `verify_final_hash()` has been replaced by
`verify_final_hash_against_difficulty()`.
[#200](https://github.com/chfast/ethash/pull/200)
- Deprecated: The ProgPoW support has been deprecated and will be removed
in the next release.
[#201](https://github.com/chfast/ethash/pull/201)
- Changed: The internal hash type comparison operators have been
optimized and the dependency on the `memcmp()` function has been dropped.
[#186](https://github.com/chfast/ethash/pull/186)
- Changed: Verification functions now return error codes instead of `bool`
with additional information about which verification check has failed.
[#187](https://github.com/chfast/ethash/pull/187)
- In C API error codes are represented by the `ethash_errc` enum,
- In C++ the error codes are wrapped into `std::error_code`.
- Changed: Some build requirements have been increased.
- C11 is required (previously C99),
[#188](https://github.com/chfast/ethash/pull/188)
- C++14 is required (previously C++11),
[#189](https://github.com/chfast/ethash/pull/189)
- CMake 3.16 is required (previously 3.13),
[#205](https://github.com/chfast/ethash/pull/205)
- Python wheels are now built with `manylinux_2_24`.
[#194](https://github.com/chfast/ethash/pull/194)


## [0.7.1] — 2021-08-26

- Added: Support for building with clang-cl (LLVM-based toolchain for Visual Studio 2019).
[#179](https://github.com/chfast/ethash/pull/179)
[#180](https://github.com/chfast/ethash/pull/180)
[#182](https://github.com/chfast/ethash/pull/182)
[#183](https://github.com/chfast/ethash/pull/183)
[#184](https://github.com/chfast/ethash/pull/184)

## [0.7.0] — 2021-05-26

- Changed: The global context API (aka "managed" API) has been moved to
separate library `ethash::global-context` and `ethash/global_context.hpp`
header.
[#175](https://github.com/chfast/ethash/pull/175)
- Added: CMake options to disable building of individual libraries:
- `-DETHASH_BUILD_GLOBAL_CONTEXT=NO` disables building
`ethash::global-context`.
- `-DETHASH_BUILD_ETHASH=NO` disables building `ethash::ethash` and
`ethash::global-context`. Only `ethash::keccak` is built then.
- Added: Basic support for building to WebAssembly
[#175](https://github.com/chfast/ethash/pull/175)

## [0.6.0] — 2020-12-15

- Added: The ethash::keccak library received the optimized Keccak implementation
which uses BMI and BMI2 x86_64 extensions. This implementation is automatically
selected at startup provided the used extensions are available in the hardware.
[#162](https://github.com/chfast/ethash/pull/162)
[#168](https://github.com/chfast/ethash/pull/168)

## [0.5.2] — 2020-08-03

- Fixed: Fix compilation with MSVC/C++17.
[#154](https://github.com/chfast/ethash/issues/154)

## [0.5.1] — 2020-01-30

- Added: Experimental Python bindings — [ethash][pypi-ethash] package.
[#123](https://github.com/chfast/ethash/pull/123)
[#138](https://github.com/chfast/ethash/pull/138)
- Added: More functions exposed in C API.
[#136](https://github.com/chfast/ethash/pull/136)
- Changed: ProgPoW implementation updated to revision [0.9.3][ProgPoW-changelog].
[#151](https://github.com/chfast/ethash/pull/151)

## [0.5.0] — 2019-06-07

- Changed:
The Keccak implementation has been moved to separate library "keccak",
available as ethash::keccak target in the ethash CMake package.
[#131](https://github.com/chfast/ethash/pull/131)

## [0.4.4] — 2019-02-26

- Fixed:
Fix compilation on PowerPC architectures (-mtune=generic not supported there).
[#125](https://github.com/chfast/ethash/pull/125)

## [0.4.3] — 2019-02-19

- Added:
The public `version.h` header with information about the ethash library version.
[#121](https://github.com/chfast/ethash/pull/121)
- Added:
Ethash and ProgPoW revisions exposed as `{ethash,progpow}::revision` constants.
[#121](https://github.com/chfast/ethash/pull/121)

## [0.4.2] — 2019-01-24

- Fixed: The `progpow.cpp` file encoding changed from utf-8 to ascii.

## [0.4.1] — 2018-12-14

- Added: [KISS99 PRNG](https://en.wikipedia.org/wiki/KISS_(algorithm) distribution tester tool.
- Changed: ProgPoW implementation updated to revision [0.9.2][ProgPoW-changelog].
- Changed: ProgPoW implementation optimizations.

## [0.4.0] — 2018-12-04

- Added: Experimental support for [ProgPoW] [0.9.1][ProgPoW-changelog].


[1.0.1]: https://github.com/chfast/ethash/releases/tag/v1.0.1
[1.0.0]: https://github.com/chfast/ethash/releases/tag/v1.0.0
[0.9.0]: https://github.com/chfast/ethash/releases/tag/v0.9.0
[0.8.0]: https://github.com/chfast/ethash/releases/tag/v0.8.0
[0.7.1]: https://github.com/chfast/ethash/releases/tag/v0.7.1
[0.7.0]: https://github.com/chfast/ethash/releases/tag/v0.7.0
[0.6.0]: https://github.com/chfast/ethash/releases/tag/v0.6.0
[0.5.2]: https://github.com/chfast/ethash/releases/tag/v0.5.2
[0.5.1]: https://github.com/chfast/ethash/releases/tag/v0.5.1
[0.5.0]: https://github.com/chfast/ethash/releases/tag/v0.5.0
[0.4.4]: https://github.com/chfast/ethash/releases/tag/v0.4.4
[0.4.3]: https://github.com/chfast/ethash/releases/tag/v0.4.3
[0.4.2]: https://github.com/chfast/ethash/releases/tag/v0.4.2
[0.4.1]: https://github.com/chfast/ethash/releases/tag/v0.4.1
[0.4.0]: https://github.com/chfast/ethash/releases/tag/v0.4.0

[ProgPoW]: https://github.com/ifdefelse/ProgPOW/blob/master/README.md
[ProgPoW-changelog]: https://github.com/ifdefelse/ProgPOW#change-history
[pypi-ethash]: https://pypi.org/project/ethash/
115 changes: 72 additions & 43 deletions src/eth_client/utils/ethash/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,68 +1,97 @@
# ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.
# Licensed under the Apache License, Version 2.0.

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16.2...3.25)

if(POLICY CMP0069)
cmake_policy(SET CMP0069 NEW) # Allow LTO.
endif()

include(cmake/cable/bootstrap.cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

include(CableBuildType)
include(CableCompilerSettings)
include(CableToolchains)
include(HunterGate)

include(defaults/HunterCacheServers)
include(CMakeDependentOption)
include(CMakePackageConfigHelpers)

cable_configure_toolchain(DEFAULT cxx11)
option(ETHASH_INSTALL_CMAKE_CONFIG "Install CMake configuration scripts for find_package(CONFIG)" ON)
option(ETHASH_BUILD_ETHASH "Build ethash::ethash library (if NO only ethash::keccak is built)" YES)
cmake_dependent_option(ETHASH_BUILD_GLOBAL_CONTEXT "Build ethash::global-context library" YES "ETHASH_BUILD_ETHASH" NO)
option(ETHASH_TESTING "Build unit tests" NO)

if(NOT WIN32)
# Outside of Windows build only Release packages.
set(HUNTER_CONFIGURATION_TYPES Release
CACHE STRING "Build type of the Hunter packages")
if(ETHASH_TESTING)
include(cmake/Hunter/init.cmake)
endif()

HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.20.35.tar.gz"
SHA1 "6e3cb4c333b76803a83c56fcbca3b0bfd9f96f27"
)

project(ethash)
set(PROJECT_VERSION 0.4.1)

cable_set_build_type(DEFAULT Release CONFIGURATION_TYPES Release RelWithDebInfo Debug)
set(PROJECT_VERSION 1.0.1)

cable_configure_compiler(NO_STACK_PROTECTION)
if(CABLE_COMPILER_GNULIKE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og")

option(ETHASH_NATIVE "Build for native CPU" OFF)
if(ETHASH_NATIVE)
add_compile_options(-march=native)
elseif(NOT CMAKE_CROSSCOMPILING)
# Tune for currently most common CPUs (flag not supported in cross compilation).
add_compile_options(-mtune=generic)
add_compile_options(
# -Wcast-align #TODO: Build fails on mips64
-Wcast-qual
-Wmissing-declarations
-Wsign-conversion
-Wundef
-Wunreachable-code
$<$<COMPILE_LANGUAGE:C>:-Wmissing-prototypes>
$<$<CXX_COMPILER_ID:Clang>:-Wduplicate-enum>
$<$<CXX_COMPILER_ID:Clang>:-Wnewline-eof>
$<$<CXX_COMPILER_ID:Clang>:-Wunreachable-code-aggressive>
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
)

if(MSVC) # clang-cl
add_compile_options(
-Wno-exit-time-destructors
-Wno-global-constructors
$<$<COMPILE_LANGUAGE:CXX>:-Wno-c++98-compat-pedantic>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-old-style-cast>
)
endif()
elseif(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
# For Win32 builds allow allocating more than 2 GB of memory.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
endif()

option(ETHASH_INSTALL_CMAKE_CONFIG "Install CMake configuration scripts for find_package(CONFIG)" ON)

option(ETHASH_FUZZING "Build with fuzzer instrumentation" OFF)
if(ETHASH_FUZZING)
set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=fuzzer-no-link ${CMAKE_EXE_LINKER_FLAGS}")
add_compile_options(-fno-omit-frame-pointer -fsanitize=fuzzer,undefined,integer -fno-sanitize-recover=all)
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_DEBUG} -fprofile-instr-generate -fcoverage-mapping")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-instr-generate -fcoverage-mapping")
elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_DEBUG} --coverage")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
endif()

add_subdirectory(lib/ethash)
set(include_dir ${PROJECT_SOURCE_DIR}/include)

add_subdirectory(lib)

option(ETHASH_BUILD_TESTS "Build unit tests" ON)
if(ETHASH_BUILD_TESTS)
if(ETHASH_TESTING)
enable_testing()
add_subdirectory(test)
endif()


install(
DIRECTORY
${include_dir}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(ETHASH_INSTALL_CMAKE_CONFIG)
write_basic_package_version_file(ethashConfigVersion.cmake COMPATIBILITY SameMajorVersion)
configure_package_config_file(cmake/Config.cmake.in ethashConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ethash)

install(
EXPORT ethashTargets
NAMESPACE ethash::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ethash
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/ethashConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/ethashConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ethash
)
endif()
4 changes: 4 additions & 0 deletions src/eth_client/utils/ethash/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include CMakeLists.txt
recursive-include cmake *
recursive-include include *
recursive-include lib *
Loading

0 comments on commit 47d426e

Please sign in to comment.