SCORU: Add missing protocol constants and tests for invariants
- Add a protocol constant
sc_rollup_stake_amount_in_mutez
- Add a protocol constant
sc_rollup_commitment_frequency_in_blocks
(replacing hardcoded value inSc_rollup_storage
). - Add a protocol constant
sc_rollup_max_lookahead_in_blocks
(replacing hardcoded value inSc_rollup_storage
).
Add tests checking that:
-
challenge_window_in_blocks < max_lookahead
(somewhat) -
commitment_storage_cost*(max_lookahead/commitment_frequency) < stake_amount
wherecommitment_storage_cost = the cost of storing one commitment = storage burn for 84 bytes
.
Add documentation of the new constants mentioning the above constraints.
Background
We impose restrictions on commitment frequency for two reasons:
-
To prevent overallocation of storage. Because backtracking the stake position is not allowed each staker can allocate at most [d] nodes, where [d] is the depth of the tree on which they are staked.
The constants used by [assert_commitment_tree_not_too_deep] and [assert_commitment_frequency] are chosen so that the maximum cost of storage allocated by each staker at most the size of their deposit.
-
To enforce Disjointness of commitments we tag inbox messages with L1 block, then produce exactly one L2 commitment per (n > 0) L1 blocks.
Edited by Emma Turner