Skip to content

fix(cli): resolve float64 marshal failures for audit/supernode query commands#115

Merged
mateeullahmalik merged 3 commits intomasterfrom
fix/cli-float64-query-marshalling-audit-supernode
Apr 15, 2026
Merged

fix(cli): resolve float64 marshal failures for audit/supernode query commands#115
mateeullahmalik merged 3 commits intomasterfrom
fix/cli-float64-query-marshalling-audit-supernode

Conversation

@mateeullahmalik
Copy link
Copy Markdown
Contributor

@mateeullahmalik mateeullahmalik commented Apr 9, 2026

Summary

Fix CLI query rendering failures (unknown type float64) for float-bearing responses in audit and supernode modules.

This PR applies a surgical CLI-layer fix: skip affected AutoCLI query handlers and route those commands through custom query commands that use gRPC query client + clientCtx.PrintProto.

Root cause

AutoCLI query output path marshals via aminojson and fails on responses containing float fields (float64) for specific commands.

Scope

Supernode module

  • q supernode get-metrics

Audit module

  • q audit epoch-report
  • q audit epoch-reports-by-reporter
  • q audit host-reports

Implementation details

  • Enable query custom-command enhancement:
    • x/supernode/v1/module/autocli.go
    • x/audit/v1/module/autocli.go
  • Skip affected RPCs in AutoCLI query options.
  • Add custom query command trees:
    • x/supernode/v1/client/cli/query.go
    • x/supernode/v1/client/cli/query_get_metrics.go
    • x/audit/v1/client/cli/query.go
    • x/audit/v1/client/cli/query_reports.go
  • Wire module custom query commands:
    • x/supernode/v1/module/module.go
    • x/audit/v1/module/module.go

Regression tests

Added tests to prevent reintroduction:

  • Supernode:
    • x/supernode/v1/module/autocli_test.go
    • x/supernode/v1/client/cli/query_test.go
  • Audit:
    • x/audit/v1/module/autocli_test.go
    • x/audit/v1/client/cli/query_test.go

Validation performed

Local stack bring-up

  • Ran local devnet via skill path (lumera-e2e-runner) on this branch.

Reproduced before fix (on prior state)

  • q supernode get-metrics
  • q audit epoch-report
  • q audit epoch-reports-by-reporter
  • q audit host-reports

all failed with:
cannot marshal response ... unknown type float64

Verified after fix

Executed full CLI pass on this branch (local devnet):

All supernode query commands

  • params
  • list-supernodes
  • get-supernode
  • get-supernode-by-address
  • get-top-supernodes-for-block
  • get-metrics ✅ now returns JSON with float fields

All audit query commands

  • params
  • current-epoch
  • current-epoch-anchor
  • epoch-anchor
  • assigned-targets
  • epoch-report ✅
  • epoch-reports-by-reporter ✅
  • host-reports ✅
  • storage-challenge-reports
  • evidence-by-subject
  • evidence-by-action
  • evidence (expected not-found for missing id)

All tx subcommands smoke-checked (--generate-only)

  • supernode: register, deregister, start, stop, update, report-supernode-metrics
  • audit: submit-epoch-report, submit-evidence

Baseline non-target module checks (no regression)

  • bank total
  • staking params
  • gov params voting
  • auth params
  • slashing params
  • distribution params
  • ibc client params

All successful.

Risk / blast radius

  • No state machine logic changes.
  • No keeper/proto/migration changes.
  • CLI-only query dispatch change for affected commands.
  • Minimal blast radius, targeted bug fix.

@mateeullahmalik mateeullahmalik changed the title fix(cli): avoid AutoCLI float64 marshal failures in audit/supernode q… fix(cli): resolve float64 marshal failures for audit/supernode query commands Apr 9, 2026
@a-ok123 a-ok123 requested review from a-ok123 and Copilot April 10, 2026 12:49
a-ok123
a-ok123 previously approved these changes Apr 10, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Cosmos SDK AutoCLI JSON rendering failures (unknown type float64) for specific query responses containing float fields by skipping the affected AutoCLI-generated query commands and routing them through custom Cobra query commands that use the gRPC query client plus clientCtx.PrintProto.

Changes:

  • Enable AutoCLI “custom command enhancement” and skip float-bearing RPCs in AutoCLI query options for audit and supernode.
  • Add custom CLI query command trees for the skipped RPCs, printing protobuf responses via clientCtx.PrintProto.
  • Wire the modules to expose custom query roots, and add regression tests asserting the skipped RPCs and presence of custom commands.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
x/supernode/v1/module/module.go Exposes module custom query root and indicates module has a custom query command.
x/supernode/v1/module/autocli.go Enables enhanced custom command behavior; skips GetMetrics in AutoCLI.
x/supernode/v1/module/autocli_test.go Tests that GetMetrics is skipped and custom enhancement is enabled.
x/supernode/v1/client/cli/query.go Adds supernode custom query root and registers get-metrics.
x/supernode/v1/client/cli/query_test.go Asserts custom query root contains get-metrics.
x/supernode/v1/client/cli/query_get_metrics.go Implements custom get-metrics query using gRPC client + PrintProto.
x/audit/v1/module/module.go Exposes module custom query root and indicates module has a custom query command.
x/audit/v1/module/autocli.go Enables enhanced custom command behavior; skips float-bearing audit report RPCs in AutoCLI.
x/audit/v1/module/autocli_test.go Tests that the targeted audit RPCs are skipped and enhancement is enabled.
x/audit/v1/client/cli/query.go Adds audit custom query root and registers the custom report queries.
x/audit/v1/client/cli/query_test.go Asserts custom query root contains the three report commands.
x/audit/v1/client/cli/query_reports.go Implements custom audit report queries using gRPC client + PrintProto (with pagination/flags).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread x/supernode/v1/client/cli/query_get_metrics.go
@mateeullahmalik mateeullahmalik merged commit 1de7dda into master Apr 15, 2026
15 of 16 checks passed
akobrin1 added a commit that referenced this pull request Apr 24, 2026
Integrates two master commits into the evm feature branch:
  - 7ca770a Everlight (#113): new v1.12.0 upgrade handler, supernode
    storage-full / storage-recovered / reward-distribution events, reward
    attribute keys. Coexists with evm's v1.20.0 upgrade (both registered).
  - 1de7dda fix(cli) (#115): float64 marshal fix for audit/supernode CLI.

Conflicts resolved:
  - upgrades registry / tests: both v1.12.0 (Everlight) and v1.20.0 (EVM)
    handlers registered side-by-side.
  - supernode event type list + reward attribute keys: union of both sides.
  - Makefile / Makefile.devnet / gitignore / CI workflows: union of both
    sides' additions; determinism.yml keeps evm's 500ulume fees for the EVM
    feemarket minimum and drops the now-unused submit_evidence_tx helper.
  - release.yml: kept evm's shared build.yml refactor.
  - go.mod / tests/systemtests/go.mod: reconciled via go mod tidy (Go 1.26.2,
    cosmos-sdk v0.53.6, gjson v1.18.0, grpc v1.80.0).
  - devnet/default-config/devnet-genesis.json: kept master's additional audit
    params (min_cpu/mem/disk_free_percent, sc_challengers_per_epoch).
  - devnet/scripts/configure.sh: kept master's deterministic config.json /
    validators.json rename on copy.
  - docs/static/openapi.yml: kept master's spec (will be regenerated by
    make openrpc).
  - audit_test_helpers_test.go: kept master's more robust timeout floor.
  - Everlight distribution/eligibility tests: renamed
    lcfg.{Account,Validator}AddressPrefix to their evm-branch
    Bech32-prefixed equivalents (Bech32AccountAddressPrefix /
    Bech32ValidatorAddressPrefix).
  - Unused-linter errors on master's storage-full helpers
    (markStorageFull / recoverFromStorageFull / lastNonDegradedState)
    suppressed with //nolint:unused pending the follow-up audit
    enforcement wiring.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

4 participants