From edabe4d83bd9d262719f014729a883ad8d9026d1 Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Tue, 12 Jul 2022 14:08:19 +0200 Subject: [PATCH] Proto: increase VDF constants --- src/proto_alpha/lib_parameters/default_parameters.ml | 8 ++++---- src/proto_alpha/lib_protocol/raw_context.ml | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 36867bf24ab5..5ab8028bafe4 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -79,7 +79,7 @@ let constants_mainnet = Constants.Parametric.preserved_cycles = 5; blocks_per_cycle = 8192l; blocks_per_commitment = 64l; - nonce_revelation_threshold = 32l; + nonce_revelation_threshold = 256l; blocks_per_stake_snapshot = 512l; cycles_per_voting_period = 5l; hard_gas_limit_per_operation = Gas.Arith.(integral_of_int_exn 1_040_000); @@ -87,13 +87,13 @@ let constants_mainnet = proof_of_work_threshold = Int64.(sub (shift_left 1L 46) 1L); tokens_per_roll = Tez.(mul_exn one 6_000); (* VDF's difficulty must be a multiple of `nonce_revelation_threshold` times - the block time. At the moment it is equal to 1B = 1000 * 5 * .2M with - - 1000 ~= 32 * 30 that is nonce_revelation_threshold * block time + the block time. At the moment it is equal to 8B = 8000 * 5 * .2M with + - 8000 ~= 256 * 30 that is nonce_revelation_threshold * block time - .2M ~= number of modular squaring per second on benchmark machine with 2.8GHz CPU - 5: security factor (strictly higher than the ratio between highest CPU clock rate and benchmark machine that is 8.43/2.8 ~= 3 *) - vdf_difficulty = 1_000_000_000L; + vdf_difficulty = 8_000_000_000L; seed_nonce_revelation_tip = (match Tez.(one /? 8L) with Ok c -> c | Error _ -> assert false); origination_size = 257; diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 400886352ed3..c7346ac07765 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -909,8 +909,8 @@ let prepare_first_block ~level ~timestamp ctxt = blocks_per_cycle = c.blocks_per_cycle; blocks_per_commitment = c.blocks_per_commitment; nonce_revelation_threshold = - (if Compare.Int32.(32l < c.blocks_per_commitment) then 32l - else c.blocks_per_commitment); + (if Compare.Int32.(256l < c.blocks_per_cycle) then 256l + else (* not on mainnet *) Int32.div c.blocks_per_cycle 2l); blocks_per_stake_snapshot = c.blocks_per_stake_snapshot; cycles_per_voting_period = c.cycles_per_voting_period; hard_gas_limit_per_operation = c.hard_gas_limit_per_operation; @@ -918,9 +918,8 @@ let prepare_first_block ~level ~timestamp ctxt = proof_of_work_threshold = c.proof_of_work_threshold; tokens_per_roll = c.tokens_per_roll; vdf_difficulty = - (if Compare.Int32.(32l < c.blocks_per_commitment) then - 1_000_000_000L - else 50_000L); + (if Compare.Int32.(256l < c.blocks_per_cycle) then 8_000_000_000L + else (* not on mainnet *) 50_000L); seed_nonce_revelation_tip = c.seed_nonce_revelation_tip; origination_size = c.origination_size; max_operations_time_to_live = c.max_operations_time_to_live; -- GitLab