Skip to content

feat: v30 chain upgrade (scaffolding + MCP delegation)#69

Closed
trevormil wants to merge 9 commits intomasterfrom
feat/v30
Closed

feat: v30 chain upgrade (scaffolding + MCP delegation)#69
trevormil wants to merge 9 commits intomasterfrom
feat/v30

Conversation

@trevormil
Copy link
Copy Markdown
Collaborator

Summary

Tracking branch for the v30 chain upgrade. Long-lived, not ready to merge until the v30 hard fork. Opening as a PR so it shows up alongside the rest of the MCP-fold-in wave and so reviewers can follow the chain-side work.

Currently contains three commits on top of master:

31ff71a2 feat: add MCP command for BitBadges Builder tools
0ece2e73 chore: remove deprecated Pulsar API files
9c898fe8 wip: v30 upgrade scaffolding

feat: add MCP command for BitBadges Builder tools

Adds bitbadgeschaind mcp — a cobra subcommand that delegates to the Node.js bitbadges-cli mcp tool via the existing execNodeCLI bridge. Makes the 50+ MCP builder tools, resources, and session flow reachable directly from the chain binary. Pairs with:

Also includes a .gitignore fix — the previous rule bitbadgeschaind (no leading slash) matched any path component named bitbadgeschaind, which silently ignored all new files under cmd/bitbadgeschaind/. Changed to /bitbadgeschaind so it only matches the built binary at repo root.

chore: remove deprecated Pulsar API files

wip: v30 upgrade scaffolding

Pre-existing scaffolding for the v30 upgrade — migrations, x/tokenization/types/v29/ proto copies for the upgrade handler, etc. Not authored as part of the MCP work; just what was already on the branch.

Test plan

  • go build -tags=test ./cmd/bitbadgeschaind clean
  • bitbadgeschaind mcp list --names → 51 tools (requires bitbadges-cli on PATH or BITBADGES_SDK_CLI_PATH set)
  • bitbadgeschaind mcp call get_current_timestamp round-trips through to the Node CLI
  • bitbadgeschaind mcp resources list --uris → 11 resources
  • bitbadgeschaind mcp --help forwards the full subcommand tree from the Node CLI
  • v30 upgrade handler dry-run (pending full v30 scope)
  • Hard fork height coordination (pending)

Status

WIP / tracking branch. Not for merge until the v30 upgrade is complete. Cross-referenced here so the MCP fold-in wave has a chain-side anchor.

🤖 Generated with Claude Code

trevormil and others added 3 commits April 13, 2026 08:03
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit deletes several obsolete Pulsar API files, including genesis.pulsar.go, packet.pulsar.go, params.pulsar.go, query.pulsar.go, and tx.pulsar.go, as part of the ongoing cleanup and refactoring efforts. These files are no longer needed and their removal helps streamline the codebase.
This commit introduces a new command, `mcp`, to the BitBadges CLI, allowing users to directly invoke session builder tools without the MCP protocol. The command supports various operations, including listing and calling session builders, and requires Node.js with the bitbadges-cli installed. Additionally, the `.gitignore` file has been updated to correctly ignore the `bitbadgeschaind` directory.
trevormil and others added 6 commits April 13, 2026 11:24
Tracks the bitbadgesjs-sdk and bitbadges-cli rename — the JS CLI's
top-level subcommand is now `bitbadges-cli builder …`, so the chain
binary's cobra delegation follows suit. One commit, one file rename,
one registration update.

Scope:
- cmd/bitbadgeschaind/cmd/mcp_cmd.go → builder_cmd.go
- McpCmd() → BuilderCmd()
- Cobra Use: "mcp [args...]" → "builder [args...]"
- execNodeCLI("mcp", args) → execNodeCLI("builder", args)
- Short/Long descriptions and example blocks rewritten
- commands.go registration line

Verified: `go build -tags=test ./cmd/bitbadgeschaind` clean,
`bitbadgeschaind builder --help` forwards the full JS subcommand tree.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…isting

Both tools were removed from the SDK registry — review_collection
replaces them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ckage

The BitBadges SDK has been renamed on npm: 'bitbadgesjs-sdk' → 'bitbadges'.
The chain binary delegates sdk / api / builder subcommands to the Node
bitbadges-cli via npx; this updates the subprocess args and all user-facing
install instructions to reference the new package name.

- cmd/bitbadgeschaind/cmd/node_cli.go: npx subprocess args
  'npx -p bitbadgesjs-sdk bitbadges-cli' → 'npx -p bitbadges bitbadges-cli';
  install hint in the 'SDK CLI not available' error message
- cmd/bitbadgeschaind/cmd/{sdk,api,builder}_cmd.go: command help text
  'npm install -g bitbadgesjs-sdk' → 'npm install -g bitbadges'
- install.sh: 3 install commands (bun + npm) + help text
- .github/workflows/release.yml: CI install command

Filesystem path references in _docs/ left unchanged (package directory
remains packages/bitbadgesjs-sdk/ in the bitbadgesjs monorepo).

Verified: go build ./cmd/bitbadgeschaind/ clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: migrate CLI delegation + install instructions to 'bitbadges' package
The chain binary previously exposed three near-identical forwarder
commands (`sdk`, `api`, `builder`) each of which shelled out to the
Node.js bitbadges-cli with a hardcoded subcommand name. Every new
top-level bitbadges-cli subcommand (e.g. `config`, and the newly
shipped `burner` / `create-with-burner` under `builder`) required a
new `*_cmd.go` file and a commands.go registration — three near-copy
files growing unboundedly as the JS CLI grows.

Replace the three with a single generic forwarder:

    bitbadgeschaind cli <subcommand> [args...]

`cli` is a cobra command with DisableFlagParsing and a trivial RunE
that pulls the first positional as the subcommand name and passes
the rest through execNodeCLI(). Any top-level bitbadges-cli subcommand
is now automatically reachable without a Go change:

    bitbadgeschaind cli sdk review tx.json
    bitbadgeschaind cli api tokens get-collection 1
    bitbadgeschaind cli builder templates vault --backing-coin USDC
    bitbadgeschaind cli builder create-with-burner --msg-file col.json --manager bb1...
    bitbadgeschaind cli config set apiKey <key>

Changes:

- NEW  cmd/bitbadgeschaind/cmd/cli_cmd.go — the generic forwarder
- DEL  cmd/bitbadgeschaind/cmd/sdk_cmd.go
- DEL  cmd/bitbadgeschaind/cmd/api_cmd.go
- DEL  cmd/bitbadgeschaind/cmd/builder_cmd.go
- MOD  cmd/bitbadgeschaind/cmd/commands.go — drop the three
       aliases, register CliCmd() instead
- MOD  x/tokenization/client/cli/help_links.go — update the
       in-repo help footer from `bitbadgeschaind sdk docs messages`
       to `bitbadgeschaind cli sdk docs messages`

Clean break, no deprecation layer. The short `sdk`/`api`/`builder`
forms shipped with earlier releases; anyone scripting against them
will need to prefix with `cli` on v30. Worth it — the alternative is
carrying three dead files forever and still having to add new ones.

External-repo migration (bitbadges-docs, bitbadges-frontend, any dev
docs that show example commands) deferred to a follow-up when v30
lands on main — updating those today would break users on the
current release where `cli` doesn't exist yet.

Verified: `go build ./...` and `go vet ./cmd/bitbadgeschaind/...`
both clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…me (#74)

The x/badges module was renamed to x/tokenization in v23, but the migration
that re-derives collection addresses with the new module name — and moves
the corresponding bank balances — was never wired into any upgrade handler.
Every existing mainnet collection still stores a mintEscrowAddress /
cosmosCoinBackedPath.address / cosmosCoinWrapperPath.address derived from
module="badges", while today's msg handlers and every downstream consumer
derives with module="tokenization". The daily indexer consistency check
surfaced this as a 16-field-per-collection drift across all 11 active
collections on mainnet.

This adds migrateCollectionAddressesFromBadgesToTokenization and hooks it
into the existing MigrateCollections loop so v30 will:

  1. For each collection, compute the legacy (badges) and new (tokenization)
     forms of mintEscrowAddress + cosmosCoinBackedPath.address + every
     cosmosCoinWrapperPath.address.
  2. Move any bank balances from the old address to the new one via
     bankKeeper.SendCoins. No-op when balances are zero (common for fresh
     wrapper/backed paths that never held funds).
  3. Flip the reserved-protocol-address flag from the old address to the
     new one so downstream lookups don't treat stale module addresses as
     reserved.
  4. Overwrite the stored address on the collection so future queries return
     the tokenization-derived value.

All steps are skipped when old == new, so re-running the migration (or
running it on a chain that was created post-rename) is a no-op. Derivation
helpers are direct ports of the ones in msg_server_universal_update_collection.go
with a pluggable module name.

Pairs with bitbadges-indexer#100 which mirrors chain-augmented fields in
the handler + has a one-shot v29-patch migration to re-sync DB state from
chain; after v30 runs, that migration will pick up the new addresses.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@trevormil
Copy link
Copy Markdown
Collaborator Author

Superseded by #76. The files-changed view on this PR was stuck at 208 files / 63k+ additions because 8 of the 9 commits here had already landed on master directly (same SHAs), leaving GitHub's diff computation confused. Only the address-migration commit was really outstanding — it's been cherry-picked onto a clean branch off current master in #76 with a proper 1-file / +172-line diff.

@trevormil trevormil closed this Apr 20, 2026
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