Module Octez_smart_rollup_node.Loser_mode

type t

A list of failures.

type dal_parameters = {
  1. number_of_slots : int64;
  2. attestation_lag : int64;
  3. slot_size : int64;
  4. page_size : int64;
}
type dal_page = {
  1. inbox_level : int32 option;
  2. published_level : int32 option;
  3. slot_index : int option;
  4. page_index : int option;
  5. page_payload_strategy : [ `Alter | `Flip ];
}

DAL page selector and payload-forging strategy.

Optional fields act as wildcards:

  • None means "match any value" for that dimension. Example:

inbox_level = None; published_level = None; slot_index = Some 3; page_index = None; _

matches every page of slot index 3 at any level.

Fields:

  • inbox_level: L1 level at which the slot is being imported (or None).
  • published_level: L1 level at which the slot was supposed to be published (or None).
  • slot_index: Index of the target slot at that level (or None).
  • page_index: Index of the target page within the slot (or None).
  • page_payload_strategy: How the faulty/losing node derives the payload from the honest page:
  • `Alter: Mutate the bytes of an existing Some payload. No effect if the honest payload is None.
  • `Flip: Toggle presence: None -> Some bytes, Some _ -> None.
val no_failures : t

no_failures are planned.

val make : string -> t option

make s parses a list of integers separated by spaces that is a periodic sequence of triple level message_index message_tick representing a failure that the rollup node is supposed to make. This function returns None if the input string is not syntactically correct.

val is_failure : t -> level:int -> message_index:int -> int64 list

is_failure failures ~level ~message_index returns message_ticks where a failure is supposed to happen at the point of the rollup node processing of a given inbox level, a given message_index and for all message_ticks. Ticks are sorted by increasing order.

val is_invalid_dal_parameters : t -> dal_parameters option
val is_invalid_dal_page : inbox_level:int32 -> published_level:int32 -> slot_index:int -> page_index:int -> page_size:int -> honest_payload:bytes option -> t -> (unit, bytes option) Either.t Lwt.t

Decide whether to corrupt a DAL page and, if so, how.

Given the current inbox_level, published_level, slot_index, page_index, page_size, the honest page payload (honest_payload), and a failure plan t, this function checks whether an Invalid_dal_page rule matches (wildcards allowed via None in the rule). If no rule applies, returns Either.left ().

If a rule applies, returns Either.right forged:

  • forged = None -> payload is removed (flip from Some _ to None).
  • forged = Some bs -> payload is replaced with bs.

See dal_page above for forge strategies.