cosmos-sdk/x
Amaury 6e95e114c1
fix(group): Better error logs for MsgExec (#11746)
## Description

ref: #10968 

In case of MsgExec failure, we added a `logs` field in the event. While debugging #11679, I noticed these logs were not clear.

Before, the event on MsgExec failure looks like:

```
{
          "key": "logs",
          "value": "\"proposal execution failed on proposal 2, because of error \\ngithub.com/cosmos/cosmos-sdk/x/bank/keeper.BaseSendKeeper.subUnlockedCoins\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/bank/keeper/send.go:192\\ngithub.com/cosmos/cosmos-sdk/x/bank/keeper.BaseSendKeeper.SendCoins\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/bank/keeper/send.go:137\\ngithub.com/cosmos/cosmos-sdk/x/bank/keeper.msgServer.Send\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/bank/keeper/msg_server.go:46\\ngithub.com/cosmos/cosmos-sdk/x/bank/types._Msg_Send_Handler.func1\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/bank/types/tx.pb.go:324\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.(*MsgServiceRouter).RegisterService.func2.1\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/msg_service_router.go:114\\ngithub.com/cosmos/cosmos-sdk/x/bank/types._Msg_Send_Handler\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/bank/types/tx.pb.go:326\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.(*MsgServiceRouter).RegisterService.func2\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/msg_service_router.go:118\\ngithub.com/cosmos/cosmos-sdk/x/group/keeper.Keeper.doExecuteMsgs\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/group/keeper/proposal_executor.go:40\\ngithub.com/cosmos/cosmos-sdk/x/group/keeper.Keeper.Exec\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/group/keeper/msg_server.go:752\\ngithub.com/cosmos/cosmos-sdk/x/group._Msg_Exec_Handler.func1\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/group/tx.pb.go:2069\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.(*MsgServiceRouter).RegisterService.func2.1\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/msg_service_router.go:114\\ngithub.com/cosmos/cosmos-sdk/x/group._Msg_Exec_Handler\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/group/tx.pb.go:2071\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.(*MsgServiceRouter).RegisterService.func2\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/msg_service_router.go:118\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.runMsgsTxHandler.runMsgs\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/run_msgs.go:67\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.runMsgsTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/run_msgs.go:36\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.tipsTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/tips.go:36\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.consumeBlockGasHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/block_gas.go:47\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.branchAndRun\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/branch_store.go:45\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.branchStoreHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/branch_store.go:29\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.incrementSequenceTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/sigverify.go:604\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.sigVerificationTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/sigverify.go:532\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.sigGasConsumeTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/sigverify.go:380\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.validateSigCountTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/sigverify.go:213\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.setPubKeyTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/sigverify.go:142\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.deductFeeTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/fee.go:124\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.consumeTxSizeGasTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/basic.go:322\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.validateMemoTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/basic.go:207\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.txTimeoutHeightTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/basic.go:141\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.validateBasicTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/basic.go:79\\ngithub.com/cosmos/cosmos-sdk/x/auth/middleware.rejectExtensionOptionsTxHandler.DeliverTx\\n\\t/Users/amaury/Workspace/regen/cosmos-sdk/x/auth/middleware/ext.go:76\\nmessage \\\"from_address:\\\\\\\"cosmos142498n8sya3k3s5jftp7dujuqfw3ag4tpzc2ve45ykpwx6zmng8sn2mzmw\\\\\\\" to_address:\\\\\\\"cosmos1uce9j2nwcsvr5asrpayxx57tjzkj8ctf2cm77r\\\\\\\" amount:\\u003cdenom:\\\\\\\"stake\\\\\\\" amount:\\\\\\\"10\\\\\\\" \\u003e \\\" at position 0: 0stake is smaller than 10stake: insufficient funds\"",
          "index": true
        }
```

After, it looks like:

```
 {
          "key": "logs",
          "value": "\"proposal execution failed on proposal 2, because of error message /cosmos.bank.v1beta1.MsgSend at position 0: 0stake is smaller than 10stake: insufficient funds\"",
          "index": true
        }
```



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
2022-04-25 13:37:29 +00:00
..
auth chore: add more tests for code cov in `middleware` (#11694) 2022-04-20 09:56:07 -04:00
authz chore: (x/authz) add helpers `AppendBytes`, `ParseByteSlice` (#11713) 2022-04-21 14:52:31 -04:00
bank refactor: rename `GenTx` to `GenSignedMockTx` to avoid confusion with genutil/GenTx (#11696) 2022-04-20 11:27:19 -04:00
capability fix: Use fixed length hex for pointer at FwdCapabilityKey (#11737) 2022-04-25 08:12:32 +02:00
crisis revert: replace all ModuleCdc instances with legacy.Cdc (#11680) 2022-04-20 09:27:40 +00:00
distribution refactor!: Coins Add and Sub Consistency (#11689) 2022-04-20 08:36:10 -04:00
epoching docs: Improve markdownlint configuration (#11104) 2022-02-10 12:07:01 +00:00
evidence revert: replace all ModuleCdc instances with legacy.Cdc (#11680) 2022-04-20 09:27:40 +00:00
feegrant refactor!: Coins Add and Sub Consistency (#11689) 2022-04-20 08:36:10 -04:00
genutil refactor: rename `GenTx` to `GenSignedMockTx` to avoid confusion with genutil/GenTx (#11696) 2022-04-20 11:27:19 -04:00
gov refactor: rename `GenTx` to `GenSignedMockTx` to avoid confusion with genutil/GenTx (#11696) 2022-04-20 11:27:19 -04:00
group fix(group): Better error logs for MsgExec (#11746) 2022-04-25 13:37:29 +00:00
mint chore: remove migrations 0.42 and below (#11556) 2022-04-07 13:04:03 +00:00
nft chore: master -> main (#11730) 2022-04-24 10:19:04 -04:00
params chore: remove migrations 0.42 and below (#11556) 2022-04-07 13:04:03 +00:00
simulation refactor: rename `GenTx` to `GenSignedMockTx` to avoid confusion with genutil/GenTx (#11696) 2022-04-20 11:27:19 -04:00
slashing refactor: rename `GenTx` to `GenSignedMockTx` to avoid confusion with genutil/GenTx (#11696) 2022-04-20 11:27:19 -04:00
staking fix(tests): fix simulations on cancel unbond (#11712) 2022-04-21 09:44:34 -04:00
upgrade chore: master -> main (#11730) 2022-04-24 10:19:04 -04:00
README.md docs: Improve markdownlint configuration (#11104) 2022-02-10 12:07:01 +00:00

README.md

List of Modules

Here are some production-grade modules that can be used in Cosmos SDK applications, along with their respective documentation:

  • Auth - Authentication of accounts and transactions for Cosmos SDK applications.
  • Authz - Authorization for accounts to perform actions on behalf of other accounts.
  • Bank - Token transfer functionalities.
  • Capability - Object capability implementation.
  • Crisis - Halting the blockchain under certain circumstances (e.g. if an invariant is broken).
  • Distribution - Fee distribution, and staking token provision distribution.
  • Epoching - Allows modules to queue messages for execution at a certain block height.
  • Evidence - Evidence handling for double signing, misbehaviour, etc.
  • Feegrant - Grant fee allowances for executing transactions.
  • Governance - On-chain proposals and voting.
  • Mint - Creation of new units of staking token.
  • Params - Globally available parameter store.
  • Slashing - Validator punishment mechanisms.
  • Staking - Proof-of-Stake layer for public blockchains.
  • Upgrade - Software upgrades handling and coordination.

To learn more about the process of building modules, visit the building modules reference documentation.

IBC

The IBC module for the SDK has moved to its own repository.