Alpha: rename voting_period_length into block_per_voting_period

This commit is contained in:
Grégoire Henry 2018-03-15 15:12:58 +01:00 committed by Benjamin Canou
parent 7ef2803199
commit c1ddec37ab
11 changed files with 30 additions and 30 deletions

View File

@ -268,7 +268,7 @@ module Constants : sig
val blocks_per_cycle: context -> int32 val blocks_per_cycle: context -> int32
val blocks_per_commitment: context -> int32 val blocks_per_commitment: context -> int32
val blocks_per_roll_snapshot: 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 time_between_blocks: context -> Period.t list
val first_free_baking_slot: context -> int val first_free_baking_slot: context -> int
val endorsers_per_block: context -> int val endorsers_per_block: context -> int

View File

@ -138,7 +138,7 @@ let record_ballot ctxt delegate proposal ballot =
let last_of_a_voting_period ctxt l = let last_of_a_voting_period ctxt l =
Compare.Int32.(Int32.succ l.Level.voting_period_position = 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 may_start_new_voting_cycle ctxt =
let level = Level.current ctxt in let level = Level.current ctxt in

View File

@ -49,7 +49,7 @@ type constants = {
blocks_per_cycle: int32 ; blocks_per_cycle: int32 ;
blocks_per_commitment: int32 ; blocks_per_commitment: int32 ;
blocks_per_roll_snapshot: int32 ; blocks_per_roll_snapshot: int32 ;
voting_period_length: int32 ; blocks_per_voting_period: int32 ;
time_between_blocks: Period_repr.t list ; time_between_blocks: Period_repr.t list ;
first_free_baking_slot: int ; first_free_baking_slot: int ;
endorsers_per_block: int ; endorsers_per_block: int ;
@ -70,7 +70,7 @@ let default = {
blocks_per_cycle = 4096l ; blocks_per_cycle = 4096l ;
blocks_per_commitment = 32l ; blocks_per_commitment = 32l ;
blocks_per_roll_snapshot = 256l ; blocks_per_roll_snapshot = 256l ;
voting_period_length = 32768l ; blocks_per_voting_period = 32768l ;
time_between_blocks = time_between_blocks =
List.map Period_repr.of_seconds_exn [ 60L ] ; List.map Period_repr.of_seconds_exn [ 60L ] ;
first_free_baking_slot = 16 ; first_free_baking_slot = 16 ;
@ -125,9 +125,9 @@ let constants_encoding =
and blocks_per_roll_snapshot = and blocks_per_roll_snapshot =
opt Compare.Int32.(=) opt Compare.Int32.(=)
default.blocks_per_roll_snapshot c.blocks_per_roll_snapshot default.blocks_per_roll_snapshot c.blocks_per_roll_snapshot
and voting_period_length = and blocks_per_voting_period =
opt Compare.Int32.(=) 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 = and time_between_blocks =
opt Compare_time_between_blocks.(=) opt Compare_time_between_blocks.(=)
default.time_between_blocks c.time_between_blocks default.time_between_blocks c.time_between_blocks
@ -166,7 +166,7 @@ let constants_encoding =
blocks_per_cycle, blocks_per_cycle,
blocks_per_commitment, blocks_per_commitment,
blocks_per_roll_snapshot, blocks_per_roll_snapshot,
voting_period_length, blocks_per_voting_period,
time_between_blocks, time_between_blocks,
first_free_baking_slot, first_free_baking_slot,
endorsers_per_block, endorsers_per_block,
@ -182,7 +182,7 @@ let constants_encoding =
blocks_per_cycle, blocks_per_cycle,
blocks_per_commitment, blocks_per_commitment,
blocks_per_roll_snapshot, blocks_per_roll_snapshot,
voting_period_length, blocks_per_voting_period,
time_between_blocks, time_between_blocks,
first_free_baking_slot, first_free_baking_slot,
endorsers_per_block, endorsers_per_block,
@ -202,8 +202,8 @@ let constants_encoding =
unopt default.blocks_per_commitment blocks_per_commitment ; unopt default.blocks_per_commitment blocks_per_commitment ;
blocks_per_roll_snapshot = blocks_per_roll_snapshot =
unopt default.blocks_per_roll_snapshot blocks_per_roll_snapshot ; unopt default.blocks_per_roll_snapshot blocks_per_roll_snapshot ;
voting_period_length = blocks_per_voting_period =
unopt default.voting_period_length voting_period_length ; unopt default.blocks_per_voting_period blocks_per_voting_period ;
time_between_blocks = time_between_blocks =
unopt default.time_between_blocks @@ unopt default.time_between_blocks @@
time_between_blocks ; time_between_blocks ;
@ -236,7 +236,7 @@ let constants_encoding =
(opt "blocks_per_cycle" int32) (opt "blocks_per_cycle" int32)
(opt "blocks_per_commitment" int32) (opt "blocks_per_commitment" int32)
(opt "blocks_per_roll_snapshot" 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 "time_between_blocks" (list Period_repr.encoding))
(opt "first_free_baking_slot" uint16) (opt "first_free_baking_slot" uint16)
(opt "endorsers_per_block" uint16) (opt "endorsers_per_block" uint16)

View File

@ -32,13 +32,13 @@ module S = struct
~output: (obj1 (req "blocks_per_cycle" int32)) ~output: (obj1 (req "blocks_per_cycle" int32))
RPC_path.(custom_root / "blocks_per_cycle") RPC_path.(custom_root / "blocks_per_cycle")
let voting_period_length = let blocks_per_voting_period =
RPC_service.post_service RPC_service.post_service
~description: "Length of the voting period" ~description: "Length of the voting period"
~query: RPC_query.empty ~query: RPC_query.empty
~input: empty ~input: empty
~output: (obj1 (req "voting_period_length" int32)) ~output: (obj1 (req "blocks_per_voting_period" int32))
RPC_path.(custom_root / "voting_period_length") RPC_path.(custom_root / "blocks_per_voting_period")
let blocks_per_commitment = let blocks_per_commitment =
RPC_service.post_service RPC_service.post_service
@ -115,8 +115,8 @@ let () =
register0 S.blocks_per_cycle begin fun ctxt () () -> register0 S.blocks_per_cycle begin fun ctxt () () ->
return (Constants.blocks_per_cycle ctxt) return (Constants.blocks_per_cycle ctxt)
end ; end ;
register0 S.voting_period_length begin fun ctxt () () -> register0 S.blocks_per_voting_period begin fun ctxt () () ->
return (Constants.voting_period_length ctxt) return (Constants.blocks_per_voting_period ctxt)
end ; end ;
register0 S.blocks_per_commitment begin fun ctxt () () -> register0 S.blocks_per_commitment begin fun ctxt () () ->
return (Constants.blocks_per_commitment 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 () () RPC_context.make_call0 S.blocks_per_cycle ctxt block () ()
let preserved_cycles ctxt block = let preserved_cycles ctxt block =
RPC_context.make_call0 S.preserved_cycles ctxt block () () RPC_context.make_call0 S.preserved_cycles ctxt block () ()
let voting_period_length ctxt block = let blocks_per_voting_period ctxt block =
RPC_context.make_call0 S.voting_period_length ctxt block () () RPC_context.make_call0 S.blocks_per_voting_period ctxt block () ()
let blocks_per_commitment ctxt block = let blocks_per_commitment ctxt block =
RPC_context.make_call0 S.blocks_per_commitment ctxt block () () RPC_context.make_call0 S.blocks_per_commitment ctxt block () ()
let blocks_per_roll_snapshot ctxt block = let blocks_per_roll_snapshot ctxt block =

View File

@ -15,7 +15,7 @@ val preserved_cycles:
val blocks_per_cycle: val blocks_per_cycle:
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t '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 'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
val blocks_per_commitment: val blocks_per_commitment:

View File

@ -19,9 +19,9 @@ let blocks_per_commitment c =
let blocks_per_roll_snapshot c = let blocks_per_roll_snapshot c =
let constants = Raw_context.constants c in let constants = Raw_context.constants c in
constants.blocks_per_roll_snapshot constants.blocks_per_roll_snapshot
let voting_period_length c = let blocks_per_voting_period c =
let constants = Raw_context.constants c in let constants = Raw_context.constants c in
constants.voting_period_length constants.blocks_per_voting_period
let time_between_blocks c = let time_between_blocks c =
let constants = Raw_context.constants c in let constants = Raw_context.constants c in
constants.time_between_blocks constants.time_between_blocks

View File

@ -72,7 +72,7 @@ let root first_level =
} }
let from_raw let from_raw
~first_level ~blocks_per_cycle ~voting_period_length ~first_level ~blocks_per_cycle ~blocks_per_voting_period
~blocks_per_commitment ~blocks_per_commitment
level = level =
let raw_level = Raw_level_repr.to_int32 level in 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 cycle_position = Int32.rem level_position blocks_per_cycle in
let voting_period = let voting_period =
Voting_period_repr.of_int32_exn 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 = 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 pos = Int32.rem cycle_position blocks_per_commitment in
let expected_commitment = Compare.Int32.(pos = 0l) in let expected_commitment = Compare.Int32.(pos = 0l) in
{ level ; level_position ; { level ; level_position ;

View File

@ -30,7 +30,7 @@ val root: Raw_level_repr.t -> level
val from_raw: val from_raw:
first_level:Raw_level_repr.t -> first_level:Raw_level_repr.t ->
blocks_per_cycle:int32 -> blocks_per_cycle:int32 ->
voting_period_length:int32 -> blocks_per_voting_period:int32 ->
blocks_per_commitment:int32 -> blocks_per_commitment:int32 ->
Raw_level_repr.t -> level Raw_level_repr.t -> level

View File

@ -19,7 +19,7 @@ let from_raw c ?offset l =
Level_repr.from_raw Level_repr.from_raw
~first_level ~first_level
~blocks_per_cycle:constants.Constants_repr.blocks_per_cycle ~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 ~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment
l l

View File

@ -204,7 +204,7 @@ let prepare ~level ~timestamp ~fitness ctxt =
Level_repr.from_raw Level_repr.from_raw
~first_level ~first_level
~blocks_per_cycle:constants.Constants_repr.blocks_per_cycle ~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 ~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment
level in level in
return ({ context = ctxt ; constants ; level ; return ({ context = ctxt ; constants ; level ;

View File

@ -56,13 +56,13 @@ module Constants = struct
~output: (obj1 (req "blocks_per_cycle" int32)) ~output: (obj1 (req "blocks_per_cycle" int32))
RPC_path.(custom_root / "constants" / "blocks_per_cycle") 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 RPC_service.post_service
~description: "Length of the voting period" ~description: "Length of the voting period"
~query: RPC_query.empty ~query: RPC_query.empty
~input: empty ~input: empty
~output: (obj1 (req "voting_period_length" int32)) ~output: (obj1 (req "blocks_per_voting_period" int32))
RPC_path.(custom_root / "constants" / "voting_period_length") RPC_path.(custom_root / "constants" / "blocks_per_voting_period")
let time_before_reward custom_root = let time_before_reward custom_root =
RPC_service.post_service RPC_service.post_service