Skip to content

fix: name pool close/reclaim estimation reverts and drop "on-chain" - #2428

Merged
thiras merged 1 commit into
mainfrom
fix/pool-estimation-revert
Oct 12, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/pool-estimation-revert

Conversation

@thiras

@thiras thiras commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

What

A closePool or reclaim send that carries revert data was rejected at gas estimation, so nothing was broadcast. The CLI said "reverted on-chain" and dropped the error, so the operator could not see which PaymentPool error fired.

  • close_and_forget / reclaim_and_forget route the revert-data arm through a new send_reverted. It keeps the source error (raw revert data, any Error(string) reason), says "rejected at gas estimation; nothing was sent", and names the decoded error with a hint: PoolNotOpen() (concurrent close), NotPoolOwner(), PoolNotClosing() (concurrent reclaim), GraceWindowActive().
  • A reclaim estimation revert with an unknown selector points at the USDC refund transfer. A concurrent reclaim would have decoded as PoolNotClosing(), so the old "most likely a concurrent reclaim" guess now stays only on the mined revert (reclaim_reverted), which carries no revert data.
  • decdn-incentive gains PoolLifecycleRevert (selector decoder + signature() from the sol! constants) in pool_open_error.rs; is_pool_not_open delegates to it. Also fixes that file's PoolNotOpen doc, which named a nonexistent assignCapability.
  • CHANGELOG Fixed entry.

Closes #2426
Closes #2417

Reviewer notes

  • The production provider has the recommended fillers, so revert data on send() comes from eth_estimateGas. The tests use the filler-free mock from fix: warn when a failed pool send may have broadcast #2424, where the canned revert answers eth_sendTransaction; both surface as the same ErrorResp.
  • The per-error hints stay in the CLI; the library type carries only the contract meaning.
  • Not in this PR: nothing pins the Rust error selectors to PaymentPool.sol's ABI (true of is_pool_not_open already). Candidate follow-up in crates/e2e/tests/payment_pool_probe_selector.rs.

Verification

  • cargo fmt -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings, and the cargo doc gate
  • cargo nextest run -p decdn-incentive -p decdn-cli: 1233 passed. New mocked-provider tests cover each of the four errors plus an unknown selector at both sites; mutation-checked by deleting the close guard arm (both close tests fail).
  • contracts/ changed: n/a
  • User-visible change: CHANGELOG.md entry added
  • Design change: n/a
  • PR title uses an allowed type with a lowercase subject

🤖 Generated with Claude Code

A `closePool` or `reclaim` send that carries revert data was rejected at
gas estimation, so nothing was broadcast. The CLI said it "reverted
on-chain" and dropped the error. Route both arms through `send_reverted`,
which keeps the source error, says nothing was sent, and names the
decoded `PaymentPool` error (`PoolNotOpen()`, `NotPoolOwner()`,
`PoolNotClosing()`, `GraceWindowActive()`) with its likely cause. A
`reclaim` estimation revert with any other selector points at the USDC
refund transfer; the concurrent-reclaim guess stays on the mined revert,
which carries no revert data.

`decdn-incentive` gains `PoolLifecycleRevert`, a selector decoder beside
`is_pool_not_open`, which now delegates to it.

Closes #2426
Closes #2417

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 09:29
@thiras thiras self-assigned this Oct 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the contract behavior and includes comprehensive regression coverage.

0 open findings

What changed in this PR

Improves pool lifecycle revert diagnostics by distinguishing gas-estimation rejection from mined reverts.

Changes:

  • Decodes four PaymentPool lifecycle errors.
  • Preserves revert details and provides actionable CLI hints.
  • Adds focused decoder and mocked-provider tests.
File Description
CHANGELOG.md Documents the corrected diagnostics.
crates/​cli/​src/​commands/​pool.rs Handles estimation reverts with decoded causes.
crates/​cli/​src/​commands/​pool/​tests.rs Tests known and unknown revert selectors.
crates/​incentive/​src/​lib.rs Exports the lifecycle decoder.
crates/​incentive/​src/​pool_open_error.rs Implements selector decoding and signatures.
crates/​incentive/​src/​pool_open_error/​tests.rs Tests lifecycle selector decoding.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit f5b3ed6 in the fix/pool-estimation-... branch remains at 75%, unchanged from commit 7422e6e in the main branch.

Show a line coverage summary of the most impacted files.
File main 7422e6e fix/pool-estimation-... f5b3ed6 +/-
crates/cache/src/engine.rs 91% 91% 0%
crates/protocol/src/framing.rs 93% 93% 0%
crates/node/src...gin/pull_leg.rs 85% 85% 0%
crates/incentiv...l_open_error.rs 100% 100% 0%
crates/cli/src/...ommands/pool.rs 57% 58% +1%
crates/node/src...s/client/mod.rs 89% 90% +1%

@thiras
thiras merged commit 8613695 into main Oct 12, 2026
32 checks passed
@thiras
thiras deleted the fix/pool-estimation-revert branch October 12, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants