From dc681551e60aa51eddc56b8d077fa4016511662a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Thu, 15 Mar 2018 14:47:48 +0100 Subject: [PATCH] Alpha: adjust constants --- .../lib_protocol/src/alpha_context.mli | 2 +- .../lib_protocol/src/constants_repr.ml | 37 ++++++------------- .../lib_protocol/src/constants_services.ml | 13 ------- .../lib_protocol/src/constants_services.mli | 3 -- .../lib_protocol/src/constants_storage.ml | 3 -- src/proto_alpha/lib_protocol/src/main.ml | 2 +- 6 files changed, 13 insertions(+), 47 deletions(-) diff --git a/src/proto_alpha/lib_protocol/src/alpha_context.mli b/src/proto_alpha/lib_protocol/src/alpha_context.mli index d2c678f1e..d8507717a 100644 --- a/src/proto_alpha/lib_protocol/src/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/src/alpha_context.mli @@ -269,7 +269,6 @@ module Constants : sig val blocks_per_commitment: context -> int32 val block_per_roll_snapshot: context -> int32 val voting_period_length: context -> int32 - val time_before_reward: context -> Period.t val slot_durations: context -> Period.t list val first_free_baking_slot: context -> int val max_signing_slot: context -> int @@ -279,6 +278,7 @@ module Constants : sig val max_number_of_operations: context -> int list val max_operation_data_length: context -> int val michelson_maximum_type_size: context -> int + end module Voting_period : sig diff --git a/src/proto_alpha/lib_protocol/src/constants_repr.ml b/src/proto_alpha/lib_protocol/src/constants_repr.ml index 9fd3b6af2..22119b331 100644 --- a/src/proto_alpha/lib_protocol/src/constants_repr.ml +++ b/src/proto_alpha/lib_protocol/src/constants_repr.ml @@ -20,21 +20,21 @@ let seed_nonce_revelation_tip = let origination_burn = Tez_repr.one -(* 1000 tez *) +(* 512 tez *) let baking_bond_cost = - Tez_repr.(mul_exn one 1000) + Tez_repr.(mul_exn one 512) -(* 1000 tez *) +(* 64 tez *) let endorsement_bond_cost = - Tez_repr.(mul_exn one 1000) + Tez_repr.(mul_exn one 64) -(* 150 tez *) +(* 16 tez *) let baking_reward = - Tez_repr.(mul_exn one 150) + Tez_repr.(mul_exn one 16) -(* 150 tez *) +(* 2 tez *) let endorsement_reward = - Tez_repr.(mul_exn one 150) + Tez_repr.(mul_exn one 2) (* 100,000 tez *) let faucet_credit = @@ -50,7 +50,6 @@ type constants = { blocks_per_commitment: int32 ; block_per_roll_snapshot: int32 ; voting_period_length: int32 ; - time_before_reward: Period_repr.t ; slot_durations: Period_repr.t list ; first_free_baking_slot: int ; max_signing_slot: int ; @@ -68,18 +67,14 @@ let read_public_key s = Ed25519.Public_key.of_hex_exn (`Hex s) let default = { preserved_cycles = 5 ; - cycle_length = 2048l ; + cycle_length = 4096l ; blocks_per_commitment = 32l ; block_per_roll_snapshot = 256l ; voting_period_length = 32768l ; - time_before_reward = - Period_repr.of_seconds_exn - (* One year in seconds *) - Int64.(mul 365L (mul 24L 3600L)) ; slot_durations = List.map Period_repr.of_seconds_exn [ 60L ] ; first_free_baking_slot = 16 ; - max_signing_slot = 15 ; + max_signing_slot = 32 ; max_gas = 40_000 ; proof_of_work_threshold = Int64.(sub (shift_left 1L 56) 1L) ; @@ -133,10 +128,6 @@ let constants_encoding = and voting_period_length = opt Compare.Int32.(=) default.voting_period_length c.voting_period_length - and time_before_reward = - map_option Period_repr.to_seconds @@ - opt Period_repr.(=) - default.time_before_reward c.time_before_reward and slot_durations = opt Compare_slot_durations.(=) default.slot_durations c.slot_durations @@ -176,7 +167,6 @@ let constants_encoding = blocks_per_commitment, block_per_roll_snapshot, voting_period_length, - time_before_reward, slot_durations, first_free_baking_slot, max_signing_slot, @@ -193,7 +183,6 @@ let constants_encoding = blocks_per_commitment, block_per_roll_snapshot, voting_period_length, - time_before_reward, slot_durations, first_free_baking_slot, max_signing_slot, @@ -215,9 +204,6 @@ let constants_encoding = unopt default.block_per_roll_snapshot block_per_roll_snapshot ; voting_period_length = unopt default.voting_period_length voting_period_length ; - time_before_reward = - unopt default.time_before_reward @@ - map_option Period_repr.of_seconds_exn time_before_reward ; slot_durations = unopt default.slot_durations @@ slot_durations ; @@ -245,13 +231,12 @@ let constants_encoding = Data_encoding.( merge_objs (merge_objs - (obj10 + (obj9 (opt "preserved_cycles" uint8) (opt "cycle_length" int32) (opt "blocks_per_commitment" int32) (opt "block_per_roll_snapshot" int32) (opt "voting_period_length" int32) - (opt "time_before_reward" int64) (opt "slot_durations" (list Period_repr.encoding)) (opt "first_free_baking_slot" uint16) (opt "max_signing_slot" uint16) diff --git a/src/proto_alpha/lib_protocol/src/constants_services.ml b/src/proto_alpha/lib_protocol/src/constants_services.ml index d9cdc73cb..97449f885 100644 --- a/src/proto_alpha/lib_protocol/src/constants_services.ml +++ b/src/proto_alpha/lib_protocol/src/constants_services.ml @@ -56,14 +56,6 @@ module S = struct ~output: (obj1 (req "block_per_roll_snapshot" int32)) RPC_path.(custom_root / "block_per_roll_snapshot") - let time_before_reward = - RPC_service.post_service - ~description: "Time before reward" - ~query: RPC_query.empty - ~input: empty - ~output: (obj1 (req "time_before_reward" Period.encoding)) - RPC_path.(custom_root / "time_before_reward") - let slot_durations = RPC_service.post_service ~description: "Slot durations" @@ -132,9 +124,6 @@ let () = register0 S.block_per_roll_snapshot begin fun ctxt () () -> return (Constants.block_per_roll_snapshot ctxt) end ; - register0 S.time_before_reward begin fun ctxt () () -> - return (Constants.time_before_reward ctxt) - end ; register0 S.slot_durations begin fun ctxt () () -> return (Constants.slot_durations ctxt) end ; @@ -164,8 +153,6 @@ 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 time_before_reward ctxt block = - RPC_context.make_call0 S.time_before_reward 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 80e159d54..c62617025 100644 --- a/src/proto_alpha/lib_protocol/src/constants_services.mli +++ b/src/proto_alpha/lib_protocol/src/constants_services.mli @@ -24,9 +24,6 @@ val blocks_per_commitment: val block_per_roll_snapshot: 'a #RPC_context.simple -> 'a -> int32 shell_tzresult Lwt.t -val time_before_reward: - 'a #RPC_context.simple -> 'a -> Period.t shell_tzresult Lwt.t - val slot_durations: 'a #RPC_context.simple -> 'a -> Period.t list shell_tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/src/constants_storage.ml b/src/proto_alpha/lib_protocol/src/constants_storage.ml index a5e12cc92..d22b38e74 100644 --- a/src/proto_alpha/lib_protocol/src/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/src/constants_storage.ml @@ -22,9 +22,6 @@ let block_per_roll_snapshot c = let voting_period_length c = let constants = Raw_context.constants c in constants.voting_period_length -let time_before_reward c = - let constants = Raw_context.constants c in - constants.time_before_reward let slot_durations c = let constants = Raw_context.constants c in constants.slot_durations diff --git a/src/proto_alpha/lib_protocol/src/main.ml b/src/proto_alpha/lib_protocol/src/main.ml index 044e32847..5879db235 100644 --- a/src/proto_alpha/lib_protocol/src/main.ml +++ b/src/proto_alpha/lib_protocol/src/main.ml @@ -21,7 +21,7 @@ let validation_passes = Updater.[ { max_size = 32 * 1024 ; max_op = Some 32 } ; (* 32kB FIXME *) { max_size = 32 * 1024 ; max_op = None } ; (* 32kB FIXME *) { max_size = 32 * 1024 ; max_op = Some 32 } ; (* 32kB FIXME *) - { max_size = 1024 * 1024 ; max_op = None } ] (* 1MB *) + { max_size = 512 * 1024 ; max_op = None } ] (* 512kB *) let rpc_services = Services_registration.get_rpc_services ()