Proto: SCORU: Commitment logic
Add API to Sc_rollup_storage and Alpha_context.Sc_rollup for manipulation of pending commitments. Specifically this API adds protocol functions for:
- Submitting and withdrawing stake.
- Staking one new commitments.
- Staking on previous commitments.
- Extraction of conflict points for dispute starts.
- Forced removal of stakers, intended to be used at dispute conclusion.
Adds the following tests (in test_sc_rollup_storage.ml):
-
Deposit to missing rollup fails. -
Deposit to existing rollup succeeds. -
Deposit, then withdrawing succeeds. -
Withdrawing when not staked fails. -
Withdrawing twice fails. -
Staking on a new node succeeds. -
Staking on existing node succeeds. -
Withdrawal fails when not staked on LFC. -
Rollup starts in pre-boot state. -
Finalization succeeds. -
Finalization fails when the commitment is too recent. -
Finalization with two stakers succeeds. -
Finalization fails on conflict. -
We can finds a conflict point at the LFC. -
We can force-remove stakers. -
A removed staker can not withdraw. -
Removing a staker from the LFC fails.
I'm planning to add further tests, tracked in #2460.
Context
This follows !4148 (merged), implementing commitment logic for Smart Contract Optimistic Rollups.
Actual handling of stake amounts (debit/credit/freezing) is not implemented here. This is tracked in #2449 (closed).
Fixes #2106 (closed) #2117 (closed) #2113 (closed)
Manually testing the MR
dune exec src/proto_alpha/lib_protocol/test/unit/main.exe -- test "^\[Unit\] Sc_rollup_storage.ml$"
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, theDevelopment Versionsection ofCHANGES.mdfor everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Hans Hoglund