Alpha: rename block_per_roll_snapshot
into blocks_per_roll_snapshot
This commit is contained in:
parent
e81c02c27a
commit
4f968d6fdc
@ -267,7 +267,7 @@ module Constants : sig
|
|||||||
val preserved_cycles: context -> int
|
val preserved_cycles: context -> int
|
||||||
val cycle_length: context -> int32
|
val cycle_length: context -> int32
|
||||||
val blocks_per_commitment: 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 voting_period_length: context -> int32
|
||||||
val slot_durations: context -> Period.t list
|
val slot_durations: context -> Period.t list
|
||||||
val first_free_baking_slot: context -> int
|
val first_free_baking_slot: context -> int
|
||||||
|
@ -577,10 +577,10 @@ let apply_operation
|
|||||||
|
|
||||||
let may_snapshot_roll ctxt =
|
let may_snapshot_roll ctxt =
|
||||||
let level = Alpha_context.Level.current ctxt in
|
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
|
if Compare.Int32.equal
|
||||||
(Int32.rem level.cycle_position block_per_roll_snapshot)
|
(Int32.rem level.cycle_position blocks_per_roll_snapshot)
|
||||||
(Int32.pred block_per_roll_snapshot)
|
(Int32.pred blocks_per_roll_snapshot)
|
||||||
then
|
then
|
||||||
Alpha_context.Roll.snapshot_rolls ctxt >>=? fun ctxt ->
|
Alpha_context.Roll.snapshot_rolls ctxt >>=? fun ctxt ->
|
||||||
return ctxt
|
return ctxt
|
||||||
|
@ -48,7 +48,7 @@ type constants = {
|
|||||||
preserved_cycles: int ;
|
preserved_cycles: int ;
|
||||||
cycle_length: int32 ;
|
cycle_length: int32 ;
|
||||||
blocks_per_commitment: int32 ;
|
blocks_per_commitment: int32 ;
|
||||||
block_per_roll_snapshot: int32 ;
|
blocks_per_roll_snapshot: int32 ;
|
||||||
voting_period_length: int32 ;
|
voting_period_length: int32 ;
|
||||||
slot_durations: Period_repr.t list ;
|
slot_durations: Period_repr.t list ;
|
||||||
first_free_baking_slot: int ;
|
first_free_baking_slot: int ;
|
||||||
@ -69,7 +69,7 @@ let default = {
|
|||||||
preserved_cycles = 5 ;
|
preserved_cycles = 5 ;
|
||||||
cycle_length = 4096l ;
|
cycle_length = 4096l ;
|
||||||
blocks_per_commitment = 32l ;
|
blocks_per_commitment = 32l ;
|
||||||
block_per_roll_snapshot = 256l ;
|
blocks_per_roll_snapshot = 256l ;
|
||||||
voting_period_length = 32768l ;
|
voting_period_length = 32768l ;
|
||||||
slot_durations =
|
slot_durations =
|
||||||
List.map Period_repr.of_seconds_exn [ 60L ] ;
|
List.map Period_repr.of_seconds_exn [ 60L ] ;
|
||||||
@ -122,9 +122,9 @@ let constants_encoding =
|
|||||||
and blocks_per_commitment =
|
and blocks_per_commitment =
|
||||||
opt Compare.Int32.(=)
|
opt Compare.Int32.(=)
|
||||||
default.blocks_per_commitment c.blocks_per_commitment
|
default.blocks_per_commitment c.blocks_per_commitment
|
||||||
and block_per_roll_snapshot =
|
and blocks_per_roll_snapshot =
|
||||||
opt Compare.Int32.(=)
|
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 =
|
and voting_period_length =
|
||||||
opt Compare.Int32.(=)
|
opt Compare.Int32.(=)
|
||||||
default.voting_period_length c.voting_period_length
|
default.voting_period_length c.voting_period_length
|
||||||
@ -165,7 +165,7 @@ let constants_encoding =
|
|||||||
((( preserved_cycles,
|
((( preserved_cycles,
|
||||||
cycle_length,
|
cycle_length,
|
||||||
blocks_per_commitment,
|
blocks_per_commitment,
|
||||||
block_per_roll_snapshot,
|
blocks_per_roll_snapshot,
|
||||||
voting_period_length,
|
voting_period_length,
|
||||||
slot_durations,
|
slot_durations,
|
||||||
first_free_baking_slot,
|
first_free_baking_slot,
|
||||||
@ -181,7 +181,7 @@ let constants_encoding =
|
|||||||
(fun ((( preserved_cycles,
|
(fun ((( preserved_cycles,
|
||||||
cycle_length,
|
cycle_length,
|
||||||
blocks_per_commitment,
|
blocks_per_commitment,
|
||||||
block_per_roll_snapshot,
|
blocks_per_roll_snapshot,
|
||||||
voting_period_length,
|
voting_period_length,
|
||||||
slot_durations,
|
slot_durations,
|
||||||
first_free_baking_slot,
|
first_free_baking_slot,
|
||||||
@ -200,8 +200,8 @@ let constants_encoding =
|
|||||||
unopt default.cycle_length cycle_length ;
|
unopt default.cycle_length cycle_length ;
|
||||||
blocks_per_commitment =
|
blocks_per_commitment =
|
||||||
unopt default.blocks_per_commitment blocks_per_commitment ;
|
unopt default.blocks_per_commitment blocks_per_commitment ;
|
||||||
block_per_roll_snapshot =
|
blocks_per_roll_snapshot =
|
||||||
unopt default.block_per_roll_snapshot block_per_roll_snapshot ;
|
unopt default.blocks_per_roll_snapshot blocks_per_roll_snapshot ;
|
||||||
voting_period_length =
|
voting_period_length =
|
||||||
unopt default.voting_period_length voting_period_length ;
|
unopt default.voting_period_length voting_period_length ;
|
||||||
slot_durations =
|
slot_durations =
|
||||||
@ -235,7 +235,7 @@ let constants_encoding =
|
|||||||
(opt "preserved_cycles" uint8)
|
(opt "preserved_cycles" uint8)
|
||||||
(opt "cycle_length" int32)
|
(opt "cycle_length" int32)
|
||||||
(opt "blocks_per_commitment" int32)
|
(opt "blocks_per_commitment" int32)
|
||||||
(opt "block_per_roll_snapshot" int32)
|
(opt "blocks_per_roll_snapshot" int32)
|
||||||
(opt "voting_period_length" int32)
|
(opt "voting_period_length" int32)
|
||||||
(opt "slot_durations" (list Period_repr.encoding))
|
(opt "slot_durations" (list Period_repr.encoding))
|
||||||
(opt "first_free_baking_slot" uint16)
|
(opt "first_free_baking_slot" uint16)
|
||||||
@ -261,7 +261,7 @@ let read = function
|
|||||||
match Data_encoding.Json.(destruct constants_encoding json) with
|
match Data_encoding.Json.(destruct constants_encoding json) with
|
||||||
| exception exn -> fail (Constant_read exn)
|
| exception exn -> fail (Constant_read exn)
|
||||||
| c ->
|
| c ->
|
||||||
if Compare.Int32.(c.block_per_roll_snapshot > c.cycle_length) then
|
if Compare.Int32.(c.blocks_per_roll_snapshot > c.cycle_length) then
|
||||||
failwith "Invalid sandbox: 'block_per_roll_snapshot > cycle_length'"
|
failwith "Invalid sandbox: 'blocks_per_roll_snapshot > cycle_length'"
|
||||||
else
|
else
|
||||||
return c
|
return c
|
||||||
|
@ -48,13 +48,13 @@ module S = struct
|
|||||||
~output: (obj1 (req "blocks_per_commitment" int32))
|
~output: (obj1 (req "blocks_per_commitment" int32))
|
||||||
RPC_path.(custom_root / "blocks_per_commitment")
|
RPC_path.(custom_root / "blocks_per_commitment")
|
||||||
|
|
||||||
let block_per_roll_snapshot =
|
let blocks_per_roll_snapshot =
|
||||||
RPC_service.post_service
|
RPC_service.post_service
|
||||||
~description: "How many blocks between roll snapshots"
|
~description: "How many blocks between roll snapshots"
|
||||||
~query: RPC_query.empty
|
~query: RPC_query.empty
|
||||||
~input: empty
|
~input: empty
|
||||||
~output: (obj1 (req "block_per_roll_snapshot" int32))
|
~output: (obj1 (req "blocks_per_roll_snapshot" int32))
|
||||||
RPC_path.(custom_root / "block_per_roll_snapshot")
|
RPC_path.(custom_root / "blocks_per_roll_snapshot")
|
||||||
|
|
||||||
let slot_durations =
|
let slot_durations =
|
||||||
RPC_service.post_service
|
RPC_service.post_service
|
||||||
@ -121,8 +121,8 @@ let () =
|
|||||||
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)
|
||||||
end ;
|
end ;
|
||||||
register0 S.block_per_roll_snapshot begin fun ctxt () () ->
|
register0 S.blocks_per_roll_snapshot begin fun ctxt () () ->
|
||||||
return (Constants.block_per_roll_snapshot ctxt)
|
return (Constants.blocks_per_roll_snapshot ctxt)
|
||||||
end ;
|
end ;
|
||||||
register0 S.slot_durations begin fun ctxt () () ->
|
register0 S.slot_durations begin fun ctxt () () ->
|
||||||
return (Constants.slot_durations 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 () ()
|
RPC_context.make_call0 S.voting_period_length 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 block_per_roll_snapshot ctxt block =
|
let blocks_per_roll_snapshot ctxt block =
|
||||||
RPC_context.make_call0 S.block_per_roll_snapshot ctxt block () ()
|
RPC_context.make_call0 S.blocks_per_roll_snapshot ctxt block () ()
|
||||||
let slot_durations ctxt block =
|
let slot_durations ctxt block =
|
||||||
RPC_context.make_call0 S.slot_durations ctxt block () ()
|
RPC_context.make_call0 S.slot_durations ctxt block () ()
|
||||||
let first_free_baking_slot ctxt block =
|
let first_free_baking_slot ctxt block =
|
||||||
|
@ -21,7 +21,7 @@ val voting_period_length:
|
|||||||
val blocks_per_commitment:
|
val blocks_per_commitment:
|
||||||
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
|
'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
|
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
|
||||||
|
|
||||||
val slot_durations:
|
val slot_durations:
|
||||||
|
@ -16,9 +16,9 @@ let cycle_length c =
|
|||||||
let blocks_per_commitment c =
|
let blocks_per_commitment c =
|
||||||
let constants = Raw_context.constants c in
|
let constants = Raw_context.constants c in
|
||||||
constants.blocks_per_commitment
|
constants.blocks_per_commitment
|
||||||
let block_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.block_per_roll_snapshot
|
constants.blocks_per_roll_snapshot
|
||||||
let voting_period_length c =
|
let voting_period_length c =
|
||||||
let constants = Raw_context.constants c in
|
let constants = Raw_context.constants c in
|
||||||
constants.voting_period_length
|
constants.voting_period_length
|
||||||
|
Loading…
Reference in New Issue
Block a user