Alpha: rename voting_period_length
into block_per_voting_period
This commit is contained in:
parent
7ef2803199
commit
c1ddec37ab
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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 =
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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 ;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 ;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user