Proto/ai: don't update the Unstake_requests storage when not necessary
Context
Depends on !9406 (merged)
Only the last commit is in this MR
This MR optimizes the finalize_unstake call when no unstake request in unfinalizable. As I understand, the desired behavior was that prepare_finalize_unstake returned None if there was no finalizable requests, but this was not the case, so there were wasteful update calls. This MR should fix it. I don't think we can do much better than that in terms of performance, as it is necessary to scan all the unstake requests to know which ones are unfinalizable or not, if any.
Manually testing the MR
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR