Skip to content

incentive: stale comment claims this alloy build ships no Asserter/MockProvider, deferring real test coverage #1356

Closed as not planned

Description

@yigitdot

What

crates/incentive/src/swap_balancer.rs:509-512:

// swap *reverts on-chain*, and the two follow-up resets are then observed —
// needs an anvil / mock-transport harness this crate does not have (no anvil
// dev-dep, and this alloy build ships no `Asserter`/`MockProvider`).
// Deferred rather than faked.

The parenthetical is false. alloy::providers::mock::Asserter + ProviderBuilder::new().connect_mocked_client(...) is available in the pinned alloy version and already used in six places:

  • crates/node/src/blacklist_watcher.rs:894, 947, 1088
  • crates/node/src/chain_events/resumable_watcher.rs:994, 1049, 1081

Why it matters

This is a comment that caused a coverage gap rather than merely describing one: the stated reason for deferring the balancer swap-revert test does not hold, so the test was skipped on a false premise. It also misinformed the review of #1353 — I took it at face value when scoping that work and assumed no mock infrastructure existed, until a reviewer checked. A wrong claim in a comment that justifies not writing a test will keep doing that to whoever reads it next.

Fix

  1. Correct or delete the parenthetical.
  2. Re-evaluate whether the deferred swap-revert coverage is now writable with Asserter. The pattern that fits is a static, ordered response queue — see resumable_watcher.rs:994 for the idiom, and crates/cli/src/commands/unbond.rs mod plan_computation (added in feat(cli): add decdn node unbond + G-NODE-06 journey (#1033) #1353) for a contract-view example where queueing exact response counts doubles as an assertion about which reads happen.
  3. Grep for other comments asserting the same thing.

Pre-existing; not caused by #1353.

Activity

  1. added
    kind:test
    rust
    prio:low
    on Jul 21, 2026
  2. self-assigned this
    on Jul 21, 2026
  3. thiras commented on Jul 21, 2026

    @thiras
    Contributor

    Duplicate of #1347 — same two comments (swap_uniswap.rs / swap_balancer.rs), same false parenthetical about this alloy build shipping no Asserter/MockProvider.

    Closing in favour of #1347, which stays open for the remaining half of the work. Part 1 (correcting the comments) landed in #1358; part 2 (actually writing the deferred swap-revert tests, now that the stated reason for skipping them is gone) is still to do.

    Worth preserving from this issue, since #1347 doesn't say it as directly: the framing that this was a comment that caused a coverage gap rather than describing one — the test was skipped on a premise that was never true. That is why the fix corrects the claim in place rather than just deleting the note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:testprio:lowrust

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions