cosmos-sdk: cli should throw error if --chain-id not provided
Txs require --chain-id to be provided so it can be signed.
Note the chainid is not included in the tx itself, but it is part of the bytes that get signed to prevent cross-chain replay attacks.
Unfortunately, it means the error message just comes up as “signature verification failed” and we can’t really detect why.
Thus, if the --chain-id is not provided, we should throw an error and tell the user it must be provided.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (16 by maintainers)
Commits related to this issue
- Automatically determine chainID, throw error if not provided (closes #810) — committed to cosmos/cosmos-sdk by cwgoes 6 years ago
- Automatically determine chainID, throw error if not provided (closes #810) — committed to cosmos/cosmos-sdk by cwgoes 6 years ago
- Don't fallback to any default values for chain id - Remove DefaultChainID(). User needs to suplly chain ID via either config or flag. - Mark --chain-id as required by all tx commands. - Fix gaiacli... — committed to cosmos/cosmos-sdk by deleted user 6 years ago
- Don't fallback to any default values for chain id - Remove DefaultChainID(). User needs to suplly chain ID via either config or flag. - Mark --chain-id as required by all tx commands. - Fix gaiacli... — committed to cosmos/cosmos-sdk by deleted user 6 years ago
- Don't fallback to any default values for chain id - Remove DefaultChainID(). User needs to suplly chain ID via either config or flag. - Mark --chain-id as required by all tx commands. - Fix gaiacli... — committed to cosmos/cosmos-sdk by deleted user 6 years ago
- Merge PR #3127: Don't fallback to any default values for chain id - Remove DefaultChainID(). User needs to suplly chain ID via either config or flag. - Mark --chain-id as required by all tx comma... — committed to cosmos/cosmos-sdk by alessio 6 years ago
I think this is a bit dangerous - chain ID is part of the signature; if you sign over a message with a chain ID you didn’t intend it could have deleterious consequences (e.g. it might be a valid tx on a different blockchain). Better to require chain ID, if it isn’t specified in the CLI config.
Can we load the chain ID automatically from the genesis file, if present?
@aaronc this is done now, please test
Indeed. Seems like we have an actionable item here to require the chain ID flag.