Add reset/cleanup functions to defer in close nonce#803
Conversation
|
Please do similarly for the CloseWorkerNonce counterparts: |
|
Additionally. For example, in this function we detect that and ultimately we So I believe we should move both function cleanings (worker, reputer) closest to the point where the (topic, block) is detected (and thus we know we need to ultimately clean). |
xmariachi
left a comment
There was a problem hiding this comment.
an additional comment, lgtm otherwise
1c27c5c to
faadf6c
Compare
Purpose of Changes and their Description
This PR enhances the robustness of the CloseReputerNonce function by implementing a defer block to ensure critical cleanup operations (fulfilling the nonce, resetting active reputers, resetting submissions) are always executed, even if errors occur during the processing of reputer bundles.
The primary goal is to prevent the system from getting stuck in an inconsistent state if CloseReputerNonce fails mid-execution. By guaranteeing cleanup actions via defer, we ensure the nonce is properly fulfilled and associated state (active reputers, submissions) is reset, improving the reliability of the nonce management and reward distribution process.
Link(s) to Ticket(s) or Issue(s) resolved by this PR
https://linear.app/alloralabs/issue/ENGN-3672/required-functions-not-being-called-not-deferd
Are these changes tested and documented?
Unreleasedsection ofCHANGELOG.md?Still Left Todo