Skip to content

fix(rest): chain firmware gate threw 'json is not defined' when it fired#370

Merged
BitHighlander merged 1 commit into
developfrom
fix/rest-chain-gate-scope
Jul 18, 2026
Merged

fix(rest): chain firmware gate threw 'json is not defined' when it fired#370
BitHighlander merged 1 commit into
developfrom
fix/rest-chain-gate-scope

Conversation

@BitHighlander

Copy link
Copy Markdown
Collaborator

Observed on latest develop: [REST] Error on POST /addresses/hive: json is not defined.

requireChainSupport was defined at server scope but returns via the per-request json() closure (CORS + audit logging), so whenever the firmware gate actually fired it threw ReferenceError instead of the intended 501 with the firmware-requirement message. Latent on every route using the gate (solana/tron/ton/hive) — only visible when a chain's minFirmware check fails.

Moved the helper inside the request scope. Proof it was the bug: the rest-api tsc baseline drops 66 → 65 — the out-of-scope json reference had been sitting in the known type-error noise the whole time.

requireChainSupport was defined at server scope but returns via the
per-request json() closure (CORS + audit logging), so the moment the
firmware gate actually fired — observed on POST /addresses/hive — it
threw ReferenceError instead of the intended 501. Latent on the
solana/tron/ton routes too. Moved inside the request scope; tsc had
been flagging the out-of-scope name all along (rest-api baseline
66 → 65 errors).
@BitHighlander
BitHighlander merged commit 3359c8b into develop Jul 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant