diff --git a/src/proto_alpha/lib_protocol/src/alpha_context.mli b/src/proto_alpha/lib_protocol/src/alpha_context.mli index cd8b05fff..0fad57539 100644 --- a/src/proto_alpha/lib_protocol/src/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/src/alpha_context.mli @@ -268,7 +268,7 @@ module Constants : sig val blocks_per_cycle: context -> int32 val blocks_per_commitment: context -> int32 val blocks_per_roll_snapshot: context -> int32 - val voting_period_length: context -> int32 + val blocks_per_voting_period: context -> int32 val time_between_blocks: context -> Period.t list val first_free_baking_slot: context -> int val endorsers_per_block: context -> int diff --git a/src/proto_alpha/lib_protocol/src/amendment.ml b/src/proto_alpha/lib_protocol/src/amendment.ml index 54e39df2b..c4dc769cc 100644 --- a/src/proto_alpha/lib_protocol/src/amendment.ml +++ b/src/proto_alpha/lib_protocol/src/amendment.ml @@ -138,7 +138,7 @@ let record_ballot ctxt delegate proposal ballot = let last_of_a_voting_period ctxt l = Compare.Int32.(Int32.succ l.Level.voting_period_position = - Constants.voting_period_length ctxt ) + Constants.blocks_per_voting_period ctxt ) let may_start_new_voting_cycle ctxt = let level = Level.current ctxt in diff --git a/src/proto_alpha/lib_protocol/src/constants_repr.ml b/src/proto_alpha/lib_protocol/src/constants_repr.ml index 30cdcc2ca..5b34f9d50 100644 --- a/src/proto_alpha/lib_protocol/src/constants_repr.ml +++ b/src/proto_alpha/lib_protocol/src/constants_repr.ml @@ -49,7 +49,7 @@ type constants = { blocks_per_cycle: int32 ; blocks_per_commitment: int32 ; blocks_per_roll_snapshot: int32 ; - voting_period_length: int32 ; + blocks_per_voting_period: int32 ; time_between_blocks: Period_repr.t list ; first_free_baking_slot: int ; endorsers_per_block: int ; @@ -70,7 +70,7 @@ let default = { blocks_per_cycle = 4096l ; blocks_per_commitment = 32l ; blocks_per_roll_snapshot = 256l ; - voting_period_length = 32768l ; + blocks_per_voting_period = 32768l ; time_between_blocks = List.map Period_repr.of_seconds_exn [ 60L ] ; first_free_baking_slot = 16 ; @@ -125,9 +125,9 @@ let constants_encoding = and blocks_per_roll_snapshot = opt Compare.Int32.(=) default.blocks_per_roll_snapshot c.blocks_per_roll_snapshot - and voting_period_length = + and blocks_per_voting_period = opt Compare.Int32.(=) - default.voting_period_length c.voting_period_length + default.blocks_per_voting_period c.blocks_per_voting_period and time_between_blocks = opt Compare_time_between_blocks.(=) default.time_between_blocks c.time_between_blocks @@ -166,7 +166,7 @@ let constants_encoding = blocks_per_cycle, blocks_per_commitment, blocks_per_roll_snapshot, - voting_period_length, + blocks_per_voting_period, time_between_blocks, first_free_baking_slot, endorsers_per_block, @@ -182,7 +182,7 @@ let constants_encoding = blocks_per_cycle, blocks_per_commitment, blocks_per_roll_snapshot, - voting_period_length, + blocks_per_voting_period, time_between_blocks, first_free_baking_slot, endorsers_per_block, @@ -202,8 +202,8 @@ let constants_encoding = unopt default.blocks_per_commitment blocks_per_commitment ; blocks_per_roll_snapshot = unopt default.blocks_per_roll_snapshot blocks_per_roll_snapshot ; - voting_period_length = - unopt default.voting_period_length voting_period_length ; + blocks_per_voting_period = + unopt default.blocks_per_voting_period blocks_per_voting_period ; time_between_blocks = unopt default.time_between_blocks @@ time_between_blocks ; @@ -236,7 +236,7 @@ let constants_encoding = (opt "blocks_per_cycle" int32) (opt "blocks_per_commitment" int32) (opt "blocks_per_roll_snapshot" int32) - (opt "voting_period_length" int32) + (opt "blocks_per_voting_period" int32) (opt "time_between_blocks" (list Period_repr.encoding)) (opt "first_free_baking_slot" uint16) (opt "endorsers_per_block" uint16) diff --git a/src/proto_alpha/lib_protocol/src/constants_services.ml b/src/proto_alpha/lib_protocol/src/constants_services.ml index 656495c86..ec77abb2f 100644 --- a/src/proto_alpha/lib_protocol/src/constants_services.ml +++ b/src/proto_alpha/lib_protocol/src/constants_services.ml @@ -32,13 +32,13 @@ module S = struct ~output: (obj1 (req "blocks_per_cycle" int32)) RPC_path.(custom_root / "blocks_per_cycle") - let voting_period_length = + let blocks_per_voting_period = RPC_service.post_service ~description: "Length of the voting period" ~query: RPC_query.empty ~input: empty - ~output: (obj1 (req "voting_period_length" int32)) - RPC_path.(custom_root / "voting_period_length") + ~output: (obj1 (req "blocks_per_voting_period" int32)) + RPC_path.(custom_root / "blocks_per_voting_period") let blocks_per_commitment = RPC_service.post_service @@ -115,8 +115,8 @@ let () = register0 S.blocks_per_cycle begin fun ctxt () () -> return (Constants.blocks_per_cycle ctxt) end ; - register0 S.voting_period_length begin fun ctxt () () -> - return (Constants.voting_period_length ctxt) + register0 S.blocks_per_voting_period begin fun ctxt () () -> + return (Constants.blocks_per_voting_period ctxt) end ; register0 S.blocks_per_commitment begin fun ctxt () () -> return (Constants.blocks_per_commitment ctxt) @@ -147,8 +147,8 @@ let blocks_per_cycle ctxt block = RPC_context.make_call0 S.blocks_per_cycle ctxt block () () let preserved_cycles ctxt block = RPC_context.make_call0 S.preserved_cycles ctxt block () () -let voting_period_length ctxt block = - RPC_context.make_call0 S.voting_period_length ctxt block () () +let blocks_per_voting_period ctxt block = + RPC_context.make_call0 S.blocks_per_voting_period ctxt block () () let blocks_per_commitment ctxt block = RPC_context.make_call0 S.blocks_per_commitment ctxt block () () let blocks_per_roll_snapshot ctxt block = diff --git a/src/proto_alpha/lib_protocol/src/constants_services.mli b/src/proto_alpha/lib_protocol/src/constants_services.mli index 17fcb61ec..aba683702 100644 --- a/src/proto_alpha/lib_protocol/src/constants_services.mli +++ b/src/proto_alpha/lib_protocol/src/constants_services.mli @@ -15,7 +15,7 @@ val preserved_cycles: val blocks_per_cycle: 'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t -val voting_period_length: +val blocks_per_voting_period: 'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t val blocks_per_commitment: diff --git a/src/proto_alpha/lib_protocol/src/constants_storage.ml b/src/proto_alpha/lib_protocol/src/constants_storage.ml index 5693e01f8..bbeeb9623 100644 --- a/src/proto_alpha/lib_protocol/src/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/src/constants_storage.ml @@ -19,9 +19,9 @@ let blocks_per_commitment c = let blocks_per_roll_snapshot c = let constants = Raw_context.constants c in constants.blocks_per_roll_snapshot -let voting_period_length c = +let blocks_per_voting_period c = let constants = Raw_context.constants c in - constants.voting_period_length + constants.blocks_per_voting_period let time_between_blocks c = let constants = Raw_context.constants c in constants.time_between_blocks diff --git a/src/proto_alpha/lib_protocol/src/level_repr.ml b/src/proto_alpha/lib_protocol/src/level_repr.ml index dacf3071e..a71c5fea7 100644 --- a/src/proto_alpha/lib_protocol/src/level_repr.ml +++ b/src/proto_alpha/lib_protocol/src/level_repr.ml @@ -72,7 +72,7 @@ let root first_level = } let from_raw - ~first_level ~blocks_per_cycle ~voting_period_length + ~first_level ~blocks_per_cycle ~blocks_per_voting_period ~blocks_per_commitment level = let raw_level = Raw_level_repr.to_int32 level in @@ -84,9 +84,9 @@ let from_raw let cycle_position = Int32.rem level_position blocks_per_cycle in let voting_period = Voting_period_repr.of_int32_exn - (Int32.div level_position voting_period_length) in + (Int32.div level_position blocks_per_voting_period) in let voting_period_position = - Int32.rem level_position voting_period_length in + Int32.rem level_position blocks_per_voting_period in let pos = Int32.rem cycle_position blocks_per_commitment in let expected_commitment = Compare.Int32.(pos = 0l) in { level ; level_position ; diff --git a/src/proto_alpha/lib_protocol/src/level_repr.mli b/src/proto_alpha/lib_protocol/src/level_repr.mli index 48ffe64b8..abe88bc4b 100644 --- a/src/proto_alpha/lib_protocol/src/level_repr.mli +++ b/src/proto_alpha/lib_protocol/src/level_repr.mli @@ -30,7 +30,7 @@ val root: Raw_level_repr.t -> level val from_raw: first_level:Raw_level_repr.t -> blocks_per_cycle:int32 -> - voting_period_length:int32 -> + blocks_per_voting_period:int32 -> blocks_per_commitment:int32 -> Raw_level_repr.t -> level diff --git a/src/proto_alpha/lib_protocol/src/level_storage.ml b/src/proto_alpha/lib_protocol/src/level_storage.ml index 16b5f8bcb..51706114c 100644 --- a/src/proto_alpha/lib_protocol/src/level_storage.ml +++ b/src/proto_alpha/lib_protocol/src/level_storage.ml @@ -19,7 +19,7 @@ let from_raw c ?offset l = Level_repr.from_raw ~first_level ~blocks_per_cycle:constants.Constants_repr.blocks_per_cycle - ~voting_period_length:constants.Constants_repr.voting_period_length + ~blocks_per_voting_period:constants.Constants_repr.blocks_per_voting_period ~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment l diff --git a/src/proto_alpha/lib_protocol/src/raw_context.ml b/src/proto_alpha/lib_protocol/src/raw_context.ml index c7b0ca829..d5b583c11 100644 --- a/src/proto_alpha/lib_protocol/src/raw_context.ml +++ b/src/proto_alpha/lib_protocol/src/raw_context.ml @@ -204,7 +204,7 @@ let prepare ~level ~timestamp ~fitness ctxt = Level_repr.from_raw ~first_level ~blocks_per_cycle:constants.Constants_repr.blocks_per_cycle - ~voting_period_length:constants.Constants_repr.voting_period_length + ~blocks_per_voting_period:constants.Constants_repr.blocks_per_voting_period ~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment level in return ({ context = ctxt ; constants ; level ; diff --git a/src/proto_alpha/lib_protocol/src/services.ml b/src/proto_alpha/lib_protocol/src/services.ml index d03b560fe..51da1d8d7 100644 --- a/src/proto_alpha/lib_protocol/src/services.ml +++ b/src/proto_alpha/lib_protocol/src/services.ml @@ -56,13 +56,13 @@ module Constants = struct ~output: (obj1 (req "blocks_per_cycle" int32)) RPC_path.(custom_root / "constants" / "blocks_per_cycle") - let voting_period_length custom_root = + let blocks_per_voting_period custom_root = RPC_service.post_service ~description: "Length of the voting period" ~query: RPC_query.empty ~input: empty - ~output: (obj1 (req "voting_period_length" int32)) - RPC_path.(custom_root / "constants" / "voting_period_length") + ~output: (obj1 (req "blocks_per_voting_period" int32)) + RPC_path.(custom_root / "constants" / "blocks_per_voting_period") let time_before_reward custom_root = RPC_service.post_service