Skip to content

decide: -32000 is DISPATCH_FAILED in the shell and SERVER_ERROR in the contract crate #496

Description

@MichaelTaylor3d

Task

-32000 is DISPATCH_FAILED in dig-node-service and SERVER_ERROR in dig-rpc-protocol. Decide
whether the shell adopts the crate's name, and say what a client matching the other one sees.

Split out of #478, which pointed the shell's error
catalogue at dig_rpc_protocol::ErrorCode for every other shared code and deliberately excluded this
one rather than renaming it silently.

Why it was excluded there, measured

-32004 was safe to reconcile because RESOURCE_NOT_AVAILABLE_AT_ROOT had zero producers: every
-32004 frame dig-node emits is minted in dig-node-core and framed from dig_rpc_protocol, so it
already carried RESOURCE_UNAVAILABLE. The long name existed only in the discovery document — a lie
about the wire, fixable without touching the wire.

-32000 is the opposite case:

  • DISPATCH_FAILED is on the wire. dig-node-service's rpc_error (src/rpc.rs:67-77) puts
    code.name() into error.data.code, and server.rs mints ErrorCode::DispatchFailed at two sites
    (the spawn join failure, and the Sage wallet HTTP fallback arm).
  • dig-node-core mints no -32000 under ServerError — grep returns nothing — so unlike -32004
    there is no second name reaching the same client. The shell's catalogue and the shell's frames agree.

So this is a divergence between two documents, not a lie to a client, and renaming it is a genuine
released-wire-name change of the class SYSTEM.md records the dig-rpc-protocol 0.9.0 yank for.

Scope

Pick one and record it in SPEC.md §error table either way:

  1. Keep DISPATCH_FAILED and state in SPEC.md that the shell's -32000 carries a more specific
    name than the crate's generic one, deliberately — a dispatch failure is strictly narrower than
    "server error", and the narrower name is the more useful branch key.
  2. Adopt SERVER_ERROR, accepting the break, with the migration a renamed wire string needs.

Note that option 1 is not the status quo by default: it needs the SPEC sentence, because today the
disagreement reads as unexamined drift.

Evidence

crates/dig-node-service/src/meta.rs (code() / name(), both carrying a comment pointing here),
src/rpc.rs:74, src/server.rs, dig-rpc-protocol 0.10.2 src/error.rs:113,267.

Parent: #478

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:maintenancereal work that changes nothing a user can perceive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions