Skip to content

Commit

Permalink
Merge pull request #200 from madMAx43v3r/testnet11
Browse files Browse the repository at this point in the history
Testnet11
  • Loading branch information
madMAx43v3r authored May 1, 2024
2 parents 87b2048 + c38b43a commit da8737a
Show file tree
Hide file tree
Showing 1,203 changed files with 17,587 additions and 119,704 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
6 changes: 1 addition & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ concurrency:
cancel-in-progress: true

env:
VCPKG_COMMIT_ID: "53bef8994c541b6561884a8395ea35715ece75db"
CMAKE_BUILD_PRESET: "gha-windows-release"
CMAKE_BUILD_PRESET: "windows-default"
MMX_VERSION: ${{ github.ref_name }}
MMX_WIN_PACK: "TRUE"
MMX_GIGAHORSE: "FALSE"

MMX_TELEGRAM_TOKEN: ${{ secrets.MMX_TELEGRAM_TOKEN }}
MMX_TELEGRAM_TO_1: ${{ secrets.MMX_TELEGRAM_TO_1 }}
Expand All @@ -37,8 +35,6 @@ jobs:

- name: Restore artifacts, or setup vcpkg (do not install any package)
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}

- name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg.
uses: lukka/run-cmake@v10
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CMakeUserPresets.json
/DB_VERSION
/testnet*
/tmp
/coverage.info
/.idea
/_deps
/*.dat
Expand Down
8 changes: 1 addition & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
[submodule "bls-signatures"]
path = lib/bls-signatures
url = https://github.com/Chia-Network/bls-signatures.git
[submodule "secp256k1"]
path = lib/secp256k1
url = https://github.com/bitcoin-core/secp256k1.git
[submodule "chiapos"]
path = chiapos
url = https://github.com/Chia-Network/chiapos.git
[submodule "uint256_t"]
path = uint256_t
url = https://github.com/calccrypto/uint256_t.git
url = https://github.com/madMAx43v3r/uint256_t.git
[submodule "libbech32"]
path = lib/libbech32
url = https://github.com/dcdpr/libbech32.git
Expand Down
71 changes: 39 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.13)
project(mmx-node C CXX ASM)

include(FetchContent)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(MSVC)
Expand All @@ -11,7 +13,7 @@ if(MSVC)
add_compile_definitions(TARGET_FILENAME=$(TargetName)$(TargetExt))
add_compile_options(/openmp /EHsc /MP)

set(MSVC_DEBUG_OPTIONS /Od)
set(MSVC_DEBUG_OPTIONS /Od /FS)
set(MSVC_RELEASE_OPTIONS /W1 /O2)

add_compile_options(
Expand All @@ -32,20 +34,25 @@ if(MSVC)
INTERFACE_INCLUDE_DIRECTORIES "${secp256k1_IMPORT_PREFIX}/include"
)
else()
message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")

set(CMAKE_CXX_STANDARD 17)
include(cmake/commit_hash_json.cmake)

add_compile_options(-Wall -Wno-unused-function -Wno-parentheses -Wno-unused-local-typedefs)
add_compile_options(-Wall -Wno-unused-function -Wno-parentheses -Wno-unused-local-typedefs -Wno-unknown-pragmas)

set_source_files_properties(src/vm/Compiler.cpp
PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)

if(WITH_SECP256K1)
message(STATUS "Using secp256k1")
include_directories(lib/secp256k1/include)
link_directories(lib/secp256k1/.libs)
if(WITH_COVERAGE)
message(STATUS "Enabling -O0 -coverage")
add_compile_options(-O0 --coverage)
add_link_options(-lgcov --coverage)
endif()

set_source_files_properties(src/vm/Compiler.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)

find_library(secp256k1_LIBRARY NAMES secp256k1 PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib/secp256k1/.libs" NO_DEFAULT_PATH)

include_directories(lib/secp256k1/include)

if(ENABLE_MEM_SANITIZE)
message(STATUS "Compiling with -fsanitize=address")
add_compile_options(-fsanitize=address)
Expand All @@ -59,10 +66,6 @@ else()
endif()
endif()

set(ARITH "easy" CACHE STRING "BLS ARITH")
set(BUILD_BLS_TESTS OFF CACHE BOOL "BUILD_BLS_TESTS")
set(BUILD_BLS_BENCHMARKS OFF CACHE BOOL "BUILD_BLS_BENCHMARKS")
set(BUILD_BLS_PYTHON_BINDINGS OFF CACHE BOOL "BUILD_BLS_PYTHON_BINDINGS")
set(LIBBECH32_BUILD_TESTS OFF CACHE BOOL "LIBBECH32_BUILD_TESTS")
set(LIBBECH32_BUILD_EXAMPLES OFF CACHE BOOL "LIBBECH32_BUILD_EXAMPLES")
set(DIRENT_BUILD_TESTS OFF CACHE STRING "DIRENT_BUILD_TESTS")
Expand All @@ -71,7 +74,6 @@ set(VNX_BUILD_TOOLS ON CACHE STRING "VNX_BUILD_TOOLS")
add_subdirectory(vnx-base)
add_subdirectory(vnx-addons)
add_subdirectory(lib/libbech32)
add_subdirectory(lib/bls-signatures)
add_subdirectory(tools)
add_subdirectory(test)

Expand All @@ -95,8 +97,6 @@ if(OpenCL_FOUND)
)
endif()

include(cmake/chiapos.cmake)

file(GLOB GENERATED_SOURCE_FILES
generated/src/*.cpp
generated/vm/src/*.cpp
Expand All @@ -123,17 +123,15 @@ add_library(mmx_iface SHARED
src/secp256k1.cpp
src/uint128.cpp
src/fixed128.cpp
src/skey_t.cpp
src/hash_t.cpp
src/hash_512_t.cpp
src/addr_t.cpp
src/pubkey_t.cpp
src/signature_t.cpp
src/bls_signature_t.cpp
src/exec_result_t.cpp
src/exec_error_t.cpp
src/vm/var_t.cpp
src/vm/varptr_t.cpp
src/contract/NFT.cpp
src/contract/Data.cpp
src/contract/WebData.cpp
src/contract/PubKey.cpp
Expand All @@ -145,11 +143,8 @@ add_library(mmx_iface SHARED
src/contract/method_t.cpp
src/solution/PubKey.cpp
src/solution/MultiSig.cpp
src/solution/BLS_PubKey.cpp
src/operation/Spend.cpp
src/operation/Deposit.cpp
src/operation/Execute.cpp
src/operation/Vote.cpp
src/sha256_avx2.cpp
src/sha256_64_x8.cpp
src/sha256_ni.cpp
Expand Down Expand Up @@ -179,6 +174,13 @@ add_library(mmx_db SHARED
src/table.cpp
)

add_library(mmx_pos SHARED
src/pos/mem_hash.cpp
src/pos/verify.cpp
src/pos/encoding.cpp
src/pos/Prover.cpp
)

add_library(mmx_modules SHARED
src/TimeLord.cpp
src/Node.cpp
Expand All @@ -199,10 +201,17 @@ add_library(uint256_t STATIC
uint256_t/uint256_t.cpp
)

target_include_directories(mmx_vm
PUBLIC lib/lexy/include
)

target_include_directories(mmx_pos
PUBLIC include
)

target_include_directories(mmx_iface
PUBLIC
include
lib/lexy/include
generated/include
generated/vm/include
generated/contract/include
Expand All @@ -216,23 +225,19 @@ target_include_directories(uint256_t

target_compile_definitions(uint256_t PUBLIC _UINT256_T_STATIC _UINT128_T_STATIC)

target_include_directories(mmx_chiapos
PUBLIC src/chiapos
PRIVATE chiapos/src chiapos/lib/include
)

target_link_libraries(mmx_iface uint256_t secp256k1 bech32 bls vnx_base vnx_addons)
target_link_libraries(mmx_iface vnx_base vnx_addons uint256_t bech32 ${secp256k1_LIBRARY})

target_link_libraries(mmx_db mmx_iface)

target_link_libraries(mmx_pos mmx_iface)
target_link_libraries(mmx_vm mmx_db mmx_iface)

target_link_libraries(mmx_modules mmx_chiapos mmx_vm mmx_db mmx_iface)
target_link_libraries(mmx_modules mmx_pos mmx_vm mmx_db mmx_iface)

if(MSVC)
GENERATE_EXPORT_HEADER(mmx_iface)
GENERATE_EXPORT_HEADER(mmx_modules)
GENERATE_EXPORT_HEADER(mmx_db)
GENERATE_EXPORT_HEADER(mmx_pos)
GENERATE_EXPORT_HEADER(mmx_vm)

set_target_properties(mmx_iface PROPERTIES ENABLE_EXPORTS 1)
Expand All @@ -244,6 +249,7 @@ if(MSVC)
set_target_properties(mmx_modules PROPERTIES LINK_OPTIONS "/NODEFAULTLIB:LIBCMT")

set_target_properties(mmx_vm PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
set_target_properties(mmx_pos PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
set_target_properties(mmx_db PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)

# Workaround for:
Expand Down Expand Up @@ -307,6 +313,7 @@ install(TARGETS mmx_db DESTINATION lib)
install(TARGETS mmx_vm DESTINATION lib)
install(TARGETS mmx_iface DESTINATION lib)
install(TARGETS mmx_modules DESTINATION lib)
install(FILES ${secp256k1_LIBRARY} DESTINATION lib)

install(TARGETS mmx DESTINATION bin)
install(TARGETS mmx_node DESTINATION bin)
Expand Down
42 changes: 5 additions & 37 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,61 +24,29 @@
"CMAKE_LIBRARY_OUTPUT_DIRECTORY": "${sourceDir}/build/${presetName}/!bin",
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/${presetName}/!bin",

"MMX_WIN_PACK": "$env{MMX_WIN_PACK}",
"MMX_GIGAHORSE": "$env{MMX_GIGAHORSE}"
"MMX_WIN_PACK": "$env{MMX_WIN_PACK}"
}
},

{
"name": "windows-release",
"displayName": "Windows x64 Release",
"description": "Sets Visual Studio generator, build directory",
"name": "windows-default",
"displayName": "Windows x64",
"inherits": "windows-base",
"cacheVariables": {
"MMX_VERSION": "$env{MMX_VERSION}"
},
"warnings": {
"dev": false
}
},

{
"name": "gha-windows-release",
"displayName": "GHA Windows x64 Release",
"description": "Sets Visual Studio generator, build directory",
"inherits": "windows-release",
"environment": {
"VCPKG_ROOT": "./vcpkg"
}
},

{
"name": "windows-debug",
"displayName": "Windows x64 Debug",
"description": "Sets Visual Studio generator, build directory",
"inherits": "windows-base",
"cacheVariables": {
"MMX_VERSION": "$env{MMX_VERSION}"
}
}

],

"buildPresets": [
{
"name": "gha-windows-release",
"configurePreset": "gha-windows-release",
"name": "windows-default",
"configurePreset": "windows-default",
"configuration": "Release"
},
{
"name": "windows-release",
"configurePreset": "windows-release",
"configuration": "Release"
},
{
"name": "windows-debug",
"configurePreset": "windows-release",
"configuration": "Debug"
}
]

Expand Down
14 changes: 5 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ RUN apt-get update && apt-get -y upgrade \
apt-utils \
git \
cmake \
automake \
libtool \
build-essential \
libsecp256k1-dev \
librocksdb-dev \
libsodium-dev \
libminiupnpc-dev \
libjemalloc-dev \
zlib1g-dev \
libgmp-dev \
libzstd-dev \
ocl-icd-opencl-dev \
ccache \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -26,13 +25,10 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y upgrade \
&& apt-get install -y \
apt-utils \
libsecp256k1-0 \
librocksdb6.11 \
libsodium23 \
libminiupnpc17 \
libjemalloc2 \
zlib1g \
libgmp10 \
libzstd1 \
libgomp1 \
ocl-icd-libopencl1 \
curl \
Expand All @@ -46,7 +42,7 @@ ENV MMX_HOME="/data/"
VOLUME /data

# node p2p port
EXPOSE 12339/tcp
EXPOSE 12341/tcp
# http api port
EXPOSE 11380/tcp

Expand Down
2 changes: 1 addition & 1 deletion activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cp "${PASSWD_PATH}" "${MMX_HOME}PASSWD"
if [ -f "${MMX_HOME}NETWORK" ]; then
NETWORK=$(cat "${MMX_HOME}NETWORK")
else
NETWORK=testnet10
NETWORK=testnet11
echo ${NETWORK} > "${MMX_HOME}NETWORK"
fi

Expand Down
1 change: 0 additions & 1 deletion chiapos
Submodule chiapos deleted from 8c7693
1 change: 1 addition & 0 deletions clean_all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

rm -rf build
rm -rf lib/.cache

Loading

0 comments on commit da8737a

Please sign in to comment.