diff --git a/src/proto_alpha/lib_client/mockup.ml b/src/proto_alpha/lib_client/mockup.ml index 7b5fcb6e7446710b353850d606ef5030fe55f916..c297e718f6bb37b704cc984945b1b30fb5349d53 100644 --- a/src/proto_alpha/lib_client/mockup.ml +++ b/src/proto_alpha/lib_client/mockup.ml @@ -100,7 +100,7 @@ module Protocol_constants_overrides = struct frozen_deposits_percentage : int option; double_baking_punishment : Tez.t option; ratio_of_frozen_deposits_slashed_per_double_endorsement : Ratio.t option; - governance_dictator : Signature.Public_key_hash.t option option; + testnet_dictator : Signature.Public_key_hash.t option option; cache_script_size : int option; cache_stake_distribution_cycles : int option; cache_sampler_state_cycles : int option; @@ -267,7 +267,7 @@ module Protocol_constants_overrides = struct c.frozen_deposits_percentage, c.double_baking_punishment, c.ratio_of_frozen_deposits_slashed_per_double_endorsement, - c.governance_dictator, + c.testnet_dictator, c.chain_id, c.timestamp, c.initial_seed ), @@ -309,7 +309,7 @@ module Protocol_constants_overrides = struct frozen_deposits_percentage, double_baking_punishment, ratio_of_frozen_deposits_slashed_per_double_endorsement, - governance_dictator, + testnet_dictator, chain_id, timestamp, initial_seed ), @@ -352,7 +352,7 @@ module Protocol_constants_overrides = struct frozen_deposits_percentage; double_baking_punishment; ratio_of_frozen_deposits_slashed_per_double_endorsement; - governance_dictator; + testnet_dictator; cache_script_size; cache_stake_distribution_cycles; cache_sampler_state_cycles; @@ -408,7 +408,7 @@ module Protocol_constants_overrides = struct "ratio_of_frozen_deposits_slashed_per_double_endorsement" Ratio.encoding) (opt - "governance_dictator" + "testnet_dictator" (option Signature.Public_key_hash.encoding)) (opt "chain_id" Chain_id.encoding) (opt "initial_timestamp" Time.Protocol.encoding) @@ -486,7 +486,7 @@ module Protocol_constants_overrides = struct ratio_of_frozen_deposits_slashed_per_double_endorsement = Some parametric.ratio_of_frozen_deposits_slashed_per_double_endorsement; - governance_dictator = Some parametric.governance_dictator; + testnet_dictator = Some parametric.testnet_dictator; cache_script_size = Some parametric.cache_script_size; cache_stake_distribution_cycles = Some parametric.cache_stake_distribution_cycles; @@ -580,7 +580,7 @@ module Protocol_constants_overrides = struct frozen_deposits_percentage = None; double_baking_punishment = None; ratio_of_frozen_deposits_slashed_per_double_endorsement = None; - governance_dictator = None; + testnet_dictator = None; cache_script_size = None; cache_stake_distribution_cycles = None; cache_sampler_state_cycles = None; @@ -1037,8 +1037,8 @@ module Protocol_constants_overrides = struct Option.value ~default:c.ratio_of_frozen_deposits_slashed_per_double_endorsement o.ratio_of_frozen_deposits_slashed_per_double_endorsement; - governance_dictator = - Option.value ~default:c.governance_dictator o.governance_dictator; + testnet_dictator = + Option.value ~default:c.testnet_dictator o.testnet_dictator; (* Notice that the chain_id and the timestamp are not used here as they are not protocol constants... *) cache_script_size = diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 688ca2af1defd3bd9fc31427dd1366415a552249..36867bf24ab5e647affabc6f3eac4c2ef0a36a06 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -132,8 +132,8 @@ let constants_mainnet = double_baking_punishment = Tez.(mul_exn one 640); ratio_of_frozen_deposits_slashed_per_double_endorsement = {numerator = 1; denominator = 2}; - (* The `governance_dictator` should absolutely be None on mainnet *) - governance_dictator = None; + (* The `testnet_dictator` should absolutely be None on mainnet *) + testnet_dictator = None; initial_seed = None; (* A cache for contract source code and storage. Its size has been chosen not too exceed 100 000 000 bytes. *) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 35309a96e21695dfc56bd1d71daa1acc0a135a6c..64b319c25dbefcf326860b80a39934106fe64888 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -845,7 +845,7 @@ module Constants : sig frozen_deposits_percentage : int; double_baking_punishment : Tez.t; ratio_of_frozen_deposits_slashed_per_double_endorsement : Ratio.t; - governance_dictator : public_key_hash option; + testnet_dictator : public_key_hash option; initial_seed : State_hash.t option; cache_script_size : int; cache_stake_distribution_cycles : int; @@ -946,7 +946,7 @@ module Constants : sig val ratio_of_frozen_deposits_slashed_per_double_endorsement : context -> Ratio.t - val governance_dictator : context -> public_key_hash option + val testnet_dictator : context -> public_key_hash option val tx_rollup_enable : context -> bool @@ -2545,7 +2545,7 @@ module Voting_period : sig val get_rpc_succ_info : context -> info tzresult Lwt.t - module Governance_dictator : sig + module Testnet_dictator : sig val overwrite_current_kind : context -> Chain_id.t -> Voting_period_repr.kind -> context tzresult Lwt.t end diff --git a/src/proto_alpha/lib_protocol/amendment.ml b/src/proto_alpha/lib_protocol/amendment.ml index 43c1c6482e56b6093f834a5090c1fe0984cde1d1..9bc9a8d4829f513dfe0e429ce0a3e6d676800ac4 100644 --- a/src/proto_alpha/lib_protocol/amendment.ml +++ b/src/proto_alpha/lib_protocol/amendment.ml @@ -115,7 +115,7 @@ let get_approval_and_update_participation_ema ctxt = for the next block. *) let start_new_voting_period ctxt = (* any change related to the storage in this function must probably - be replicated in `record_governance_dictator_proposals` *) + be replicated in `record_testnet_dictator_proposals` *) Voting_period.get_current_kind ctxt >>=? fun kind -> (match kind with | Proposal -> ( @@ -246,12 +246,11 @@ let () = `Permanent ~id:"invalid_dictator_proposal" ~title:"Invalid dictator proposal" - ~description:"A governance dictator can only submit one proposal at a time." + ~description:"A testnet dictator can only submit one proposal at a time." ~pp:(fun ppf () -> Format.fprintf ppf - "A governance dictator can only submit one proposal at a time. There \ - is no governance dictator on mainnet.") + "A testnet dictator can only submit one proposal at a time.") empty (function Invalid_dictator_proposal -> Some () | _ -> None) (fun () -> Invalid_dictator_proposal) @@ -283,34 +282,34 @@ let record_delegate_proposals ctxt delegate proposals = else fail Unauthorized_proposal | Exploration | Cooldown | Promotion | Adoption -> fail Unexpected_proposal -let record_governance_dictator_proposals ctxt chain_id proposals = +let record_testnet_dictator_proposals ctxt chain_id proposals = Vote.clear_ballots ctxt >>= fun ctxt -> Vote.clear_proposals ctxt >>= fun ctxt -> Vote.clear_current_proposal ctxt >>=? fun ctxt -> match proposals with | [] -> - Voting_period.Governance_dictator.overwrite_current_kind + Voting_period.Testnet_dictator.overwrite_current_kind ctxt chain_id Proposal | [proposal] -> Vote.init_current_proposal ctxt proposal >>=? fun ctxt -> - Voting_period.Governance_dictator.overwrite_current_kind + Voting_period.Testnet_dictator.overwrite_current_kind ctxt chain_id Adoption | _ :: _ :: _ -> fail Invalid_dictator_proposal -let is_governance_dictator ctxt chain_id delegate = +let is_testnet_dictator ctxt chain_id delegate = (* This function should always, ALWAYS, return false on mainnet!!!! *) - match Constants.governance_dictator ctxt with + match Constants.testnet_dictator ctxt with | Some pkh when Chain_id.(chain_id <> Constants_repr.mainnet_id) -> Signature.Public_key_hash.equal pkh delegate | _ -> false let record_proposals ctxt chain_id delegate proposals = - if is_governance_dictator ctxt chain_id delegate then - record_governance_dictator_proposals ctxt chain_id proposals + if is_testnet_dictator ctxt chain_id delegate then + record_testnet_dictator_proposals ctxt chain_id proposals else record_delegate_proposals ctxt delegate proposals let record_ballot ctxt delegate proposal ballot = diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index 323ba7e87d0e16116b904ca2fb16d3d8a310789a..6d8678201e3360606d60e3617a389ba2248b0feb 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -141,7 +141,7 @@ type t = { frozen_deposits_percentage : int; double_baking_punishment : Tez_repr.t; ratio_of_frozen_deposits_slashed_per_double_endorsement : Ratio_repr.t; - governance_dictator : Signature.Public_key_hash.t option; + testnet_dictator : Signature.Public_key_hash.t option; initial_seed : State_hash.t option; (* If a new cache is added, please also modify the [cache_layout_size] value. *) @@ -305,7 +305,7 @@ let encoding = c.frozen_deposits_percentage, c.double_baking_punishment, c.ratio_of_frozen_deposits_slashed_per_double_endorsement, - c.governance_dictator, + c.testnet_dictator, c.initial_seed ), ( ( c.cache_script_size, c.cache_stake_distribution_cycles, @@ -345,7 +345,7 @@ let encoding = frozen_deposits_percentage, double_baking_punishment, ratio_of_frozen_deposits_slashed_per_double_endorsement, - governance_dictator, + testnet_dictator, initial_seed ), ( ( cache_script_size, cache_stake_distribution_cycles, @@ -386,7 +386,7 @@ let encoding = frozen_deposits_percentage; double_baking_punishment; ratio_of_frozen_deposits_slashed_per_double_endorsement; - governance_dictator; + testnet_dictator; initial_seed; cache_script_size; cache_stake_distribution_cycles; @@ -443,9 +443,7 @@ let encoding = (req "ratio_of_frozen_deposits_slashed_per_double_endorsement" Ratio_repr.encoding) - (opt - "governance_dictator" - Signature.Public_key_hash.encoding) + (opt "testnet_dictator" Signature.Public_key_hash.encoding) (opt "initial_seed" State_hash.encoding)) (merge_objs (obj3 diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index fb2f53eea5e072dcd702e79455ee864929c994b8..41a652bc63cbde746bccb75b0d0a30b603c5d082 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -142,7 +142,7 @@ type t = { (* that is, (100 * delegated tz / own tz) *) double_baking_punishment : Tez_repr.t; ratio_of_frozen_deposits_slashed_per_double_endorsement : Ratio_repr.t; - governance_dictator : Signature.Public_key_hash.t option; + testnet_dictator : Signature.Public_key_hash.t option; initial_seed : State_hash.t option; cache_script_size : int; (* in bytes *) diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index fa84403d9a93e01b92d47494298cdfa60cb9cb8c..aa92d0c80ba946add3121eca9d7a80426a49088c 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -222,9 +222,9 @@ let ratio_of_frozen_deposits_slashed_per_double_endorsement c = let constants = Raw_context.constants c in constants.ratio_of_frozen_deposits_slashed_per_double_endorsement -let governance_dictator c = +let testnet_dictator c = let constants = Raw_context.constants c in - constants.governance_dictator + constants.testnet_dictator let sc_rollup_enable c = let sc_rollup = Raw_context.sc_rollup c in diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index b437603ca4b58fe50b1463df83a2d9e007c0c440..f3aff29231fce1dad979506e40ee4bb97668005a 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -129,7 +129,7 @@ val tx_rollup_sunset_level : Raw_context.t -> int32 val ratio_of_frozen_deposits_slashed_per_double_endorsement : Raw_context.t -> Ratio_repr.t -val governance_dictator : Raw_context.t -> Signature.Public_key_hash.t option +val testnet_dictator : Raw_context.t -> Signature.Public_key_hash.t option val minimal_block_delay : Raw_context.t -> Period_repr.t diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index f94d4bfae2fbe87ac8024a70be836345e9dff4c0..400886352ed31f20a113eac23cd55ba74d6d656d 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -947,8 +947,8 @@ let prepare_first_block ~level ~timestamp ctxt = double_baking_punishment = c.double_baking_punishment; ratio_of_frozen_deposits_slashed_per_double_endorsement = c.ratio_of_frozen_deposits_slashed_per_double_endorsement; - (* The `governance_dictator` should absolutely be None on mainnet *) - governance_dictator = None; + (* The `testnet_dictator` should absolutely be None on mainnet *) + testnet_dictator = None; initial_seed = c.initial_seed; cache_script_size = c.cache_script_size; cache_stake_distribution_cycles = c.cache_stake_distribution_cycles; diff --git a/src/proto_alpha/lib_protocol/voting_period_storage.ml b/src/proto_alpha/lib_protocol/voting_period_storage.ml index 9a33d729bf3fb0afe278495d1b1d6a7ea420105e..b15dd523009674747ccdf749920b91787538d063 100644 --- a/src/proto_alpha/lib_protocol/voting_period_storage.ml +++ b/src/proto_alpha/lib_protocol/voting_period_storage.ml @@ -193,7 +193,7 @@ let get_rpc_succ_info ctxt = in Voting_period_repr.{voting_period; position; remaining} -module Governance_dictator = struct +module Testnet_dictator = struct type error += Forbidden_on_mainnet let overwrite_current_kind ctxt chain_id kind = diff --git a/src/proto_alpha/lib_protocol/voting_period_storage.mli b/src/proto_alpha/lib_protocol/voting_period_storage.mli index 63994dca42ac59d1708b77781d4ca9c157138b61..06a6997aa1dbb2dcaf8e9579fee61a391cdfa3ee 100644 --- a/src/proto_alpha/lib_protocol/voting_period_storage.mli +++ b/src/proto_alpha/lib_protocol/voting_period_storage.mli @@ -60,9 +60,9 @@ val get_rpc_current_info : (** Returns the voting period information for the next level. *) val get_rpc_succ_info : Raw_context.t -> Voting_period_repr.info tzresult Lwt.t -module Governance_dictator : sig +module Testnet_dictator : sig (** Overwrites the kind of the current voting period WITHOUT incrementing the index. - Must ONLY be called by the governance dictator on a testnet. *) + Must ONLY be called by the testnet dictator on a testnet. *) val overwrite_current_kind : Raw_context.t -> Chain_id.t -> diff --git a/tests_python/tests_alpha/test_mockup.py b/tests_python/tests_alpha/test_mockup.py index faf0cd820b794ad7fd953850f05f2f9b22127cb6..d8b03e378c103aa7501f09a130fd16f0ac84709b 100644 --- a/tests_python/tests_alpha/test_mockup.py +++ b/tests_python/tests_alpha/test_mockup.py @@ -622,7 +622,7 @@ def _test_create_mockup_init_show_roundtrip( "origination_size": 258, "vdf_difficulty": "1000000000", "seed_nonce_revelation_tip": "125001", - "governance_dictator": None, + "testnet_dictator": None, "tokens_per_roll": "8000000001", "proof_of_work_threshold": "-2", "hard_gas_limit_per_block": "10400001", diff --git a/tezt/tests/main.ml b/tezt/tests/main.ml index 9077cd6302ca119b3c4e86ef5d9428f4b6bc1bd8..48f89a9428b658ee2a51b97de4c7ffb1190a570e 100644 --- a/tezt/tests/main.ml +++ b/tezt/tests/main.ml @@ -129,7 +129,7 @@ let () = Client_run_view.register ~protocols:[Alpha; Jakarta] ; Multinode_snapshot.register ~protocols:[Alpha] ; (* Relies on a feature only available since K. *) - Governance_dictator.register ~protocols:[Alpha] ; + Testnet_dictator.register ~protocols:[Alpha] ; Config.register () ; Events.register ~protocols:[Alpha] ; (* Relies on a feature only available since K. *) diff --git a/tezt/tests/governance_dictator.ml b/tezt/tests/testnet_dictator.ml similarity index 97% rename from tezt/tests/governance_dictator.ml rename to tezt/tests/testnet_dictator.ml index d23285a7ccf28cd376284d9c55c6920f823e0971..1215aa601c14923d1cc8f9e4e08fcff9cd345886 100644 --- a/tezt/tests/governance_dictator.ml +++ b/tezt/tests/testnet_dictator.ml @@ -26,7 +26,7 @@ (* Testing ------- Component: Testnet dictator key - Invocation: dune exec tezt/tests/main.exe -- --file governance_dictator.ml + Invocation: dune exec tezt/tests/main.exe -- --file testnet_dictator.ml Subject: This tests that, on testnets where a dictator key is setup, the dictator is able to force a protocol migration. *) @@ -102,7 +102,7 @@ let init_with_dictator ~chain_id ~protocol = (["blocks_per_cycle"], Some "4"); (["cycles_per_voting_period"], Some "1"); (["nonce_revelation_threshold"], Some "3"); - (["governance_dictator"], Some ("\"" ^ dictator.public_key_hash ^ "\"")); + (["testnet_dictator"], Some ("\"" ^ dictator.public_key_hash ^ "\"")); ] in let* () = @@ -136,7 +136,7 @@ let register_test chain_id period = ~__FILE__ ~title: (sf - "governance dictator (%s, %s)" + "testnet dictator (%s, %s)" (string_of_chain_id chain_id) (Voting.period_kind_to_string period)) ~tags: