SecretNetwork
SecretNetwork copied to clipboard
Fix `secretcli tx authz grant` for Ledger
$ secretcli version --long
version: 1.4.0-beta.5
$ secretcli tx authz grant \
secret1mpf7w0yyz9n3dh42un2zqu2dmsqv7dhkdlh78e generic \
--msg-type /cosmos.gov.v1beta1.MsgVote \
--expiration 1694386800 \
--chain-id pulsar-2 \
--node https://rpc.pulsar.scrttestnet.com \
--gas auto --gas-prices 0.025uscrt \
--gas-adjustment 1.5 \
--from ecostake-test-ledger
raw_log: 'signature verification failed; please verify account number (65436), sequence
(0) and chain-id (pulsar-2): unable to verify single signer signature 3e32eb70529cd138db03663c83a696e08248385f75dd4df6b2c46404d332ffde17e7c93c30c48e3a9fa823957527ab4f74902aa825a229e06946cc1951961e07
for signBytes 7b226163636f756e745f6e756d626572223a223635343336222c22636861696e5f6964223a2270756c7361722d32222c22666565223a7b22616d6f756e74223a5b7b2....
This happens because this calls this which encodes msg.Grant.Authorization as protobuf regardless of SIGN_MODE.
Ledger account can only sign using SIGN_MODE_LEGACY_AMINO_JSON, so we need to check for sign mode and encode appropriately.