Raw File
tx_rollup_message_result_repr.mli
(*****************************************************************************)
(*                                                                           *)
(* Open Source License                                                       *)
(* Copyright (c) 2022 Nomadic Labs <contact@nomadic-labs.com>                *)
(*                                                                           *)
(* Permission is hereby granted, free of charge, to any person obtaining a   *)
(* copy of this software and associated documentation files (the "Software"),*)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense,  *)
(* and/or sell copies of the Software, and to permit persons to whom the     *)
(* Software is furnished to do so, subject to the following conditions:      *)
(*                                                                           *)
(* The above copyright notice and this permission notice shall be included   *)
(* in all copies or substantial portions of the Software.                    *)
(*                                                                           *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING   *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER       *)
(* DEALINGS IN THE SOFTWARE.                                                 *)
(*                                                                           *)
(*****************************************************************************)

type t = {
  context_hash : Context_hash.t;
  withdraw_list_hash : Tx_rollup_withdraw_list_hash_repr.t;
}

val encoding : t Data_encoding.t

val init : t

(** [empty_l2_context_hash] is the context hash of the layer-2 context
    just after its origination.

    The empty layer2 context hash is the hash of the underlying Irmin tree.
    One important note is: an empty tree *must* not be hashed when it's empty.
    See https://github.com/mirage/irmin/issues/1304.

    Our solution is to write data in the tree to have a non-empty one.
    We write the {!Tx_rollup_l2_context.Ticket_count} default value (i.e. 0)
    and the {!Tx_rollup_l2_context.Address_count} as well in the tree. Then
    we hash the resulting tree to create this constant.
*)
val empty_l2_context_hash : Context_hash.t
back to top