Repository navigation
test(e2e): cover G-ORIGIN-01 namespace publish + claim journeys - #1285
Conversation
Adds `crates/e2e/tests/g_origin_01_publish.rs`, driving the publisher control plane end-to-end against a real anvil `PublisherRegistry`: - `namespace_create_claim_and_union`: a publisher with a real encrypted keystore runs `decdn publish namespace create` and `decdn publish claim` as subprocesses; `namespaceOf(H)` is asserted on-chain. Negatives ride the same fixture — a re-claim into the same namespace is rejected and leaves the claim set unduplicated (append-only), and a claim into a second namespace resolves as a union of both ids. - `namespace_transfer_respects_timelock`: the 2-step ownership transfer cannot be finalized one second before `pendingTransfer.readyAt` and does transfer once the chain clock is warped past it. No CLI subcommand covers transfers, so this leg drives the bindings directly. Adds the `hasClaimed` / transfer-surface `PublisherRegistry` bindings the transfer leg needs. Out of scope (forward reference to G-NODE-08): proving H becomes servable as an origin — that needs a chain-backed origin directory in the daemon, which does not exist yet. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (4)
WalkthroughThe change extends ChangesNamespace publishing and transfer
Estimated code review effort: 3 (Moderate) | ~25 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 |
There was a problem hiding this comment.
Code Review
This pull request adds contract bindings for namespace ownership transfer and claim verification, and introduces end-to-end tests for namespace publishing, claiming, and timelocked ownership transfers. Specifically, it updates crates/e2e/src/bindings.rs with new PublisherRegistry functions and adds a comprehensive test suite in crates/e2e/tests/g_origin_01_publish.rs. There are no review comments, and I have no additional 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.
Coverage reportTotal: 81.59% (was 81.61%, ▼ 0.03%) — 48724/59720 lines
History
|
Review follow-ups on the G-ORIGIN-01 publish journeys: - Correct the module doc's out-of-scope rationale. It claimed ChainOriginDirectory "does not exist"; it does, and the runtime selects it. The real blocker is fixture setup (OriginAssignment proposal + governance activation + bonded operator), which is G-NODE-08's. Rotted source comment tracked in #1289. - Replace the 1-second pre-timelock warp margin with WARP_MARGIN plus an explicit head < readyAt assertion. Anvil derives block timestamps from wall-clock, so the old margin (which relied on advance_to's undocumented +1) could overshoot on a loaded runner and turn the timelock gate into a spurious pass. - Assert readyAt == init_ts + timelock against the initiating block's timestamp, replacing a one-sided >= check that a now + 700 days bug would have passed. - Add expect_revert, matching on the 4-byte selector, and use it for every negative. Distinguishes the guard under test from a transport fault or a different revert, which is_err() accepted. - Cover the authorization guards: NotNamespaceOwner on claimContent (previously every claim was made by the namespace's own owner, so a registry that dropped the check entirely still passed), NotPendingOwner on finalize, and NoPendingTransfer via cancelNamespaceTransfer — whose binding was added but never exercised. - Drop the ownerOf check that followed a static .call() and so could never fail. - Hoist decdn_cli_bin into decdn_e2e::node; the test had a duplicate keyed on DECDN_BIN instead of the conventional DECDN_CLI_BIN, which would silently exec a stale binary. Verified: 4 consecutive green runs, plus mutation checks confirming the new selector assertions fail on a wrong expected error. slash_appeal (shared helper) still passes. fmt + clippy --all-targets clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`cargo doc` runs with `-D warnings`, so the `[`decdn_node_bin`]` link on the newly-public `decdn_cli_bin` tripped rustdoc::private_intra_doc_links (the target is private). Keep the cross-reference as prose. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds one new e2e test file,
crates/e2e/tests/g_origin_01_publish.rs, covering the on-chain half of G-ORIGIN-01.What it covers
namespace_create_claim_and_union— CLI-driven happy path plus the negatives on one fixture:eth_identity::generate_and_persist, the same artifactdecdn key-genproduces) runsdecdn publish namespace createanddecdn publish claim <H>as subprocesses, with--jsonoutput parsed for the minted id.PublisherRegistry.namespaceOf(H)is asserted on-chain to be exactly[ns1], andownerOf(ns1)to be the CLI signer.Hinto the same namespace revertsAlreadyClaimedand — the property that matters — leavesnamespaceOf(H)a single, unduplicated entry.Hdoes not displace the first;namespaceOf(H)returns both ids in claim order, cross-checked againsthasClaimed.NotNamespaceOwner. Without this, a registry that dropped the owner check entirely would still have passed — every other claim in the test is made by the namespace's own owner.namespace_transfer_respects_timelock— the 2-step ownership transfer:namespaceTransferTimelockis the ADR 002 7-day default and thatpendingTransfer.readyAt == <initiating block timestamp> + timelockexactly (not a one-sided>=, which anow + 700 daysbug would satisfy).readyAt, asserts the head really is beforereadyAt, then assertsfinalizeNamespaceTransferrevertsTransferNotReadyand ownership has not moved — so the rejection is the timelock gate specifically, not merely "no time has passed".readyAt, finalizes as the recipient, and asserts ownership moved and the pending record cleared.NotPendingOwner; cancelling a non-existent transfer revertsNoPendingTransfer.Every negative goes through a shared
expect_reverthelper that matches on the error's 4-byte selector, so a transport fault or an unrelated revert fails the test rather than passing it.There is no
publish namespace transferCLI subcommand, so the transfer leg drivesPublisherRegistrybindings directly and uses the existingcrates/e2e/src/time.rsadvance_tohelper.Out of scope
The issue's clause "feed into G-NODE-08 to prove
Hbecomes servable as origin" is a forward reference to a different issue and is not attempted here. The daemon can already do it —crates/node/src/dht/chain_origin_directory.rsresolvesnamespaceOf(H)→ assigned origins → operator, and the runtime selects it when the registry addresses are configured. What is missing is the fixture: anOriginAssignmentproposal, governance activation, and a bonded operator to serve it. That setup is G-NODE-08's. The test file's module docs say so. A rotted source comment found along the way is tracked in #1289.Other changes
crates/e2e/src/bindings.rs(+20): addshasClaimed, the namespace-transfer surface (initiateNamespaceTransfer,finalizeNamespaceTransfer,cancelNamespaceTransfer, thependingTransfergetter,namespaceTransferTimelock), and the fiveerrordeclarations the selector assertions match against.crates/e2e/src/node.rs(+24): hoistsdecdn_cli_bin()out ofslash_appeal.rsinto the shared fixture module, alongside the privatedecdn_node_bin. The new test had grown a duplicate keyed onDECDN_BINinstead of the conventionalDECDN_CLI_BIN, which would have silently exec'd a stale binary.crates/e2e/tests/slash_appeal.rs(−22): drops its now-shared local copy of that helper.No production code touched; test code plus those two
crates/e2e/srcadditions only.Verification
Run repeatedly, green each time (no flake). The new selector assertions were mutation-checked — each fails when pointed at a wrong expected error.
slash_appeal, which shares the hoisted helper, still passes. Also clean:cargo fmt -- --checkcargo clippy --workspace --all-targets -- -D warningsThe tests exec the pre-built
decdnanddecdn-nodebinaries, socargo buildthem first.🤖 Generated with Claude Code
Closes #1038