diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 835c41138..ed23e7050 100644 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -52,6 +52,7 @@ lines under the new release. | #164 | api: `ContractAllMethodsGet` now returns the annotations the executor reports for each method and argument (`@Getter`, `@UsingContract`, `@ContractAddress`, `@ContractMethod`, in the IDL fields `MethodDescription.annotations` and `MethodArgument.annotations` that were always left empty), so a client can tell a getter; ci: `contracts.py` checks the `@Getter` methods of `samples/contracts/Counter.java` | | #165 | api: a CS payment to a payable contract was recorded as a contract deployed by the payer, and `SmartContractsListGet` / `SmartContractAddressesListGet` failed on every page holding one ("No more data to read"); only a transaction carrying an invocation now counts as a deploy in that list (API only, `SmartContracts::is_deploy` and consensus unchanged); ci: `contracts.py` pays `samples/contracts/TipJar.java` and checks the lists and the payments in `TransactionsGet` | | #167 | solver: stage-3 diagnostics at info level, logging only: what this node signed (`stage3 inputs`: sequence, previous hash, timestamp, reward, hashes of the transactions and fees, the three signed hashes), why a peer's stage 3 failed (another block/round hash or a key/message mismatch), the agree/disagree split among the confidants, the keys a round package gray-lists (`OWN KEY` when ours is one), the counts on "not enough active confidants", and the block on "signatures of the block are insufficient" (now a warning); see [consensus-diagnostics.md](consensus-diagnostics.md) | +| #168 | solver: the `stage3 inputs` line of #167 is logged at info level only when a stage-3 check fails (once per iteration, before the first `stage3 check failed`), at debug level every round, so a healthy node logs none of the stage-3 diagnostics | ## community.16 — 2026-11-03 diff --git a/docs/consensus-diagnostics.md b/docs/consensus-diagnostics.md index d531cb235..54936040c 100644 --- a/docs/consensus-diagnostics.md +++ b/docs/consensus-diagnostics.md @@ -15,12 +15,15 @@ the next round table and the hash of the next confidant list, and sends the thre without the hashes. A receiver checks each signature against **its own** three hashes. When a signature fails, either the key or message is wrong, or the sender built a different block or round table. The lines below, at info level (no debug log needed), tell these cases apart and -show which input differed. They are written only to the log: nothing is signed, sent or stored +show which input differed. They appear only when something goes wrong (a failed check, a +gray-listing, a missing majority): a node in a healthy network logs none of them. They are written only to the log: nothing is signed, sent or stored differently, and the consensus result is the same as without them. ## 1. What this node signed: `stage3 inputs` -One line per stage 3 sent by this node: +What this node put into the hashes it signed. It is logged at info level once per iteration, just +before the first `stage3 check failed` line, so both sides of a split print it for the same round; +at debug level it is logged for every stage 3: ``` info SolverCore: stage3 inputs: R-37 iter=0 seq=37 prev=7C839893 ts=1793783441147 reward=- tx=1 diff --git a/solver/include/solver/solvercore.hpp b/solver/include/solver/solvercore.hpp index 9cb52e5c9..e888e5050 100644 --- a/solver/include/solver/solvercore.hpp +++ b/solver/include/solver/solvercore.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include // forward declarations @@ -332,6 +333,9 @@ class SolverCore { // diagnostics only (never sent or stored): stage-3 final-check failures of the current // iteration as (sender index, failure pattern bits), used to log the agree/disagree split std::vector> stage3Failures_; + // diagnostics only: the "stage3 inputs" line of our last stage 3, logged at info level only when + // a peer's stage 3 fails the final check (at debug level every round) + std::string stage3InputsLine_; bool realTrustedChanged_; cs::Bytes tempRealTrusted_; diff --git a/solver/src/solvercore.cpp b/solver/src/solvercore.cpp index f650cca14..4084eb2ec 100644 --- a/solver/src/solvercore.cpp +++ b/solver/src/solvercore.cpp @@ -627,10 +627,12 @@ void SolverCore::spawn_next_round(const cs::PublicKeys& nodes, const cs::Packets csdebug() << "NODE> StageThree prepared:" << std::endl << cs::StageThree::toString(stage3); - // Diagnostics only (one info line per stage 3): the inputs that went into our block/round hashes. - // Stage-3 carries signatures but no hashes, so a receiver that fails "Block/Round Signatures are - // not valid" cannot see what the sender signed; comparing this line between nodes for the same - // round shows which input differed. Read-only: nothing below is signed, sent or stored. + // Diagnostics only: the inputs that went into our block/round hashes. Stage-3 carries signatures + // but no hashes, so a receiver that fails "Block/Round Signatures are not valid" cannot see what + // the sender signed; comparing this line between nodes for the same round shows which input + // differed. Kept for the round and logged at info level only when a peer's stage 3 fails the + // final check (logStage3Failure), at debug level every round. Read-only: nothing below is + // signed, sent or stored. { const csdb::Pool& blk = deferredBlock_; const auto& trxs = blk.transactions(); @@ -662,7 +664,8 @@ void SolverCore::spawn_next_round(const cs::PublicKeys& nodes, const cs::Packets const cs::Bytes prevHash = blk.previous_hash().to_binary(); const cs::PoolMetaInfo& meta = justCreatedRoundPackage_.poolMetaInfo(); - cslog() << log_prefix << "stage3 inputs: R-" << conveyer.currentRoundNumber() + std::ostringstream line; + line << "stage3 inputs: R-" << conveyer.currentRoundNumber() << " iter=" << static_cast(stage3.iteration) << " seq=" << seq << " prev=" << short8(prevHash.data(), prevHash.size()) @@ -680,6 +683,8 @@ void SolverCore::spawn_next_round(const cs::PublicKeys& nodes, const cs::Packets << " round=" << short8(stage3.roundHash.data(), stage3.roundHash.size()) << " trusted=" << short8(stage3.trustedHash.data(), stage3.trustedHash.size()) << " mask=" << cs::TrustedMask::toString(stage3.realTrustedMask); + stage3InputsLine_ = line.str(); + csdebug() << log_prefix << stage3InputsLine_; } } diff --git a/solver/src/solverinterface.cpp b/solver/src/solverinterface.cpp index 371dc3321..409e0acea 100644 --- a/solver/src/solverinterface.cpp +++ b/solver/src/solverinterface.cpp @@ -202,6 +202,7 @@ void SolverCore::nextRound(bool updateRound) { stageThreeStorage.clear(); trueStageThreeStorage.clear(); stage3Failures_.clear(); + stage3InputsLine_.clear(); trusted_candidates.clear(); realTrustedChanged_ = false; tempRealTrusted_.clear(); @@ -511,6 +512,10 @@ void SolverCore::logStage3Failure(const cs::StageThree& stageFrom, uint8_t patte return; // already counted in this iteration } } + if (stage3Failures_.empty() && !stage3InputsLine_.empty()) { + // the first failure of the iteration: what we signed, to compare with the other side's line + cslog() << kLogPrefix_ << stage3InputsLine_; + } stage3Failures_.emplace_back(stageFrom.sender, pattern); if (stage3Failures_.size() > kS3SplitMaxFailures) { if (stage3Failures_.size() == kS3SplitMaxFailures + 1) {