diff --git a/src/proto_alpha/lib_protocol/src/alpha_context.mli b/src/proto_alpha/lib_protocol/src/alpha_context.mli index e83676a26..12276bdad 100644 --- a/src/proto_alpha/lib_protocol/src/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/src/alpha_context.mli @@ -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 diff --git a/src/proto_alpha/lib_protocol/src/apply.ml b/src/proto_alpha/lib_protocol/src/apply.ml index ff6676384..0afd66881 100644 --- a/src/proto_alpha/lib_protocol/src/apply.ml +++ b/src/proto_alpha/lib_protocol/src/apply.ml @@ -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 diff --git a/src/proto_alpha/lib_protocol/src/constants_repr.ml b/src/proto_alpha/lib_protocol/src/constants_repr.ml index 151223cf6..fccbc4fdb 100644 --- a/src/proto_alpha/lib_protocol/src/constants_repr.ml +++ b/src/proto_alpha/lib_protocol/src/constants_repr.ml @@ -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 diff --git a/src/proto_alpha/lib_protocol/src/constants_services.ml b/src/proto_alpha/lib_protocol/src/constants_services.ml index 97449f885..804c34218 100644 --- a/src/proto_alpha/lib_protocol/src/constants_services.ml +++ b/src/proto_alpha/lib_protocol/src/constants_services.ml @@ -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 = diff --git a/src/proto_alpha/lib_protocol/src/constants_services.mli b/src/proto_alpha/lib_protocol/src/constants_services.mli index c62617025..7e4c6f97c 100644 --- a/src/proto_alpha/lib_protocol/src/constants_services.mli +++ b/src/proto_alpha/lib_protocol/src/constants_services.mli @@ -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: diff --git a/src/proto_alpha/lib_protocol/src/constants_storage.ml b/src/proto_alpha/lib_protocol/src/constants_storage.ml index ef9b25473..a8ee98a8a 100644 --- a/src/proto_alpha/lib_protocol/src/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/src/constants_storage.ml @@ -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