Skip to content

Commit

Permalink
Merge pull request monero-project#267 from stoffu/aeon-ibd-test
Browse files Browse the repository at this point in the history
IBD (Initial Blockchain Download) testing
  • Loading branch information
aeonix committed May 16, 2022
2 parents 88d374b + 6388f52 commit 7178eec
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 2 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/cryptonote_protocol/cryptonote_protocol_handler.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 9 additions & 1 deletion src/daemonizer/windows_daemonizer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ namespace daemonizer
"run-as-service"
, "Hidden -- true if running as windows service"
};
const command_line::arg_descriptor<bool> arg_non_interactive = {
"non-interactive"
, "Run non-interactive"
};

std::string get_argument_string(int argc, char const * argv[])
{
Expand All @@ -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()
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/p2p/net_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ namespace nodetool
const command_line::arg_descriptor<int64_t> arg_limit_rate_down = {"limit-rate-down", "set limit-rate-down [kB/s]", -1};
const command_line::arg_descriptor<int64_t> arg_limit_rate = {"limit-rate", "set limit-rate [kB/s]", -1};

const command_line::arg_descriptor<int64_t> 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<bool> arg_save_graph = {"save-graph", "Save data for dr aeon", false};
}
3 changes: 3 additions & 0 deletions src/p2p/net_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> m_save_graph;
std::atomic<bool> is_closing;
std::unique_ptr<boost::thread> mPeersLoggerThread;
Expand Down Expand Up @@ -356,6 +357,8 @@ namespace nodetool
extern const command_line::arg_descriptor<int64_t> arg_limit_rate_down;
extern const command_line::arg_descriptor<int64_t> arg_limit_rate;

extern const command_line::arg_descriptor<int64_t> arg_ibd_test;

extern const command_line::arg_descriptor<bool> arg_save_graph;
}

Expand Down
12 changes: 12 additions & 0 deletions src/p2p/net_node.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
//-----------------------------------------------------------------------------------
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -1324,6 +1326,16 @@ namespace nodetool
m_gray_peerlist_housekeeping_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::gray_peerlist_housekeeping, this));
m_peerlist_store_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::store_config, this));
m_incoming_connections_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::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;
}
//-----------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions tests/core_proxy/core_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<crypto::hash> &hashes) { return 0; }
void stop() {}
};
}

0 comments on commit 7178eec

Please sign in to comment.