From 89c68338453f53b942500b3c8affab3075fa9d30 Mon Sep 17 00:00:00 2001 From: Snider Date: Wed, 1 Oct 2025 18:04:44 +0100 Subject: [PATCH] Switch to conanfile.py, update build scripts and genesis data Replaces conanfile.txt with conanfile.py for improved Conan package management. Updates Makefile and CMakeLists.txt to align with new Conan workflow and build folder structure. Increases premine amount in default.cmake and updates genesis transaction data. Comments out a hardcoded seed node in net_node.inl. --- CMakeLists.txt | 2 +- Makefile | 11 ++++--- conanfile.py | 47 +++++++++++++++++++++++++++++ conanfile.txt | 10 ------ src/config/default.cmake | 2 +- src/genesis/_genesis_acc_tn.cpp.gen | 2 +- src/genesis/_genesis_tn.cpp.gen | 2 +- src/p2p/net_node.inl | 2 +- 8 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e301d0c..d1ea8bea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ endif() set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers") set(DISABLE_TOR FALSE CACHE BOOL "Disable TOR library(and related tor-connect submodule)") -set(TESTNET FALSE CACHE BOOL "Compile for testnet") +set(TESTNET 0 CACHE BOOL "Build TESTNET") set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon") set(USE_BITCOIN_SECP256K1_FOR_ECDSA FALSE CACHE BOOL "Use bitcoin-secp256k1 library for validating ECDSA(instead of OpenSSL)") if(NOT USE_BITCOIN_SECP256K1_FOR_ECDSA) diff --git a/Makefile b/Makefile index 8d6a3327..3e3d72ef 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ TESTNET:= 0 STATIC:= 0 BUILD_TYPE ?=Release BUILD_VERSION:=6.0.1 +BUILD_FOLDER:=build/Release # ----------------------------------------------------------------- # Unix‑like systems (Linux, macOS, *BSD, etc.) @@ -82,11 +83,11 @@ CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile all: help release: conan-profile-detect - @echo "Building profile: release $(TESTNET)" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=$(BUILD_TYPE) - cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) - cmake --build build/release --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) - (cd build/release && cpack) + @echo "Building profile: $(BUILD_TYPE) testnet=$(TESTNET)" + CONAN_HOME=$(CONAN_CACHE) conan install . --build=missing -s build_type=$(BUILD_TYPE) + cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) + cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) + (cd $(BUILD_FOLDER) && cpack) debug: conan-profile-detect @echo "Building profile: debug" diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000..e7885501 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,47 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain, CMake + + +class BlockchainConan(ConanFile): + name = "blockchain" + version = "6.0.1" + settings = "os", "compiler", "build_type", "arch" + + options = { + "static": [True, False], + "testnet": [True, False] + } + default_options = { + "static": False, + "testnet": False + } + + requires = [ + "zlib/1.3.1", + "boost/1.85.0", + "openssl/3.2.0", + "miniupnpc/2.2.5", + "jwt-cpp/0.7.1" + ] + + def generate(self): + tc = CMakeToolchain(self) + tc.user_presets_path = False + tc.variables["STATIC"] = self.options.static + tc.variables["TESTNET"] = self.options.testnet + # tc.preprocessor_definitions["TESTNET"] = None + # tc.variables["BUILD_VERSION"] = self.options.build_version + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 1103965d..00000000 --- a/conanfile.txt +++ /dev/null @@ -1,10 +0,0 @@ -[requires] -zlib/1.3.1 -boost/1.85.0 -openssl/3.2.0 -miniupnpc/2.2.5 -jwt-cpp/0.7.1 - -[generators] -CMakeDeps -CMakeToolchain diff --git a/src/config/default.cmake b/src/config/default.cmake index 5c9fbe1f..56929c50 100644 --- a/src/config/default.cmake +++ b/src/config/default.cmake @@ -1,6 +1,6 @@ # Tokenomics set(coin 1000000000000 CACHE STRING "COIN" ) -set(premine_amount 4000000000000000000 CACHE STRING "PREMINE_AMOUNT" ) +set(premine_amount 10000000000000000000 CACHE STRING "PREMINE_AMOUNT" ) set(tx_default_fee 10000000000 CACHE STRING "TX_DEFAULT_FEE" ) set(tx_minimum_fee 10000000000 CACHE STRING "TX_MINIMUM_FEE" ) set(currency_block_reward 1000000000000 CACHE STRING "CURRENCY_BLOCK_REWARD" ) diff --git a/src/genesis/_genesis_acc_tn.cpp.gen b/src/genesis/_genesis_acc_tn.cpp.gen index 1cb443d5..6add48fe 100644 --- a/src/genesis/_genesis_acc_tn.cpp.gen +++ b/src/genesis/_genesis_acc_tn.cpp.gen @@ -1,4 +1,4 @@ -const std::string ggenesis_tx_pub_key_str = "6f7fbc7dfa2809974084b92e8930353b7e93f8759979ff037984a1837fb3948a"; +const std::string ggenesis_tx_pub_key_str = "f971f914382e875df5655f591c8df7b126d95f5e8331613ba3f5c797f541839c"; const crypto::public_key ggenesis_tx_pub_key = epee::string_tools::parse_tpod_from_hex_string(ggenesis_tx_pub_key_str); extern const genesis_tx_dictionary_entry ggenesis_dict[1]; const genesis_tx_dictionary_entry ggenesis_dict[1] = { diff --git a/src/genesis/_genesis_tn.cpp.gen b/src/genesis/_genesis_tn.cpp.gen index a69f3962..55bc3608 100644 --- a/src/genesis/_genesis_tn.cpp.gen +++ b/src/genesis/_genesis_tn.cpp.gen @@ -1,3 +1,3 @@ const genesis_tx_raw_data ggenesis_tx_raw = {{ -0xa080800100000101,0x03018ae3c8e0c8cf,0xa0a1421a26cc1373,0x73787ce6cb72c402,0x3fda9ba544cff9e4,0xa0e3d415d65186dd,0xfa7dbc7f6f160500,0x892eb98440970928,0x9975f8937e3b3530,0x7f83a1847903ff79,0x2074496b138a94b3,0x64612073656b6174,0x20656761746e6176,0x6e2065687420666f,0x666f206572757461,0x616d726f666e6920,0x696562206e6f6974,0x207973616520676e,0x6165727073206f74,0x6168207475622064,0x7473206f74206472,0x202d202e656c6669,0x206968736f746153,0x6f746f6d616b614e,0x0a0eddbc020b0015}, +0xa080800100000101,0x03018ae3c8e0c8cf,0x7b0287d2a2218485,0x720c5b385edbe3dd,0x178e7c64d18a598f,0x98bb613ff63e6d03,0x3814f971f9160500,0x1c595f65f55d872e,0x835e5fd926b1f78d,0xf597c7f5a33b6131,0x2074496b139c8341,0x64612073656b6174,0x20656761746e6176,0x6e2065687420666f,0x666f206572757461,0x616d726f666e6920,0x696562206e6f6974,0x207973616520676e,0x6165727073206f74,0x6168207475622064,0x7473206f74206472,0x202d202e656c6669,0x206968736f746153,0x6f746f6d616b614e,0x0a0e0d66020b0015}, {0x00,0x00}}; diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 2f1df0e2..17f4a28b 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -434,7 +434,7 @@ namespace nodetool { #ifndef TESTNET //TODO: - ADD_HARDCODED_SEED_NODE(std::string("0.0.0.0:") + std::to_string(P2P_DEFAULT_PORT)); + // ADD_HARDCODED_SEED_NODE(std::string("0.0.0.0:") + std::to_string(P2P_DEFAULT_PORT)); ADD_HARDCODED_SEED_NODE("116.202.82.115", P2P_DEFAULT_PORT); //ADD_HARDCODED_SEED_NODE("94.130.137.230", P2P_DEFAULT_PORT); //ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT);