From 7e2d0fcb6bb98593ae16b53a46fb7880a598a8ab Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 9 May 2022 01:44:18 +0200 Subject: [PATCH 1/5] Dockerfile updated, as for official image at sowle/zano-full-node --- utils/docker/Dockerfile | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile index 08f2ffe1..2fe77a64 100644 --- a/utils/docker/Dockerfile +++ b/utils/docker/Dockerfile @@ -44,18 +44,37 @@ RUN curl https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5 cmake --version &&\ rm cmake-3.15.5-Linux-x86_64.sh -# Boost 1.68 -RUN curl https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.bz2 -OL &&\ - echo '7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 boost_1_68_0.tar.bz2' | sha256sum -c - &&\ - tar -xjf boost_1_68_0.tar.bz2 &&\ - rm boost_1_68_0.tar.bz2 &&\ - cd boost_1_68_0 &&\ - ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer &&\ +# Boost 1.70 + +RUN curl https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2 -OL &&\ + echo '430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 boost_1_70_0.tar.bz2' | sha256sum -c - &&\ + tar -xjf boost_1_70_0.tar.bz2 &&\ + rm boost_1_70_0.tar.bz2 &&\ + cd boost_1_70_0 &&\ + ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log &&\ ./b2 &&\ cd .. -ENV BOOST_ROOT=/root/boost_1_68_0 +ENV BOOST_ROOT=/root/boost_1_70_0 + + +# OpenSSL 1.1.1n + +RUN curl https://www.openssl.org/source/openssl-1.1.1n.tar.gz -OL &&\ + echo '40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a openssl-1.1.1n.tar.gz' | sha256sum -c - &&\ + tar xaf openssl-1.1.1n.tar.gz &&\ + rm openssl-1.1.1n.tar.gz &&\ + cd openssl-1.1.1n &&\ + ./config --prefix=/root/openssl --openssldir=/root/openssl shared zlib &&\ + make &&\ + make test &&\ + make install &&\ + cd .. &&\ + rm -rf openssl-1.1.1n + +ENV OPENSSL_ROOT_DIR=/root/openssl + # Zano @@ -63,9 +82,8 @@ RUN pwd && mem_avail_gb=$(( $(getconf _AVPHYS_PAGES) * $(getconf PAGE_SIZE) / (1 make_job_slots=$(( $mem_avail_gb < 4 ? 1 : $mem_avail_gb / 4)) &&\ echo make_job_slots=$make_job_slots &&\ set -x &&\ - git clone --single-branch https://github.com/hyle-team/zano.git &&\ + git clone --single-branch --recursive https://github.com/hyle-team/zano.git &&\ cd zano &&\ - git submodule update --init --recursive &&\ mkdir build && cd build &&\ cmake -D STATIC=TRUE .. &&\ make -j $make_job_slots daemon simplewallet From 0123e311c087f3ccaa2734c84d607288b19583dd Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sat, 14 May 2022 00:00:34 +0200 Subject: [PATCH 2/5] Added get_mining_history API --- src/wallet/wallet2.cpp | 4 ++-- src/wallet/wallet2.h | 2 +- src/wallet/wallet_public_structs_defs.h | 6 ++++++ src/wallet/wallet_rpc_server.cpp | 5 +++++ src/wallet/wallet_rpc_server.h | 2 ++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 26778182..54f88e1e 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3373,11 +3373,11 @@ bool wallet2::is_transfer_okay_for_pos(const transfer_details& tr, uint64_t& sta return true; } //---------------------------------------------------------------------------------------------------- -void wallet2::get_mining_history(wallet_public::mining_history& hist) +void wallet2::get_mining_history(wallet_public::mining_history& hist, uint64_t timestamp_from) { for (auto& tr : m_transfer_history) { - if (currency::is_coinbase(tr.tx) && tr.tx.vin.size() == 2) + if (currency::is_coinbase(tr.tx) && tr.tx.vin.size() == 2 && tr.timestamp > timestamp_from) { tools::wallet_public::mining_history_entry mhe = AUTO_VAL_INIT(mhe); mhe.a = tr.amount; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index e57ff79a..d34cc4e0 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -819,7 +819,7 @@ namespace tools bool reset_history(); bool is_transfer_unlocked(const transfer_details& td) const; bool is_transfer_unlocked(const transfer_details& td, bool for_pos_mining, uint64_t& stake_lock_time) const; - void get_mining_history(wallet_public::mining_history& hist); + void get_mining_history(wallet_public::mining_history& hist, uint64_t timestamp_from = 0); void set_core_runtime_config(const currency::core_runtime_config& pc); currency::core_runtime_config& get_core_runtime_config(); bool backup_keys(const std::string& path); diff --git a/src/wallet/wallet_public_structs_defs.h b/src/wallet/wallet_public_structs_defs.h index 960516db..ce318bf5 100644 --- a/src/wallet/wallet_public_structs_defs.h +++ b/src/wallet/wallet_public_structs_defs.h @@ -318,6 +318,12 @@ namespace wallet_public END_KV_SERIALIZE_MAP() }; + struct COMMAND_RPC_GET_MINING_HISTORY + { + typedef currency::struct_with_one_t_type request; + typedef wallet_public::mining_history response; + }; + #define ORDER_FROM_BEGIN_TO_END "FROM_BEGIN_TO_END" #define ORDER_FROM_FROM_END_TO_BEGIN "FROM_END_TO_BEGIN" diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 43d9625b..dc809096 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -741,6 +741,11 @@ namespace tools return true; } + bool wallet_rpc_server::on_get_mining_history(const wallet_public::COMMAND_RPC_GET_MINING_HISTORY::request& req, wallet_public::COMMAND_RPC_GET_MINING_HISTORY::response& res, epee::json_rpc::error& er, connection_context& cntx) + { + m_wallet.get_mining_history(res, req.v); + return true; + } //------------------------------------------------------------------------------------------------------------------------------ bool wallet_rpc_server::on_contracts_send_proposal(const wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::request& req, wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::response& res, epee::json_rpc::error& er, connection_context& cntx) { diff --git a/src/wallet/wallet_rpc_server.h b/src/wallet/wallet_rpc_server.h index b99420d4..8d1aa084 100644 --- a/src/wallet/wallet_rpc_server.h +++ b/src/wallet/wallet_rpc_server.h @@ -53,6 +53,7 @@ namespace tools MAP_JON_RPC_WE("search_for_transactions", on_search_for_transactions, wallet_public::COMMAND_RPC_SEARCH_FOR_TRANSACTIONS) MAP_JON_RPC_WE("get_restore_info", on_getwallet_restore_info, wallet_public::COMMAND_RPC_GET_WALLET_RESTORE_INFO) MAP_JON_RPC_WE("get_seed_phrase_info", on_get_seed_phrase_info, wallet_public::COMMAND_RPC_GET_SEED_PHRASE_INFO) + MAP_JON_RPC_WE("get_mining_history", on_get_mining_history, wallet_public::COMMAND_RPC_GET_MINING_HISTORY) //contracts API MAP_JON_RPC_WE("contracts_send_proposal", on_contracts_send_proposal, wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL) MAP_JON_RPC_WE("contracts_accept_proposal", on_contracts_accept_proposal, wallet_public::COMMAND_CONTRACTS_ACCEPT_PROPOSAL) @@ -91,6 +92,7 @@ namespace tools bool on_sign_transfer(const wallet_public::COMMAND_SIGN_TRANSFER::request& req, wallet_public::COMMAND_SIGN_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx); bool on_submit_transfer(const wallet_public::COMMAND_SUBMIT_TRANSFER::request& req, wallet_public::COMMAND_SUBMIT_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx); bool on_search_for_transactions(const wallet_public::COMMAND_RPC_SEARCH_FOR_TRANSACTIONS::request& req, wallet_public::COMMAND_RPC_SEARCH_FOR_TRANSACTIONS::response& res, epee::json_rpc::error& er, connection_context& cntx); + bool on_get_mining_history(const wallet_public::COMMAND_RPC_GET_MINING_HISTORY::request& req, wallet_public::COMMAND_RPC_GET_MINING_HISTORY::response& res, epee::json_rpc::error& er, connection_context& cntx); bool on_contracts_send_proposal(const wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::request& req, wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::response& res, epee::json_rpc::error& er, connection_context& cntx); bool on_contracts_accept_proposal(const wallet_public::COMMAND_CONTRACTS_ACCEPT_PROPOSAL::request& req, wallet_public::COMMAND_CONTRACTS_ACCEPT_PROPOSAL::response& res, epee::json_rpc::error& er, connection_context& cntx); From c97ef1431b6f19640e962b0901546a0229ba6f13 Mon Sep 17 00:00:00 2001 From: Snider Date: Wed, 18 May 2022 15:33:24 +0100 Subject: [PATCH 3/5] docker: adjustable library versions (#331) * Adjustable lib versions via docker build args * gha for docker build. * removes the push to repo * moves arg's to the top of the file. * Delete docker-build.yml --- utils/docker/Dockerfile | 109 ++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 39 deletions(-) diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile index 2fe77a64..580c2a31 100644 --- a/utils/docker/Dockerfile +++ b/utils/docker/Dockerfile @@ -17,12 +17,19 @@ # To stop container: # docker stop zanod # +# To build with different lib versions, pass through --build-arg's +# docker build --build-arg OPENSSL_VERSION_DOT=1.1.1n --build-arg OPENSSL_HASH=40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a -f utils/docker/Dockerfile . +# +# Available Build Args +# - CMake Version: CMAKE_VERSION_DOT, CMAKE_HASH +# - Boost Version: BOOST_VERSION, BOOST_VERSION_DOT, BOOST_HASH +# - OpenSSL Version: OPENSSL_VERSION_DOT, OPENSSL_HASH # # Build Zano # -FROM ubuntu:18.04 as zano-build +FROM ubuntu:18.04 as build-prep RUN apt update && \ apt install -y build-essential \ @@ -34,47 +41,71 @@ RUN apt update && \ WORKDIR /root -# CMake 3.15.5 +# Lib Settings +ARG CMAKE_VERSION_DOT=3.15.5 +ARG CMAKE_HASH=62e3e7d134a257e13521e306a9d3d1181ab99af8fcae66699c8f98754fc02dda -RUN curl https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Linux-x86_64.sh -OL &&\ - echo '62e3e7d134a257e13521e306a9d3d1181ab99af8fcae66699c8f98754fc02dda cmake-3.15.5-Linux-x86_64.sh' | sha256sum -c - &&\ - mkdir /opt/cmake &&\ - sh cmake-3.15.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license &&\ - ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake &&\ - cmake --version &&\ - rm cmake-3.15.5-Linux-x86_64.sh +ARG BOOST_VERSION=1_70_0 +ARG BOOST_VERSION_DOT=1.70.0 +ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 +ARG OPENSSL_VERSION_DOT=1.1.1n +ARG OPENSSL_HASH=40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a -# Boost 1.70 - -RUN curl https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2 -OL &&\ - echo '430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 boost_1_70_0.tar.bz2' | sha256sum -c - &&\ - tar -xjf boost_1_70_0.tar.bz2 &&\ - rm boost_1_70_0.tar.bz2 &&\ - cd boost_1_70_0 &&\ - ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log &&\ - ./b2 &&\ - cd .. - -ENV BOOST_ROOT=/root/boost_1_70_0 - - -# OpenSSL 1.1.1n - -RUN curl https://www.openssl.org/source/openssl-1.1.1n.tar.gz -OL &&\ - echo '40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a openssl-1.1.1n.tar.gz' | sha256sum -c - &&\ - tar xaf openssl-1.1.1n.tar.gz &&\ - rm openssl-1.1.1n.tar.gz &&\ - cd openssl-1.1.1n &&\ - ./config --prefix=/root/openssl --openssldir=/root/openssl shared zlib &&\ - make &&\ - make test &&\ - make install &&\ - cd .. &&\ - rm -rf openssl-1.1.1n - +# Environment Variables +ENV BOOST_ROOT /root/boost_${BOOST_VERSION} ENV OPENSSL_ROOT_DIR=/root/openssl +########################################################## +# Split download & compile to use dockers caching layers # +########################################################## + +# Download CMake +RUN set -ex \ + && curl https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.sh -OL\ + && echo "${CMAKE_HASH} cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.sh" | sha256sum -c + +# Download Boost +RUN set -ex \ + && curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \ + && sha256sum boost_${BOOST_VERSION}.tar.bz2 \ + && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c\ + && tar -xvf boost_${BOOST_VERSION}.tar.bz2 + + +# Download OpenSSL +RUN curl https://www.openssl.org/source/openssl-${OPENSSL_VERSION_DOT}.tar.gz -OL \ + && sha256sum openssl-${OPENSSL_VERSION_DOT}.tar.gz \ + && echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION_DOT}.tar.gz" | sha256sum -c + + +# Compile CMake +RUN set -ex \ + && mkdir /opt/cmake \ + && sh cmake-3.15.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license\ + && ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake\ + && cmake --version\ + && rm cmake-3.15.5-Linux-x86_64.sh + +# Compile Boost +RUN set -ex \ + && cd boost_${BOOST_VERSION} \ + && ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log \ + && ./b2 + +# Compile OpenSSL +RUN set -ex \ + && tar xaf openssl-${OPENSSL_VERSION_DOT}.tar.gz \ + && rm openssl-${OPENSSL_VERSION_DOT}.tar.gz \ + && cd openssl-${OPENSSL_VERSION_DOT} \ + && ./config --prefix=/root/openssl --openssldir=/root/openssl shared zlib \ + && make \ + && make test \ + && make install \ + && cd .. \ + && rm -rf openssl-${OPENSSL_VERSION_DOT} + +FROM build-prep as build # Zano @@ -102,8 +133,8 @@ RUN useradd -ms /bin/bash zano &&\ USER zano:zano WORKDIR /home/zano -COPY --chown=zano:zano --from=zano-build /root/zano/build/src/zanod . -COPY --chown=zano:zano --from=zano-build /root/zano/build/src/simplewallet . +COPY --chown=zano:zano --from=build /root/zano/build/src/zanod . +COPY --chown=zano:zano --from=build /root/zano/build/src/simplewallet . # blockchain loaction VOLUME /home/zano/.Zano From 7cf459e9f5fe2eb94b74c1673f086cf35e7fb93d Mon Sep 17 00:00:00 2001 From: ArqTras <33489188+ArqTras@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:55:08 +0200 Subject: [PATCH 4/5] Update README.md (#333) fix for a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6ad2f56..2d2950cb 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ For instance, by adding the following lines to `~/.bashrc` 1. Build GUI: cd zano - utils/build_sript_linux.sh + utils/build_script_linux.sh 7. Look for the binaries in `build` folder From 8dd8e5dbce66669549dd0714423fd6544271349d Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Mon, 1 Aug 2022 17:02:43 +0200 Subject: [PATCH 5/5] Removed dl --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 734f695f..da31da22 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -174,7 +174,7 @@ ENABLE_SHARED_PCH_EXECUTABLE(connectivity_tool) add_executable(simplewallet ${SIMPLEWALLET}) add_dependencies(simplewallet version) -target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} dl) +target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) ENABLE_SHARED_PCH(simplewallet SIMPLEWALLET) ENABLE_SHARED_PCH_EXECUTABLE(simplewallet)