From 57b30206581fc001f5ff6f4639cc56b5b36f9b91 Mon Sep 17 00:00:00 2001 From: stoffu Date: Wed, 11 May 2022 01:41:00 +0900 Subject: [PATCH 1/4] p2p: add IBD (initial blockchain download) test mode --- src/p2p/net_node.cpp | 2 ++ src/p2p/net_node.h | 3 +++ src/p2p/net_node.inl | 12 ++++++++++++ tests/core_proxy/core_proxy.h | 1 + 4 files changed, 18 insertions(+) diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp index 5dbd7ad9de4..1ee102a24ae 100644 --- a/src/p2p/net_node.cpp +++ b/src/p2p/net_node.cpp @@ -66,5 +66,7 @@ namespace nodetool const command_line::arg_descriptor arg_limit_rate_down = {"limit-rate-down", "set limit-rate-down [kB/s]", -1}; const command_line::arg_descriptor arg_limit_rate = {"limit-rate", "set limit-rate [kB/s]", -1}; + const command_line::arg_descriptor arg_ibd_test = {"ibd-test", "Run in the Initial Blockchain Download test mode, where the daemon stops when reaching the given height (give -1 for synchronizing up to the current top)", 0}; + const command_line::arg_descriptor arg_save_graph = {"save-graph", "Save data for dr aeon", false}; } diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 9073d67217f..b0fac7dbc69 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -292,6 +292,7 @@ namespace nodetool bool m_hide_my_port; bool m_no_igd; bool m_offline; + uint64_t m_ibd_test; std::atomic m_save_graph; std::atomic is_closing; std::unique_ptr mPeersLoggerThread; @@ -356,6 +357,8 @@ namespace nodetool extern const command_line::arg_descriptor arg_limit_rate_down; extern const command_line::arg_descriptor arg_limit_rate; + extern const command_line::arg_descriptor arg_ibd_test; + extern const command_line::arg_descriptor arg_save_graph; } diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 078f3dab42c..44ca8293e9b 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -83,6 +83,7 @@ namespace nodetool command_line::add_arg(desc, arg_limit_rate_up); command_line::add_arg(desc, arg_limit_rate_down); command_line::add_arg(desc, arg_limit_rate); + command_line::add_arg(desc, arg_ibd_test); command_line::add_arg(desc, arg_save_graph); } //----------------------------------------------------------------------------------- @@ -266,6 +267,7 @@ namespace nodetool m_allow_local_ip = command_line::get_arg(vm, arg_p2p_allow_local_ip); m_no_igd = command_line::get_arg(vm, arg_no_igd); m_offline = command_line::get_arg(vm, cryptonote::arg_offline); + m_ibd_test = (uint64_t)command_line::get_arg(vm, arg_ibd_test); if (command_line::has_arg(vm, arg_p2p_add_peer)) { @@ -1324,6 +1326,16 @@ namespace nodetool m_gray_peerlist_housekeeping_interval.do_call(boost::bind(&node_server::gray_peerlist_housekeeping, this)); m_peerlist_store_interval.do_call(boost::bind(&node_server::store_config, this)); m_incoming_connections_interval.do_call(boost::bind(&node_server::check_incoming_connections, this)); + + if (m_ibd_test) + { + if (m_payload_handler.get_core().get_current_blockchain_height() >= m_ibd_test || m_payload_handler.is_synchronized()) + { + MGINFO_GREEN("IBD test done, stopping..."); + send_stop_signal(); + } + } + return true; } //----------------------------------------------------------------------------------- diff --git a/tests/core_proxy/core_proxy.h b/tests/core_proxy/core_proxy.h index 3d46d8a5696..3ab7306af3e 100644 --- a/tests/core_proxy/core_proxy.h +++ b/tests/core_proxy/core_proxy.h @@ -104,5 +104,6 @@ namespace tests cryptonote::difficulty_type get_block_cumulative_difficulty(uint64_t height) const { return 0; } bool fluffy_blocks_enabled() const { return false; } uint64_t prevalidate_block_hashes(uint64_t height, const std::vector &hashes) { return 0; } + void stop() {} }; } From 4546a7d618182c2cf2142a9dcbec8eae3ab4902d Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 23 Apr 2019 00:25:36 +0000 Subject: [PATCH 2/4] daemonizer: add --non-interactive for windows monero/#5480 The RPC functional tests need it Thanks to iDunk for debugging/testing --- src/daemonizer/windows_daemonizer.inl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/daemonizer/windows_daemonizer.inl b/src/daemonizer/windows_daemonizer.inl index 3690635c20e..8857373583a 100644 --- a/src/daemonizer/windows_daemonizer.inl +++ b/src/daemonizer/windows_daemonizer.inl @@ -61,6 +61,10 @@ namespace daemonizer "run-as-service" , "Hidden -- true if running as windows service" }; + const command_line::arg_descriptor arg_non_interactive = { + "non-interactive" + , "Run non-interactive" + }; std::string get_argument_string(int argc, char const * argv[]) { @@ -83,6 +87,7 @@ namespace daemonizer command_line::add_arg(normal_options, arg_start_service); command_line::add_arg(normal_options, arg_stop_service); command_line::add_arg(hidden_options, arg_is_service); + command_line::add_arg(hidden_options, arg_non_interactive); } inline boost::filesystem::path get_default_data_dir() @@ -177,7 +182,10 @@ namespace daemonizer else // interactive { //LOG_PRINT_L0("Aeon '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL); - return executor.run_interactive(vm); + if (command_line::has_arg(vm, arg_non_interactive)) + return executor.run_non_interactive(vm); + else + return executor.run_interactive(vm); } return false; From acd3364a2be2ac1b23e1d18fa498ba6684c05969 Mon Sep 17 00:00:00 2001 From: stoffu Date: Fri, 11 Mar 2022 10:42:44 +0900 Subject: [PATCH 3/4] workflows: add IBD test --- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a378c812d6a..c0eb9b12d62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -161,3 +161,75 @@ jobs: env: CTEST_OUTPUT_ON_FAILURE: ON run: make release-test -j3 + + + + ibdtest-macos: + needs: build-macos + runs-on: macOS-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 0 + - name: determine artifact name + run: | + export ARTIFACT_NAME="aeon-mac-x64-$(git describe --tags)" + echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV + - uses: actions/download-artifact@v3 + with: + name: ${{ env.ARTIFACT_NAME }}.tar.bz2 + - name: extract & install + run: | + tar xvf $ARTIFACT_NAME.tar.bz2 + sudo cp $ARTIFACT_NAME/* /usr/local/bin + - name: run IBD test + run: aeond --non-interactive --ibd-test -1 + + ibdtest-windows: + needs: build-windows + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 0 + - uses: eine/setup-msys2@v2 + with: + update: true + install: mingw-w64-x86_64-toolchain git unzip curl + - name: determine artifact name + run: | + export ARTIFACT_NAME="aeon-win-x64-$(git describe --tags)" + echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV + - uses: actions/download-artifact@v3 + with: + name: ${{ env.ARTIFACT_NAME }}.zip + - name: extract & install + run: | + unzip $ARTIFACT_NAME.zip + cp $ARTIFACT_NAME/* /usr/bin + - name: run IBD test + run: aeond --non-interactive --ibd-test -1 + + ibdtest-ubuntu: + needs: build-ubuntu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 0 + - name: determine artifact name + run: | + export ARTIFACT_NAME="aeon-linux-x64-$(git describe --tags)" + echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV + - uses: actions/download-artifact@v3 + with: + name: ${{ env.ARTIFACT_NAME }}.tar.bz2 + - name: extract & install + run: | + tar xvf $ARTIFACT_NAME.tar.bz2 + sudo cp $ARTIFACT_NAME/* /usr/local/bin + - name: run IBD test + run: aeond --non-interactive --ibd-test -1 From 6388f5263106b6e2b084d6d4f6840e1d03b795b9 Mon Sep 17 00:00:00 2001 From: stoffu Date: Sat, 7 May 2022 06:33:43 +0900 Subject: [PATCH 4/4] cryptonote_protocol_handler: temporary easy workaround for the daemon stuck issue will hopefully be fixed properly by monero/#4843 --- src/cryptonote_protocol/cryptonote_protocol_handler.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index c5f4ff26242..397d35e7ba1 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -1552,7 +1552,7 @@ skip: m_core.get_short_chain_history(r.block_ids); CHECK_AND_ASSERT_MES(!r.block_ids.empty(), false, "Short chain history is empty"); - if (!start_from_current_chain) + if (!start_from_current_chain && false) { // we'll want to start off from where we are on that peer, which may not be added yet if (context.m_last_known_hash != crypto::null_hash && r.block_ids.front() != context.m_last_known_hash)