Remove the large votes flag and batch hashes at the confirm_req and vote limits (#5245) * Remove the large votes rollout flag The disable_large_votes flag lowered the mutable nano::network statics confirm_req_hashes_max and confirm_ack_hashes_max from 255 to 7 and 12. With it set, the vote replier refused any confirm_req of more than 12 pairs, so a peer's request of 13 to 255 pairs went unanswered. The statics go, and the command line option stays so that existing launch commands still parse: `--help` lists it as deprecated and it has no effect. The limits now live on the types that own the wire format: confirm_req::max_hashes for the (hash, root) pairs a request carries, and the existing vote::max_hashes for the hashes of a vote, and so of a confirm_ack. Both message constructors assert against them in place of the bare 256. The confirmation solicitor and the vote replier bound requests by confirm_req::max_hashes, and the vote generator bounds its broadcast batches by vote::max_hashes. * Batch hashes into confirm_reqs and votes at their limits confirm_req::batch_hashes and vote::batch_hashes split a list into the requests or votes it fits, in order, next to the max_hashes each one applies. The confirmation solicitor sends one confirm_req per batch. voting_policy::sign splits its permits over as many votes as they need and every representative signs each of them, so a vote never outgrows vote::max_hashes, whatever a caller passes. The vote replier no longer depends on a full request fitting one vote. The vote tests move out of vote_processor.cpp into their own vote.cpp, next to the new batching tests. * Fix the final-vote check in packed_timestamp and test the vote type packed_timestamp asserted that the maximum timestamp only packs with the final duration, but compared the unmasked argument against timestamp_max, so a timestamp with any low bit set, such as the all-ones marker with a lower duration, packed into a non-final vote at the maximum timestamp. It now compares the masked timestamp. Both of its checks are release asserts, since a vote signed past them carries a timestamp the whole network ranks above every genuine one, and each says what went wrong and with which exponent. hashes_string had no callers, operator!= is synthesized from operator== since C++20, and operator== compares every member, so it is defaulted. The declared copy constructor only suppressed the implicit move. The vote suite covered the batching and little else: of vote.cpp it ran 12 of 22 functions and 11 of 24 branches, and empty_hashes asserted nothing. It now covers the wire format round trip, truncated and over-long streams, what the signed hash does and does not cover, validate against each kind of tampering, equality, the final vote marker, every duration exponent and the JSON form, and death tests pin both packed_timestamp checks. empty_hashes checks that the empty vote validates, serializes to the fixed part alone and reads back equal. The vote_uniquer tests move out of conflicts.cpp, where they had nothing to do with conflicts, next to the type they test, with plain hashes in place of the blocks they built only to hash. * Add is_debug_build beside the platform predicates Code and tests can ask whether debug_assert is compiled in through a consteval predicate, like the sanitizer and platform ones in config.hpp, instead of testing NDEBUG where it matters. Nothing uses it yet. * Move vote from nano/lib to nano/secure A vote is a signed statement about blocks, consensus state like the ledger and the voting policy rather than a plain utility, so it lives in secure with them. nano_messages already links secure, and nothing in nano_lib used the type. The store's db_val converted a database value into a vote for a vote table that no longer exists; the conversion had no callers and goes, which keeps the store below secure. The messages forward header takes its declarations from secure/fwd.hpp, which chains to lib/fwd.hpp. * Document the vote class in the one-line header style Give every function and member of nano::vote a short purpose comment and add a class overview covering what the signature spans, how the timestamp packs the duration exponent and where the hash count lives. Spell out the error conventions of deserialize () and validate () and tell the two digests apart. Drop the cpp comment blocks the header now covers and the TODO on size ().
__________
Type: commit
Hash: f1af0ffb182478b5b821b9f44fb5599a81ca3ac2
Created: today
__________
gr0v1ty/nano-node:f1af0ffb182478b5b821b9f44fb5599a81ca3ac2
| Test Case | Status | Duration | Median Deviation | Log | Graph |
|---|---|---|---|---|---|
| No test results available yet. Check the GitHub test run for job status and logs. | |||||