From b25f35e2b5084c708e2f048d828220c7d7971580 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Mon, 6 Nov 2017 14:12:19 +0100 Subject: [PATCH] Rename last occurences of miner into baker --- .../embedded/alpha/client_baking_main.ml | 4 +-- .../embedded/alpha/client_proto_args.ml | 2 +- src/proto/alpha/apply.ml | 34 +++++++++---------- src/proto/alpha/baking.ml | 4 +-- src/proto/alpha/baking.mli | 2 +- src/proto/alpha/main.ml | 28 +++++++-------- src/proto/alpha/services_registration.ml | 8 ++--- src/proto/alpha/storage.ml | 2 +- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/client/embedded/alpha/client_baking_main.ml b/src/client/embedded/alpha/client_baking_main.ml index f9a180c30..6039da0ab 100644 --- a/src/client/embedded/alpha/client_baking_main.ml +++ b/src/client/embedded/alpha/client_baking_main.ml @@ -124,7 +124,7 @@ let commands () = (args2 force_switch max_priority_arg) (prefixes [ "endorse"; "for" ] @@ Client_keys.Public_key_hash.alias_param - ~name:"miner" ~desc: "name of the delegate owning the endorsement right" + ~name:"baker" ~desc: "name of the delegate owning the endorsement right" @@ stop) (fun (force, max_priority) (_, delegate) cctxt -> endorse_block cctxt @@ -133,7 +133,7 @@ let commands () = (args3 max_priority_arg force_switch free_baking_switch) (prefixes [ "mine"; "for" ] @@ Client_keys.Public_key_hash.alias_param - ~name:"miner" ~desc: "name of the delegate owning the baking right" + ~name:"baker" ~desc: "name of the delegate owning the baking right" @@ stop) (fun (max_priority, force, free_baking) (_, delegate) cctxt -> mine_block cctxt cctxt.config.block diff --git a/src/client/embedded/alpha/client_proto_args.ml b/src/client/embedded/alpha/client_proto_args.ml index f402a6567..229e51568 100644 --- a/src/client/embedded/alpha/client_proto_args.ml +++ b/src/client/embedded/alpha/client_proto_args.ml @@ -124,7 +124,7 @@ let fee_arg = tez_arg ~default:"0.05" ~parameter:"-fee" - ~doc:"The fee in \xEA\x9C\xA9 to pay to the miner." + ~doc:"The fee in \xEA\x9C\xA9 to pay to the baker." let max_priority_arg = arg diff --git a/src/proto/alpha/apply.ml b/src/proto/alpha/apply.ml index ec35ac98f..4b715dca8 100644 --- a/src/proto/alpha/apply.ml +++ b/src/proto/alpha/apply.ml @@ -161,7 +161,7 @@ let check_signature_and_update_public_key ctxt id public_key op = return ctxt let apply_sourced_operation - ctxt miner_contract pred_block block_prio + ctxt baker_contract pred_block block_prio operation origination_nonce ops = match ops with | Manager_operations { source ; public_key ; fee ; counter ; operations = contents } -> @@ -173,7 +173,7 @@ let apply_sourced_operation ctxt source counter >>=? fun () -> Contract.increment_counter ctxt source >>=? fun ctxt -> Contract.spend ctxt source fee >>=? fun ctxt -> - (match miner_contract with + (match baker_contract with | None -> return ctxt | Some contract -> Contract.credit ctxt contract fee) >>=? fun ctxt -> @@ -209,7 +209,7 @@ let apply_sourced_operation fork_test_network ctxt hash expiration >>= fun ctxt -> return (ctxt, origination_nonce, None) -let apply_anonymous_operation ctxt miner_contract origination_nonce kind = +let apply_anonymous_operation ctxt baker_contract origination_nonce kind = match kind with | Seed_nonce_revelation { level ; nonce } -> let level = Level.from_raw ctxt level in @@ -218,7 +218,7 @@ let apply_anonymous_operation ctxt miner_contract origination_nonce kind = Reward.record ctxt delegate_to_reward level.cycle reward_amount >>=? fun ctxt -> begin - match miner_contract with + match baker_contract with | None -> return (ctxt, origination_nonce) | Some contract -> Contract.credit @@ -228,7 +228,7 @@ let apply_anonymous_operation ctxt miner_contract origination_nonce kind = | Faucet { id = manager } -> (* Free tez for all! *) begin - match miner_contract with + match baker_contract with | None -> return None | Some contract -> Contract.get_delegate_opt ctxt contract end >>=? fun delegate -> @@ -239,19 +239,19 @@ let apply_anonymous_operation ctxt miner_contract origination_nonce kind = return (ctxt, origination_nonce) let apply_operation - ctxt miner_contract pred_block block_prio operation = + ctxt baker_contract pred_block block_prio operation = match operation.contents with | Anonymous_operations ops -> let origination_nonce = Contract.initial_origination_nonce operation.hash in fold_left_s (fun (ctxt, origination_nonce) -> - apply_anonymous_operation ctxt miner_contract origination_nonce) + apply_anonymous_operation ctxt baker_contract origination_nonce) (ctxt, origination_nonce) ops >>=? fun (ctxt, origination_nonce) -> return (ctxt, Contract.originated_contracts origination_nonce, None) | Sourced_operations op -> let origination_nonce = Contract.initial_origination_nonce operation.hash in apply_sourced_operation - ctxt miner_contract pred_block block_prio + ctxt baker_contract pred_block block_prio operation origination_nonce op >>=? fun (ctxt, origination_nonce, err) -> return (ctxt, Contract.originated_contracts origination_nonce, err) @@ -277,10 +277,10 @@ let begin_full_construction ctxt pred_timestamp proto_header = (Block_header.parse_unsigned_proto_header proto_header) >>=? fun proto_header -> Baking.check_baking_rights - ctxt proto_header pred_timestamp >>=? fun miner -> - Baking.pay_baking_bond ctxt proto_header miner >>=? fun ctxt -> + ctxt proto_header pred_timestamp >>=? fun baker -> + Baking.pay_baking_bond ctxt proto_header baker >>=? fun ctxt -> let ctxt = Fitness.increase ctxt in - return (ctxt, proto_header, miner) + return (ctxt, proto_header, baker) let begin_partial_construction ctxt = let ctxt = Fitness.increase ctxt in @@ -290,18 +290,18 @@ let begin_application ctxt block_header pred_timestamp = Baking.check_proof_of_work_stamp ctxt block_header >>=? fun () -> Baking.check_fitness_gap ctxt block_header >>=? fun () -> Baking.check_baking_rights - ctxt block_header.proto pred_timestamp >>=? fun miner -> - Baking.check_signature ctxt block_header miner >>=? fun () -> - Baking.pay_baking_bond ctxt block_header.proto miner >>=? fun ctxt -> + ctxt block_header.proto pred_timestamp >>=? fun baker -> + Baking.check_signature ctxt block_header baker >>=? fun () -> + Baking.pay_baking_bond ctxt block_header.proto baker >>=? fun ctxt -> let ctxt = Fitness.increase ctxt in - return (ctxt, miner) + return (ctxt, baker) -let finalize_application ctxt block_proto_header miner = +let finalize_application ctxt block_proto_header baker = (* end of level (from this point nothing should fail) *) let priority = block_proto_header.Block_header.priority in let reward = Baking.base_baking_reward ctxt ~priority in Nonce.record_hash ctxt - miner reward block_proto_header.seed_nonce_hash >>=? fun ctxt -> + baker reward block_proto_header.seed_nonce_hash >>=? fun ctxt -> Reward.pay_due_rewards ctxt >>=? fun ctxt -> (* end of cycle *) may_start_new_cycle ctxt >>=? fun ctxt -> diff --git a/src/proto/alpha/baking.ml b/src/proto/alpha/baking.ml index b8d16d7b7..4293e98da 100644 --- a/src/proto/alpha/baking.ml +++ b/src/proto/alpha/baking.ml @@ -24,7 +24,7 @@ let () = ~id:"baking.timestamp_too_early" ~title:"Block forged too early" ~description:"The block timestamp is before the first slot \ - for this miner at this level" + for this baker at this level" ~pp:(fun ppf (r, p) -> Format.fprintf ppf "Block forged too early (%a is before %a)" Time.pp_hum p Time.pp_hum r) @@ -78,7 +78,7 @@ let () = ~id:"baking.cannot_pay_baking_bond" ~title:"Cannot pay baking bond" ~description: - "Impossible to take the required tokens on the miner's contract" + "Impossible to take the required tokens on the baker's contract" ~pp:(fun ppf () -> Format.fprintf ppf "Cannot pay the baking bond") Data_encoding.unit (function Cannot_pay_baking_bond -> Some () | _ -> None) diff --git a/src/proto/alpha/baking.mli b/src/proto/alpha/baking.mli index 82db0a08f..7c5d6cf4b 100644 --- a/src/proto/alpha/baking.mli +++ b/src/proto/alpha/baking.mli @@ -23,7 +23,7 @@ val paying_priorities: context -> int list val minimal_time: context -> int -> Time.t -> Time.t tzresult Lwt.t (** [minimal_time ctxt priority pred_block_time] returns the minimal time, given the predecessor block timestamp [pred_block_time], - after which a miner with priority [priority] is allowed to + after which a baker with priority [priority] is allowed to mine. Fail with [Invalid_slot_durations_constant] if the minimal time cannot be computed. *) diff --git a/src/proto/alpha/main.ml b/src/proto/alpha/main.ml index dbf431d94..146371d8f 100644 --- a/src/proto/alpha/main.ml +++ b/src/proto/alpha/main.ml @@ -27,7 +27,7 @@ let rpc_services = Services_registration.rpc_services type validation_mode = | Application of { block_header : Tezos_context.Block_header.t ; - miner : Tezos_context.public_key_hash ; + baker : Tezos_context.public_key_hash ; } | Partial_construction of { predecessor : Block_hash.t ; @@ -35,7 +35,7 @@ type validation_mode = | Full_construction of { predecessor : Block_hash.t ; block_proto_header : Tezos_context.Block_header.proto_header ; - miner : Tezos_context.public_key_hash ; + baker : Tezos_context.public_key_hash ; } type validation_state = @@ -65,8 +65,8 @@ let begin_application let timestamp = block_header.shell.timestamp in Tezos_context.init ~level ~timestamp ~fitness ctxt >>=? fun ctxt -> Apply.begin_application - ctxt block_header pred_timestamp >>=? fun (ctxt, miner) -> - let mode = Application { block_header ; miner } in + ctxt block_header pred_timestamp >>=? fun (ctxt, baker) -> + let mode = Application { block_header ; baker } in return { mode ; ctxt ; op_count = 0 } let begin_construction @@ -90,27 +90,27 @@ let begin_construction | Some proto_header -> Apply.begin_full_construction ctxt pred_timestamp - proto_header >>=? fun (ctxt, block_proto_header, miner) -> + proto_header >>=? fun (ctxt, block_proto_header, baker) -> let mode = - Full_construction { predecessor ; miner ; block_proto_header } in + Full_construction { predecessor ; baker ; block_proto_header } in return (mode, ctxt) end >>=? fun (mode, ctxt) -> return { mode ; ctxt ; op_count = 0 } let apply_operation ({ mode ; ctxt ; op_count } as data) operation = - let pred_block, block_prio, miner_contract = + let pred_block, block_prio, baker_contract = match mode with | Partial_construction { predecessor } -> predecessor, 0, None | Application - { miner ; block_header = { shell = { predecessor } ; + { baker ; block_header = { shell = { predecessor } ; proto = block_proto_header } } - | Full_construction { predecessor ; block_proto_header ; miner } -> + | Full_construction { predecessor ; block_proto_header ; baker } -> predecessor, block_proto_header.priority, - Some (Tezos_context.Contract.default_contract miner) in + Some (Tezos_context.Contract.default_contract baker) in Apply.apply_operation - ctxt miner_contract pred_block block_prio operation + ctxt baker_contract pred_block block_prio operation >>=? fun (ctxt, _contracts, _ignored_script_error) -> let op_count = op_count + 1 in return { data with ctxt ; op_count } @@ -120,9 +120,9 @@ let finalize_block { mode ; ctxt ; op_count } = match mode with let ctxt = Tezos_context.finalize ctxt in return ctxt | Application - { miner ; block_header = { proto = block_proto_header } } - | Full_construction { block_proto_header ; miner } -> - Apply.finalize_application ctxt block_proto_header miner >>=? fun ctxt -> + { baker ; block_header = { proto = block_proto_header } } + | Full_construction { block_proto_header ; baker } -> + Apply.finalize_application ctxt block_proto_header baker >>=? fun ctxt -> let { level } : Tezos_context.Level.t = Tezos_context. Level.current ctxt in let priority = block_proto_header.priority in diff --git a/src/proto/alpha/services_registration.ml b/src/proto/alpha/services_registration.ml index de84448f6..9f03e3574 100644 --- a/src/proto/alpha/services_registration.ml +++ b/src/proto/alpha/services_registration.ml @@ -240,7 +240,7 @@ let () = register1 minimal_timestamp ctxt slot timestamp) let () = - (* ctxt accept_failing_script miner_contract pred_block block_prio operation *) + (* ctxt accept_failing_script baker_contract pred_block block_prio operation *) register1 Services.Helpers.apply_operation (fun ctxt (pred_block, hash, forged_operation, signature) -> match Data_encoding.Binary.of_bytes @@ -250,11 +250,11 @@ let () = | Some (shell, contents) -> let operation = { hash ; shell ; contents ; signature } in let level = Tezos_context.Level.current ctxt in - Baking.baking_priorities ctxt level >>=? fun (Misc.LCons (miner_pkh, _)) -> - let miner_contract = Contract.default_contract miner_pkh in + Baking.baking_priorities ctxt level >>=? fun (Misc.LCons (baker_pkh, _)) -> + let baker_contract = Contract.default_contract baker_pkh in let block_prio = 0 in Apply.apply_operation - ctxt (Some miner_contract) pred_block block_prio operation + ctxt (Some baker_contract) pred_block block_prio operation >>=? function | (_ctxt, _, Some script_err) -> Lwt.return (Error script_err) | (_ctxt, contracts, None) -> Lwt.return (Ok contracts)) ; diff --git a/src/proto/alpha/storage.ml b/src/proto/alpha/storage.ml index ba24c4687..e89353d19 100644 --- a/src/proto/alpha/storage.ml +++ b/src/proto/alpha/storage.ml @@ -547,7 +547,7 @@ module Rewards = struct else cmp1 end)(struct type value = Tez_repr.t - let name = "level miner contract" + let name = "level baker contract" let encoding = Tez_repr.encoding end)