Module Tezos_raw_protocol_alpha.Sc_rollup_dissection_chunk_repr

type t = {
  1. state_hash : Sc_rollup_repr.State_hash.t option;
  2. tick : Sc_rollup_tick_repr.t;
}

A dissection chunk is made of an optional state hash, and a tick count.

val equal : t -> t -> bool
val default_check_sections_number : default_number_of_sections:int -> number_of_sections:int -> dist:Tezos_protocol_environment_alpha.Z.t -> unit Tezos_protocol_environment_alpha.Error_monad.tzresult
val default_check : section_maximum_size:Tezos_protocol_environment_alpha.Z.t -> check_sections_number: (default_number_of_sections:int -> number_of_sections:int -> dist:Tezos_protocol_environment_alpha.Z.t -> unit Tezos_protocol_environment_alpha.Error_monad.tzresult) -> default_number_of_sections:int -> start_chunk:t -> stop_chunk:t -> t list -> unit Tezos_protocol_environment_alpha.Error_monad.tzresult

We check firstly that dissection is the correct length. It must be default_number_of_sections values long, unless the distance between start_tick and stop_tick is too small to make this possible, in which case it should be as long as possible. (If the distance is one we fail immediately as there is no possible legal dissection).

Then we check that dissection starts at the correct tick and state (specified by start_chunk), and that it ends at stop_chunk, at the correct tick and with a different state to the current dissection.

Finally, we check that dissection is well formed: it has correctly ordered the ticks, and it begins with a real hash of the form Some s not a None state. Note that we have to allow the possibility of multiple None states because the restrictions on dissection shape (which are necessary to prevent a 'linear-time game' attack) will mean that sometimes the honest play is a dissection with multiple None states.

type Tezos_protocol_environment_alpha.Error_monad.error +=
  1. | Dissection_number_of_sections_mismatch of {
    1. expected : Tezos_protocol_environment_alpha.Z.t;
    2. given : Tezos_protocol_environment_alpha.Z.t;
    }
    (*

    There are more or less than the expected number of sections in the given dissection.

    *)
  2. | Dissection_invalid_number_of_sections of Tezos_protocol_environment_alpha.Z.t
    (*

    There are less than two sections in the given dissection, which is not valid.

    *)
  3. | Dissection_start_hash_mismatch of {
    1. expected : Sc_rollup_repr.State_hash.t option;
    2. given : Sc_rollup_repr.State_hash.t option;
    }
    (*

    The given start hash in a dissection is None or doesn't match the expected one.

    *)
  4. | Dissection_stop_hash_mismatch of Sc_rollup_repr.State_hash.t option
    (*

    The given stop state hash in a dissection should not match the last hash of the section being refuted.

    *)
  5. | Dissection_edge_ticks_mismatch of {
    1. dissection_start_tick : Sc_rollup_tick_repr.t;
    2. dissection_stop_tick : Sc_rollup_tick_repr.t;
    3. chunk_start_tick : Sc_rollup_tick_repr.t;
    4. chunk_stop_tick : Sc_rollup_tick_repr.t;
    }
    (*

    The given dissection's edge ticks don't match the edge ticks of the section being refuted.

    *)
  6. | Dissection_ticks_not_increasing
    (*

    Invalid provided dissection because ticks are not increasing between two successive sections.

    *)
  7. | Dissection_invalid_distribution of Tezos_protocol_environment_alpha.Z.t
    (*

    Invalid provided dissection because ticks split is not well balanced across sections

    *)
  8. | Dissection_invalid_successive_states_shape
    (*

    A dissection cannot have a section with no state hash after another section with some state hash.

    *)