diff --git a/tezt/lib_tezos/agnostic_baker.ml b/tezt/lib_tezos/agnostic_baker.ml index 6543fe5102f4fb74559a3166cab243805f5b1f9f..64f90ccc0ddbd777072537e60f660ed93b843061 100644 --- a/tezt/lib_tezos/agnostic_baker.ml +++ b/tezt/lib_tezos/agnostic_baker.ml @@ -23,10 +23,15 @@ module Parameters = struct base_dir : string; node_data_dir : string; node_rpc_endpoint : Endpoint.t; + dal_node_rpc_endpoint : Endpoint.t option; mutable pending_ready : unit option Lwt.u list; - remote_mode : bool; liquidity_baking_toggle_vote : liquidity_baking_vote option; - use_dal_node : string option; + force_apply_from_round : int option; + remote_mode : bool; + operations_pool : string option; + state_recorder : bool; + node_version_check_bypass : bool; + node_version_allowed : string option; } type session_state = {mutable ready : bool} @@ -52,8 +57,10 @@ let set_ready agnostic_baker = let create_from_uris ?runner ?(path = Uses.path Constant.octez_experimental_agnostic_baker) ?name ?color - ?event_pipe ?(delegates = []) ?(remote_mode = false) - ?(liquidity_baking_toggle_vote = Some Pass) ?use_dal_node ~base_dir + ?event_pipe ?(delegates = []) ?(liquidity_baking_toggle_vote = Some Pass) + ?force_apply_from_round ?(remote_mode = false) ?operations_pool + ?dal_node_rpc_endpoint ?(state_recorder = false) + ?(node_version_check_bypass = false) ?node_version_allowed ~base_dir ~node_data_dir ~node_rpc_endpoint () = let agnostic_baker = create @@ -69,9 +76,14 @@ let create_from_uris ?runner node_data_dir; node_rpc_endpoint; pending_ready = []; - remote_mode; liquidity_baking_toggle_vote; - use_dal_node; + force_apply_from_round; + remote_mode; + operations_pool; + dal_node_rpc_endpoint; + state_recorder; + node_version_check_bypass; + node_version_allowed; } in agnostic_baker @@ -80,8 +92,10 @@ let handle_event node ({name; _} : event) = match name with "starting_daemon.v0" -> set_ready node | _ -> () let create ?runner ?path ?name ?color ?event_pipe ?(delegates = []) - ?(remote_mode = false) ?(liquidity_baking_toggle_vote = Some Pass) - ?use_dal_node node client = + ?(liquidity_baking_toggle_vote = Some Pass) ?force_apply_from_round + ?(remote_mode = false) ?operations_pool ?dal_node ?(state_recorder = false) + ?(node_version_check_bypass = false) ?node_version_allowed node client = + let dal_node_rpc_endpoint = Option.map Dal_node.as_rpc_endpoint dal_node in let agnostic_baker = create_from_uris ?runner @@ -89,10 +103,15 @@ let create ?runner ?path ?name ?color ?event_pipe ?(delegates = []) ?name ?color ?event_pipe - ?use_dal_node ~delegates - ~remote_mode ~liquidity_baking_toggle_vote + ?force_apply_from_round + ~remote_mode + ?operations_pool + ?dal_node_rpc_endpoint + ~state_recorder + ~node_version_check_bypass + ?node_version_allowed ~base_dir:(Client.base_dir client) ~node_data_dir:(Node.data_dir node) ~node_rpc_endpoint:(Node.as_rpc_endpoint node) @@ -113,24 +132,63 @@ let run ?event_level ?event_sections_levels (agnostic_baker : t) = let node_addr = Endpoint.as_string agnostic_baker.persistent_state.node_rpc_endpoint in - let run_args = - if agnostic_baker.persistent_state.remote_mode then ["remotely"] - else ["with"; "local"; "node"; node_data_dir] - in let liquidity_baking_toggle_vote = Cli_arg.optional_arg "liquidity-baking-toggle-vote" liquidity_baking_vote_to_string agnostic_baker.persistent_state.liquidity_baking_toggle_vote in - let use_dal_node = - match agnostic_baker.persistent_state.use_dal_node with - | None -> ["--without-dal"] - | Some endpoint -> ["--dal-node"; endpoint] + let force_apply_from_round = + (* From Protocol Q, the flag --force-apply has been replaced by + --force-apply-from-round, the following maintains back-compatibility with + ParisC tests. *) + Cli_arg.optional_arg + "force-apply-from-round" + string_of_int + agnostic_baker.persistent_state.force_apply_from_round + in + let operations_pool = + Cli_arg.optional_arg + "operations-pool" + Fun.id + agnostic_baker.persistent_state.operations_pool + in + let dal_node_endpoint = + Cli_arg.optional_arg + "dal-node" + Endpoint.as_string + agnostic_baker.persistent_state.dal_node_rpc_endpoint + in + let without_dal = + Cli_arg.optional_switch + "without-dal" + (Option.is_none agnostic_baker.persistent_state.dal_node_rpc_endpoint) + in + let state_recorder = + Cli_arg.optional_switch + "record-state" + agnostic_baker.persistent_state.state_recorder + in + let node_version_check_bypass = + Cli_arg.optional_switch + "node-version-check-bypass" + agnostic_baker.persistent_state.node_version_check_bypass + in + let node_version_allowed = + Cli_arg.optional_arg + "node-version-allowed" + Fun.id + agnostic_baker.persistent_state.node_version_allowed + in + let run_args = + if agnostic_baker.persistent_state.remote_mode then ["remotely"] + else ["with"; "local"; "node"; node_data_dir] in let arguments = ["--"; "--endpoint"; node_addr; "--base-dir"; base_dir; "run"] - @ run_args @ delegates @ liquidity_baking_toggle_vote @ use_dal_node + @ run_args @ delegates @ liquidity_baking_toggle_vote + @ force_apply_from_round @ operations_pool @ dal_node_endpoint @ without_dal + @ state_recorder @ node_version_check_bypass @ node_version_allowed in let on_terminate _ = @@ -167,8 +225,9 @@ let wait_for_ready agnostic_baker = let init ?runner ?(path = Uses.path Constant.octez_experimental_agnostic_baker) ?name ?color ?event_level ?event_pipe ?event_sections_levels - ?(delegates = []) ?remote_mode ?liquidity_baking_toggle_vote ?use_dal_node - node client = + ?(delegates = []) ?liquidity_baking_toggle_vote ?force_apply_from_round + ?remote_mode ?operations_pool ?dal_node ?state_recorder + ?node_version_check_bypass ?node_version_allowed node client = let* () = Node.wait_for_ready node in let agnostic_baker = create @@ -177,9 +236,14 @@ let init ?runner ?(path = Uses.path Constant.octez_experimental_agnostic_baker) ?name ?color ?event_pipe - ?remote_mode ?liquidity_baking_toggle_vote - ?use_dal_node + ?force_apply_from_round + ?remote_mode + ?operations_pool + ?dal_node + ?state_recorder + ?node_version_check_bypass + ?node_version_allowed ~delegates node client diff --git a/tezt/lib_tezos/agnostic_baker.mli b/tezt/lib_tezos/agnostic_baker.mli index 183c2b134cc64e5e84c17dd369b0739b1236c039..6562792dbd929eb52a3cf5b6c2db90b7a03441f5 100644 --- a/tezt/lib_tezos/agnostic_baker.mli +++ b/tezt/lib_tezos/agnostic_baker.mli @@ -38,6 +38,12 @@ val wait_for : ?where:string -> t -> string -> (JSON.t -> 'a option) -> 'a Lwt.t *) val wait_for_ready : t -> unit Lwt.t +(** Raw events. *) +type event = {name : string; value : JSON.t; timestamp : float} + +(** See [Daemon.Make.on_event]. *) +val on_event : t -> (event -> unit) -> unit + (** Spawn [octez-experimental-agnostic-baker run]. The resulting promise is fulfilled as soon as the agnostic baker has been @@ -88,19 +94,19 @@ val protocol_status : Protocol.t -> protocol_status agnostic baker. This defaults to the empty list, which is a shortcut for "every known account". - [liquidity_baking_toggle_vote] is passed to the agnostic baker - daemon through the flags [--liquidity-baking-toggle-vote]. If - [--liquidity-baking-toggle-vote] is [None], then - [--liquidity-baking-toggle-vote] is not passed. If it is [Some x] - then [--liquidity-baking-toggle-vote x] is passed. The default - value is [Some Pass]. - - [use_dal_node] is passed to the agnostic baker daemon through the - [--without-dal] or [--dal-node ] flags. If the flag is [None], the - former option is passed, otherwise if the flag is [Some ], then the - latter option is passed. The default value is [None]. + [force_apply_from_round], [operations_pool], [state_recorder], [node_version_check_bypass], + [node_version_allowed] and [liquidity_baking_toggle_vote] are passed to the + baker daemon through the flags [--force-apply-from-round], + [--operations-pool], [--record-state], [--node-version-check-bypass], [--node-version-allowed] + and [--liquidity-baking-toggle-vote]. If [--liquidity-baking-toggle-vote] + is [None], then [--liquidity-baking-toggle-vote] is not passed. If it is [Some x] then + [--liquidity-baking-toggle-vote x] is passed. The default value is [Some Pass]. If [remote_mode] is specified, the agnostic baker will run in RPC-only mode. + + If [dal_node] is specified, then it is the DAL node that the baker queries + in order to determine the attestations it sends to the L1 node. A + [--dal_node] argument is passed to specify the DAL node's endpoint. *) val create : ?runner:Runner.t -> @@ -109,9 +115,14 @@ val create : ?color:Log.Color.t -> ?event_pipe:string -> ?delegates:string list -> - ?remote_mode:bool -> ?liquidity_baking_toggle_vote:liquidity_baking_vote option -> - ?use_dal_node:string -> + ?force_apply_from_round:int -> + ?remote_mode:bool -> + ?operations_pool:string -> + ?dal_node:Dal_node.t -> + ?state_recorder:bool -> + ?node_version_check_bypass:bool -> + ?node_version_allowed:string -> Node.t -> Client.t -> t @@ -129,6 +140,10 @@ val create : The [base_dir] parameter contains needed information about the wallets used by the agnostic baker. + If [dal_node_rpc_endpoint] is specified, then it provides the DAL node RPC + server's endpoint that the baker queries in order to determine the + attestations it sends to the L1 node. A [--dal-node] argument is passed + to specify the DAL node's endpoint. *) val create_from_uris : ?runner:Runner.t -> @@ -137,9 +152,14 @@ val create_from_uris : ?color:Log.Color.t -> ?event_pipe:string -> ?delegates:string list -> - ?remote_mode:bool -> ?liquidity_baking_toggle_vote:liquidity_baking_vote option -> - ?use_dal_node:string -> + ?force_apply_from_round:int -> + ?remote_mode:bool -> + ?operations_pool:string -> + ?dal_node_rpc_endpoint:Endpoint.t -> + ?state_recorder:bool -> + ?node_version_check_bypass:bool -> + ?node_version_allowed:string -> base_dir:string -> node_data_dir:string -> node_rpc_endpoint:Endpoint.t -> @@ -191,9 +211,14 @@ val init : ?event_pipe:string -> ?event_sections_levels:(string * Daemon.Level.level) list -> ?delegates:string list -> - ?remote_mode:bool -> ?liquidity_baking_toggle_vote:liquidity_baking_vote option -> - ?use_dal_node:string -> + ?force_apply_from_round:int -> + ?remote_mode:bool -> + ?operations_pool:string -> + ?dal_node:Dal_node.t -> + ?state_recorder:bool -> + ?node_version_check_bypass:bool -> + ?node_version_allowed:string -> Node.t -> Client.t -> t Lwt.t diff --git a/tezt/tests/baker_operations_cli_options.ml b/tezt/tests/baker_operations_cli_options.ml index 9f59fb8e74b4ffb7062c114ffe4c076f160545f4..23f725169c7fa534cef593e2ea1bee7f491b228d 100644 --- a/tezt/tests/baker_operations_cli_options.ml +++ b/tezt/tests/baker_operations_cli_options.ml @@ -338,7 +338,7 @@ let test_baker_external_operations = ~__FILE__ ~title:"Baker external operations" ~tags:[Tag.layer1; "baker"; "external"; "operations"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Init" ; let node_args = Node.[Synchronisation_threshold 0] in @@ -418,7 +418,7 @@ let test_baker_external_operations = Lwt_unix.sleep (float_of_int (minimal_block_delay + delay_increment_per_round)) in - let* _baker = Baker.init ~protocol ~operations_pool node client in + let* _baker = Agnostic_baker.init ~operations_pool node client in (* Wait until we have seen enough blocks. This should not take much time. *) Log.info "Wait until high enough level" ; let* (_ : int) = Node.wait_for_level node (level + 1) in @@ -473,8 +473,8 @@ let test_baker_state_recorder protocol state_recorder = let* level = Node.get_level node in (* Initialise a baker *) let* _baker = - if state_recorder then Baker.init ~protocol ~state_recorder node client - else Baker.init ~protocol node client + if state_recorder then Agnostic_baker.init ~state_recorder node client + else Agnostic_baker.init node client in (* Wait for chain to process the empty block *) let* (_ : int) = Node.wait_for_level node (level + 1) in @@ -501,7 +501,7 @@ let test_baker_state_recorder_memory = ~__FILE__ ~title:"Baker state recorder - memory case" ~tags:[Tag.layer1; "baker"; "state"; "recorder"; "memory"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> test_baker_state_recorder protocol false let test_baker_state_recorder_filesystem = @@ -509,7 +509,7 @@ let test_baker_state_recorder_filesystem = ~__FILE__ ~title:"Baker state recorder - filesystem case" ~tags:[Tag.layer1; "baker"; "state"; "recorder"; "filesystem"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> test_baker_state_recorder protocol true let register ~protocols = diff --git a/tezt/tests/baker_test.ml b/tezt/tests/baker_test.ml index 2835c39ecc7bfc615f77db8f4928128e8b4ea318..cbca489bca00a5b6570c9e36b28927f3b2e1d832 100644 --- a/tezt/tests/baker_test.ml +++ b/tezt/tests/baker_test.ml @@ -61,16 +61,17 @@ let check_node_version_check_bypass_test = ~title:"baker node version check bypass test" ~tags:[team; "node"; "baker"] ~supports:Protocol.(From_protocol 021) - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* node, client = Client.init_with_protocol `Client ~protocol () in let baker = - Baker.create ~protocol ~node_version_check_bypass:true node client + Agnostic_baker.create ~node_version_check_bypass:true node client in let check_bypassed_event_promise = - Baker.wait_for baker "node_version_check_bypass.v0" (fun _ -> Some ()) + Agnostic_baker.wait_for baker "node_version_check_bypass.v0" (fun _ -> + Some ()) in - let* () = Baker.run baker in + let* () = Agnostic_baker.run baker in let* () = check_bypassed_event_promise in unit @@ -80,12 +81,11 @@ let check_node_version_allowed_test = ~title:"baker node version allowed test" ~tags:[team; "node"; "baker"] ~supports:Protocol.(From_protocol 022) - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* node, client = Client.init_with_protocol `Client ~protocol () in let* _baker = - Baker.init - ~protocol + Agnostic_baker.init ~node_version_allowed:"octez-v7894.789:1a991a03" node client @@ -98,11 +98,11 @@ let check_node_version_no_commit_allowed_test = ~title:"baker node version no commit allowed test" ~tags:[team; "node"; "baker"] ~supports:Protocol.(From_protocol 022) - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* node, client = Client.init_with_protocol `Client ~protocol () in let* _baker = - Baker.init ~protocol ~node_version_allowed:"octez-v7894.789" node client + Agnostic_baker.init ~node_version_allowed:"octez-v7894.789" node client in unit @@ -111,7 +111,7 @@ let baker_reward_test = ~__FILE__ ~title:"Baker rewards" ~tags:[team; "baker"; "rewards"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) (fun protocol -> let* parameter_file = Protocol.write_parameter_file @@ -127,9 +127,9 @@ let baker_reward_test = () in let level_2_promise = Node.wait_for_level node 2 in - let* baker = Baker.init ~protocol node client in + let* baker = Agnostic_baker.init node client in Log.info "Wait for new head." ; - Baker.log_events baker ; + Agnostic_baker.log_events baker ; let* _ = level_2_promise in let* _ = Client.RPC.call ~hooks client @@ RPC.get_chain_block_metadata () @@ -154,9 +154,9 @@ let baker_test protocol ~keys = in let level_2_promise = Node.wait_for_level node 2 in let level_3_promise = Node.wait_for_level node 3 in - let* baker = Baker.init ~protocol node client in + let* baker = Agnostic_baker.init node client in Log.info "Wait for new head." ; - Baker.log_events baker ; + Agnostic_baker.log_events baker ; let* _ = level_2_promise in Log.info "New head arrive level 2" ; let* _ = level_3_promise in @@ -168,7 +168,7 @@ let baker_simple_test = ~__FILE__ ~title:"baker test" ~tags:[team; "node"; "baker"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* _ = baker_test protocol ~keys:(Account.Bootstrap.keys |> Array.to_list) @@ -180,12 +180,12 @@ let baker_stresstest = ~__FILE__ ~title:"baker stresstest" ~tags:[team; "node"; "baker"; "stresstest"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* node, client = Client.init_with_protocol `Client ~protocol () ~timestamp:Now in - let* _ = Baker.init ~protocol node client in + let* _ = Agnostic_baker.init node client in let* _ = Node.wait_for_level node 3 in (* Use a large tps, to have failing operations too *) let* () = Client.stresstest ~tps:25 ~transfers:100 client in @@ -197,12 +197,12 @@ let baker_stresstest_apply = ~__FILE__ ~title:"baker stresstest with forced application" ~tags:[team; "node"; "baker"; "stresstest"; "apply"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* node, client = Client.init_with_protocol `Client ~protocol () ~timestamp:Now in - let* _ = Baker.init ~force_apply_from_round:0 ~protocol node client in + let* _ = Agnostic_baker.init ~force_apply_from_round:0 node client in let* _ = Node.wait_for_level node 3 in (* Use a large tps, to have failing operations too *) let* () = Client.stresstest ~tps:25 ~transfers:100 client in @@ -288,12 +288,12 @@ let baker_remote_test = ~__FILE__ ~title:"Baker in RPC-only mode" ~tags:[team; "baker"; "remote"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* node, client = Client.init_with_protocol `Client ~protocol () ~timestamp:Now in - let* _ = Baker.init ~remote_mode:true ~protocol node client in + let* _ = Agnostic_baker.init ~remote_mode:true node client in let* _ = Node.wait_for_level node 3 in unit @@ -302,7 +302,7 @@ let baker_check_consensus_branch = ~__FILE__ ~title:"Baker check branch in consensus operations" ~tags:[team; "baker"; "grandparent"; "parent"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Init client and node with protocol %s" (Protocol.name protocol) ; let* node, client = @@ -311,9 +311,9 @@ let baker_check_consensus_branch = let target_level = 5 in Log.info "Start a baker and bake until level %d" target_level ; - let* baker = Baker.init ~protocol node client in + let* baker = Agnostic_baker.init node client in let* _ = Node.wait_for_level node target_level in - let* () = Baker.kill baker in + let* () = Agnostic_baker.terminate baker in Log.info "Retrieve mempool" ; let* mempool = @@ -350,7 +350,7 @@ let force_apply_from_round = ~title:"Baker check force apply from round" ~tags:[team; "baker"; "force_apply_from_round"] ~supports:Protocol.(From_protocol 021) - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> log_step 1 "initialize a node and a client with protocol" ; let* node, client = @@ -389,8 +389,7 @@ let force_apply_from_round = delegate force_apply_from_round ; let* baker = - Baker.init - ~protocol + Agnostic_baker.init ~force_apply_from_round ~delegates:[delegate] node @@ -398,7 +397,7 @@ let force_apply_from_round = in (* fail if a block is applied at a round < [force_apply_from_round] *) - Baker.on_event baker (fun Baker.{name; value; _} -> + Agnostic_baker.on_event baker (fun Agnostic_baker.{name; value; _} -> if name = "forging_block.v0" then let round = JSON.(value |-> "round" |> as_int) in let level = JSON.(value |-> "level" |> as_int) in @@ -412,7 +411,7 @@ let force_apply_from_round = (* a promise that resolves on event forging_block when (force_apply = true && round = [round] && level = [level]) *) let forced_application_promise = - Baker.wait_for baker "forging_block.v0" (fun json -> + Agnostic_baker.wait_for baker "forging_block.v0" (fun json -> let round' = JSON.(json |-> "round" |> as_int) in let level' = JSON.(json |-> "level" |> as_int) in let force_apply = JSON.(json |-> "force_apply" |> as_bool) in diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index cddd2ed32577e0317cae03b4d6c0059a8a88850c..65ac5c5f7f90121dc97932aa0e50f028793fdfb5 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -2908,9 +2908,8 @@ let test_attester_with_daemon protocol parameters cryptobox node client dal_node in let run_baker delegates target_level = let* baker = - Baker.init + Agnostic_baker.init ~event_sections_levels:[(Protocol.name protocol ^ ".baker", `Debug)] - ~protocol ~dal_node ~delegates ~state_recorder:true @@ -2918,7 +2917,7 @@ let test_attester_with_daemon protocol parameters cryptobox node client dal_node client in let* _ = Node.wait_for_level node target_level in - Baker.terminate baker + Agnostic_baker.terminate baker in (* Test goal: the published slot at levels in [first_level, intermediary_level - 1] @@ -3303,7 +3302,7 @@ let create_additional_nodes ~extra_node_operators rollup_address l1_node is the sum of levels as returned by [slot_producer]. *) let e2e_test_script ?expand_test:_ ?(beforehand_slot_injection = 1) - ?(extra_node_operators = []) ~slot_index protocol parameters dal_node + ?(extra_node_operators = []) ~slot_index _protocol parameters dal_node sc_rollup_node sc_rollup_address l1_node l1_client _pvm_name ~number_of_dal_slots = let slot_size = parameters.Dal.Parameters.cryptobox.slot_size in @@ -3405,7 +3404,7 @@ let e2e_test_script ?expand_test:_ ?(beforehand_slot_injection = 1) Log.info "[e2e.start_baker] spawn a baker daemon with all bootstrap accounts@." ; let* _baker = - Baker.init ~dal_node:baker_dal_node ~protocol l1_node l1_client + Agnostic_baker.init ~dal_node:baker_dal_node l1_node l1_client in (* To be sure that we just moved to [start_dal_slots_level], we wait and extra @@ -3579,7 +3578,7 @@ let register_end_to_end_tests ~protocols = ~activation_timestamp:(Ago activation_timestamp) ~minimal_block_delay:(string_of_int block_delay) ~tags - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) title (e2e_test_script ~slot_index @@ -4285,8 +4284,8 @@ let test_gs_prune_and_ihave protocol parameters _cryptobox node client dal_node1 * the baker does not crash when there's a DAL node specified, but it is not running * the baker register profiles when the DAL node restarts. *) -let test_baker_registers_profiles protocol _parameters _cryptobox l1_node client - dal_node = +let test_baker_registers_profiles _protocol _parameters _cryptobox l1_node + client dal_node = let delegates = List.to_seq Constant.all_secret_keys |> Seq.take 3 |> List.of_seq in @@ -4299,11 +4298,12 @@ let test_baker_registers_profiles protocol _parameters _cryptobox l1_node client "Terminate the DAL node and then start the baker; the baker cannot attest \ but can advance" ; let* () = Dal_node.terminate dal_node in - let baker = Baker.create ~dal_node ~protocol l1_node client ~delegates in + let baker = Agnostic_baker.create ~dal_node l1_node client ~delegates in let wait_for_attestation_event = - Baker.wait_for baker "failed_to_get_attestations.v0" (fun _json -> Some ()) + Agnostic_baker.wait_for baker "failed_to_get_attestations.v0" (fun _json -> + Some ()) in - let* () = Baker.run baker in + let* () = Agnostic_baker.run baker in let* () = wait_for_attestation_event in let* _lvl = Node.wait_for_level l1_node 3 in @@ -4836,7 +4836,7 @@ let test_dal_node_crawler_reconnects_to_l1 _protocol _dal_parameters _cryptobox profile of the initial DAL node. It is expected to be either a bootstrap node, who stores data for [2*attestation_lag] blocks or a producer node who stores much more data. *) -let test_restart_dal_node protocol dal_parameters _cryptobox node client +let test_restart_dal_node _protocol dal_parameters _cryptobox node client dal_node = let all_pkhs = Account.Bootstrap.keys |> Array.to_list @@ -4865,8 +4865,7 @@ let test_restart_dal_node protocol dal_parameters _cryptobox node client 3 * blocks_per_cycle in let* baker = - Baker.init - ~protocol + Agnostic_baker.init ~delegates:all_pkhs ~liquidity_baking_toggle_vote:(Some On) ~state_recorder:true @@ -4894,7 +4893,7 @@ let test_restart_dal_node protocol dal_parameters _cryptobox node client wait_for_layer1_final_block dal_node last_finalized_level in let* _ = Node.wait_for_level node (last_finalized_level + 2) in - let* () = Baker.terminate baker in + let* () = Agnostic_baker.terminate baker in let* () = wait_for_dal_node in if profile <> Dal_RPC.Bootstrap then let expected_levels = @@ -7462,7 +7461,8 @@ let scenario_tutorial_dal_baker = ~regression:true ~__FILE__ ~tags:[team; Tag.memory_3k; "tutorial"; "dal"; "baker"] - ~uses:(fun protocol -> [Protocol.baker protocol; Constant.octez_dal_node]) + ~uses:(fun _protocol -> + [Constant.octez_experimental_agnostic_baker; Constant.octez_dal_node]) (Printf.sprintf "%s" description) (fun protocol -> (* Note: Step 1 consists in setting up docker which we don't use @@ -7585,9 +7585,8 @@ let scenario_tutorial_dal_baker = in Log.info "Step 5: Run an Octez baking daemon" ; let* _baker = - Baker.init + Agnostic_baker.init ~event_sections_levels:[(Protocol.name protocol ^ ".baker", `Debug)] - ~protocol ~dal_node ~delegates:all_delegates ~liquidity_baking_toggle_vote:(Some On) @@ -10141,7 +10140,7 @@ let register ~protocols = test_attester_with_bake_for protocols ; scenario_with_layer1_and_dal_nodes - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) ~attestation_threshold:100 ~attestation_lag:16 ~activation_timestamp:Now @@ -10204,7 +10203,7 @@ let register ~protocols = protocols ; scenario_with_layer1_and_dal_nodes "baker registers profiles with dal node" - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) ~activation_timestamp:Now ~prover:false test_baker_registers_profiles @@ -10323,7 +10322,7 @@ let register ~protocols = test_attesters_receive_dal_rewards (List.filter (fun p -> Protocol.number p >= 022) protocols) ; scenario_with_layer1_and_dal_nodes - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) ~tags:["restart"] ~activation_timestamp:Now ~producer_profiles:[0] @@ -10332,7 +10331,7 @@ let register ~protocols = test_restart_dal_node protocols ; scenario_with_layer1_and_dal_nodes - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) ~tags:["restart"] ~activation_timestamp:Now ~bootstrap_profile:true diff --git a/tezt/tests/http_cache_headers.ml b/tezt/tests/http_cache_headers.ml index 7cc5e7b84ec88393178cd5170b147f062a3721a4..de816c1f0c1ce970dd71aba2d74fcda62d3a4f86 100644 --- a/tezt/tests/http_cache_headers.ml +++ b/tezt/tests/http_cache_headers.ml @@ -117,7 +117,7 @@ let test_if_none_match ~rpc_external = ~title ~tags:["rpc"; "middleware"; "http_cache_headers"] ~supports:(From_protocol 19) - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Initialize client, node and baker" ; let* node, client = @@ -143,7 +143,7 @@ let test_if_none_match ~rpc_external = Client.activate_protocol ~timestamp:Now ~parameter_file ~protocol client in Log.info "Bake and wait for block" ; - let* baker = Baker.init ~protocol ~delegates node client in + let* baker = Agnostic_baker.init ~delegates node client in Log.info "Check etag found in query" ; let* _ = Node.wait_for_level node 2 in @@ -167,7 +167,7 @@ let test_if_none_match ~rpc_external = node (RPC.get_chain_block_hash ()) in - let* () = Baker.terminate baker in + let* () = Agnostic_baker.terminate baker in Check.( (String.length body > 0) int diff --git a/tezt/tests/nonce_seed_revelation.ml b/tezt/tests/nonce_seed_revelation.ml index 0a310325f67dd5234a68051ad02657a39a0df5c6..ecd3e74d99420b29caeac2f4ed225fcba769359e 100644 --- a/tezt/tests/nonce_seed_revelation.ml +++ b/tezt/tests/nonce_seed_revelation.ml @@ -57,7 +57,7 @@ let test_nonce_seed_revelation = ~__FILE__ ~title:"Nonce seed revelation" ~tags:[team; "nonce"; "seed"; "revelation"; Tag.memory_3k] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> (* Run a node and a baker. The node runs in archive mode to obtain metadata with [RPC.get_chain_block]. *) @@ -98,7 +98,7 @@ let test_nonce_seed_revelation = (fun i node -> let* client = Client.init ~endpoint:(Node node) () in let delegates = [Account.Bootstrap.keys.(i).alias] in - Baker.init ~protocol ~delegates node client) + Agnostic_baker.init ~delegates node client) nodes in let* () = @@ -114,7 +114,7 @@ let test_nonce_seed_revelation = (* Wait until target level is reached *) let* () = cycle_two_promise in (* No need to bake further *) - let* () = Lwt_list.iter_p Baker.terminate bakers in + let* () = Lwt_list.iter_p Agnostic_baker.terminate bakers in Log.info "Get all blocks" ; (* Retrieve all blocks for two full cycles. *) let* blocks = @@ -235,7 +235,7 @@ let test_baking_nonce_migration = ~__FILE__ ~title:"Baking nonce format migration" ~tags:[team; "nonce"; "migration"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Initialize node and client" ; let* node, client = @@ -248,7 +248,7 @@ let test_baking_nonce_migration = Array.to_list @@ Array.map (fun key -> Account.(key.alias)) Account.Bootstrap.keys in - let baker = Baker.create ~protocol ~delegates node client in + let baker = Agnostic_baker.create ~delegates node client in (* Reduce the block per cycle to gain some time *) let blocks_per_cycle = 4 in @@ -276,9 +276,9 @@ let test_baking_nonce_migration = Log.info "Start the baker and wait for success migration nonces baker event" ; let successful_migration_event = - Baker.wait_for baker "success_migrate_nonces.v0" Option.some + Agnostic_baker.wait_for baker "success_migrate_nonces.v0" Option.some in - let* () = Baker.run baker in + let* () = Agnostic_baker.run baker in let* _ = successful_migration_event in @@ -286,7 +286,7 @@ let test_baking_nonce_migration = "Bake until the level: %d (end of the second cycle) then kill the baker" target_level ; let* _ = target_level_promise in - let* () = Baker.kill baker in + let* () = Agnostic_baker.terminate baker in Log.info "Retrieve the nonce file contents" ; let* chain_id = Client.RPC.call client @@ RPC.get_chain_chain_id () in @@ -307,9 +307,9 @@ let test_baking_nonce_migration = "Restart the baker until level: %d (end of the fifth cycle) then kill the \ baker" target_level ; - let* () = Baker.run baker in + let* () = Agnostic_baker.run baker in let* _ = target_level_promise in - let* () = Baker.kill baker in + let* () = Agnostic_baker.terminate baker in Log.info "Concat old nonces contents with the new one" ; let new_nonces_contents = Base.read_file nonces_file in @@ -323,20 +323,20 @@ let test_baking_nonce_migration = "Restart the baker and wait for ignore failed nonce migration event then \ kill the baker" ; let failed_migration_event = - Baker.wait_for baker "ignore_failed_nonce_migration.v0" Option.some + Agnostic_baker.wait_for baker "ignore_failed_nonce_migration.v0" Option.some in - let* () = Baker.run baker in + let* () = Agnostic_baker.run baker in let* _ = failed_migration_event in - let* () = Baker.kill baker in + let* () = Agnostic_baker.terminate baker in Log.info "Remove old nonces contents from nonces file" ; let () = Base.write_file nonces_file ~contents:new_nonces_contents in Log.info "Restart the baker and wait for success migrate nonces event" ; let successful_migration_event = - Baker.wait_for baker "success_migrate_nonces.v0" Option.some + Agnostic_baker.wait_for baker "success_migrate_nonces.v0" Option.some in - let* () = Baker.run baker in + let* () = Agnostic_baker.run baker in let* _ = successful_migration_event in unit diff --git a/tezt/tests/signer_test.ml b/tezt/tests/signer_test.ml index 9a1fd1d62f689cd339a19ea6d49bb393b70f8ff4..5deebc9754308e863a01984bc91161146202b996 100644 --- a/tezt/tests/signer_test.ml +++ b/tezt/tests/signer_test.ml @@ -62,7 +62,7 @@ let signer_test protocol ~keys = in let level_2_promise = Node.wait_for_level node 2 in let level_3_promise = Node.wait_for_level node 3 in - let* _baker = Baker.init ~protocol node client in + let* _baker = Agnostic_baker.init node client in let* _ = level_2_promise in Log.info "New head arrive level 2" ; let* _ = level_3_promise in @@ -74,7 +74,8 @@ let signer_simple_test = ~__FILE__ ~title:"signer test" ~tags:[team; "node"; "baker"; "tz1"] - ~uses:(fun protocol -> [Constant.octez_signer; Protocol.baker protocol]) + ~uses:(fun _protocol -> + [Constant.octez_signer; Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let* _ = signer_test protocol ~keys:(Account.Bootstrap.keys |> Array.to_list) diff --git a/tezt/tests/synchronisation_heuristic.ml b/tezt/tests/synchronisation_heuristic.ml index 0d84a33ba95b108ba3dc32464e3f169e2cf3d0bf..a0299e9f2d14c35de37df9cdd4813657dd268357 100644 --- a/tezt/tests/synchronisation_heuristic.ml +++ b/tezt/tests/synchronisation_heuristic.ml @@ -232,7 +232,7 @@ let test_threshold_zero = ~title:"bootstrap: test threshold zero" ~tags: [team; Tag.flaky; "synchronisation_threshold"; "bootstrap"; "threshold"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Setup network" ; let* node, client = @@ -244,7 +244,7 @@ let test_threshold_zero = ~timestamp:Now () in - let* _ = Baker.init ~protocol node client in + let* _ = Agnostic_baker.init node client in Log.info "Check that the node is bootstrapped" ; let* () = check_sync_state client Synced in @@ -269,7 +269,7 @@ let test_threshold_one = ~__FILE__ ~title:"bootstrap: test threshold one" ~tags:[team; "bootstrap"; "threshold"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Add a first peer with threshold zero" ; let* node, client = @@ -281,7 +281,7 @@ let test_threshold_one = ~timestamp:Now () in - let* baker = Baker.init ~protocol node client in + let* baker = Agnostic_baker.init node client in Log.info "Check synchronisation state of first peer" ; let* () = check_sync_state client Synced in @@ -295,7 +295,7 @@ let test_threshold_one = in let* () = Client.Admin.connect_address client ~peer:node1 in let* _ = Node.wait_for_level node 2 in - let* () = Baker.kill baker in + let* () = Agnostic_baker.terminate baker in Log.info "Check bootstrapped state of second peer" ; let* () = Client.bootstrapped client1 in @@ -309,7 +309,7 @@ let test_threshold_two = ~title:"bootstrap: test threshold two" ~tags: [team; Tag.flaky; "synchronisation_threshold"; "bootstrap"; "threshold"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Add a first peer with threshold zero" ; let* node, client = @@ -321,7 +321,7 @@ let test_threshold_two = ~timestamp:Now () in - let* baker = Baker.init ~protocol node client in + let* baker = Agnostic_baker.init node client in Log.info "Add nodes and connect in clique" ; @@ -363,7 +363,7 @@ let test_threshold_two = unit) [node; node1; node2; node3] in - let* () = Baker.kill baker in + let* () = Agnostic_baker.terminate baker in let* () = Client.bootstrapped client in let* () = Client.bootstrapped client1 in @@ -378,7 +378,7 @@ let test_threshold_stuck = ~title:"bootstrap: test threshold stuck" ~tags: [team; Tag.flaky; "synchronisation_threshold"; "bootstrap"; "threshold"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let sync_latency = 3 in @@ -395,12 +395,12 @@ let test_threshold_stuck = ~timestamp:Now () in - let* baker = Baker.init ~protocol node client in + let* baker = Agnostic_baker.init node client in Log.info "Bake a few blocks and kill baker" ; let* current_level = Node.get_level node in let* (level : int) = Node.wait_for_level node (current_level + 3) in - let* () = Baker.terminate baker in + let* () = Agnostic_baker.terminate baker in Log.info "Add two additional peers" ; let* node1, client1 = @@ -442,7 +442,7 @@ let test_threshold_split_view = ~title:"bootstrap: test threshold split view" ~tags: [team; Tag.flaky; "synchronisation_threshold"; "bootstrap"; "threshold"] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> Log.info "Add two peers with threshold zero, and one with threshold 2 and a high \ @@ -474,7 +474,7 @@ let test_threshold_split_view = ~timestamp:Now () in - let* _ = Baker.init ~protocol node client in + let* _ = Agnostic_baker.init node client in let* () = connect_clique client [node; node1; node2] in Log.info "Test that all nodes bootstrap" ; @@ -517,7 +517,7 @@ let test_many_nodes_bootstrap = "threshold"; Tag.memory_4k; ] - ~uses:(fun protocol -> [Protocol.baker protocol]) + ~uses:(fun _protocol -> [Constant.octez_experimental_agnostic_baker]) @@ fun protocol -> let num_nodes = 8 in let running_time = 10.0 in @@ -538,7 +538,7 @@ let test_many_nodes_bootstrap = ~timestamp:Now () in - let* _ = Baker.init ~protocol node client in + let* _ = Agnostic_baker.init node client in let* node1, client1 = Client.init_with_protocol ~nodes_args: