From c31174751d62045958b8373603a13b127ff780bf Mon Sep 17 00:00:00 2001 From: Marina Polubelova Date: Wed, 23 Oct 2024 15:36:33 +0200 Subject: [PATCH 1/6] Proto: set tolerated_inactivity_period to 1 cycle (~1 day) --- src/proto_alpha/lib_parameters/default_parameters.ml | 3 +-- src/proto_alpha/lib_protocol/raw_context.ml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 587f88f3d140..6689c08be0ef 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -195,8 +195,7 @@ let constants_mainnet : Constants.Parametric.t = consensus_rights_delay = 2; blocks_preservation_cycles = 1; delegate_parameters_activation_delay = 5; - (* tolerated_inactivity_period = consensus_rights_delay + 1 *) - tolerated_inactivity_period = 3; + tolerated_inactivity_period = 1; blocks_per_cycle = 10800l; blocks_per_commitment = 240l; nonce_revelation_threshold = 960l; diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 8e6f9095c067..d70c90e86e78 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -1516,7 +1516,7 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = blocks_preservation_cycles; delegate_parameters_activation_delay; blocks_per_cycle; - tolerated_inactivity_period = consensus_rights_delay + 1; + tolerated_inactivity_period = 1; blocks_per_commitment; nonce_revelation_threshold; cycles_per_voting_period; -- GitLab From 224dde06a48d2c0f8f2ac2105ac045d9daf2fd25 Mon Sep 17 00:00:00 2001 From: Marina Polubelova Date: Wed, 23 Oct 2024 16:13:41 +0200 Subject: [PATCH 2/6] Proto/Tests: update tests with tolerated_inactivity_period = 1 --- src/proto_alpha/lib_protocol/test/helpers/op.ml | 9 +++++++-- .../test/integration/test_scenario_rewards.ml | 11 +++++++---- .../test/integration/test_scenario_slashing.ml | 2 +- .../integration/test_scenario_slashing_stakers.ml | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index 91ff5534a84d..cdfc072f0103 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -77,8 +77,13 @@ let mk_consensus_content_signer_and_branch ?delegate ?slot ?level ?round | None -> return (del, []) | Some slots -> return (del, slots)) in - let slot = - match slot with None -> Stdlib.List.hd slots | Some slot -> slot + let* slot = + match slot with + | None -> ( + match List.hd slots with + | Some s -> return s + | None -> tzfail (Block.No_slots_found_for delegate_pkh)) + | Some slot -> return slot in let* level = match level with diff --git a/src/proto_alpha/lib_protocol/test/integration/test_scenario_rewards.ml b/src/proto_alpha/lib_protocol/test/integration/test_scenario_rewards.ml index 58420fcc0cb7..dc4c7fe5891e 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_scenario_rewards.ml +++ b/src/proto_alpha/lib_protocol/test/integration/test_scenario_rewards.ml @@ -126,12 +126,13 @@ let test_wait_rewards_with_ai_staker_variation = --> wait_n_cycles 4 (* Staker restakes some *) --> stake "staker" Half - (* Reactivate another baker for allowing it to bake later *) - --> set_delegate "faucet" (Some "faucet") --> wait_n_cycles 4 (* Add unstake requests in the mix *) --> unstake "staker" Half - --> next_cycle + (* Reactivate another baker to allow it to bake later *) + --> set_delegate "faucet" (Some "faucet") + --> wait_n_cycles_f (fun (_, state) -> + state.State.constants.consensus_rights_delay + 1) (* Double bake for the delegate *) --> set_baker "faucet" --> double_bake "delegate" --> make_denunciations () @@ -139,7 +140,9 @@ let test_wait_rewards_with_ai_staker_variation = --> wait_n_cycles 10 (* Reactivate it, make it bake, and see everything is as before *) --> set_delegate "delegate" (Some "delegate") - --> wait_n_cycles 4 --> set_baker "delegate" --> wait_n_cycles 10 + --> wait_n_cycles_f (fun (_, state) -> + state.State.constants.consensus_rights_delay + 1) + --> set_baker "delegate" --> wait_n_cycles 10 (** Tests reward distribution under AI for one baker and two stakers, and the baker changes its limit parameter while being overstaked. diff --git a/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing.ml b/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing.ml index 73f10d44de7b..d5de46c40b9b 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing.ml +++ b/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing.ml @@ -320,7 +320,7 @@ let test_slash_timing = init_constants ~blocks_per_cycle:8l () --> activate_ai `No --> branch_flag S.Adaptive_issuance.ns_enable - --> begin_test ["delegate"; "bootstrap1"] + --> begin_test ~force_attest_all:true ["delegate"; "bootstrap1"] --> next_cycle --> (Tag "stake" --> stake "delegate" Half |+ Tag "unstake" --> unstake "delegate" Half) diff --git a/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing_stakers.ml b/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing_stakers.ml index db6450385ce3..44c5a7170c63 100644 --- a/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing_stakers.ml +++ b/src/proto_alpha/lib_protocol/test/integration/test_scenario_slashing_stakers.ml @@ -81,6 +81,7 @@ let init_with_stakers () = init_constants () --> activate_ai `Force --> branch_flag S.Adaptive_issuance.ns_enable --> begin_test + ~force_attest_all:true [ first_slashed_delegate; second_slashed_delegate; -- GitLab From 2e1ace1b4e77e76a93e2b6212ca4582e4b9bcf57 Mon Sep 17 00:00:00 2001 From: Marina Polubelova Date: Wed, 23 Oct 2024 15:56:03 +0200 Subject: [PATCH 3/6] Tezt/Tests: reset regressions --- tezt/tests/consensus_key.ml | 8 -------- ...- (mode client) RPC regression tests- delegates.out | 4 ++-- ...ode client) RPC regression tests- misc_protocol.out | 2 +- ...a- (mode light) RPC regression tests- delegates.out | 4 ++-- ...mode light) RPC regression tests- misc_protocol.out | 2 +- ...a- (mode proxy) RPC regression tests- delegates.out | 4 ++-- ...mode proxy) RPC regression tests- misc_protocol.out | 2 +- ...th (baker - delegate - consensus - destination).out | 10 +++++----- ...h (baker - delegate - consensus -- destination).out | 10 +++++----- ...h (baker -- delegate - consensus - destination).out | 10 +++++----- ... (baker -- delegate - consensus -- destination).out | 10 +++++----- .../Alpha- Test register with consensus key.out | 4 ++-- ...pha- Test set consensus key - baker is delegate.out | 6 +++--- ... Test set consensus key - baker is not delegate.out | 6 +++--- ... Test following dal and baker tutorial commands.out | 2 +- .../Alpha- weeklynet regression test.out | 2 +- 16 files changed, 39 insertions(+), 47 deletions(-) diff --git a/tezt/tests/consensus_key.ml b/tezt/tests/consensus_key.ml index 73c5ba9cb066..74cee2bf2cd0 100644 --- a/tezt/tests/consensus_key.ml +++ b/tezt/tests/consensus_key.ml @@ -100,10 +100,6 @@ let test_update_consensus_key = (["cache_stake_distribution_cycles"], `Int (consensus_rights_delay + 3)); (["adaptive_issuance_force_activation"], `Bool true); ] - @ - if Protocol.(number protocol > number Quebec) then - [(["tolerated_inactivity_period"], `Int (consensus_rights_delay + 1))] - else [] in let* parameter_file = Protocol.write_parameter_file ~base:(Right (protocol, None)) parameters @@ -632,10 +628,6 @@ let register ?(regression = true) title test = (["cache_stake_distribution_cycles"], `Int (consensus_rights_delay + 3)); (["adaptive_issuance_force_activation"], `Bool true); ] - @ - if Protocol.(number protocol > number Quebec) then - [(["tolerated_inactivity_period"], `Int (consensus_rights_delay + 1))] - else [] in let* parameter_file = Protocol.write_parameter_file ~base:(Right (protocol, None)) parameters diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out index 28829e740f34..3713bbb32e6a 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out @@ -22,7 +22,7 @@ { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 137, - "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "expected_attesting_rewards": "1065036" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -67,7 +67,7 @@ false [ "[PUBLIC_KEY_HASH]" ] ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/grace_period' -5 +3 ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/staking_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out index 24e78abef987..970ed0caadd9 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out @@ -11,7 +11,7 @@ "smart_rollup_max_number_of_messages_per_level": "1000000", "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, - "tolerated_inactivity_period": 3, "blocks_per_cycle": 8, + "tolerated_inactivity_period": 1, "blocks_per_cycle": 8, "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1386666", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out index c7e8cc220505..2ddf0b89bb30 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out @@ -22,7 +22,7 @@ { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 137, - "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "expected_attesting_rewards": "1065036" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -67,7 +67,7 @@ false [ "[PUBLIC_KEY_HASH]" ] ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/grace_period' -5 +3 ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/staking_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out index eb213b301997..7f261bd69435 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out @@ -11,7 +11,7 @@ "smart_rollup_max_number_of_messages_per_level": "1000000", "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, - "tolerated_inactivity_period": 3, "blocks_per_cycle": 8, + "tolerated_inactivity_period": 1, "blocks_per_cycle": 8, "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1386666", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out index 02c772dc091b..a3d541a49ba5 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out @@ -22,7 +22,7 @@ { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 137, - "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "expected_attesting_rewards": "1065036" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -67,7 +67,7 @@ false [ "[PUBLIC_KEY_HASH]" ] ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/grace_period' -5 +3 ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/staking_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out index f57f8faf6c37..9885c93051ce 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out @@ -11,7 +11,7 @@ "smart_rollup_max_number_of_messages_per_level": "1000000", "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 2, - "tolerated_inactivity_period": 3, "blocks_per_cycle": 8, + "tolerated_inactivity_period": 1, "blocks_per_cycle": 8, "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "1386666", diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out index ecfc33b4bc65..44cc93ce58fa 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out @@ -31,7 +31,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -66,7 +66,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -104,7 +104,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -140,7 +140,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -207,7 +207,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 59, "missed_levels": 1, "remaining_allowed_missed_slots": 9, - "expected_attesting_rewards": "13872" }, "grace_period": 4, + "expected_attesting_rewards": "13872" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out index 2129bf2f8de1..66a3dfb62971 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out @@ -31,7 +31,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -66,7 +66,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -104,7 +104,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -140,7 +140,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -207,7 +207,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 59, "missed_levels": 1, "remaining_allowed_missed_slots": 9, - "expected_attesting_rewards": "13872" }, "grace_period": 4, + "expected_attesting_rewards": "13872" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out index b8224eea75bf..5b099b7f2d6a 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out @@ -31,7 +31,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -66,7 +66,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -104,7 +104,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -140,7 +140,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -207,7 +207,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 59, "missed_levels": 1, "remaining_allowed_missed_slots": 9, - "expected_attesting_rewards": "13872" }, "grace_period": 4, + "expected_attesting_rewards": "13872" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out index f5351117db73..914e5ab747e2 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out @@ -31,7 +31,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -66,7 +66,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -104,7 +104,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -140,7 +140,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -207,7 +207,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 59, "missed_levels": 1, "remaining_allowed_missed_slots": 9, - "expected_attesting_rewards": "13872" }, "grace_period": 4, + "expected_attesting_rewards": "13872" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out b/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out index 5e37ce5bf0cf..eb85be67c3ac 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out @@ -66,7 +66,7 @@ This sequence of operations was run: { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 0, - "expected_attesting_rewards": "0" }, "grace_period": 3, + "expected_attesting_rewards": "0" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -102,7 +102,7 @@ This sequence of operations was run: { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 0, - "expected_attesting_rewards": "0" }, "grace_period": 3, + "expected_attesting_rewards": "0" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out index 5f6dccbd6b98..1cf22cf676e0 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out @@ -31,7 +31,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -66,7 +66,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -104,7 +104,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out index 07260798bc0a..15496e52bd0a 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out @@ -31,7 +31,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -66,7 +66,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, @@ -104,7 +104,7 @@ This sequence of operations was run: { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 68, - "expected_attesting_rewards": "531216" }, "grace_period": 3, + "expected_attesting_rewards": "531216" }, "grace_period": 2, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out b/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out index 28a6632f63d8..ba5ff0a0f7fb 100644 --- a/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out +++ b/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out @@ -116,7 +116,7 @@ This sequence of operations was run: { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, "missed_slots": 0, "missed_levels": 0, "remaining_allowed_missed_slots": 0, - "expected_attesting_rewards": "0" }, "grace_period": 5, + "expected_attesting_rewards": "0" }, "grace_period": 3, "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, diff --git a/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out b/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out index 999b50482525..f982931035a9 100644 --- a/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out +++ b/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out @@ -2,7 +2,7 @@ ./octez-client rpc get /chains/main/blocks/head/context/constants/parametric { "consensus_rights_delay": 2, "blocks_preservation_cycles": 1, "delegate_parameters_activation_delay": 3, - "tolerated_inactivity_period": 3, "blocks_per_cycle": 200, + "tolerated_inactivity_period": 1, "blocks_per_cycle": 200, "blocks_per_commitment": 25, "nonce_revelation_threshold": 50, "cycles_per_voting_period": 1, "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "3328000", "proof_of_work_threshold": "-1", -- GitLab From 51aebf048312c4d060d9a74c674a14d5e4bd4027 Mon Sep 17 00:00:00 2001 From: Marina Polubelova Date: Wed, 9 Oct 2024 14:12:28 +0200 Subject: [PATCH 4/6] Tezt/Tests: set tolerated_inactivity_period to 3 --- tezt/tests/adaptive_issuance.ml | 16 +++++++++++----- tezt/tests/voting.ml | 8 ++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tezt/tests/adaptive_issuance.ml b/tezt/tests/adaptive_issuance.ml index 791b5168c42f..4c2818499e8a 100644 --- a/tezt/tests/adaptive_issuance.ml +++ b/tezt/tests/adaptive_issuance.ml @@ -498,12 +498,18 @@ let test_staking = ] ~uses:(fun protocol -> [Protocol.accuser protocol]) @@ fun protocol -> + let parameters = + let overrides = + (["adaptive_issuance_force_activation"], `Bool true) :: default_overrides + in + if Protocol.number protocol > Protocol.number Protocol.Quebec then + (* TODO: https://gitlab.com/tezos/tezos/-/issues/7576 use a + default value for [tolerated_inactivity_period] *) + (["tolerated_inactivity_period"], `Int 3) :: overrides + else overrides + in let* _proto_hash, endpoint, client_1, node_1 = - init - ~overrides: - ((["adaptive_issuance_force_activation"], `Bool true) - :: default_overrides) - protocol + init ~overrides:parameters protocol in let* eosod = edge_of_staking_over_delegation client_1 in diff --git a/tezt/tests/voting.ml b/tezt/tests/voting.ml index a576d3e8f5d4..6e81358840b6 100644 --- a/tezt/tests/voting.ml +++ b/tezt/tests/voting.ml @@ -295,6 +295,14 @@ let test_voting ~from_protocol ~(to_protocol : target_protocol) ~loser_protocols (["cycles_per_voting_period"], `Int 1); ] in + let parameters = + if Protocol.number from_protocol > Protocol.number Protocol.Quebec then + (* TODO: https://gitlab.com/tezos/tezos/-/issues/7576 use a + default value for [tolerated_inactivity_period] *) + (["tolerated_inactivity_period"], `Int 3) :: parameters + else parameters + in + let* parameter_file = Protocol.write_parameter_file ~base:(Right (from_protocol, None)) parameters in -- GitLab From 6506d5d150e576d73c3cd7017482835231da83c4 Mon Sep 17 00:00:00 2001 From: Marina Polubelova Date: Wed, 23 Oct 2024 15:58:24 +0200 Subject: [PATCH 5/6] Docs: update changelog --- docs/protocols/alpha.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index 995d323b804b..bd0f296b6097 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -57,12 +57,13 @@ Protocol parameters with old cycle duration) to 14 cycles (~14 days with new cycle duration). (MR :gl:`!15196`) +- Make ``tolerated_inactivity_period`` a protocol constant, and lower + from 3 cycles (~8.5 days with old cycle duration) to 1 cycle (~1 day + with new cycle duration). (MRs :gl:`!15390`, :gl:`!15199`) + - Lower the number of blocks per cycle (``blocks_per_cycle``) for ghostnet to 10800 (~12 hours). (MR :gl:`!15196`) -- Make ``tolerated_inactivity_period`` a protocol constant. (MR - :gl:`!15390`) - Bug Fixes --------- -- GitLab From 11b2666f7e44025b5dc51200600bf51bf7685c83 Mon Sep 17 00:00:00 2001 From: Marina Polubelova Date: Wed, 9 Oct 2024 15:18:25 +0200 Subject: [PATCH 6/6] Docs: add tolerated_inactivity_period protocol constant --- docs/alpha/proof_of_stake.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/alpha/proof_of_stake.rst b/docs/alpha/proof_of_stake.rst index d4f8c8ecb30a..90dd88c9a2c2 100644 --- a/docs/alpha/proof_of_stake.rst +++ b/docs/alpha/proof_of_stake.rst @@ -94,10 +94,10 @@ delegate cannot participate in the consensus algorithm. A delegate is marked as active at its registration. -A delegate becomes passive at the end of cycle ``n`` when it has -failed to participate in the consensus algorithm in -the past ``CONSENSUS_RIGHTS_DELAY + 1`` cycles. That is, in cycles ``n``, ``n-1``, -``n-2``, ..., ``n - CONSENSUS_RIGHTS_DELAY``. +A delegate becomes inactive at the end of a cycle if it has failed to +participate in the consensus algorithm at all during this whole cycle. +This is specified by the ``TOLERATED_INACTIVITY_PERIOD`` protocol +constant, which is currently equal to ``1`` cycle. Delegates' rights selection --------------------------- @@ -168,6 +168,8 @@ Proof-of-stake parameters - 6,000 ꜩ * - ``MINIMAL_FROZEN_STAKE`` - 600 ꜩ + * - ``TOLERATED_INACTIVITY_PERIOD`` + - 1 cycle Further External Resources -------------------------- -- GitLab