sei-protocol / sei-tendermint

Tendermint fork with ABCI++ support, bug fixes, and custom features
Other
39 stars 36 forks source link

reformat RPC logs for transaction broadcast failure case for easier debugging in frontend #207

Closed dssei closed 8 months ago

dssei commented 9 months ago

Describe your changes and provide context

On sei-js side, when transaction broadcast fails, up until recently we were observing error like the following

BroadcastTxError: Broadcasting transaction failed with code 10 (codespace: sdk). Log:
    at SigningStargateClient.broadcastTx (/Users/bryantran/code/sei/nft/script/node_modules/@cosmjs/stargate/build/stargateclient.js:267:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async main (file:///Users/bryantran/code/sei/nft/script/evm/test.js:17:18) {
  code: 10,
  codespace: 'sdk',
  log: ''
}

With recent change https://github.com/sei-protocol/sei-tendermint/pull/201, the log looks like.

 log: '[{"log":"insufficient fees; got: 1200usei required: 12000usei: insufficient fee"}]'

We would like to tweak formatting a bit (from json, to a simple string) , so the output of the log is more like

log: 'insufficient fees; got: 1200usei required: 12000usei: insufficient fee'

With full error message looking like

BroadcastTxError: Broadcasting transaction failed with code 13 (codespace: sdk). Log: insufficient fees; got: 1200usei required: 12000usei: insufficient fee
    at SigningStargateClient.broadcastTxSync (/Users/denyssinyakov/repos/experimental/cosmos-test/node_modules/@cosmjs/stargate/build/stargateclient.js:290:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SigningStargateClient.broadcastTx (/Users/denyssinyakov/repos/experimental/cosmos-test/node_modules/@cosmjs/stargate/build/stargateclient.js:267:31) {
  code: 13,
  codespace: 'sdk',
  log: 'insufficient fees; got: 1200usei required: 12000usei: insufficient fee'
}

Testing performed to validate your change

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 57.89%. Comparing base (a84cd86) to head (72e28cf).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-tendermint/pull/207/graphs/tree.svg?width=650&height=150&src=pr&token=VYIWMMGYMP&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)](https://app.codecov.io/gh/sei-protocol/sei-tendermint/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) ```diff @@ Coverage Diff @@ ## main #207 +/- ## ========================================== - Coverage 58.01% 57.89% -0.12% ========================================== Files 249 249 Lines 33916 33915 -1 ========================================== - Hits 19677 19636 -41 - Misses 12670 12708 +38 - Partials 1569 1571 +2 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-tendermint/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) | Coverage Δ | | |---|---|---| | [internal/mempool/mempool.go](https://app.codecov.io/gh/sei-protocol/sei-tendermint/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-aW50ZXJuYWwvbWVtcG9vbC9tZW1wb29sLmdv) | `70.05% <100.00%> (-0.06%)` | :arrow_down: | ... and [16 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-tendermint/pull/207/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)