diff --git a/contrib/kaitai-struct-files/files/alpha__constants.ksy b/contrib/kaitai-struct-files/files/alpha__constants.ksy index 37d8ba3bbf310796724f11df2822584ec51b852b..a616216597c6b4c8f2c610ba14178aa3147d82e7 100644 --- a/contrib/kaitai-struct-files/files/alpha__constants.ksy +++ b/contrib/kaitai-struct-files/files/alpha__constants.ksy @@ -193,6 +193,8 @@ seq: type: n - id: preserved_cycles type: u1 +- id: consensus_rights_delay + type: u1 - id: blocks_per_cycle type: s4 - id: blocks_per_commitment diff --git a/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy b/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy index ccb5557bd22c45742573522a6770354157239f05..0d84675ccf06f5cc1d0f01ff999400605e653bd0 100644 --- a/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy +++ b/contrib/kaitai-struct-files/files/alpha__constants__parametric.ksy @@ -165,6 +165,8 @@ enums: seq: - id: preserved_cycles type: u1 +- id: consensus_rights_delay + type: u1 - id: blocks_per_cycle type: s4 - id: blocks_per_commitment diff --git a/contrib/kaitai-struct-files/files/alpha__parameters.ksy b/contrib/kaitai-struct-files/files/alpha__parameters.ksy index 51082561cb829233817e009a28688827b4c10148..1fca0bb263e56ddf4835fc3cd7eff9542aed650a 100644 --- a/contrib/kaitai-struct-files/files/alpha__parameters.ksy +++ b/contrib/kaitai-struct-files/files/alpha__parameters.ksy @@ -443,6 +443,8 @@ seq: if: (no_reward_cycles_tag == bool::true) - id: preserved_cycles type: u1 +- id: consensus_rights_delay + type: u1 - id: blocks_per_cycle type: s4 - id: blocks_per_commitment diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index da5ea3cc8e61ed139e2648625a1d30a663858cc3..223d1335c92804ebb4bc11765e56369cea728818 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -45,6 +45,8 @@ Operation receipts Protocol parameters ------------------- +- Added ``consensus_rights_delay`` parametric constant. (MR :gl:`!11188`) + Bug Fixes --------- diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index 74ff1dbb57220d86f8ee2119e256946d422c4537..1812c9ec9eb005ec649988baf363a9c78f2d5c00 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -129,6 +129,7 @@ let constants_mainnet = in { Constants.Parametric.preserved_cycles = 5; + consensus_rights_delay = 5; blocks_per_cycle = 16384l; blocks_per_commitment = 128l; nonce_revelation_threshold = 512l; @@ -319,6 +320,7 @@ let constants_sandbox = }; issuance_weights; Constants.Parametric.preserved_cycles = 2; + consensus_rights_delay = 2; blocks_per_cycle = 8l; blocks_per_commitment = 4l; nonce_revelation_threshold = 4l; @@ -353,6 +355,7 @@ let constants_test = }; issuance_weights; Constants.Parametric.preserved_cycles = 3; + consensus_rights_delay = 3; blocks_per_cycle = 12l; blocks_per_commitment = 4l; nonce_revelation_threshold = 4l; diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index e306f8e24ed2697c121aa63ba732f8657ca67b33..e9858dd25eb2881ebe0a150171f5ded2e27e6616 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -883,6 +883,7 @@ module Constants : sig type t = { preserved_cycles : int; + consensus_rights_delay : int; blocks_per_cycle : int32; blocks_per_commitment : int32; nonce_revelation_threshold : int32; @@ -943,6 +944,8 @@ module Constants : sig val preserved_cycles : context -> int + val consensus_rights_delay : context -> int + val blocks_per_cycle : context -> int32 val blocks_per_commitment : context -> int32 diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index 22fc08cc237c911333938be4325fd50359e02360..2d9c92042a7cd6d854ea3f542ba2ae71311e026b 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -167,6 +167,7 @@ type issuance_weights = { type t = { preserved_cycles : int; + consensus_rights_delay : int; blocks_per_cycle : int32; blocks_per_commitment : int32; nonce_revelation_threshold : int32; @@ -482,16 +483,16 @@ let encoding = let open Data_encoding in conv (fun c -> - ( ( c.preserved_cycles, - c.blocks_per_cycle, - c.blocks_per_commitment, - c.nonce_revelation_threshold, - c.blocks_per_stake_snapshot, - c.cycles_per_voting_period, - c.hard_gas_limit_per_operation, - c.hard_gas_limit_per_block, - c.proof_of_work_threshold, - c.minimal_stake ), + ( ( (c.preserved_cycles, c.consensus_rights_delay), + ( c.blocks_per_cycle, + c.blocks_per_commitment, + c.nonce_revelation_threshold, + c.blocks_per_stake_snapshot, + c.cycles_per_voting_period, + c.hard_gas_limit_per_operation, + c.hard_gas_limit_per_block, + c.proof_of_work_threshold, + c.minimal_stake ) ), ( ( c.minimal_frozen_stake, c.vdf_difficulty, c.origination_size, @@ -520,16 +521,16 @@ let encoding = ( (c.sc_rollup, c.zk_rollup), (c.adaptive_issuance, c.direct_ticket_spending_enable) ) ) ) ) ) ) )) - (fun ( ( preserved_cycles, - blocks_per_cycle, - blocks_per_commitment, - nonce_revelation_threshold, - blocks_per_stake_snapshot, - cycles_per_voting_period, - hard_gas_limit_per_operation, - hard_gas_limit_per_block, - proof_of_work_threshold, - minimal_stake ), + (fun ( ( (preserved_cycles, consensus_rights_delay), + ( blocks_per_cycle, + blocks_per_commitment, + nonce_revelation_threshold, + blocks_per_stake_snapshot, + cycles_per_voting_period, + hard_gas_limit_per_operation, + hard_gas_limit_per_block, + proof_of_work_threshold, + minimal_stake ) ), ( ( minimal_frozen_stake, vdf_difficulty, origination_size, @@ -560,6 +561,7 @@ let encoding = ) ) ) ) -> { preserved_cycles; + consensus_rights_delay; blocks_per_cycle; blocks_per_commitment; nonce_revelation_threshold; @@ -600,21 +602,24 @@ let encoding = direct_ticket_spending_enable; }) (merge_objs - (obj10 - (req "preserved_cycles" uint8) - (req "blocks_per_cycle" int32) - (req "blocks_per_commitment" int32) - (req "nonce_revelation_threshold" int32) - (req "blocks_per_stake_snapshot" int32) - (req "cycles_per_voting_period" int32) - (req - "hard_gas_limit_per_operation" - Gas_limit_repr.Arith.z_integral_encoding) - (req - "hard_gas_limit_per_block" - Gas_limit_repr.Arith.z_integral_encoding) - (req "proof_of_work_threshold" int64) - (req "minimal_stake" Tez_repr.encoding)) + (merge_objs + (obj2 + (req "preserved_cycles" uint8) + (req "consensus_rights_delay" uint8)) + (obj9 + (req "blocks_per_cycle" int32) + (req "blocks_per_commitment" int32) + (req "nonce_revelation_threshold" int32) + (req "blocks_per_stake_snapshot" int32) + (req "cycles_per_voting_period" int32) + (req + "hard_gas_limit_per_operation" + Gas_limit_repr.Arith.z_integral_encoding) + (req + "hard_gas_limit_per_block" + Gas_limit_repr.Arith.z_integral_encoding) + (req "proof_of_work_threshold" int64) + (req "minimal_stake" Tez_repr.encoding))) (merge_objs (obj7 (req "minimal_frozen_stake" Tez_repr.encoding) diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index 8ca5465acdf808638c0b7db6185a9ed4833d4691..c70d98b672bb101c970d925e5577e04d3636a8e0 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -154,6 +154,8 @@ type issuance_weights = { type t = { preserved_cycles : int; + (* Number of cycles after which computed consensus rights are used to actually participate in the consensus *) + consensus_rights_delay : int; blocks_per_cycle : int32; blocks_per_commitment : int32; nonce_revelation_threshold : int32; diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index 310e948c075730dd37e46d2f76cd13851c8c19e3..e019707fa86eb269cc58bb3d5aaece7e3f5b51dd 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -28,6 +28,10 @@ let preserved_cycles c = let constants = Raw_context.constants c in constants.preserved_cycles +let consensus_rights_delay c = + let constants = Raw_context.constants c in + constants.consensus_rights_delay + let blocks_per_cycle c = let constants = Raw_context.constants c in constants.blocks_per_cycle diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index 790e0ce5fd67c1996db004bb4aecadc06e52623c..130a009360636719e56e2296dac3b1fe4d56adf9 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -31,6 +31,8 @@ val preserved_cycles : Raw_context.t -> int +val consensus_rights_delay : Raw_context.t -> int + val blocks_per_cycle : Raw_context.t -> int32 val blocks_per_commitment : Raw_context.t -> int32 diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 8fdb18edd1b142a811222ffe16dc7c4690e63212..2280ad4130abef686799d3c8a003578bb84b9468 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -1118,6 +1118,7 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = Constants_parametric_repr. { preserved_cycles = c.preserved_cycles; + consensus_rights_delay = c.preserved_cycles; blocks_per_cycle = c.blocks_per_cycle; blocks_per_commitment = c.blocks_per_commitment; nonce_revelation_threshold = c.nonce_revelation_threshold; 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 b54b3e662958c58e0826aa6d4c707e522792ba76..db817ab3b03e7797c932e6a8a9c26569fc74363a 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 @@ -9,9 +9,10 @@ "smart_rollup_max_wrapped_proof_binary_size": 30000, "smart_rollup_message_size_limit": 4096, "smart_rollup_max_number_of_messages_per_level": "1000000", - "preserved_cycles": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_per_cycle": 8, + "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, + "blocks_per_stake_snapshot": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "2600000", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", 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 5ea2c80b08fba4597e8481e128818a3affd6f86c..11c8467907b38799626ead18933e2a04f38af1ff 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 @@ -9,9 +9,10 @@ "smart_rollup_max_wrapped_proof_binary_size": 30000, "smart_rollup_message_size_limit": 4096, "smart_rollup_max_number_of_messages_per_level": "1000000", - "preserved_cycles": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_per_cycle": 8, + "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, + "blocks_per_stake_snapshot": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "2600000", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", 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 350a7bb0a3683b05f5dce51bce3eb64e45a0a20a..3826c6b7d411428c2c94bcae949009ce21fef750 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 @@ -9,9 +9,10 @@ "smart_rollup_max_wrapped_proof_binary_size": 30000, "smart_rollup_message_size_limit": 4096, "smart_rollup_max_number_of_messages_per_level": "1000000", - "preserved_cycles": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_per_cycle": 8, + "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, + "blocks_per_stake_snapshot": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "2600000", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out index 67f9cff99c96b8d0e5b2b14fb86eea45fd47807f..f8010a7228823bc5c74a45c15cc7ad2296f8e228 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out @@ -9,9 +9,10 @@ "smart_rollup_max_wrapped_proof_binary_size": 30000, "smart_rollup_message_size_limit": 4096, "smart_rollup_max_number_of_messages_per_level": "1000000", - "preserved_cycles": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_per_cycle": 8, + "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, + "blocks_per_stake_snapshot": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "2600000", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out index 67f9cff99c96b8d0e5b2b14fb86eea45fd47807f..f8010a7228823bc5c74a45c15cc7ad2296f8e228 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out @@ -9,9 +9,10 @@ "smart_rollup_max_wrapped_proof_binary_size": 30000, "smart_rollup_message_size_limit": 4096, "smart_rollup_max_number_of_messages_per_level": "1000000", - "preserved_cycles": 2, "blocks_per_cycle": 8, "blocks_per_commitment": 4, - "nonce_revelation_threshold": 4, "blocks_per_stake_snapshot": 4, - "cycles_per_voting_period": 8, "hard_gas_limit_per_operation": "1040000", + "preserved_cycles": 2, "consensus_rights_delay": 2, "blocks_per_cycle": 8, + "blocks_per_commitment": 4, "nonce_revelation_threshold": 4, + "blocks_per_stake_snapshot": 4, "cycles_per_voting_period": 8, + "hard_gas_limit_per_operation": "1040000", "hard_gas_limit_per_block": "2600000", "proof_of_work_threshold": "4611686018427387903", "minimal_stake": "6000000000", "minimal_frozen_stake": "600000000",