Mapping between Ticket_hash.t and ticket_index.

Ticket hashes are supposed to be associated to a ticket_index in order to reduce the batches' size submitted from the layer1 to the layer2. Therefore, the first time a ticket hash is used in a layer2 operation, we associate it to a ticket_index that should be use in future layer2 operations.

val init_counter : t -> t m

init_counter ctxt writes the default counter (i.e. 0L) in the context.

get ctxt ticket returns the index associated to ticket, if any.

get_or_associate_index ctxt ticket associates a fresh ticket_index to ticket, and returns it. If the ticket has already been associated to an index, it returns it. It also returns the information on whether the index was created or already existed.

This function can fail with Too_many_l2_tickets iff there is no fresh index available.

val count : t -> int32 m

count ctxt returns the number of tickets that have been involved in the transaction rollup.