provenance-io / explorer-service

The server side of the blockchain Explorer app. Allows for UI browsing of the blockchain.
Apache License 2.0
6 stars 3 forks source link

Implement tx error handling when `ibcService.saveIbcChannelData` fails #535

Closed nullpointer0x00 closed 1 month ago

nullpointer0x00 commented 1 month ago

Summary

Implement error handling in the addTxToCache method to ensure that when ibcService.saveIbcChannelData fails, the remaining transaction data for the block is still saved, and the failure is logged in a database table.

Problem Definition

Currently, if any part of the addTxToCache method fails, such as the ibcService.saveIbcChannelData(res, txInfo, txUpdate) call, none of the transaction data for that block is saved. This issue is particularly problematic as it leads to missing transaction data in the database. Related issues, like #500 and #502, indicate that this problem may be more widespread than initially reported.

Addressing this issue will significantly improve the reliability of the explorer-service by ensuring data integrity even if parts of the transaction processing fail. It also lays the groundwork for future enhancements with similar error handling for all save operations.

Proposal

  1. Modify the addTxToCache method in the AsyncCachingV2 class to include a try-catch block around the ibcService.saveIbcChannelData(res, txInfo, txUpdate) call.
  2. If the ibcService.saveIbcChannelData call fails, log the error in a new or existing database table dedicated to tracking such failures.
  3. Ensure that the method continues processing and saving the remaining transaction data even if the IBC save operation fails.
  4. For future consideration, extend this error-handling pattern to other save operations within the addTxToCache method.

For Admin Use