cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.27k stars 3.63k forks source link

CLI help text for gov v1 proposal submission command can be misleading #15032

Closed larry0x closed 1 year ago

larry0x commented 1 year ago

Problem Definition

The cli help text for the tx gov submit-proposal includes the following example:

Example:
$ %s tx gov submit-proposal path/to/proposal.json
Where proposal.json contains:
{
  // array of proto-JSON-encoded sdk.Msgs
  "messages": [
    {
      "@type": "/cosmos.bank.v1beta1.MsgSend",
      "from_address": "cosmos1...",
      "to_address": "cosmos1...",
      "amount":[{"denom": "stake","amount": "10"}]
    }
  ],
  "metadata: "4pIMOgIGx1vZGU=", // base64-encoded metadata
  "deposit": "10stake"
  "title: "My proposal"
  "summary": "A short summary of my proposal",
  "expedited": false
}

Here, it specifies the metadata as "base64-encoded".

This can be misleading, as in fact metadata can be any string (e.g. raw text, stringified json, or an IPFS link), not necessarily has to be base64-encoded. The language used may lead users to think that only base64 is accepted.

This issue has been raised recently in separate occasions (once during an audit of Mars Hub chain, once by a community member attempting to submit a proposal).

Proposal

Refine the language used in the help text to make it clear that the metadata field accepts any string.

larry0x commented 1 year ago

Btw, I think the same cli help text also appears in the group module