Skip to content

cli: zero-address guard is only on the appeal address, not the other three contract addresses #1153

Closed

Description

@yigitdot

Spun out of the PR #1151 review (type-design + test-coverage passes). Pre-existing; noting it while the resolver family is fresh.

Observation

resolve_appeal guards its resolved address against the zero address (crates/cli/src/commands/chain_ctx.rs, ~L190):

anyhow::ensure!(
    slash_appeal_address != Address::ZERO,
    "slash_appeal_address must not be the zero address —      set it to the deployed SlashAppeal contract (ADR 028)"
);

The accompanying comment calls this "the sole validation site for the appeal address", with the rationale: a zero address parses fine but is never a real deployment — it would surface only as an opaque on-chain revert.

That rationale applies verbatim to the other three resolved contract addresses, none of which is guarded:

  • Resolved.capacity_bond_address (from resolve) — consumed by register / bond / setup.
  • ResolvedPublish.publisher_registry_address — consumed by publish namespace create / claim.
  • ResolvedPublish.origin_assignment_address — consumed by publish assign.

A misconfigured 0x000…0 for any of these parses cleanly and only fails later as an opaque contract revert (e.g. a CapacityBond/PublisherRegistry/OriginAssignment call to the zero address), instead of a clear "must not be the zero address" CLI error at resolve time.

Decision to make

Two consistent options — pick one:

  1. Extend the guard to all four resolved addresses (a shared ensure_nonzero(addr, label) helper called from resolve / resolve_appeal / resolve_publish), so every contract address gets the same early, labelled rejection.
  2. Keep appeal-only, but document why — if there's a real reason the appeal path is special (e.g. only it has no other liveness check before submit), update the chain_ctx.rs comment so the asymmetry reads as intentional rather than an oversight.

Option 1 is the likely answer (the rationale is not appeal-specific), but it is a small behavior change (new hard error on 0x0 for three more addresses), so it wants its own PR + a changelog line — hence this issue rather than bundling it into #1151.

Related

Metadata

Metadata

Assignees

Labels

area:cli

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions