Repository navigation
feat(cli): decdn publish control plane (namespace/claim/assign) (#1029) - #1074
Conversation
…es (#1029) Co-Authored-By: Claude Opus 4.8 <[email protected]>
…sign) (#1029) Adds the user-facing publisher control plane closing the CLI half of G-ORIGIN-01/02: namespace create (createNamespace), claim <hash> --namespace <id> (claimContent), and assign <namespace> <ops...> (proposeAssignment, propose-only; DAO activation is out of scope). Reuses the on-chain-write pattern from decdn node register: resolve_publish resolves the PublisherRegistry/OriginAssignment coordinates (flag > config > default), the keystore signer loads via the new load_signer_with_password_file helper, and each subcommand submits + prints a JSON or key=value receipt. --dry-run prints resolved params without sending. Unit tests cover output formatting and arg parsing. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR adds a new ChangesPublish CLI feature
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Resolver
participant Signer
participant Contract
User->>CLI: run decdn publish ...
CLI->>Resolver: resolve flags/config/defaults
Resolver-->>CLI: ResolvedPublish + addresses
alt dry-run
CLI-->>User: print outcome
else submit
CLI->>Signer: load keystore signer
Signer-->>CLI: signer
CLI->>Contract: createNamespace / claimContent / proposeAssignment
Contract-->>CLI: receipt
CLI->>CLI: validate status and extract result
CLI-->>User: print outcome
end
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the decdn publish subcommand, which serves as the origin-publisher control plane. It allows users to perform three on-chain writes: creating namespaces, claiming content hashes, and proposing authorized-origin operator sets. The changes include CLI argument parsing, configuration resolution, and contract interaction logic. Feedback suggests adding client-side validation to prevent duplicate operator addresses from being submitted in the assign command, which would otherwise cause an on-chain revert and waste gas.
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cli/src/commands/publish.rs`:
- Around line 102-155: The publish flow in namespace_create currently ignores
ResolvedPublish.chain_id, so a mismatched RPC can still be used to submit
transactions to the wrong network. Add a chain-id validation step in
namespace_create before creating the signer/provider and sending the
transaction, comparing the RPC chain id against ResolvedPublish.chain_id (or the
resolved config) and failing fast on mismatch; if chain_id is not intended to
affect this path, remove it from ResolvedPublish and any related plumbing
instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 796e4fb0-5398-4870-9762-d33be863183c
📒 Files selected for processing (9)
crates/cli/src/commands/chain_ctx.rscrates/cli/src/commands/config.rscrates/cli/src/commands/mod.rscrates/cli/src/commands/publish.rscrates/cli/src/main.rscrates/common/src/cli/mod.rscrates/common/src/cli/publish.rscrates/incentive/src/origin_assignment.rscrates/incentive/src/publisher_registry.rs
Coverage reportTotal: 81.71% (was 81.99%, ▼ 0.28%) — 42842/52433 lines
History
|
Review follow-up on #1074: - assign now rejects duplicate operator addresses client-side (the contract reverts DuplicateOperator, so failing fast saves gas). Runs on dry-run too. - namespace create / claim / assign verify the RPC's chain id matches the resolved --chain-id/config before submitting, mirroring decdn setup's pre-flight guard, so a mis-pointed --rpc-url can't hit the wrong network. The check is submit-only; --dry-run needs no network. Corrected the now- accurate --chain-id flag help (publish does no EIP-712 signing). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…adable_literal) (#1029) CI runs clippy with --all-targets -D warnings, which lints test code the scoped local run skipped; 421614/31337 tripped clippy::unreadable_literal. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements the decdn publish command, introducing the origin-publisher control plane. It allows users to create namespaces, claim content hashes, and propose authorized-origin operator sets on-chain. To support this, new CLI arguments, configuration options, and Solidity contract bindings for PublisherRegistry and OriginAssignment have been added, along with corresponding unit tests. No review comments were provided, so there is no feedback to address.
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.
…g, JSON tests (#1029) Multi-agent review follow-up on #1074: - namespace create: match NamespaceCreated by signature then decode, so an ABI drift surfaces as a decode error instead of a misleading "missing event" (the namespace was in fact created). - assign: decode AssignmentProposed to print ready_at (timelock deadline), and warn (replaced_prior / warning=replaced_existing_pending_proposal) when a prior pending proposal was silently overwritten on-chain. Binds the two events in the incentive OriginAssignment sol! block. - Add serde_json round-trip tests for all three writers' JSON branch (the machine-consumable contract, previously untested) + assign dry-run text. - Module doc: clarify signer loading is submit-path-only (skipped on --dry-run); trim a cross-contract gloss on the createNamespace binding. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…code, chain-id preflight (#1029) Addresses review findings on the `decdn publish` control plane: - Reject the reserved namespace id 0 client-side (clap value_parser on `claim --namespace` and `assign <namespace>`): id 0 is never owned by a publisher, so submitting was a guaranteed revert — now fails fast like the duplicate-operator guard, saving gas. - Correct the "idempotent" wording: claimContent is append-only and *reverts* on a repeat claim (AlreadyClaimed), it is not idempotent. Fixed the CLI revert message and the binding doc comment. - Make the AssignmentProposalCancelled decode fail-loud on ABI drift (was `.filter_map(...ok())`, silently dropping a signature-matched-but-undecodable log and under-reporting `replaced_prior`), matching the honest decode of the other two events. No-match remains the normal (nothing-replaced) case. - Run the chain-id check via a read-only provider *before* keystore decryption, so a mis-pointed --rpc-url fails before the password prompt + scrypt KDF. - Rescope the origin_assignment_address config comment: `publish assign` needs only that address; the "paired with publisher_registry_address" note applies to DHT prefetch, not assign. - Move the operator Vec into AssignOutcome instead of cloning it, so the dry-run path does no extra allocation (submit clones exactly once). Also bumps crossbeam-epoch 0.9.18 -> 0.9.20 (RUSTSEC-2026-0204, transitive via iroh) so cargo-deny is green; unrelated to the CLI changes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Closes the CLI half of G-ORIGIN-01/02 (#1029) — the origin-publisher control plane. Before this, there was no path to publish on-chain from the CLI.
What
Adds a
decdn publishcommand group wiring the already-deployedPublisherRegistry/OriginAssignmentwrites into user-facing commands:decdn publish namespace createcreateNamespace()NamespaceCreatedevent).decdn publish claim <hash> --namespace <id>claimContent(namespaceId, blake3Hash)0x…/b3:…/bare 64-hex.decdn publish assign <namespace> <ops…>proposeAssignment(namespaceId, operators)onlyRole(GOVERNANCE_ROLE)(DAO Timelock), out of CLI scope.How
Reuses the on-chain-write pattern from
decdn node register:resolve_publishresolves thePublisherRegistry/OriginAssignmentcoordinates (flag >[blockchain]config > default), the keystore signer loads via a newload_signer_with_password_filehelper (load_operator_signerdelegates to it), and each subcommand submits + prints a JSON (--json) orkey=valuereceipt.The
incentivecrate'ssol!bindings — previously read/event-only — gain the write methods (createNamespace,claimContent,ownerOf,proposeAssignment) and the events used for confirmation (NamespaceCreated,AssignmentProposed,AssignmentProposalCancelled), matching the signatures already used incrates/e2e/src/bindings.rs.Safety / UX
--dry-runneeds no secrets — resolves + prints params, loads no keystore, sends nothing.--chain-id/config (mirrorsdecdn setup's pre-flight). Submit-only.assignrejects duplicate operator addresses client-side (the contract would revertDuplicateOperatorand waste gas). Runs on--dry-runtoo.namespace creatematchesNamespaceCreatedby signature then decodes, so an ABI drift surfaces as a decode error rather than a misleading "missing event".assigntransparency — surfacesready_at(the timelock deadline for DAO activation) and warns (replaced_prior/warning=replaced_existing_pending_proposal) when a prior pending proposal was silently overwritten on-chain.sanitize_err_chainboundary, so RPC URLs (with API keys) don't leak.Tests
Unit tests cover argument parsing, config>flag precedence, output formatting for both
key=valueand JSON (round-tripped) across all three commands, dry-run states, the dedup guard, and the chain-id guard.cargo fmt/clippy --workspace --all-targets/nextestgreen (821 tests).End-to-end binary coverage against the anvil fixture is tracked as a follow-up in #1073 (matching the
node registerprecedent, which is e2e-tested separately).Review
Addressed inline bot findings (dedup, chain-id guard) and a multi-agent review pass (honest event decode,
assignready_at/overwrite surfacing, JSON output tests, doc accuracy).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
publishcommand with subcommands for creating namespaces, claiming content, and proposing origin assignments.Bug Fixes