From f14c0b7647d926ebd02a3789cd7cc28c370cfb6f Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Fri, 13 Oct 2023 14:05:50 +0200 Subject: [PATCH] Proto: remove parameter blocks_per_stake_snapshot --- .../files/alpha__constants.ksy | 2 -- .../files/alpha__constants__parametric.ksy | 2 -- .../files/alpha__parameters.ksy | 2 -- src/lib_store/unix/test/alpha_utils.ml | 12 +--------- .../lib_parameters/default_parameters.ml | 3 --- .../lib_protocol/alpha_context.mli | 3 --- .../lib_protocol/constants_parametric_repr.ml | 7 +----- .../constants_parametric_repr.mli | 1 - .../lib_protocol/constants_repr.ml | 14 ------------ .../lib_protocol/constants_storage.ml | 4 ---- .../lib_protocol/constants_storage.mli | 2 -- src/proto_alpha/lib_protocol/raw_context.ml | 3 --- .../lib_protocol/test/helpers/block.ml | 22 ++++--------------- ...t) RPC regression tests- misc_protocol.out | 4 ++-- ...t) RPC regression tests- misc_protocol.out | 4 ++-- ...y) RPC regression tests- misc_protocol.out | 4 ++-- ...r) RPC regression tests- misc_protocol.out | 4 ++-- ...c) RPC regression tests- misc_protocol.out | 4 ++-- 18 files changed, 16 insertions(+), 81 deletions(-) diff --git a/contrib/kaitai-struct-files/files/alpha__constants.ksy b/contrib/kaitai-struct-files/files/alpha__constants.ksy index 51c655a4580b..a8ba2ca95fe4 100644 --- a/contrib/kaitai-struct-files/files/alpha__constants.ksy +++ b/contrib/kaitai-struct-files/files/alpha__constants.ksy @@ -226,8 +226,6 @@ seq: type: s4 - id: nonce_revelation_threshold type: s4 -- id: blocks_per_stake_snapshot - type: s4 - id: cycles_per_voting_period type: s4 - id: hard_gas_limit_per_operation diff --git a/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy b/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy index fa867fa56722..17a5db4e9cd7 100644 --- a/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy +++ b/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy @@ -198,8 +198,6 @@ seq: type: s4 - id: nonce_revelation_threshold type: s4 -- id: blocks_per_stake_snapshot - type: s4 - id: cycles_per_voting_period type: s4 - id: hard_gas_limit_per_operation diff --git a/contrib/kaitai-struct-files/files/alpha__parameters.ksy b/contrib/kaitai-struct-files/files/alpha__parameters.ksy index e6801545055d..f773406ecaab 100644 --- a/contrib/kaitai-struct-files/files/alpha__parameters.ksy +++ b/contrib/kaitai-struct-files/files/alpha__parameters.ksy @@ -476,8 +476,6 @@ seq: type: s4 - id: nonce_revelation_threshold type: s4 -- id: blocks_per_stake_snapshot - type: s4 - id: cycles_per_voting_period type: s4 - id: hard_gas_limit_per_operation diff --git a/src/lib_store/unix/test/alpha_utils.ml b/src/lib_store/unix/test/alpha_utils.ml index 365235f509ad..fc52ebe68e55 100644 --- a/src/lib_store/unix/test/alpha_utils.ml +++ b/src/lib_store/unix/test/alpha_utils.ml @@ -375,23 +375,13 @@ let protocol_param_key = ["protocol_parameters"] let check_constants_consistency constants = let open Lwt_result_syntax in let open Constants_parametric_repr in - let {blocks_per_cycle; blocks_per_commitment; blocks_per_stake_snapshot; _} = - constants - in + let {blocks_per_cycle; blocks_per_commitment; _} = constants in let* () = Error_monad.unless (blocks_per_commitment <= blocks_per_cycle) (fun () -> failwith "Inconsistent constants : blocks per commitment must be less than \ blocks per cycle") in - let* () = - Error_monad.unless - (blocks_per_cycle >= blocks_per_stake_snapshot) - (fun () -> - failwith - "Inconsistent constants : blocks per cycle must be superior than \ - blocks per stake snapshot") - in return_unit let default_accounts = diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index aed7a63bb99f..92466e1c6776 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -187,7 +187,6 @@ let constants_mainnet = blocks_per_cycle = 24576l; blocks_per_commitment = 192l; nonce_revelation_threshold = 768l; - blocks_per_stake_snapshot = 1536l; cycles_per_voting_period = 5l; hard_gas_limit_per_operation = Gas.Arith.(integral_of_int_exn 1_040_000); hard_gas_limit_per_block = Gas.Arith.(integral_of_int_exn 1_733_333); @@ -343,7 +342,6 @@ let constants_sandbox = blocks_per_cycle = 8l; blocks_per_commitment = 4l; nonce_revelation_threshold = 4l; - blocks_per_stake_snapshot = 4l; cycles_per_voting_period = 8l; proof_of_work_threshold = Int64.(sub (shift_left 1L 62) 1L); vdf_difficulty = 50_000L; @@ -380,7 +378,6 @@ let constants_test = blocks_per_cycle = 12l; blocks_per_commitment = 4l; nonce_revelation_threshold = 4l; - blocks_per_stake_snapshot = 4l; cycles_per_voting_period = 2l; proof_of_work_threshold = Int64.(sub (shift_left 1L 62) 1L) (* 1/4 of nonces are accepted *); diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index e4b23ce9463a..409b938cdf17 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -897,7 +897,6 @@ module Constants : sig blocks_per_cycle : int32; blocks_per_commitment : int32; nonce_revelation_threshold : int32; - blocks_per_stake_snapshot : int32; cycles_per_voting_period : int32; hard_gas_limit_per_operation : Gas.Arith.integral; hard_gas_limit_per_block : Gas.Arith.integral; @@ -975,8 +974,6 @@ module Constants : sig val nonce_revelation_threshold : context -> int32 - val blocks_per_stake_snapshot : context -> int32 - val cycles_per_voting_period : context -> int32 val hard_gas_limit_per_operation : context -> Gas.Arith.integral diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index 05aba5cf22c4..cea14f53859b 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -179,7 +179,6 @@ type t = { blocks_per_cycle : int32; blocks_per_commitment : int32; nonce_revelation_threshold : int32; - blocks_per_stake_snapshot : int32; cycles_per_voting_period : int32; hard_gas_limit_per_operation : Gas_limit_repr.Arith.integral; hard_gas_limit_per_block : Gas_limit_repr.Arith.integral; @@ -527,7 +526,6 @@ let encoding = ( c.blocks_per_cycle, c.blocks_per_commitment, c.nonce_revelation_threshold, - c.blocks_per_stake_snapshot, c.cycles_per_voting_period, c.hard_gas_limit_per_operation, c.hard_gas_limit_per_block, @@ -568,7 +566,6 @@ let encoding = ( blocks_per_cycle, blocks_per_commitment, nonce_revelation_threshold, - blocks_per_stake_snapshot, cycles_per_voting_period, hard_gas_limit_per_operation, hard_gas_limit_per_block, @@ -610,7 +607,6 @@ let encoding = blocks_per_cycle; blocks_per_commitment; nonce_revelation_threshold; - blocks_per_stake_snapshot; cycles_per_voting_period; hard_gas_limit_per_operation; hard_gas_limit_per_block; @@ -653,11 +649,10 @@ let encoding = (req "consensus_rights_delay" uint8) (req "blocks_preservation_cycles" uint8) (req "delegate_parameters_activation_delay" uint8)) - (obj9 + (obj8 (req "blocks_per_cycle" int32) (req "blocks_per_commitment" int32) (req "nonce_revelation_threshold" int32) - (req "blocks_per_stake_snapshot" int32) (req "cycles_per_voting_period" int32) (req "hard_gas_limit_per_operation" diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index ee3247a84cfa..7bb25c080426 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -184,7 +184,6 @@ type t = { blocks_per_cycle : int32; blocks_per_commitment : int32; nonce_revelation_threshold : int32; - blocks_per_stake_snapshot : int32; cycles_per_voting_period : int32; hard_gas_limit_per_operation : Gas_limit_repr.Arith.integral; hard_gas_limit_per_block : Gas_limit_repr.Arith.integral; diff --git a/src/proto_alpha/lib_protocol/constants_repr.ml b/src/proto_alpha/lib_protocol/constants_repr.ml index f8259a29c8aa..14d4387913ff 100644 --- a/src/proto_alpha/lib_protocol/constants_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_repr.ml @@ -236,20 +236,6 @@ let check_constants constants = (Invalid_protocol_constants "The delegation over baking limit must be greater than or equal to 0.") in - let* () = - error_unless - (let snapshot_frequence = - Int32.div - constants.blocks_per_cycle - constants.blocks_per_stake_snapshot - in - Compare.Int32.( - snapshot_frequence > Int32.zero - && snapshot_frequence < Int32.of_int (1 lsl 16))) - (Invalid_protocol_constants - "The ratio blocks_per_cycle per blocks_per_stake_snapshot should be \ - between 1 and 65535") - in let* () = error_unless Compare.Int32.( diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index 4feb06a9a8d1..1a20937146cf 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -88,10 +88,6 @@ let nonce_revelation_threshold c = let constants = Raw_context.constants c in constants.nonce_revelation_threshold -let blocks_per_stake_snapshot c = - let constants = Raw_context.constants c in - constants.blocks_per_stake_snapshot - let cycles_per_voting_period c = let constants = Raw_context.constants c in constants.cycles_per_voting_period diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index 0c9ad1857919..e79f27fb406f 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -43,8 +43,6 @@ val blocks_per_commitment : Raw_context.t -> int32 val nonce_revelation_threshold : Raw_context.t -> int32 -val blocks_per_stake_snapshot : Raw_context.t -> int32 - val cycles_per_voting_period : Raw_context.t -> int32 val hard_gas_limit_per_operation : diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 9231712e39f4..b452b6a22ff9 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -955,7 +955,6 @@ let update_block_time_related_constants (c : Constants_parametric_repr.t) = let blocks_per_cycle = half_more c.blocks_per_cycle in let blocks_per_commitment = half_more c.blocks_per_commitment in let nonce_revelation_threshold = half_more c.nonce_revelation_threshold in - let blocks_per_stake_snapshot = half_more c.blocks_per_stake_snapshot in let max_operations_time_to_live = 3 * c.max_operations_time_to_live / 2 in let block_time = Int64.to_int (Period_repr.to_seconds minimal_block_delay) in let sc_rollup = @@ -967,7 +966,6 @@ let update_block_time_related_constants (c : Constants_parametric_repr.t) = blocks_per_cycle; blocks_per_commitment; nonce_revelation_threshold; - blocks_per_stake_snapshot; max_operations_time_to_live; minimal_block_delay; delay_increment_per_round; @@ -1202,7 +1200,6 @@ let prepare_first_block ~level ~timestamp _chain_id ctxt = blocks_per_cycle = c.blocks_per_cycle; blocks_per_commitment = c.blocks_per_commitment; nonce_revelation_threshold = c.nonce_revelation_threshold; - blocks_per_stake_snapshot = c.blocks_per_stake_snapshot; cycles_per_voting_period = c.cycles_per_voting_period; hard_gas_limit_per_operation = c.hard_gas_limit_per_operation; hard_gas_limit_per_block = c.hard_gas_limit_per_block; diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index a84f6f4cbe38..d7fead596c3f 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -369,13 +369,7 @@ let protocol_param_key = ["protocol_parameters"] let check_constants_consistency constants = let open Lwt_result_syntax in let open Constants.Parametric in - let { - blocks_per_cycle; - blocks_per_commitment; - nonce_revelation_threshold; - blocks_per_stake_snapshot; - _; - } = + let {blocks_per_cycle; blocks_per_commitment; nonce_revelation_threshold; _} = constants in let* () = @@ -384,18 +378,10 @@ let check_constants_consistency constants = "Inconsistent constants : blocks_per_commitment must be less than \ blocks_per_cycle") in - let* () = - Error_monad.unless - (nonce_revelation_threshold <= blocks_per_cycle) - (fun () -> - failwith - "Inconsistent constants : nonce_revelation_threshold must be less \ - than blocks_per_cycle") - in - Error_monad.unless (blocks_per_cycle >= blocks_per_stake_snapshot) (fun () -> + Error_monad.unless (nonce_revelation_threshold <= blocks_per_cycle) (fun () -> failwith - "Inconsistent constants : blocks_per_cycle must be superior than \ - blocks_per_stake_snapshot") + "Inconsistent constants : nonce_revelation_threshold must be less than \ + blocks_per_cycle") let prepare_main_init_params ?bootstrap_contracts commitments constants bootstrap_accounts = 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 795b91fce551..0ef3de11e7d6 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 @@ -12,8 +12,8 @@ "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1733333", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", 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 60dde986afee..dc78a7fa0ea2 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 @@ -12,8 +12,8 @@ "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1733333", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", 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 1127ebd4ca80..567fb640fab7 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 @@ -12,8 +12,8 @@ "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1733333", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", 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 ee4e6e65150f..866fdd6154de 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 @@ -12,8 +12,8 @@ "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1733333", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", 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 ee4e6e65150f..866fdd6154de 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 @@ -12,8 +12,8 @@ "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1733333", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", -- GitLab