Skip to content

Research: Amino codec coverage for all inference module transactions (Keplr/Ledger signing) #9

Description

@mingles-agent

Background

Background

Keplr wallet and Ledger hardware wallet use Amino JSON encoding to display and sign transactions. Cosmos SDK supports two signing modes:

  • SIGN_MODE_LEGACY_AMINO_JSON — used by Keplr + Ledger, human-readable, requires amino registration
  • SIGN_MODE_DIRECT (protobuf) — used by CLI, not supported by Ledger hardware

Current state in gonka:

inference-chain/x/inference/module/module.go:80:

func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}
// empty — no messages registered

All message types are registered via RegisterInterfaces (protobuf/SIGN_MODE_DIRECT only) in inference-chain/x/inference/types/codec.go, but none have amino type names.

Compare with collateral module — also empty:

func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}

Yet MsgDepositCollateral reportedly works with Keplr. Need to verify why and map exact difference.

The --ledger flag exists in Cosmos SDK's key management layer (cosmos-sdk keyring) and is inherited by inferenced CLI automatically via github.com/cosmos/ledger-cosmos-go v0.14.0 (present in inference-chain/go.mod). This is NOT a custom implementation — it's SDK-level. But signing transactions via Ledger requires amino support in the messages being signed.

What to Investigate

1. Why do some transactions work with Keplr/Ledger and others don't

  • Trace MsgDepositCollateral amino path end-to-end: is it registered somewhere, or does Keplr use a workaround?
  • Check if collateral module has amino registration in proto files (look for amino_name option in .proto files under inference-chain/proto/)
  • Check inference-chain/x/*/types/codec.go for all modules — which have RegisterLegacyAminoCodec populated vs empty
  • Understand Cosmos SDK amino fallback behavior: does RegisterImplementations alone enable amino for some message types?

2. What is required to add amino support to inference module messages

  • Which proto messages need option (amino.name) = "..." annotations
  • What changes needed in RegisterLegacyAminoCodec in inference-chain/x/inference/module/module.go
  • Whether proto regeneration is needed or manual codec registration in types/codec.go is sufficient
  • Check cosmos-sdk v0.50.x amino registration pattern (the project uses cosmos-sdk, check version in inference-chain/go.mod)
  • List ALL MsgXxx types in inference-chain/x/inference/types/tx.pb.go that need amino registration

3. Ledger integration via --ledger flag

  • How does inferenced keys add --ledger work (Cosmos SDK keyring, HD derivation path for Cosmos: m/44'/118'/0'/0/0)
  • How does inferenced tx ... --from mykey work when key was added with --ledger — does it auto-use Ledger for signing?
  • What signing mode does it use — is it amino or direct?
  • Does the current inferenced binary support Ledger out of the box (given cosmos/ledger-cosmos-go in go.mod)?
  • What build tags are needed (cosmos SDK requires ledger build tag in some versions)

4. Web3 app requirements mapping

Goal: build Keplr + Ledger web app for miner/validator setup and operations.
Map each user-facing operation to its transaction type and amino support status:

  • Deposit/withdraw collateral → MsgDepositCollateral (collateral module)
  • Register as participant → MsgSubmitNewParticipant (inference module)
  • Register model → MsgRegisterModel (inference module)
  • Claim rewards → MsgClaimRewards (inference module)
  • Update node config → identify relevant msg
  • Governance proposals → standard cosmos gov msgs

For each: document current amino status and what's needed to enable Keplr/Ledger signing.

Key Files

  • inference-chain/x/inference/types/codec.go — RegisterInterfaces (no amino)
  • inference-chain/x/inference/module/module.go:80 — empty RegisterLegacyAminoCodec
  • inference-chain/proto/inference/inference/tx.proto — check for amino_name options
  • inference-chain/x/collateral/types/codec.go — compare with inference module
  • inference-chain/go.mod — cosmos-sdk version, ledger-cosmos-go version
  • inference-chain/x/inference/types/tx.pb.go — all Msg types

Deliverables

  1. Table: all inference module Msg types + current amino status + what's needed
  2. Step-by-step: how to add amino registration for a Cosmos SDK v0.50.x module
  3. Ledger signing flow: inferenced keys add --ledgerinferenced tx → on-device signing
  4. Assessment: can all needed transactions support amino, or are there blockers?
  5. Create implementation task(s) for amino registration if feasible

Focus Areas

  • amino codec registration pattern in cosmos sdk v0.50
  • why some msgs work with keplr and others don't
  • ledger signing flow end-to-end
  • proto amino_name options
  • web3 app transaction coverage

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions