Alpha: rename block_per_roll_snapshot into blocks_per_roll_snapshot

This commit is contained in:
Grégoire Henry 2018-03-15 15:01:51 +01:00 committed by Benjamin Canou
parent e81c02c27a
commit 4f968d6fdc
6 changed files with 25 additions and 25 deletions

View File

@ -267,7 +267,7 @@ module Constants : sig
val preserved_cycles: context -> int
val cycle_length: context -> int32
val blocks_per_commitment: context -> int32
val block_per_roll_snapshot: context -> int32
val blocks_per_roll_snapshot: context -> int32
val voting_period_length: context -> int32
val slot_durations: context -> Period.t list
val first_free_baking_slot: context -> int

View File

@ -577,10 +577,10 @@ let apply_operation
let may_snapshot_roll ctxt =
let level = Alpha_context.Level.current ctxt in
let block_per_roll_snapshot = Constants.block_per_roll_snapshot ctxt in
let blocks_per_roll_snapshot = Constants.blocks_per_roll_snapshot ctxt in
if Compare.Int32.equal
(Int32.rem level.cycle_position block_per_roll_snapshot)
(Int32.pred block_per_roll_snapshot)
(Int32.rem level.cycle_position blocks_per_roll_snapshot)
(Int32.pred blocks_per_roll_snapshot)
then
Alpha_context.Roll.snapshot_rolls ctxt >>=? fun ctxt ->
return ctxt

View File

@ -48,7 +48,7 @@ type constants = {
preserved_cycles: int ;
cycle_length: int32 ;
blocks_per_commitment: int32 ;
block_per_roll_snapshot: int32 ;
blocks_per_roll_snapshot: int32 ;
voting_period_length: int32 ;
slot_durations: Period_repr.t list ;
first_free_baking_slot: int ;
@ -69,7 +69,7 @@ let default = {
preserved_cycles = 5 ;
cycle_length = 4096l ;
blocks_per_commitment = 32l ;
block_per_roll_snapshot = 256l ;
blocks_per_roll_snapshot = 256l ;
voting_period_length = 32768l ;
slot_durations =
List.map Period_repr.of_seconds_exn [ 60L ] ;
@ -122,9 +122,9 @@ let constants_encoding =
and blocks_per_commitment =
opt Compare.Int32.(=)
default.blocks_per_commitment c.blocks_per_commitment
and block_per_roll_snapshot =
and blocks_per_roll_snapshot =
opt Compare.Int32.(=)
default.block_per_roll_snapshot c.block_per_roll_snapshot
default.blocks_per_roll_snapshot c.blocks_per_roll_snapshot
and voting_period_length =
opt Compare.Int32.(=)
default.voting_period_length c.voting_period_length
@ -165,7 +165,7 @@ let constants_encoding =
((( preserved_cycles,
cycle_length,
blocks_per_commitment,
block_per_roll_snapshot,
blocks_per_roll_snapshot,
voting_period_length,
slot_durations,
first_free_baking_slot,
@ -181,7 +181,7 @@ let constants_encoding =
(fun ((( preserved_cycles,
cycle_length,
blocks_per_commitment,
block_per_roll_snapshot,
blocks_per_roll_snapshot,
voting_period_length,
slot_durations,
first_free_baking_slot,
@ -200,8 +200,8 @@ let constants_encoding =
unopt default.cycle_length cycle_length ;
blocks_per_commitment =
unopt default.blocks_per_commitment blocks_per_commitment ;
block_per_roll_snapshot =
unopt default.block_per_roll_snapshot block_per_roll_snapshot ;
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 ;
slot_durations =
@ -235,7 +235,7 @@ let constants_encoding =
(opt "preserved_cycles" uint8)
(opt "cycle_length" int32)
(opt "blocks_per_commitment" int32)
(opt "block_per_roll_snapshot" int32)
(opt "blocks_per_roll_snapshot" int32)
(opt "voting_period_length" int32)
(opt "slot_durations" (list Period_repr.encoding))
(opt "first_free_baking_slot" uint16)
@ -261,7 +261,7 @@ let read = function
match Data_encoding.Json.(destruct constants_encoding json) with
| exception exn -> fail (Constant_read exn)
| c ->
if Compare.Int32.(c.block_per_roll_snapshot > c.cycle_length) then
failwith "Invalid sandbox: 'block_per_roll_snapshot > cycle_length'"
if Compare.Int32.(c.blocks_per_roll_snapshot > c.cycle_length) then
failwith "Invalid sandbox: 'blocks_per_roll_snapshot > cycle_length'"
else
return c

View File

@ -48,13 +48,13 @@ module S = struct
~output: (obj1 (req "blocks_per_commitment" int32))
RPC_path.(custom_root / "blocks_per_commitment")
let block_per_roll_snapshot =
let blocks_per_roll_snapshot =
RPC_service.post_service
~description: "How many blocks between roll snapshots"
~query: RPC_query.empty
~input: empty
~output: (obj1 (req "block_per_roll_snapshot" int32))
RPC_path.(custom_root / "block_per_roll_snapshot")
~output: (obj1 (req "blocks_per_roll_snapshot" int32))
RPC_path.(custom_root / "blocks_per_roll_snapshot")
let slot_durations =
RPC_service.post_service
@ -121,8 +121,8 @@ let () =
register0 S.blocks_per_commitment begin fun ctxt () () ->
return (Constants.blocks_per_commitment ctxt)
end ;
register0 S.block_per_roll_snapshot begin fun ctxt () () ->
return (Constants.block_per_roll_snapshot ctxt)
register0 S.blocks_per_roll_snapshot begin fun ctxt () () ->
return (Constants.blocks_per_roll_snapshot ctxt)
end ;
register0 S.slot_durations begin fun ctxt () () ->
return (Constants.slot_durations ctxt)
@ -151,8 +151,8 @@ let voting_period_length ctxt block =
RPC_context.make_call0 S.voting_period_length ctxt block () ()
let blocks_per_commitment ctxt block =
RPC_context.make_call0 S.blocks_per_commitment ctxt block () ()
let block_per_roll_snapshot ctxt block =
RPC_context.make_call0 S.block_per_roll_snapshot ctxt block () ()
let blocks_per_roll_snapshot ctxt block =
RPC_context.make_call0 S.blocks_per_roll_snapshot ctxt block () ()
let slot_durations ctxt block =
RPC_context.make_call0 S.slot_durations ctxt block () ()
let first_free_baking_slot ctxt block =

View File

@ -21,7 +21,7 @@ val voting_period_length:
val blocks_per_commitment:
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
val block_per_roll_snapshot:
val blocks_per_roll_snapshot:
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
val slot_durations:

View File

@ -16,9 +16,9 @@ let cycle_length c =
let blocks_per_commitment c =
let constants = Raw_context.constants c in
constants.blocks_per_commitment
let block_per_roll_snapshot c =
let blocks_per_roll_snapshot c =
let constants = Raw_context.constants c in
constants.block_per_roll_snapshot
constants.blocks_per_roll_snapshot
let voting_period_length c =
let constants = Raw_context.constants c in
constants.voting_period_length