-
Notifications
You must be signed in to change notification settings - Fork 253
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.
- Create
MsgSetDenomMetaDatainagoric-sdk/golang/cosmos/proto/agoric/vbank/msgs.proto, which should be a standard Cosmos-SDK v0.50x/govproposal message. It should have all the parameters needed bybankKeeper.SetDenomMetaData, as well as the appropriateauthorityfield needed byx/gov. - Run
cd agoric-sdk/golang/cosmos && make proto-allto regenerate the*.pb.gofiles. - Add an
authorityparameter to the constructor foragoric-sdk/golang/x/vbank/keeper.NewKeeper, and provide thex/govauthority address to it in the call tovbank.NewKeeperinagoric-sdk/golang/cosmos/app.NewAgoricApp. - Add
SetDenomMetaDatato theagoric-sdk/golang/cosmos/x/vbank/types/expected_keepers.goBankKeeperinterface, with exactly the same type asx/bank/keeper.SetDenomMetaData. - Add
MsgSetDenomMetaDatato theagoric-sdk/golang/cosmos/x/vbank/types/msg_server.go, and have it verify theauthorityfield matches the Keeper's authority, and make other consistency checks for the message before callingbankKeeper.SetDenomMetaDatawith the appropriate parameters. - Write comprehensive gotest tests for the new features in
x/vbank/types/msg_server_test.go. - Run
cd agoric-sdk/golang/cosmos && go test ./x/vbank/...to check that the feature passes unit tests. - 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.