Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change -t to wire size computation, node default to witness config. #684

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 78 additions & 76 deletions console/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,72 +736,39 @@ void executor::scan_collisions() const
// arbitrary testing (const).
void executor::read_test() const
{
auto start = fine_clock::now();
auto count = query_.header_records();
uint32_t block{ one };

logger("Find strong blocks.");
while (!cancel_ && (block < count) && query_.is_strong_block(block))
{
++block;
}

auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Top strong block is [%1%] in [%2%] ms.") % sub1(block) % span.count());
start = fine_clock::now();
count = query_.header_records();
uint32_t milestone{ 295'001 };

logger("Find milestone blocks.");
while (!cancel_ && (milestone < count) && query_.is_milestone(milestone))
{
++milestone;
}

span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Top milestone block is [%1%] in [%2%] ms.") % sub1(milestone) % span.count());
start = fine_clock::now();
uint32_t tx{ one };

logger("Find strong txs.");
count = query_.tx_records();
while (!cancel_ && (tx < count) && query_.is_strong_tx(tx) )
{
++tx;
}

span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Top strong tx is [%1%] in [%2%] ms.") % sub1(tx) % span.count());
}

#if defined(UNDEFINED)

void executor::read_test() const
{
const auto from = 481'824_u32;
const auto top = 840'000_u32; ////query_.get_top_associated();
logger("Wire size computation.");
const auto start = fine_clock::now();

// segwit activation
uint32_t block{ from };
size_t total{};
////constexpr auto last = 500'000_size;
const auto last = query_.get_top_candidate();

logger("Get all coinbases.");
while (!cancel_ && (block <= top))
size_t size{};
for (auto height = zero; !cancel_ && height <= last; ++height)
{
const auto count = query_.get_tx_count(query_.to_candidate(block++));
if (is_zero(count))
const auto link = query_.to_candidate(height);
if (link.is_terminal())
{
logger(format("Max candidate height is (%1%).") % sub1(height));
return;
}

total += system::ceilinged_log2(count);
const auto bytes = query_.get_block_size(link);
if (is_zero(bytes))
{
logger(format("Block (%1%) is not associated.") % height);
return;
}

size += bytes;
}

const auto average = total / (top - from);
const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Total block depths [%1%] to [%2%] avg [%3%] in [%4%] ms.")
% total % top % average % span.count());
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
size % last % span.count());
}

#if defined(UNDEFINED)

void executor::read_test() const
{
constexpr auto start_tx = 15'000_u32;
Expand Down Expand Up @@ -1035,7 +1002,7 @@ void executor::read_test() const
outs.size() % keys.size() % span.count());

// Write it all...
#if defined(UNDEFINED)
#if !defined(UNDEFINED)
logger(
"output_script_hash, "
"output_fk, "
Expand All @@ -1056,7 +1023,7 @@ void executor::read_test() const

"input_bk_fk, "
"input_bk_hash, "
"sinput_bk_height, "
"input_bk_height, "

"output_script "
"input_script, "
Expand Down Expand Up @@ -1102,33 +1069,68 @@ void executor::read_test() const

void executor::read_test() const
{
logger("Wire size computation.");
const auto start = fine_clock::now();
constexpr auto last = 500'000_size;
auto start = fine_clock::now();
auto count = query_.header_records();
uint32_t block{ one };

size_t size{};
for (auto height = zero; !cancel_ && height <= last; ++height)
logger("Find strong blocks.");
while (!cancel_ && (block < count) && query_.is_strong_block(block))
{
const auto link = query_.to_candidate(height);
if (link.is_terminal())
{
logger(format("Max candidate height is (%1%).") % sub1(height));
return;
}
++block;
}

const auto bytes = query_.get_block_size(link);
if (is_zero(bytes))
{
logger(format("Block (%1%) is not associated.") % height);
auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Top strong block is [%1%] in [%2%] ms.") % sub1(block) % span.count());
start = fine_clock::now();
count = query_.header_records();
uint32_t milestone{ 295'001 };

logger("Find milestone blocks.");
while (!cancel_ && (milestone < count) && query_.is_milestone(milestone))
{
++milestone;
}

span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Top milestone block is [%1%] in [%2%] ms.") % sub1(milestone) % span.count());
start = fine_clock::now();
uint32_t tx{ one };

logger("Find strong txs.");
count = query_.tx_records();
while (!cancel_ && (tx < count) && query_.is_strong_tx(tx))
{
++tx;
}

span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Top strong tx is [%1%] in [%2%] ms.") % sub1(tx) % span.count());
}

void executor::read_test() const
{
const auto from = 481'824_u32;
const auto top = 840'000_u32; ////query_.get_top_associated();
const auto start = fine_clock::now();

// segwit activation
uint32_t block{ from };
size_t total{};

logger("Get all coinbases.");
while (!cancel_ && (block <= top))
{
const auto count = query_.get_tx_count(query_.to_candidate(block++));
if (is_zero(count))
return;
}

size += bytes;
total += system::ceilinged_log2(count);
}

const auto average = total / (top - from);
const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
size % last % span.count());
logger(format("Total block depths [%1%] to [%2%] avg [%3%] in [%4%] ms.")
% total % top % average % span.count());
}

void executor::read_test() const
Expand Down
16 changes: 6 additions & 10 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ parser::parser(system::chain::selection context) NOEXCEPT
configured.network.outbound_connections = 100;
configured.network.protocol_minimum = level::headers_protocol;
configured.network.protocol_maximum = level::bip130;
configured.network.services_minimum = service::node_network;
configured.network.services_maximum = service::node_network |

// services_minimum must be node_witness to be a witness node.
configured.network.services_minimum = service::node_network |
service::node_witness;
configured.network.services_maximum = service::node_network |
service::node_witness;

// database
Expand Down Expand Up @@ -123,13 +126,6 @@ parser::parser(system::chain::selection context) NOEXCEPT
configured.database.neutrino_buckets = 0;
configured.database.neutrino_size = 1;
configured.database.neutrino_rate = 5;

////configured.database.buffer_buckets = 100;
////configured.database.buffer_size = 1;
////configured.database.buffer_rate = 5;

////configured.database.bootstrap_size = 1;
////configured.database.bootstrap_rate = 5;
}

options_metadata parser::load_options() THROWS
Expand Down Expand Up @@ -486,7 +482,7 @@ options_metadata parser::load_settings() THROWS
(
"network.services_minimum",
value<uint64_t>(&configured.network.services_minimum),
"The minimum services exposed by network connections, defaults to 1 (full node)."
"The minimum services exposed by network connections, defaults to 9 (full node, witness)."
)
(
"network.invalid_services",
Expand Down
Loading