package tezos-protocol-alpha

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This module introduces various functions to manipulate the storage related to commitments for transaction rollups.

add_commitment context tx_rollup contract commitment adds a commitment to a rollup. It returns the new context, the new state, and the committer of the previous commitment stored for this level if any.

In case this committer exists, then it means its bond needs to be slashed.

This function returns the errors

  • Level_already_has_commitment iff there is already a valid commitment (i.e., not orphan) at this level.
  • Invalid_committer iff an orphan commitment from the same committer already is in the storage.
  • Missing_commitment_predecessor iff the predecessor does not match the already-stored predecessor commitment.
  • Wrong_commitment_predecessor_level iff there is no predecessor level, but a predecessor commitment is provided (or no predecessor commitment is provided but there is a precessor level)
  • Wrong_batch_count iff the number of batches does not equal the length of the inbox.

remove_bond context state tx_rollup contract removes the bond for an implicit contract. This will fail if either the bond does not exist, or if the bond is currently in use.

slash_bond ctxt tx_rollup contract removes the bond counter for an implicit contract if it exists. Besides, it returns a boolean to determine if this counter was strictly superior to 0.

find context tx_rollup state level returns the commitment for a level, if any exists and is not orphan (that is, one of its ancestors has been rejected). If the rollup does not exist, the error Tx_rollup_does_not_exist is returned.

get context tx_rollup state level returns the commitment for a level, if any exists. If the rollup does not exist, the error Tx_rollup_does_not_exist is returned. If there is no commitment in the storage, or if a commitment exists but it is orphan (that is, one of its ancestors has been rejected), then Commitment_does_not_exist is returned.

get_finalized context tx_rollup level returns the commitment for a level, if any exists and is finalized. If the rollup does not exist, the error Tx_rollup_does_not_exist is returned. If the commitment is not finalized the error Tx_rollup_commitment_not_final is returned

pending_bonded_commitments ctxt tx_rollup contract returns the number of commitments that contract has made that are still in the storage.

has_bond ctxt tx_rollup contract returns true if we have already collected a bond for contract for commitments on tx_rollup.

finalize_commitment ctxt tx_rollup state marks the commitment of the oldest inbox as final, if the commitment exists and if it is old enough. Otherwise, this function returns the error No_commitment_to_finalize.

The number of pending_bonded_commitments is not updated, it is decremented when the commitment is removed (see remove_commitment). It is done to force the rollup operators to clean up the commitment storage.

The state of the rollup is adjusted accordingly, and the finalized level is returned. Besides, the inbox at said level is removed from the context. This function returns the new context, and the new state.

remove_commitment ctxt tx_rollup state tries to remove the oldest finalized commitment from the layer-1 storage, if it exists, and if it is old enough. Otherwise, this functions returns the error No_commitment_to_remove.

The state of the rollup is adjusted accordingly.

reject_commitment context tx_rollup state level removes the commitment at level. It should only be called after a successful rejection operation. The state is updated to reflect the rejection, and returned.