tezos-reward-distributor icon indicating copy to clipboard operation
tezos-reward-distributor copied to clipboard

Handle simulation errors and mark payments as failed

Open AndrewKishino opened this issue 2 years ago • 3 comments


name: Handle simulation errors and mark payments as failed about: General try/catch for simulate_single_operation when calling attempt_single_batch labels:


IMPORTANT NOTICE: I read and understood the guidelines for contributions to the TRD. The contribution may qualify for being compensated by the TRD grant if approved by the maintainers.

This PR resolves the issue #621. The following steps were performed:

  • Analysis: Some RPC fields changed names resulting in a python exception when simulating payments to KT accounts

  • Solution: Wrap operation simulations in a try/catch and handle errors by marking the payment as failed

  • Implementation: Catching general exceptions from the operation simulation and marking the payment as failed as well as logging the error.

  • Performed tests: Reverted https://github.com/tezos-reward-distributor-organization/tezos-reward-distributor/commit/e1c5e4e668806f32b01eddeb02e8a29dff4c7943 and ran payments for a cycle on Ghostnet. Verified failed payments to KT accounts are accurately recorded in pymt/reports/<tz...>/payments/failed/<cycle>.csv. Reset https://github.com/tezos-reward-distributor-organization/tezos-reward-distributor/commit/e1c5e4e668806f32b01eddeb02e8a29dff4c7943 and re-ran TRD for the same cycle to process failed payments. Confirmed previously failed payments were successfully applied.

  • Documentation: Make sure to document the added changes in a proper way (Readme, help section, documentation, comments in code if needed)

  • Check list:

  • [ ] I extended the Github Actions CI test units with the corresponding tests for this new feature (if needed).
  • [ ] I extended the Sphinx documentation (if needed).
  • [ ] I extended the help section (if needed).
  • [ ] I changed the README file (if needed).
  • [ ] I created a new issue if there is further work left to be done (if needed).

Work effort: 1hrs

AndrewKishino avatar Sep 26 '22 00:09 AndrewKishino

We could argue if we put AVOIDED or FAILED in there.

jdsika avatar Sep 26 '22 16:09 jdsika

My understanding is that FAILED payments would be filtered into the failed reports and are retry-able whereas AVOIDED payments are not considered FAILED and are not retried.

AndrewKishino avatar Sep 26 '22 17:09 AndrewKishino

Yes, line 707 is therefore inconsistent and probably wrong?

jdsika avatar Sep 27 '22 08:09 jdsika