Repository navigation
Description
Follow-up from review of #1367 (G-GOV-03). Three small robustness gaps in the e2e fixtures — none is a live bug, all three degrade diagnosis when something else breaks.
1. The Slashed log scan swallows a decode failure
ChainFixture::challenge_with_real_evidence (and its pre-existing twin in slash_operator_via_judge) does:
for log in receipt.inner.logs() {
if let Ok(ev) = SlashJudge::Slashed::decode_log_data(&log.inner.data) { return Ok(ev.slashId); }
}
anyhow::bail!("{what} mined but emitted no Slashed event")decode_log_data checks topic0 then decodes the body, so a log whose topic0 is Slashed but whose body fails to decode is silently skipped and reported as "emitted no Slashed event" — pointing at the contract when the real cause is an ABI mismatch.
(To be clear: grabbing the wrong Slashed is not a risk. Two are emitted in the same tx — CapacityBond.Slashed and ISlashJudge.Slashed — but their topic0s differ, so check_signature separates them.)
Suggested: find by log.address == slash_judge + topic0, then propagate the decode error with context instead of swallowing it. While there, assert ev.offenseType == offense and ev.evidenceHash == evidence_hash — both are already in hand, and it pins "slashed for the reason we induced" inside the fixture instead of leaving it to each journey.
2. refused_stream misdiagnoses a served response
ClientFixture::channel_context zeroes prior_nonce / prior_bytes_delivered / prior_amount on a channel the earlier fetch already advanced. That is safe only under the assumption the helper is trying to verify — that the node refuses at open. If the induced condition fails to take (an eviction that no-ops, a hash unexpectedly present), the node serves, the first voucher replays nonce 1, the node rejects it, and the helper reports "expected a typed refusal, got: …" — headlining a wrong-error-type problem when the real finding is "the node served when it should have refused".
Suggested: add an explicit UpstreamVoucherRejected arm that says so.
3. Node B's refusal assertion over-claims
In g_gov_03_real_evidence.rs the node-B capture comments that the NotFound proves an honest cache miss, "so the rate really is the only thing that moved between the two messages". StreamError::NotFound cannot establish that: ServeRejectReason::wire_error deliberately collapses seven reasons onto NotFound, including UnknownChannel, OwnerMismatch, and InsufficientDeposit.
If a future set_rate_per_mb regression reset the chain watcher and dropped channel_b, the journey would stay green while testing something weaker than intended — the rate predicate does not care why the stream was refused. The parallel node-A assertion reasons about exactly this hazard and can pin a unique code (EvictedSinceProbe); node B cannot.
Suggested: a second successful client.fetch on channel_b after the reload to prove the channel still works, or read the per-reason metric off the metrics port the fixture already configures.
4. Minor: refusal()'s dead None arm has a backwards message
In crates/client-pull/src/lib.rs, the arm reads "delivery refused with no error code (unvalidated response?)" — but validate() rejects (ok = false, error = None) with MissingStreamError, and both call sites are downstream of an unconditional verify_response. The response is always validated by the time this arm could fire, so the parenthetical is exactly backwards.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix(e2e,client-pull): correct two false doc claims, reuse typed rever…
feat(e2e,client-pull): real daemon responses as on-chain slash eviden…