Skip to content

Expose bankKeeper.SetDenomMetaData to on-chain governance #12292

@michaelfig

Description

@michaelfig

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.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions