Repository navigation
fix(cli,incentive): reject zero address for all parsed contract addresses + fix bindNodeId runbook (#1213, #1195) - #1218
Conversation
…sses (#1213) The #1153 guard (`parse_nonzero_address`) was applied only to the four addresses resolved by `resolve` / `resolve_appeal` / `resolve_publish`, leaving several other CLI contract-address parse sites on the plain `parse_address`, which accepts `0x0000…0000` — the same logical address was guarded via `resolve()` but not via `fetch`. Route the remaining CLI contract sites through `parse_nonzero_address`: `fetch` (`payment_channel_address`, `slash_judge_address`, `capacity_bond_address`), `channel` (`payment_channel_address`), and `setup` (`usdc_address`). Extend the same guard to the swap contract addresses parsed in `incentive::swap_venue::from_config` (router/quoter/pool/usdc) via a local `parse_nonzero` helper — `incentive` cannot depend on `cli`, so the guard is duplicated with the existing error-message wording preserved. Account/EOA addresses (`--provider-address`, `operator`) deliberately stay on `parse_address` — the "never a real deployment" rationale is contract-specific. New hard error on `0x0` (present-but-zero only; unset optionals still resolve to `None`). Adds zero-address rejection tests for the fetch/channel resolvers and every swap address across both venues; broadens the `parse_nonzero_address` doc comment and adds a CHANGELOG entry. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (7)
WalkthroughThe change extends zero-address validation to CLI contract address parsing and incentive swap-venue configuration, adds rejection tests, updates the breaking-change notes, and revises the iroh node-key rotation runbook for two ChangesZero Address Validation
Operator Key Rotation Documentation
Estimated code review effort: 2 (Simple) | ~15 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Contracts coverageLine coverage: 88.92% (2488/2798 lines) |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
Code Review
This pull request expands the zero-address guard to cover all parsed contract addresses across the CLI and swap venues, preventing opaque on-chain reverts. It also updates the operator key rotation documentation to include the required ed25519Signature for bindNodeId. I have no further feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR hardens contract-address handling in the CLI (and swap-venue config in decdn-incentive) by rejecting the zero address at parse time, and corrects the operator key-rotation runbook’s documented bindNodeId ABI.
Changes:
- Route remaining CLI contract-address parse sites through
parse_nonzero_address, with new tests covering each address on thefetch,channel, andsetuppaths. - Add an
incentive-local non-zero address parser for swap venue contracts (Uniswap V3 + Balancer V3), with comprehensive zero-address rejection tests. - Update the operator key-rotation runbook to reflect
CapacityBond.bindNodeId’s 3-argument ABI and document the need for both signatures.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/incentive/src/swap_venue.rs | Adds local parse_nonzero guard and tests to reject zero swap contract addresses. |
| crates/cli/src/commands/setup.rs | Uses parse_nonzero_address when re-parsing USDC address for ERC20 binding. |
| crates/cli/src/commands/fetch.rs | Zero-guards fetch-path contract addresses and adds targeted tests. |
| crates/cli/src/commands/channel.rs | Zero-guards payment-channel address and adds a regression test. |
| crates/cli/src/commands/chain_ctx.rs | Updates documentation to reflect expanded non-zero guard coverage and rationale. |
| CHANGELOG.md | Documents the expanded zero-address guard coverage across CLI + swap venues. |
| adr/appendix-operator-key-rotation.md | Updates bindNodeId ABI in runbook steps and “API used” line. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…oof arg (#1195) The operator key-rotation runbook documented `CapacityBond.bindNodeId(newNodeId, signature)`, but the contract takes three args — `bindNodeId(bytes32 nodeId, bytes bindingSignature, bytes ed25519Signature)` (CapacityBond.sol) — so a call built from the doc as written reverts. Update the "API used" line and procedure steps 4–5 in `appendix-operator-key-rotation.md`: step 4 now builds both the EIP-712 binding signature and the ed25519 ownership proof over the new NodeId, and step 5 submits all three args. Edited in place per the repo ADR convention. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
d862bc4 to
e0f7eee
Compare
Coverage reportTotal: 80.53% (was 80.45%, ▲ +0.08%) — 47742/59284 lines
History
|
Summary
Two small CLI/docs hardening fixes, batched. Both are correctness gaps noticed while the surrounding code was fresh.
Closes #1213. Closes #1195.
#1213 — reject the zero address for every parsed contract address
The #1153 guard (
parse_nonzero_address) was applied only to the four addresses resolved byresolve/resolve_appeal/resolve_publish, leaving other CLI contract-address parse sites on the permissiveparse_address(which accepts0x0000…0000). The same logical address was guarded viaresolve()but not viafetch.parse_nonzero_address:fetch(payment_channel_address,slash_judge_address,capacity_bond_address),channel(payment_channel_address),setup(usdc_address).incentive::swap_venue::from_config(router/quoter/pool/usdc) via a localparse_nonzerohelper (incentivecan't depend oncli), preserving the existing error-message wording so the malformed-address tests keep matching.--provider-address,operator) deliberately stay onparse_address— the "never a real deployment" rationale is contract-specific.New hard error on
0x0(present-but-zero only; unset optionals still resolve toNone).#1195 — fix the
bindNodeIdrunbook ABIadr/appendix-operator-key-rotation.mddocumentedCapacityBond.bindNodeId(newNodeId, signature), but the contract takes three args —bindNodeId(bytes32 nodeId, bytes bindingSignature, bytes ed25519Signature)— so a call built from the doc reverts. Updated the "API used" line and procedure steps 4–5 (step 4 now builds both the EIP-712 binding signature and the ed25519 ownership proof).Tests
11 new zero-address rejection tests — the fetch/channel resolvers and every swap address across both venues. Each asserts both the address label and the distinctive "must not be the zero address" message.
Verification
cargo build && cargo clippy --all-targets— cleancargo nextest run -p decdn-incentive -p decdn-cli— 541 passedcargo fmt --check— cleanpre-commit run --all-filesgate passed (incl. ADR reference-hygiene for the doc change)No Solidity, gossip, or protocol/wire changes.
Reviewed
Ran the multi-agent PR review (code / tests / comments / silent-failure). All approved; the three low-severity doc-accuracy suggestions are folded into the fix commit.
Follow-up (out of scope)
The
decdn-nodedaemon parses the same contracts unguarded (crates/node/src/runtime/mod.rs), so a0x0misconfig there still surfaces as the opaque late revert this PR eliminates on the CLI. Tracked in #1219.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation