Skip to content

feat: allow x/gov proposals to call bankKeeper.SetDenomMetaData#12293

Open
Copilot wants to merge 32 commits intomasterfrom
copilot/expose-bankkeeper-setdenommetadata
Open

feat: allow x/gov proposals to call bankKeeper.SetDenomMetaData#12293
Copilot wants to merge 32 commits intomasterfrom
copilot/expose-bankkeeper-setdenommetadata

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 18, 2025

Description

This PR exposes the bankKeeper.SetDenomMetaData method to on-chain governance, allowing governance proposals to set bank denom metadata without requiring hard forks or chain-halting upgrades.

Changes

  • Proto Definitions: Added MsgSetDenomMetaData message in proto/agoric/vbank/msgs.proto that imports Metadata and DenomUnit from cosmos.bank.v1beta1 instead of defining them inline
  • Keeper: Added authority field to vbank keeper, passed from x/gov module address in app initialization
  • Message Handler: Implemented SetDenomMetaData that validates authority and delegates to bankKeeper.SetDenomMetaData
  • Validation: Uses Cosmos SDK's built-in Metadata.Validate() method for comprehensive validation
  • Module Registration: Wired up actual MsgServer implementation (replaced unimplemented stub)
  • Tests: Comprehensive test suite with 9 test cases covering success and various error scenarios, updated to use banktypes.Metadata
  • TypeScript Codegen: Generated TypeScript bindings for client applications in packages/client-utils and packages/cosmic-proto, including RPC message handlers for the new governance message
  • A3P Integration Test: Updated vbank-msg-absence test to recognize "unable to resolve type URL" errors when checking that the message type doesn't exist before upgrade

Security Considerations

This feature is controlled by the x/gov authority and can only be invoked by stakers passing an x/gov proposal. The authority address is verified on every call to ensure only governance can execute these operations. This prevents ordinary transactions from modifying denom metadata.

Scaling Considerations

This change has minimal scaling impact. Setting denom metadata is a rare governance operation that writes a small amount of data to the bank module's state. No increase in CPU cycles, RAM, or message exchanges for normal operations.

Documentation Considerations

Users will need documentation on:

  • How to create governance proposals to set denom metadata
  • The required message format for MsgSetDenomMetaData
  • Validation rules for metadata (enforced by Cosmos SDK's Metadata.Validate())
  • Use case: marking IBC denoms (e.g., ibc/FA77...) as known tokens like USDC with appropriate exponents

Testing Considerations

  • All vbank unit tests passing (9 new tests for MsgSetDenomMetaData)
  • All integration tests passing
  • Full test suite passing with no regressions
  • Tests cover: success cases, invalid authority, validation errors (missing base denom, empty units, duplicates, invalid display)
  • A3P integration test validates that message type doesn't exist before upgrade

Upgrade Considerations

This is a backwards-compatible addition that:

  • Adds a new governance message type
  • Does not modify existing data structures or APIs
  • Requires no migration of existing data
  • Can be deployed in a standard upgrade without special procedures

After deployment, governance can immediately begin using this feature to set metadata for denoms that currently lack it.

Original prompt

This section details on the original issue you should resolve

<issue_title>Expose bankKeeper.SetDenomMetaData to on-chain governance</issue_title>
<issue_description>## What is the Problem Being Solved?

Currently, the /denoms_metadata queries reveal that we are missing information for certain coins (namely, the ibc/FA7775734CC73176B7425910DE001A1D2AD9B6D9E93129A5D0750EAD13E4E63A denom that needs to be identified as uusdc (USDC, with "exponent": 6).

We cannot update our genesis.json (since that requires a hard fork), nor do we want to perform a chain-halting upgrade (since that requires chain downtime) every time we add or update the denom metadata.

Description of the Design

x/bank has a bankKeeper.SetDenomMetaData method that should be callable by a modern x/gov proposal, and our agoric-sdk/golang/cosmos/x/vbank module already has an Agoric-specific wrapper for the standard x/bank module, which gives us a place to stand to implement this feature.

  1. Create MsgSetDenomMetaData in agoric-sdk/golang/cosmos/proto/agoric/vbank/msgs.proto, which should be a standard Cosmos-SDK v0.50 x/gov proposal message. It should have all the parameters needed by bankKeeper.SetDenomMetaData, as well as the appropriate authority field needed by x/gov.
  2. Run cd agoric-sdk/golang/cosmos && make proto-all to regenerate the *.pb.go files.
  3. Add an authority parameter to the constructor for agoric-sdk/golang/x/vbank/keeper.NewKeeper, and provide the x/gov authority address to it in the call to vbank.NewKeeper in agoric-sdk/golang/cosmos/app.NewAgoricApp.
  4. Add SetDenomMetaData to the agoric-sdk/golang/cosmos/x/vbank/types/expected_keepers.go BankKeeper interface, with exactly the same type as x/bank/keeper.SetDenomMetaData.
  5. Add MsgSetDenomMetaData to the agoric-sdk/golang/cosmos/x/vbank/types/msg_server.go, and have it verify the authority field matches the Keeper's authority, and make other consistency checks for the message before calling bankKeeper.SetDenomMetaData with the appropriate parameters.
  6. Write comprehensive gotest tests for the new features in x/vbank/types/msg_server_test.go.
  7. Run cd agoric-sdk/golang/cosmos && go test ./x/vbank/... to check that the feature passes unit tests.
  8. Run cd agoric-sdk/golang/cosmos && go test ./... to verify the functionality does not break other tests.

Security

This new feature is controlled by the x/gov authority, and thereby can only be invoked by stakers passing an x/gov proposal. Thus, it is protected from ordinary transactions.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Expose bankKeeper.SetDenomMetaData to on-chain governance Expose bankKeeper.SetDenomMetaData to on-chain governance Dec 18, 2025
Copilot AI requested a review from michaelfig December 18, 2025 22:49
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot please undo this change, since it only hacks around the symptom of a larger problem (your environment isn't correctly running make proto-all). protocgen.sh should exit with a failure status if the cp command fails.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in commit 014da25. The protocgen.sh script now has the unconditional cp command that will properly fail if the directory doesn't exist.

@michaelfig
Copy link
Copy Markdown
Member

@copilot, please try running make proto-gen again. This time, if it fails, then do not continue.

@michaelfig
Copy link
Copy Markdown
Member

@copilot Try again with the new commits.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 19, 2025

@copilot Try again with the new commits.

The make proto-gen command is still failing with permission errors in the Docker container. The error occurs during go mod tidy when it tries to write to /go/pkg/mod/cache/download/.

The error shows:

mkdir /go/pkg/mod/cache/download/github.com/agoric-labs: permission denied
open /go/pkg/mod/cache/download/google.golang.org/protobuf/@v/v1.36.4.lock: permission denied

This is an environment-level issue with the Docker setup that prevents the Go module cache from being written. The proto generation step requires additional Docker volume mounts or environment configuration to allow the build cache to work properly.

My implementation of the MsgSetDenomMetaData feature is complete and ready for proto generation once the environment issue is resolved. All the Go code (keeper, message handler, validation, tests) has been implemented according to the requirements.

@michaelfig michaelfig force-pushed the copilot/expose-bankkeeper-setdenommetadata branch 2 times, most recently from 045d8d7 to 95aa5db Compare December 19, 2025 21:10
@michaelfig
Copy link
Copy Markdown
Member

@copilot, please try the make proto-all again, and if it succeeds, continue with the rest of the plan.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 19, 2025

@copilot, please try the make proto-all again, and if it succeeds, continue with the rest of the plan.

make proto-all succeeded and generated the required msgs.pb.go file. Completed the remaining steps:

  • Fixed field name mismatches (URI/URIHash) in commit 247b60c
  • Updated test mocks to use correct types and interfaces
  • Fixed integration test to register actual MsgServer implementation in commit 80dd2bc
  • All vbank unit tests passing (9 tests)
  • All integration tests passing
  • Full test suite passing with no regressions

Implementation is complete and ready for code review.

@michaelfig
Copy link
Copy Markdown
Member

@copilot Update the GitHub PR description to match the style of agoric-sdk/.github/PULL_REQUEST_TEMPLATE.md, filling out the blanks with what you know about this PR.
Also, please run (cd packages/cosmic-proto && ./update-protos.sh) and commit the results.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 19, 2025

@copilot Update the GitHub PR description to match the style of agoric-sdk/.github/PULL_REQUEST_TEMPLATE.md, filling out the blanks with what you know about this PR.
Also, please run `(cd packages/c...

Updated PR description to follow the template format with sections for Description, Security, Scaling, Documentation, Testing, and Upgrade Considerations.

Ran (cd packages/cosmic-proto && ./update-protos.sh) and committed the results in commit 1d22021. The script synchronized the proto definitions from golang/cosmos to packages/cosmic-proto.

@michaelfig michaelfig changed the title Expose bankKeeper.SetDenomMetaData to on-chain governance feat: allow x/gov proposals to call bankKeeper.SetDenomMetaData Dec 19, 2025
@michaelfig
Copy link
Copy Markdown
Member

@copilot It looks like DenomUnit and Metadata should not be inline... now I imported them from cosmos.bank.v1beta1 and removed the duplicate definitions. Please work on verifying and finishing the job.

Copilot AI and others added 28 commits April 28, 2026 13:37
Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
…e test

Co-authored-by: michaelfig <457244+michaelfig@users.noreply.github.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
@michaelfig michaelfig force-pushed the copilot/expose-bankkeeper-setdenommetadata branch 2 times, most recently from e5b2ebf to 87b515e Compare April 28, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agd Agoric (Golang) Daemon agoric-cosmos force:integration Force integration tests to run on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose bankKeeper.SetDenomMetaData to on-chain governance

4 participants