From 6270eff9b07056d56fa3a400f4e3c346402d0281 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Fri, 13 Oct 2023 13:58:23 +0200 Subject: [PATCH 1/2] Proto/Storage: remove Last_snapshot --- src/proto_alpha/lib_protocol/init_storage.ml | 2 +- src/proto_alpha/lib_protocol/storage.ml | 25 -------------------- src/proto_alpha/lib_protocol/storage.mli | 4 ---- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/proto_alpha/lib_protocol/init_storage.ml b/src/proto_alpha/lib_protocol/init_storage.ml index b88044bf93e3..08a2672a4a94 100644 --- a/src/proto_alpha/lib_protocol/init_storage.ml +++ b/src/proto_alpha/lib_protocol/init_storage.ml @@ -219,7 +219,6 @@ let prepare_first_block chain_id ctxt ~typecheck_smart_contract let* ctxt, commitments_balance_updates = List.fold_left_es init_commitment (ctxt, []) param.commitments in - let* ctxt = Storage.Stake.Last_snapshot.init ctxt 0 in let* ctxt = Seed_storage.init ?initial_seed:param.constants.initial_seed ctxt in @@ -280,6 +279,7 @@ let prepare_first_block chain_id ctxt ~typecheck_smart_contract let*! ctxt = migrate_already_denounced_from_Oxford ctxt in let* ctxt = migrate_staking_balance_and_active_delegates_for_p ctxt in let* ctxt = clean_frozen_deposits_for_p ctxt in + let*! ctxt = Raw_context.remove ctxt ["last_snapshot"] in return (ctxt, []) in let* ctxt = diff --git a/src/proto_alpha/lib_protocol/storage.ml b/src/proto_alpha/lib_protocol/storage.ml index c57acf3949e6..e0e2fb3d3279 100644 --- a/src/proto_alpha/lib_protocol/storage.ml +++ b/src/proto_alpha/lib_protocol/storage.ml @@ -1305,31 +1305,6 @@ module Stake = struct module Selected_distribution_for_cycle = Cycle.Selected_stake_distribution module Total_active_stake = Cycle.Total_active_stake - - (* This is an index that is set to 0 by calls to - {!val:Stake_storage.selected_new_distribution_at_cycle_end} and - incremented (by 1) by calls to {!val:Stake_storage.snapshot}. - - {!val:Stake_storage.snapshot} is called in relation with constant - [blocks_per_stake_snapshot] in - {!val:Level_storage.may_snapshot_stake_distribution}. - - That is, the increment is done every [blocks_per_stake_snaphot] - blocks and reset at the end of cycles. So, it goes up to - [blocks_per_cycle / blocks_per_stake_snaphot], which is currently - 16 (= 24576/1536 -- the concrete values can be found in - {!val:Default_parameters.constants_mainnet}), then comes back to - 0, so that a UInt16 is big enough. - - The ratio [blocks_per_cycle / blocks_per_stake_snapshot] above is - checked in {!val:Constants_repr.check_constants} to fit in a - UInt16. *) - module Last_snapshot = - Make_single_data_storage (Registered) (Raw_context) - (struct - let name = ["last_snapshot"] - end) - (Encoding.UInt16) end module Delegate_sampler_state = Cycle.Delegate_sampler_state diff --git a/src/proto_alpha/lib_protocol/storage.mli b/src/proto_alpha/lib_protocol/storage.mli index d75ce4ffaae1..d9a463767bfe 100644 --- a/src/proto_alpha/lib_protocol/storage.mli +++ b/src/proto_alpha/lib_protocol/storage.mli @@ -518,10 +518,6 @@ module Stake : sig with type elt = Signature.Public_key_hash.t and type t := Raw_context.t - (** Counter of stake storage snapshots taken since last cycle *) - module Last_snapshot : - Single_data_storage with type value = int and type t := Raw_context.t - (** List of active stake *) module Selected_distribution_for_cycle : Indexed_data_storage -- GitLab From 6641524f1f82925bfde133e8b6ea9fb4c3d596f5 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Mon, 4 Dec 2023 11:05:15 +0100 Subject: [PATCH 2/2] Tezt: update regression test output --- .../expected/tickets.ml/Alpha- Send tickets in bigmap.out | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tezt/tests/expected/tickets.ml/Alpha- Send tickets in bigmap.out b/tezt/tests/expected/tickets.ml/Alpha- Send tickets in bigmap.out index 99e39b4293a2..74ef597a6ef7 100644 --- a/tezt/tests/expected/tickets.ml/Alpha- Send tickets in bigmap.out +++ b/tezt/tests/expected/tickets.ml/Alpha- Send tickets in bigmap.out @@ -137,7 +137,7 @@ Contract memorized as send_tickets_in_big_map. ./octez-client --mode mockup --wait none transfer 0 from bootstrap2 to '[CONTRACT_HASH]' --burn-cap 30 --storage-limit 1000000 --arg '"[CONTRACT_HASH]"' Node is bootstrapped. -Estimated gas: 98835.841 units (will add 100 for safety) +Estimated gas: 98835.369 units (will add 100 for safety) Estimated storage: 10767 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -266,7 +266,7 @@ This sequence of operations was run: Set temp(1)[40] to (Pair 0x010d30dc625f57274f300abc4af284934bc05fc46c00 (Pair "BLUE" 1)) Storage size: 320 bytes Paid storage size diff: 67 bytes - Consumed gas: 49910.055 + Consumed gas: 49909.937 Balance updates: [PUBLIC_KEY_HASH] ... -ꜩ0.01675 storage fees ........................... +ꜩ0.01675 @@ -283,7 +283,7 @@ This sequence of operations was run: Copy temp(1) to map(5) Storage size: 10783 bytes Paid storage size diff: 10700 bytes - Consumed gas: 48926.775 + Consumed gas: 48926.421 Balance updates: [PUBLIC_KEY_HASH] ... -ꜩ2.675 storage fees ........................... +ꜩ2.675 -- GitLab