Alpha: add constant block_per_commitments
This commit is contained in:
parent
abfc317ee8
commit
54b7d44da8
@ -265,6 +265,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 voting_period_length: context -> int32
|
val voting_period_length: context -> int32
|
||||||
val time_before_reward: context -> Period.t
|
val time_before_reward: context -> Period.t
|
||||||
val slot_durations: context -> Period.t list
|
val slot_durations: context -> Period.t list
|
||||||
|
@ -47,6 +47,7 @@ let bootstrap_wealth =
|
|||||||
type constants = {
|
type constants = {
|
||||||
preserved_cycles: int ;
|
preserved_cycles: int ;
|
||||||
cycle_length: int32 ;
|
cycle_length: int32 ;
|
||||||
|
blocks_per_commitment: int32 ;
|
||||||
voting_period_length: int32 ;
|
voting_period_length: int32 ;
|
||||||
time_before_reward: Period_repr.t ;
|
time_before_reward: Period_repr.t ;
|
||||||
slot_durations: Period_repr.t list ;
|
slot_durations: Period_repr.t list ;
|
||||||
@ -67,6 +68,7 @@ let read_public_key s = Ed25519.Public_key.of_hex_exn (`Hex s)
|
|||||||
let default = {
|
let default = {
|
||||||
preserved_cycles = 5 ;
|
preserved_cycles = 5 ;
|
||||||
cycle_length = 2048l ;
|
cycle_length = 2048l ;
|
||||||
|
blocks_per_commitment = 32l ;
|
||||||
voting_period_length = 32768l ;
|
voting_period_length = 32768l ;
|
||||||
time_before_reward =
|
time_before_reward =
|
||||||
Period_repr.of_seconds_exn
|
Period_repr.of_seconds_exn
|
||||||
@ -120,6 +122,9 @@ let constants_encoding =
|
|||||||
and cycle_length =
|
and cycle_length =
|
||||||
opt Compare.Int32.(=)
|
opt Compare.Int32.(=)
|
||||||
default.cycle_length c.cycle_length
|
default.cycle_length c.cycle_length
|
||||||
|
and blocks_per_commitment =
|
||||||
|
opt Compare.Int32.(=)
|
||||||
|
default.blocks_per_commitment c.blocks_per_commitment
|
||||||
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
|
||||||
@ -163,6 +168,7 @@ let constants_encoding =
|
|||||||
in
|
in
|
||||||
((( preserved_cycles,
|
((( preserved_cycles,
|
||||||
cycle_length,
|
cycle_length,
|
||||||
|
blocks_per_commitment,
|
||||||
voting_period_length,
|
voting_period_length,
|
||||||
time_before_reward,
|
time_before_reward,
|
||||||
slot_durations,
|
slot_durations,
|
||||||
@ -178,6 +184,7 @@ let constants_encoding =
|
|||||||
michelson_maximum_type_size)), ()) )
|
michelson_maximum_type_size)), ()) )
|
||||||
(fun ((( preserved_cycles,
|
(fun ((( preserved_cycles,
|
||||||
cycle_length,
|
cycle_length,
|
||||||
|
blocks_per_commitment,
|
||||||
voting_period_length,
|
voting_period_length,
|
||||||
time_before_reward,
|
time_before_reward,
|
||||||
slot_durations,
|
slot_durations,
|
||||||
@ -195,6 +202,8 @@ let constants_encoding =
|
|||||||
unopt default.preserved_cycles preserved_cycles ;
|
unopt default.preserved_cycles preserved_cycles ;
|
||||||
cycle_length =
|
cycle_length =
|
||||||
unopt default.cycle_length cycle_length ;
|
unopt default.cycle_length cycle_length ;
|
||||||
|
blocks_per_commitment =
|
||||||
|
unopt default.blocks_per_commitment blocks_per_commitment ;
|
||||||
voting_period_length =
|
voting_period_length =
|
||||||
unopt default.voting_period_length voting_period_length ;
|
unopt default.voting_period_length voting_period_length ;
|
||||||
time_before_reward =
|
time_before_reward =
|
||||||
@ -227,9 +236,10 @@ let constants_encoding =
|
|||||||
Data_encoding.(
|
Data_encoding.(
|
||||||
merge_objs
|
merge_objs
|
||||||
(merge_objs
|
(merge_objs
|
||||||
(obj9
|
(obj10
|
||||||
(opt "preserved_cycles" uint8)
|
(opt "preserved_cycles" uint8)
|
||||||
(opt "cycle_length" int32)
|
(opt "cycle_length" int32)
|
||||||
|
(opt "blocks_per_commitment" int32)
|
||||||
(opt "voting_period_length" int32)
|
(opt "voting_period_length" int32)
|
||||||
(opt "time_before_reward" int64)
|
(opt "time_before_reward" int64)
|
||||||
(opt "slot_durations" (list Period_repr.encoding))
|
(opt "slot_durations" (list Period_repr.encoding))
|
||||||
|
@ -40,6 +40,14 @@ module S = struct
|
|||||||
~output: (obj1 (req "voting_period_length" int32))
|
~output: (obj1 (req "voting_period_length" int32))
|
||||||
RPC_path.(custom_root / "voting_period_length")
|
RPC_path.(custom_root / "voting_period_length")
|
||||||
|
|
||||||
|
let blocks_per_commitment =
|
||||||
|
RPC_service.post_service
|
||||||
|
~description: "How many blocks beetween random seed's nonce commitment"
|
||||||
|
~query: RPC_query.empty
|
||||||
|
~input: empty
|
||||||
|
~output: (obj1 (req "blocks_per_commitment" int32))
|
||||||
|
RPC_path.(custom_root / "blocks_per_commitment")
|
||||||
|
|
||||||
let time_before_reward =
|
let time_before_reward =
|
||||||
RPC_service.post_service
|
RPC_service.post_service
|
||||||
~description: "Time before reward"
|
~description: "Time before reward"
|
||||||
@ -110,6 +118,9 @@ let () =
|
|||||||
register0 S.voting_period_length begin fun ctxt () () ->
|
register0 S.voting_period_length begin fun ctxt () () ->
|
||||||
return (Constants.voting_period_length ctxt)
|
return (Constants.voting_period_length ctxt)
|
||||||
end ;
|
end ;
|
||||||
|
register0 S.blocks_per_commitment begin fun ctxt () () ->
|
||||||
|
return (Constants.blocks_per_commitment ctxt)
|
||||||
|
end ;
|
||||||
register0 S.time_before_reward begin fun ctxt () () ->
|
register0 S.time_before_reward begin fun ctxt () () ->
|
||||||
return (Constants.time_before_reward ctxt)
|
return (Constants.time_before_reward ctxt)
|
||||||
end ;
|
end ;
|
||||||
@ -138,6 +149,8 @@ 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 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 =
|
||||||
|
RPC_context.make_call0 S.blocks_per_commitment ctxt block () ()
|
||||||
let time_before_reward ctxt block =
|
let time_before_reward ctxt block =
|
||||||
RPC_context.make_call0 S.time_before_reward ctxt block () ()
|
RPC_context.make_call0 S.time_before_reward ctxt block () ()
|
||||||
let slot_durations ctxt block =
|
let slot_durations ctxt block =
|
||||||
|
@ -18,6 +18,9 @@ val cycle_length:
|
|||||||
val voting_period_length:
|
val voting_period_length:
|
||||||
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
|
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
|
||||||
|
|
||||||
|
val blocks_per_commitment:
|
||||||
|
'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t
|
||||||
|
|
||||||
val time_before_reward:
|
val time_before_reward:
|
||||||
'a #RPC_context.simple -> 'a -> Period.t shell_tzresult Lwt.t
|
'a #RPC_context.simple -> 'a -> Period.t shell_tzresult Lwt.t
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ let preserved_cycles c =
|
|||||||
let cycle_length c =
|
let cycle_length c =
|
||||||
let constants = Raw_context.constants c in
|
let constants = Raw_context.constants c in
|
||||||
constants.cycle_length
|
constants.cycle_length
|
||||||
|
let blocks_per_commitment c =
|
||||||
|
let constants = Raw_context.constants c in
|
||||||
|
constants.blocks_per_commitment
|
||||||
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