Module Tezos_raw_protocol_alpha.Sc_rollup_stake_storage

remove_staker context rollup staker forcibly removes the given staker and confiscates their frozen deposits.

Removes staker from the list of active stakers on the rollup and clean its metadata.

publish_commitment context rollup staker commitment published commitment.

Starts by depositing a stake for staker if staker is not a known staker of rollup. Then, staker will use its stake to stake on commitment.

For publishing to succeed, the following must hold:

  1. A deposit exists (or can be deposited) for staker.
  2. The commitment respects the commitment period and is not published in advance.
  3. The commitment is not past the curfew, i.e., stakers has a limit on the available time to publish, if a staker already published for this inbox level.
  4. The commitment.predecessor exists.
  5. The commitment contains at least one tick.

Returns the hash of the given commitment, the level when the commitment was first published by some staker, the modified context and the balance updates if a stake was deposited.

This function does not authenticate the staker.

cement context rollup tries to cement the next inbox level commitment, that is, the LCC's successor. Returns the cemented commitment hash and its hash.

For cementing to succeed, we need to have **one** commitment respecting the following properties:

  1. The deadline for commitment must have passed.
  2. The predecessor of commitment must be the Last Cemented Commitment.
  3. There must be at least one staker.
  4. All stakers must be indirectly staked on commitment.

If successful, Last Cemented commitment is set to the found commitment, and deallocate the old cemented commitment accordingly to the number of stored cemented commitments.

Clean the storage for the metadata added for this inbox level.

find_staker context rollup staker returns the most recent commitment staker staked on, or None if its last staked commitment is older or equal than the last cemented commitment.

is_staked_on context rollup staker commitment_hash returns true iff staker is an active staker and has staked on commitment_hash.

commitments_uncarbonated ctxt ~rollup ~inbox_level returns the list of commitments associated to rollup at inbox_level

stakers_ids_uncarbonated ctxt ~rollup ~commitment returns the list of stakers' indexes associated to rollup for a specific commitment

staker_id_uncarbonated ctxt ~rollup ~pkh returns the staker's index associated to the public key hash pkh

stakers_pkhs_uncarbonated ctxt ~rollup returns the public key hashes of stakers that are currently actively staking on rollup

withdraw_stake context rollup staker removes staker and cleans its metadata. staker is allowed to withdraw if it latest staked commitment is older than the last cemented commitment.

commitments_of_inbox_level ctxt rollup inbox_level returns the list of commitments for inbox_level.

stakers_of_commitment ctxt rollup commitment_hash returns the list of stakers staking on commitment_hash.

find_commitment_of_staker_in_commitments ctxt rollup staker_index commitments selects in commitments the hash of the commitment staked by staker_index, if any.