[go: up one dir, main page]

Proto/AI: refactor unstake request storage

Based on !15564 (merged)

It kind of tackles #6019 as the check is now much simpler I don't think it needs to be carbonated.

What

This MR refactor the code around unstake_requests_storage.

It makes it the responsibility of unstake_requests_storage to update what is stored in it.

The Unstake_requests_storage module's invariants are documented in the first commit, then operations on unstake requests are progressively moved into it.

The refactor should not change the carbonation. There are tests of that in tezt/tests/main.exe --file tezt/tests/operation_size_and_gas.ml --title 'Alpha: operation size and gas for staking operations' but they might not cover every possible execution path (like staking from unstake requests).

Why

To prevent bugs that we have seen already where invariant on the internal representation was not preserved, preventing further unstaking.

How

Manually testing the MR

The staking/unstaking mechanism is heavily tested in protocol's and integration tests.

Edited by Julien

Merge request reports

Loading