diff --git a/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml b/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml index 2728d785fee1c1a4a2014cb0767f55fc63c45405..1e71b6292e2653cb27074e74d1ac339dc36d7c0e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml +++ b/src/proto_alpha/bin_sc_rollup_node/arith_pvm.ml @@ -36,6 +36,11 @@ module Arith_proof_format = struct type proof = IStoreProof.Proof.tree IStoreProof.Proof.t + let context_hash_to_state_hash h = + Sc_rollup.State_hash.hash_bytes [Context_hash.to_bytes h] + + let hash_tree tree = context_hash_to_state_hash (IStoreTree.hash tree) + let verify_proof proof step = (* The rollup node is not supposed to verify proof. We keep this part in case this changes in the future. *) @@ -58,8 +63,7 @@ module Arith_proof_format = struct let kinded_hash_to_state_hash : IStoreProof.Proof.kinded_hash -> Sc_rollup.State_hash.t = function - | `Value hash | `Node hash -> - Sc_rollup.State_hash.hash_bytes [Context_hash.to_bytes hash] + | `Value hash | `Node hash -> context_hash_to_state_hash hash let proof_before proof = kinded_hash_to_state_hash proof.IStoreProof.Proof.before diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index a914b3f76dd2468d787a2eb61d2f24855f14bd44..942150f4e84ff01b34f96047c1120c7f9bb16514 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -1375,3 +1375,71 @@ let sc_rollup_dal_slot_subscribe (cctxt : #full) ~chain ~block ?confirmations match Apply_results.pack_contents_list op result with | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> return (oph, op, result)) + +let sc_rollup_refute (cctxt : #full) ~chain ~block ?confirmations ?dry_run + ?verbose_signing ?simulation ?fee ?gas_limit ?storage_limit ?counter ~source + ~rollup ~refutation ~opponent ~is_opening_move ~src_pk ~src_sk + ~fee_parameter () = + let op = + Annotated_manager_operation.Single_manager + (Injection.prepare_manager_operation + ~fee:(Limit.of_option fee) + ~gas_limit:(Limit.of_option gas_limit) + ~storage_limit:(Limit.of_option storage_limit) + (Sc_rollup_refute {rollup; refutation; opponent; is_opening_move})) + in + Injection.inject_manager_operation + cctxt + ~chain + ~block + ?confirmations + ?dry_run + ?verbose_signing + ?simulation + ?counter + ~source + ~fee:(Limit.of_option fee) + ~storage_limit:(Limit.of_option storage_limit) + ~gas_limit:(Limit.of_option gas_limit) + ~src_pk + ~src_sk + ~fee_parameter + op + >>=? fun (oph, _, op, result) -> + match Apply_results.pack_contents_list op result with + | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> + return (oph, op, result) + +let sc_rollup_timeout (cctxt : #full) ~chain ~block ?confirmations ?dry_run + ?verbose_signing ?simulation ?fee ?gas_limit ?storage_limit ?counter ~source + ~rollup ~alice ~bob ~src_pk ~src_sk ~fee_parameter () = + let stakers = Sc_rollup.Game.Index.make alice bob in + let op = + Annotated_manager_operation.Single_manager + (Injection.prepare_manager_operation + ~fee:(Limit.of_option fee) + ~gas_limit:(Limit.of_option gas_limit) + ~storage_limit:(Limit.of_option storage_limit) + (Sc_rollup_timeout {rollup; stakers})) + in + Injection.inject_manager_operation + cctxt + ~chain + ~block + ?confirmations + ?dry_run + ?verbose_signing + ?simulation + ?counter + ~source + ~fee:(Limit.of_option fee) + ~storage_limit:(Limit.of_option storage_limit) + ~gas_limit:(Limit.of_option gas_limit) + ~src_pk + ~src_sk + ~fee_parameter + op + >>=? fun (oph, _, op, result) -> + match Apply_results.pack_contents_list op result with + | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> + return (oph, op, result) diff --git a/src/proto_alpha/lib_client/client_proto_context.mli b/src/proto_alpha/lib_client/client_proto_context.mli index c1e510b964f8582e2fbdb64984b3db6f84a5cd68..51108bfecc88e89bbc4f5a5fb3ecb456be106da6 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -882,6 +882,59 @@ val sc_rollup_recover_bond : tzresult Lwt.t +val sc_rollup_refute : + #Protocol_client_context.full -> + chain:Chain_services.chain -> + block:Block_services.block -> + ?confirmations:int -> + ?dry_run:bool -> + ?verbose_signing:bool -> + ?simulation:bool -> + ?fee:Tez.t -> + ?gas_limit:Gas.Arith.integral -> + ?storage_limit:counter -> + ?counter:counter -> + source:public_key_hash -> + rollup:Alpha_context.Sc_rollup.t -> + refutation:Alpha_context.Sc_rollup.Game.refutation -> + opponent:Alpha_context.Sc_rollup.Staker.t -> + is_opening_move:bool -> + src_pk:public_key -> + src_sk:Client_keys.sk_uri -> + fee_parameter:Injection.fee_parameter -> + unit -> + (Operation_hash.t + * Kind.sc_rollup_refute Kind.manager contents + * Kind.sc_rollup_refute Kind.manager Apply_results.contents_result) + tzresult + Lwt.t + +val sc_rollup_timeout : + #Protocol_client_context.full -> + chain:Chain_services.chain -> + block:Block_services.block -> + ?confirmations:int -> + ?dry_run:bool -> + ?verbose_signing:bool -> + ?simulation:bool -> + ?fee:Tez.t -> + ?gas_limit:Gas.Arith.integral -> + ?storage_limit:counter -> + ?counter:counter -> + source:public_key_hash -> + rollup:Alpha_context.Sc_rollup.t -> + alice:Alpha_context.Sc_rollup.Staker.t -> + bob:Alpha_context.Sc_rollup.Staker.t -> + src_pk:public_key -> + src_sk:Client_keys.sk_uri -> + fee_parameter:Injection.fee_parameter -> + unit -> + (Operation_hash.t + * Kind.sc_rollup_timeout Kind.manager contents + * Kind.sc_rollup_timeout Kind.manager Apply_results.contents_result) + tzresult + Lwt.t + val sc_rollup_dal_slot_subscribe : #Protocol_client_context.full -> chain:Chain_services.chain -> diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 688ca2af1defd3bd9fc31427dd1366415a552249..7dc8c6b06d731bca392252501b77abd0a1de00c1 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -206,7 +206,7 @@ let constants_mainnet = max_available_messages = 1_000_000; (* TODO: https://gitlab.com/tezos/tezos/-/issues/2756 The following constants need to be refined. *) - stake_amount = Tez.of_mutez_exn 32_000_000L; + stake_amount = Tez.of_mutez_exn 10_000_000_000L; commitment_period_in_blocks = 30; max_lookahead_in_blocks = 30_000l; max_active_outbox_levels = sc_rollup_max_active_outbox_levels; diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 48aa9a2acecc6d3bc92df4145cc021a3982b4384..dd9c58546ded1363bb253e5ac59a241bc13a5715 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -1899,6 +1899,46 @@ module Sc_rollup = struct ~query:RPC_query.empty ~output:(Data_encoding.list Sc_rollup.Address.encoding) path + + let ongoing_refutation_game = + let query = + let open RPC_query in + query Sc_rollup.Staker.of_b58check_exn + |+ field "staker" RPC_arg.string "" (fun x -> + Format.asprintf "%a" Sc_rollup.Staker.pp x) + |> seal + in + let output = + Sc_rollup.( + Data_encoding.( + option + (obj3 + (req "game" Game.encoding) + (req "alice" Staker.encoding) + (req "bob" Staker.encoding)))) + in + RPC_service.get_service + ~description:"Ongoing refufation game for a given staker" + ~query + ~output + RPC_path.(path /: Sc_rollup.Address.rpc_arg / "game") + + let conflicts = + let query = + let open RPC_query in + query Sc_rollup.Staker.of_b58check_exn + |+ field "staker" RPC_arg.string "" (fun x -> + Format.asprintf "%a" Sc_rollup.Staker.pp x) + |> seal + in + let output = + Sc_rollup.(Data_encoding.list Refutation_storage.conflict_encoding) + in + RPC_service.get_service + ~description:"List of stakers in conflict with the given staker" + ~query + ~output + RPC_path.(path /: Sc_rollup.Address.rpc_arg / "conflicts") end let kind ctxt block sc_rollup_address = @@ -1972,6 +2012,30 @@ module Sc_rollup = struct Registration.register0 ~chunked:true S.root (fun context () () -> Sc_rollup.list context) + let register_ongoing_refutation_game () = + Registration.register1 + ~chunked:false + S.ongoing_refutation_game + (fun context rollup staker () -> + let open Lwt_tzresult_syntax in + let open Sc_rollup.Game.Index in + let open Sc_rollup.Refutation_storage in + let* game, _ = get_ongoing_game_for_staker context rollup staker in + let game = + Option.map (fun (game, index) -> (game, index.alice, index.bob)) game + in + return game) + + let register_conflicts () = + Registration.register1 + ~chunked:false + S.conflicts + (fun context rollup staker () -> + Sc_rollup.Refutation_storage.conflicting_stakers_uncarbonated + context + rollup + staker) + let register () = register_kind () ; register_inbox () ; @@ -1981,7 +2045,9 @@ module Sc_rollup = struct register_staked_on_commitment () ; register_commitment () ; register_dal_slot_subscriptions () ; - register_root () + register_root () ; + register_ongoing_refutation_game () ; + register_conflicts () let list ctxt block = RPC_context.make_call0 S.root ctxt block () () @@ -2009,6 +2075,17 @@ module Sc_rollup = struct let boot_sector ctxt block sc_rollup_address = RPC_context.make_call1 S.boot_sector ctxt block sc_rollup_address () () + + let ongoing_refutation_game ctxt block sc_rollup_address staker = + RPC_context.make_call1 + S.ongoing_refutation_game + ctxt + block + sc_rollup_address + staker + + let conflicts ctxt block sc_rollup_address staker = + RPC_context.make_call1 S.conflicts ctxt block sc_rollup_address staker end module Tx_rollup = struct diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index fa193e68509c1164a4b166cd8ea17bb8aba29967..964ee44b0b27bfe8ad7b1e4e5bc511b8dcb49db5 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2738,6 +2738,8 @@ module Sc_rollup : sig val next : t -> t + val jump : t -> Z.t -> t + val distance : t -> t -> Z.t val of_int : int -> t option @@ -2762,7 +2764,11 @@ module Sc_rollup : sig module Staker : S.SIGNATURE_PUBLIC_KEY_HASH with type t = Signature.Public_key_hash.t - module State_hash : S.HASH + module State_hash : sig + include S.HASH + + val context_hash_to_state_hash : Context_hash.t -> t + end module Inbox : sig type t @@ -3030,6 +3036,8 @@ module Sc_rollup : sig type tree = Tree.tree + val hash_tree : tree -> State_hash.t + type proof val proof_encoding : proof Data_encoding.t @@ -3194,6 +3202,8 @@ module Sc_rollup : sig module Game : sig type player = Alice | Bob + val player_equal : player -> player -> bool + type t = { turn : player; inbox_snapshot : Inbox.t; @@ -3202,12 +3212,16 @@ module Sc_rollup : sig dissection : (State_hash.t option * Tick.t) list; } + val pp : Format.formatter -> t -> unit + module Index : sig type t = private {alice : Staker.t; bob : Staker.t} val make : Staker.t -> Staker.t -> t end + val encoding : t Data_encoding.t + val opponent : player -> player type step = @@ -3284,6 +3298,24 @@ module Sc_rollup : sig type conflict_point = point * point + type conflict = { + other : Staker.t; + their_commitment : Commitment.t; + our_commitment : Commitment.t; + parent_commitment : Commitment.Hash.t; + } + + val conflict_encoding : conflict Data_encoding.t + + val conflicting_stakers_uncarbonated : + context -> t -> Staker.t -> conflict list tzresult Lwt.t + + val get_ongoing_game_for_staker : + context -> + t -> + Staker.t -> + ((Game.t * Game.Index.t) option * context) tzresult Lwt.t + val game_move : context -> t -> diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index f94d4bfae2fbe87ac8024a70be836345e9dff4c0..942324657bd104c76eeb15dc70f37f07d174c7f0 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -987,7 +987,7 @@ let prepare_first_block ~level ~timestamp ctxt = max_available_messages = 1_000_000; (* TODO: https://gitlab.com/tezos/tezos/-/issues/2756 The following constants need to be refined. *) - stake_amount = Tez_repr.of_mutez_exn 32_000_000L; + stake_amount = Tez_repr.of_mutez_exn 10_000_000_000L; commitment_period_in_blocks = 30; max_lookahead_in_blocks = 30_000l; (* Number of active levels kept for executing outbox messages. diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml index 781c520042a1711bf51bc38b35e54015d196bc42..52be4709cd9073ce76dbf14975eff6f8ff8e0852 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -31,6 +31,8 @@ module type P = sig type tree = Tree.tree + val hash_tree : tree -> State_hash.t + type proof val proof_encoding : proof Data_encoding.t @@ -671,6 +673,7 @@ module Make (Context : P) : let* vars_pp = Vars.pp in let* output_pp = Output.pp in let* stack = Stack.to_list in + let* current_tick_pp = CurrentTick.pp in return @@ fun fmt () -> Format.fprintf fmt @@ -682,6 +685,7 @@ module Make (Context : P) : %a@;\ %a@;\ %a@;\ + tick : %a@;\ vars : %a@;\ output :%a@;\ stack : %a@;\ @@ -700,6 +704,8 @@ module Make (Context : P) : () evaluation_result_pp () + current_tick_pp + () vars_pp () output_pp @@ -739,9 +745,7 @@ module Make (Context : P) : let* status = Status.get in match status with | Halted -> return State_hash.zero - | _ -> - Context_hash.to_bytes @@ Tree.hash state |> fun h -> - return @@ State_hash.hash_bytes [h] + | _ -> return @@ Context.hash_tree state in let open Lwt_syntax in let* state = Monad.run m state in @@ -863,15 +867,14 @@ module Make (Context : P) : let* () = ParsingResult.set None in let* () = ParserState.set SkipLayout in let* () = LexerState.set (0, 0) in - let* () = Status.set Parsing in let* () = Code.clear in return () let start_evaluating : unit t = let open Monad.Syntax in + let* () = Status.set Evaluating in let* () = EvaluationResult.set None in let* () = Stack.clear in - let* () = Status.set Evaluating in return () let stop_parsing outcome = @@ -1134,6 +1137,8 @@ module ProtocolImplementation = Make (struct type tree = Context.tree + let hash_tree t = State_hash.context_hash_to_state_hash (Tree.hash t) + type proof = Context.Proof.tree Context.Proof.t let verify_proof p f = @@ -1144,8 +1149,7 @@ module ProtocolImplementation = Make (struct Lwt.return None let kinded_hash_to_state_hash = function - | `Value hash | `Node hash -> - State_hash.hash_bytes [Context_hash.to_bytes hash] + | `Value hash | `Node hash -> State_hash.context_hash_to_state_hash hash let proof_before proof = kinded_hash_to_state_hash proof.Context.Proof.before diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli index dc3efc840c8dfe5cc9c4800c5887fe73809850bd..3fae2cb0915c0f2d815472a48559e4e1b4c845f2 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli @@ -133,6 +133,8 @@ module type P = sig type tree = Tree.tree + val hash_tree : tree -> Sc_rollup_repr.State_hash.t + type proof val proof_encoding : proof Data_encoding.t diff --git a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml index 95d11924bf3ddf11e2e869ec14e054b8cfef99f9..11422287b43280d39cbcae8c86b6e670a585b6f5 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml @@ -45,17 +45,49 @@ module V1 = struct case ~title:"Alice" (Tag 0) - unit + (constant "alice") (function Alice -> Some () | _ -> None) (fun () -> Alice); case ~title:"Bob" (Tag 1) - unit + (constant "bob") (function Bob -> Some () | _ -> None) (fun () -> Bob); ] + let player_equal p1 p2 = + match (p1, p2) with + | Alice, Alice -> true + | Bob, Bob -> true + | _, _ -> false + + let equal + { + turn = turn1; + inbox_snapshot = inbox_snapshot1; + level = level1; + pvm_name = pvm_name1; + dissection = dissection1; + } + { + turn = turn2; + inbox_snapshot = inbox_snapshot2; + level = level2; + pvm_name = pvm_name2; + dissection = dissection2; + } = + player_equal turn1 turn2 + && Sc_rollup_inbox_repr.equal inbox_snapshot1 inbox_snapshot2 + && Raw_level_repr.equal level1 level2 + && String.equal pvm_name1 pvm_name2 + && List.equal + (fun (h1, t1) (h2, t2) -> + Option.equal State_hash.equal h1 h2 + && Sc_rollup_tick_repr.equal t1 t2) + dissection1 + dissection2 + let string_of_player = function Alice -> "alice" | Bob -> "bob" let pp_player ppf player = Format.fprintf ppf "%s" (string_of_player player) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli index 7f6b0d6aa09b284a8a6dea77e54a43be04379e56..6eab6370d3e5b3741c23f0ecc26c697e3939f886 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.mli @@ -167,6 +167,9 @@ module V1 : sig dissection : (State_hash.t option * Sc_rollup_tick_repr.t) list; } + (** [equal g1 g2] returns [true] iff [g1] is equal to [g2]. *) + val equal : t -> t -> bool + (** Return the other player *) val opponent : player -> player @@ -177,6 +180,8 @@ module V1 : sig (Sc_rollup_repr.State_hash.t option * Sc_rollup_tick_repr.t) list -> unit + val player_equal : player -> player -> bool + val pp : Format.formatter -> t -> unit end diff --git a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml index 84333262f7aecba559d54fa31d9d8bde80781e0b..4e5a3f8dd01eb967284c214627930a9415c66cfa 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_proof_repr.ml @@ -115,8 +115,6 @@ module type PVM_with_context_and_state = sig val state : state end -type error += Proof_cannot_be_wrapped - let produce pvm_and_state inbox commit_level = let open Lwt_result_syntax in let (module P : PVM_with_context_and_state) = pvm_and_state in @@ -144,4 +142,4 @@ let produce pvm_and_state inbox commit_level = end in match Sc_rollups.wrap_proof (module P_with_proof) with | Some pvm_step -> return {pvm_step; inbox} - | None -> fail Proof_cannot_be_wrapped + | None -> proof_error "Could not wrap proof" diff --git a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml index 66e00aa3cca1cc8639b3544cb1822f66d3a93bce..cc6860fcaeb2f0a282acff56300cc8e5eef090d7 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml @@ -45,6 +45,20 @@ let timeout_level ctxt = let level = Raw_context.current_level ctxt in Raw_level_repr.add level.level timeout_period_in_blocks +let get_ongoing_game ctxt rollup staker1 staker2 = + let open Lwt_tzresult_syntax in + let stakers = Sc_rollup_game_repr.Index.make staker1 staker2 in + let* ctxt, game = Store.Game.find (ctxt, rollup) stakers in + let answer = Option.map (fun game -> (game, stakers)) game in + return (answer, ctxt) + +let get_ongoing_game_for_staker ctxt rollup staker = + let open Lwt_tzresult_syntax in + let* ctxt, opponent = Store.Opponent.find (ctxt, rollup) staker in + match opponent with + | Some opponent -> get_ongoing_game ctxt rollup staker opponent + | None -> return (None, ctxt) + (** [goto_inbox_level ctxt rollup inbox_level commit] Follows the predecessors of [commit] until it arrives at the exact [inbox_level]. The result is the commit hash at the given inbox level. *) let goto_inbox_level ctxt rollup inbox_level commit = @@ -293,3 +307,47 @@ let apply_outcome ctxt rollup stakers (outcome : Sc_rollup_game_repr.outcome) = module Internal_for_tests = struct let get_conflict_point = get_conflict_point end + +type conflict = { + other : Sc_rollup_repr.Staker.t; + their_commitment : Sc_rollup_commitment_repr.t; + our_commitment : Sc_rollup_commitment_repr.t; + parent_commitment : Sc_rollup_commitment_repr.Hash.t; +} + +let conflict_encoding = + Data_encoding.( + conv + (fun {other; their_commitment; our_commitment; parent_commitment} -> + (other, their_commitment, our_commitment, parent_commitment)) + (fun (other, their_commitment, our_commitment, parent_commitment) -> + {other; their_commitment; our_commitment; parent_commitment}) + (obj4 + (req "other" Sc_rollup_repr.Staker.encoding) + (req "their_commitment" Sc_rollup_commitment_repr.encoding) + (req "our_commitment" Sc_rollup_commitment_repr.encoding) + (req "parent_commitment" Sc_rollup_commitment_repr.Hash.encoding))) + +let conflicting_stakers_uncarbonated ctxt rollup staker = + let open Lwt_tzresult_syntax in + let make_conflict ctxt rollup other (our_point, their_point) = + let our_hash = our_point.hash and their_hash = their_point.hash in + let get = Sc_rollup_commitment_storage.get_commitment_unsafe ctxt rollup in + let* our_commitment, _ = get our_hash in + let* their_commitment, _ = get their_hash in + let parent_commitment = our_commitment.predecessor in + return {other; their_commitment; our_commitment; parent_commitment} + in + let* _, stakers = Store.stakers ctxt rollup in + List.fold_left_es + (fun conflicts (other_staker, _) -> + let*! res = get_conflict_point ctxt rollup staker other_staker in + match res with + | Ok (conflict_point, _) -> + let* conflict = + make_conflict ctxt rollup other_staker conflict_point + in + return (conflict :: conflicts) + | Error _ -> return conflicts) + [] + stakers diff --git a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.mli b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.mli index faac56a0eaaf88a7c1ecde61eca07fa5b30adbf9..53039131d44399ab13e317a6af9639df34f54d15 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.mli @@ -33,6 +33,42 @@ type point = { type conflict_point = point * point +(** [get_ongoing_game_for_staker ctxt rollup staker] returns [Some game] if [staker] + is currently playing a refutation game in the [rollup]. *) +val get_ongoing_game_for_staker : + Raw_context.t -> + Sc_rollup_repr.t -> + Sc_rollup_repr.Staker.t -> + ((Sc_rollup_game_repr.t * Sc_rollup_game_repr.Index.t) option * Raw_context.t) + tzresult + Lwt.t + +(** A conflict between a staker and an [other] staker. The conflict is + about the commitment that follows the [parent_commitment]: + [their_commitment] and [our_commitment] are distinct, hence in + conflict. *) +type conflict = { + other : Sc_rollup_repr.Staker.t; + their_commitment : Sc_rollup_commitment_repr.t; + our_commitment : Sc_rollup_commitment_repr.t; + parent_commitment : Sc_rollup_commitment_repr.Hash.t; +} + +val conflict_encoding : conflict Data_encoding.t + +(** [conflicting_stakers_uncarbonated rollup staker] returns the list + of conflicts with [staker] in [rollup]. + + Notice that this operation can be expensive as it is proportional + to the number of stakers multiplied by the number of commitments in + the staked branches. Fortunately, this operation is only useful as + an RPC for the rollup node to look for a new conflict to solve. *) +val conflicting_stakers_uncarbonated : + Raw_context.t -> + Sc_rollup_repr.t -> + Sc_rollup_repr.Staker.t -> + conflict list tzresult Lwt.t + (** [game_move ctxt rollup player opponent refutation is_opening_move] handles the storage-side logic for when one of the players makes a move in the game. It initializes the game if [is_opening_move] is @@ -61,7 +97,7 @@ type conflict_point = point * point {li [Sc_rollup_wrong_turn] if a player is trying to move out of turn} } - + The [is_opening_move] argument is included here to make sure that an operation intended to start a refutation game is never mistaken for an operation to play the second move of the game---this may diff --git a/src/proto_alpha/lib_protocol/sc_rollup_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_repr.ml index db14462b787e1d22ea374a4aec61fe053798508f..54d93a6b21b668b315fe1b0ab8fd0f5bd9f53ad4 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_repr.ml @@ -109,6 +109,8 @@ module State_hash = struct let () = Base58.check_encoded_prefix b58check_encoding prefix encoded_size include Path_encoding.Make_hex (H) + + let context_hash_to_state_hash h = hash_bytes [Context_hash.to_bytes h] end type t = Address.t diff --git a/src/proto_alpha/lib_protocol/sc_rollup_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_repr.mli index e24094de265155f1f20a2d90df1198e0d0c4d2a1..602a6255d5e36697973a76566ce7aadb85134bac 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_repr.mli @@ -61,7 +61,13 @@ module Internal_for_tests : sig val originated_sc_rollup : Origination_nonce.t -> Address.t end -module State_hash : S.HASH +module State_hash : sig + include S.HASH + + (** [context_hash_to_state_hash ch] turns an (Irmin) context hash + into a state hash. *) + val context_hash_to_state_hash : Context_hash.t -> t +end (** Number of messages consumed by a single commitment. This represents a claim about the shape of the Inbox, which can be disputed as part of a commitment diff --git a/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.ml index 4485fa03e32f1d188bd7167c935b55afcf705697..88e120ae2935b611d4c52593aac186d99249a781 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.ml @@ -30,6 +30,8 @@ let initial = zero let next = succ +let jump tick z = max initial (add tick z) + let pp = pp_print let encoding = Data_encoding.n diff --git a/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.mli b/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.mli index 802e86a9dcec090bd46f56449a6cd330cb2b3457..19d8d34c74c67da22fad35f2cabed38ba6559337 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_tick_repr.mli @@ -33,9 +33,13 @@ type t (** The initial tick. *) val initial : t -(** [next tick] returns the counter successor of [tick]. No overflow can happen. *) +(** [next tick] returns the counter successor of [tick]. *) val next : t -> t +(** [jump tick k] moves [tick] by [k] (possibly negative) steps. + The move stops at [initial] when going back in time. *) +val jump : t -> Z.t -> t + (** [distance t1 t2] is the absolute value of the difference between [t1] and [t2]. *) val distance : t -> t -> Z.t diff --git a/src/proto_alpha/lib_protocol/storage.ml b/src/proto_alpha/lib_protocol/storage.ml index 064797d6476b54eef8a9ed4bc23fa07ebecd4482..8fa50071d3eb6e57bab5030811302de16ce40d1a 100644 --- a/src/proto_alpha/lib_protocol/storage.ml +++ b/src/proto_alpha/lib_protocol/storage.ml @@ -480,11 +480,7 @@ module Big_map = struct let encoding = Script_repr.expr_encoding end) - module Contents : - Non_iterable_indexed_carbonated_data_storage_with_values - with type key = Script_expr_hash.t - and type value = Script_repr.expr - and type t := key = struct + module Contents = struct module I = Storage_functors.Make_indexed_carbonated_data_storage (Make_subcontext (Registered) (Indexed_context.Raw_context) @@ -518,7 +514,10 @@ module Big_map = struct let add = I.add - let list_values = I.list_values + let list_values ?offset ?length (ctxt, id) = + let open Lwt_tzresult_syntax in + let* ctxt, values = I.list_values ?offset ?length (ctxt, id) in + return (ctxt, List.map snd values) let consume_deserialize_gas ctxt value = Raw_context.consume_gas ctxt (Script_repr.deserialized_cost value) @@ -1675,6 +1674,9 @@ module Sc_rollup = struct let encoding = Sc_rollup_commitment_repr.Hash.encoding end) + let stakers (ctxt : Raw_context.t) (rollup : Sc_rollup_repr.t) = + Stakers.list_values (ctxt, rollup) + module Staker_count = Indexed_context.Make_carbonated_map (struct diff --git a/src/proto_alpha/lib_protocol/storage.mli b/src/proto_alpha/lib_protocol/storage.mli index 9fd408a5e7bbb28b26fd81c0a85e2243c9be5653..46ebdad44d5f5364f5a614bf373e8acda044d9bf 100644 --- a/src/proto_alpha/lib_protocol/storage.mli +++ b/src/proto_alpha/lib_protocol/storage.mli @@ -739,6 +739,16 @@ module Sc_rollup : sig and type value = Sc_rollup_commitment_repr.Hash.t and type t = Raw_context.t * Sc_rollup_repr.t + (** [stakers ctxt rollup] returns all the stakers over [rollup] with + their related commitment. *) + val stakers : + Raw_context.t -> + Sc_rollup_repr.t -> + (Raw_context.t + * (Signature.Public_key_hash.t * Sc_rollup_commitment_repr.Hash.t) list) + tzresult + Lwt.t + (** Cache: This should always be the number of entries in [Stakers]. Combined with {!Commitment_stake_count} (see below), this ensures we can diff --git a/src/proto_alpha/lib_protocol/storage_functors.ml b/src/proto_alpha/lib_protocol/storage_functors.ml index d32d3f00c45626102bd9c53593d79b5911708f3f..4170b7bb2f5548dd27c8897e7b60ba9fee3fee38 100644 --- a/src/proto_alpha/lib_protocol/storage_functors.ml +++ b/src/proto_alpha/lib_protocol/storage_functors.ml @@ -500,7 +500,7 @@ module Make_indexed_carbonated_data_storage_INTERNAL | None -> assert false | Some key -> get_unprojected s key >|=? fun (s, value) -> - (s, value :: rev_values, 0, pred length)) + (s, (key, value) :: rev_values, 0, pred length)) | _ -> Lwt.return acc) >|=? fun (s, rev_values, _offset, _length) -> (C.project s, List.rev rev_values) diff --git a/src/proto_alpha/lib_protocol/storage_sigs.ml b/src/proto_alpha/lib_protocol/storage_sigs.ml index ad16d90af8555bdb258883746b3d1bb33b7d8436..7871fc33b00b66a587a79df8b78611283b59ed20 100644 --- a/src/proto_alpha/lib_protocol/storage_sigs.ml +++ b/src/proto_alpha/lib_protocol/storage_sigs.ml @@ -222,7 +222,7 @@ module type Non_iterable_indexed_carbonated_data_storage_with_values = sig ?offset:int -> ?length:int -> t -> - (Raw_context.t * value list) tzresult Lwt.t + (Raw_context.t * (key * value) list) tzresult Lwt.t end module type Non_iterable_indexed_carbonated_data_storage_INTERNAL = sig diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml index bc5ff20abb8a7cf864083040fb81c3d2b8780a44..48fbc6dd037b53625fb0c1fb859eedc2b3b67e20 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_refutation_game.ml @@ -378,6 +378,9 @@ module ContextPVM = ArithPVM.Make (struct type tree = Tree.tree + let hash_tree tree = + Sc_rollup.State_hash.context_hash_to_state_hash (Tree.hash tree) + type proof = Proof.tree Proof.t let verify_proof proof f = @@ -390,8 +393,7 @@ module ContextPVM = ArithPVM.Make (struct return (Some proof) let kinded_hash_to_state_hash = function - | `Value hash | `Node hash -> - State_hash.hash_bytes [Context_hash.to_bytes hash] + | `Value hash | `Node hash -> State_hash.context_hash_to_state_hash hash let proof_before proof = kinded_hash_to_state_hash proof.Proof.before diff --git a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml index 3324faa5b7e9429d30d0e9f1b284bdd7cfb6924b..d824eb283e92c8aeb3822a67bab0fa8cc75a4c4d 100644 --- a/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml +++ b/src/proto_alpha/lib_protocol/test/pbt/test_sc_rollup_encoding.ml @@ -35,6 +35,8 @@ open Protocol open QCheck2 open Lib_test.Qcheck2_helpers +let lift k = Lwt.map Environment.wrap_tzresult k + (** {2 Generators} *) let gen_state_hash = @@ -86,6 +88,84 @@ let gen_versioned_commitment = let* commitment = gen_commitment in return (Sc_rollup_commitment_repr.to_versioned commitment) +let gen_player = Gen.oneofl Sc_rollup_game_repr.[Alice; Bob] + +let gen_messages inbox level = + let open Gen in + let* payloads = small_list (small_string ~gen:printable) in + let messages = + let open Lwt_result_syntax in + let* ctxt = Context.default_raw_context () in + lift + @@ let*? input_messages = + List.map_e + (fun msg -> Sc_rollup_inbox_message_repr.(to_bytes (External msg))) + payloads + in + let messages = + Environment.Context.Tree.empty (Raw_context.recover ctxt) + in + Sc_rollup_inbox_repr.add_messages_no_history + inbox + level + input_messages + messages + in + return + @@ (Lwt_main.run messages |> function + | Ok v -> snd v + | Error e -> + Stdlib.failwith (Format.asprintf "%a" Error_monad.pp_print_trace e)) + +let gen_inbox rollup level = + let open Gen in + let inbox = Sc_rollup_inbox_repr.empty rollup level in + let* inbox = gen_messages inbox level in + return inbox + +let gen_raw_level = + let open Gen in + let* level = small_nat in + return @@ Raw_level_repr.of_int32_exn (Int32.of_int level) + +let gen_pvm_name = Gen.string_printable + +let gen_tick = + let open Gen in + let* t = small_nat in + match Sc_rollup_tick_repr.of_int t with + | None -> assert false + | Some r -> return r + +let gen_dissection = + let open Gen in + small_list (pair (opt gen_state_hash) gen_tick) + +let gen_rollup = + let open Gen in + let* bytes = bytes_fixed_gen Sc_rollup_repr.Address.size in + return (Sc_rollup_repr.Address.hash_bytes [bytes]) + +let gen_game = + let open Gen in + let* turn = gen_player in + let* level = gen_raw_level in + let* rollup = gen_rollup in + let* inbox_snapshot = gen_inbox rollup level in + let* pvm_name = gen_pvm_name in + let* dissection = gen_dissection in + return Sc_rollup_game_repr.{turn; inbox_snapshot; level; pvm_name; dissection} + +let gen_conflict = + let open Gen in + let other = Sc_rollup_repr.Staker.zero in + let* their_commitment = gen_commitment in + let* our_commitment = gen_commitment in + let* parent_commitment = gen_commitment_hash in + return + Sc_rollup_refutation_storage. + {other; their_commitment; our_commitment; parent_commitment} + (** {2 Tests} *) let test_commitment = @@ -104,6 +184,23 @@ let test_versioned_commitment = ~eq:( = ) Sc_rollup_commitment_repr.versioned_encoding -let tests = [test_commitment; test_versioned_commitment] +let test_game = + test_roundtrip + ~count:1_000 + ~title:"Sc_rollup_game.t" + ~gen:gen_game + ~eq:Sc_rollup_game_repr.equal + Sc_rollup_game_repr.encoding + +let test_conflict = + test_roundtrip + ~count:1_000 + ~title:"Sc_rollup_refutation_storage.conflict" + ~gen:gen_conflict + ~eq:( = ) + Sc_rollup_refutation_storage.conflict_encoding + +let tests = + [test_commitment; test_versioned_commitment; test_game; test_conflict] let () = Alcotest.run "SC rollup encoding" [("roundtrip", qcheck_wrap tests)] diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml index af7ef4619671f046452113498bd4bc2de46276b3..106b7e319e5598d535f7fa9b25e58a6f3116a45d 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml @@ -57,6 +57,9 @@ module Arith_Context = struct type tree = Tree.tree + let hash_tree tree = + Sc_rollup_repr.State_hash.context_hash_to_state_hash (Tree.hash tree) + type proof = Context_binary.Proof.tree Context_binary.Proof.t let proof_encoding = @@ -64,7 +67,7 @@ module Arith_Context = struct let kinded_hash_to_state_hash = function | `Value hash | `Node hash -> - Sc_rollup_repr.State_hash.hash_bytes [Context_hash.to_bytes hash] + Sc_rollup_repr.State_hash.context_hash_to_state_hash hash let proof_before proof = kinded_hash_to_state_hash proof.Context_binary.Proof.before diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out index 61e22df23b8acc8bda39d5073188a97953be124d..4de1c9ba32ad83bf125de16742dcf54f6ad7fe17 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out @@ -51,7 +51,7 @@ "sc_rollup_origination_size": 6314, "sc_rollup_challenge_window_in_blocks": 20160, "sc_rollup_max_available_messages": 1000000, - "sc_rollup_stake_amount": "32000000", + "sc_rollup_stake_amount": "10000000000", "sc_rollup_commitment_period_in_blocks": 30, "sc_rollup_max_lookahead_in_blocks": 30000, "sc_rollup_max_active_outbox_levels": 20160, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out index f3889f9611210fe99af9d095829ce10591bc1ef7..550580f4db2884589e17548189c5cb8c9233e2c8 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out @@ -51,7 +51,7 @@ "sc_rollup_origination_size": 6314, "sc_rollup_challenge_window_in_blocks": 20160, "sc_rollup_max_available_messages": 1000000, - "sc_rollup_stake_amount": "32000000", + "sc_rollup_stake_amount": "10000000000", "sc_rollup_commitment_period_in_blocks": 30, "sc_rollup_max_lookahead_in_blocks": 30000, "sc_rollup_max_active_outbox_levels": 20160, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out index 82d83ae637d7b1e4892aec270e5e0b821773640a..de3836004240abda6419adcfc6dfe1db47687547 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out @@ -51,7 +51,7 @@ "sc_rollup_origination_size": 6314, "sc_rollup_challenge_window_in_blocks": 20160, "sc_rollup_max_available_messages": 1000000, - "sc_rollup_stake_amount": "32000000", + "sc_rollup_stake_amount": "10000000000", "sc_rollup_commitment_period_in_blocks": 30, "sc_rollup_max_lookahead_in_blocks": 30000, "sc_rollup_max_active_outbox_levels": 20160, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out index 0569165099ea8f45c1c3428b62555ed2ea887fc9..f19b21573f7a69b24255abd8de8ef12016ebf116 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out @@ -51,7 +51,7 @@ "sc_rollup_origination_size": 6314, "sc_rollup_challenge_window_in_blocks": 20160, "sc_rollup_max_available_messages": 1000000, - "sc_rollup_stake_amount": "32000000", + "sc_rollup_stake_amount": "10000000000", "sc_rollup_commitment_period_in_blocks": 30, "sc_rollup_max_lookahead_in_blocks": 30000, "sc_rollup_max_active_outbox_levels": 20160, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out index 0569165099ea8f45c1c3428b62555ed2ea887fc9..f19b21573f7a69b24255abd8de8ef12016ebf116 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out @@ -51,7 +51,7 @@ "sc_rollup_origination_size": 6314, "sc_rollup_challenge_window_in_blocks": 20160, "sc_rollup_max_available_messages": 1000000, - "sc_rollup_stake_amount": "32000000", + "sc_rollup_stake_amount": "10000000000", "sc_rollup_commitment_period_in_blocks": 30, "sc_rollup_max_lookahead_in_blocks": 30000, "sc_rollup_max_active_outbox_levels": 20160, diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- consecutive commitments.out b/tezt/tests/expected/sc_rollup.ml/Alpha- consecutive commitments.out index 9e75a142abc72b3cd4be1c2fa64af12167bec062..08252632eae5d9d46b1587b09ef1f21ca69c38cf 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- consecutive commitments.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- consecutive commitments.out @@ -31,7 +31,7 @@ This sequence of operations was run: ./tezos-client --wait none publish commitment from '[PUBLIC_KEY_HASH]' for sc rollup '[SC_ROLLUP_HASH]' with compressed state scs11VNjWyZw4Tgbvsom8epQbox86S2CKkE1UAZkXMM7Pj8MQMLzMf at inbox level 32 and predecessor '[SC_ROLLUP_COMMITMENT_HASH]' and number of messages 0 and number of ticks 0 Node is bootstrapped. -Estimated gas: 5330.828 units (will add 100 for safety) +Estimated gas: 5330.832 units (will add 100 for safety) Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -56,12 +56,12 @@ This sequence of operations was run: number_of_messages: 0 number_of_ticks: 0 in the smart contract rollup at address [SC_ROLLUP_HASH] This smart contract rollup commitment publishing was successfully applied - Consumed gas: 5330.828 + Consumed gas: 5330.832 Hash of commit: [SC_ROLLUP_COMMITMENT_HASH] Commitment published at level: 3 Balance updates: - [PUBLIC_KEY_HASH] ....................................................... -ꜩ32 - Frozen_bonds([PUBLIC_KEY_HASH],[SC_ROLLUP_HASH]) ... +ꜩ32 + [PUBLIC_KEY_HASH] ....................................................... -ꜩ10000 + Frozen_bonds([PUBLIC_KEY_HASH],[SC_ROLLUP_HASH]) ... +ꜩ10000 ./tezos-client --wait none publish commitment from '[PUBLIC_KEY_HASH]' for sc rollup '[SC_ROLLUP_HASH]' with compressed state scs11VNjWyZw4Tgbvsom8epQbox86S2CKkE1UAZkXMM7Pj8MQMLzMf at inbox level 62 and predecessor '[SC_ROLLUP_COMMITMENT_HASH]' and number of messages 0 and number of ticks 0 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- observing the correct handling of commitments in the rollup node (no_comm.out b/tezt/tests/expected/sc_rollup.ml/Alpha- observing the correct handling of commitments in the rollup node (no_comm.out index ec1c558afda3937fa08173cef3659d71c2062309..b5e029aed80a8d390cfad4e28e5b6c1f3eeb493e 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- observing the correct handling of commitments in the rollup node (no_comm.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- observing the correct handling of commitments in the rollup node (no_comm.out @@ -103,7 +103,7 @@ This sequence of operations was run: "sc_rollup_origination_size": 6314, "sc_rollup_challenge_window_in_blocks": 1, "sc_rollup_max_available_messages": 1000000, - "sc_rollup_stake_amount": "32000000", + "sc_rollup_stake_amount": "10000000000", "sc_rollup_commitment_period_in_blocks": 30, "sc_rollup_max_lookahead_in_blocks": 30000, "sc_rollup_max_active_outbox_levels": 20160, @@ -205,7 +205,7 @@ This sequence of operations was run: "sc_rollup_origination_size": 6314, "sc_rollup_challenge_window_in_blocks": 1, "sc_rollup_max_available_messages": 1000000, - "sc_rollup_stake_amount": "32000000", + "sc_rollup_stake_amount": "10000000000", "sc_rollup_commitment_period_in_blocks": 30, "sc_rollup_max_lookahead_in_blocks": 30000, "sc_rollup_max_active_outbox_levels": 20160, @@ -213,7 +213,7 @@ This sequence of operations was run: ./tezos-client --wait none recover bond of '[PUBLIC_KEY_HASH]' for sc rollup '[SC_ROLLUP_HASH]' --fee 1 Node is bootstrapped. -Estimated gas: 3205.160 units (will add 100 for safety) +Estimated gas: 3205.162 units (will add 100 for safety) Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -235,9 +235,9 @@ This sequence of operations was run: From: [PUBLIC_KEY_HASH] This smart contract bond retrieval was successfully applied Balance updates: - Frozen_bonds([PUBLIC_KEY_HASH],[SC_ROLLUP_HASH]) ... -ꜩ32 - [PUBLIC_KEY_HASH] ....................................................... +ꜩ32 - Consumed gas: 3205.160 + Frozen_bonds([PUBLIC_KEY_HASH],[SC_ROLLUP_HASH]) ... -ꜩ10000 + [PUBLIC_KEY_HASH] ....................................................... +ꜩ10000 + Consumed gas: 3205.162 ./tezos-sc-rollup-client-alpha rpc get /local/last_published_commitment