Skip to content

Commit 15f0494

Browse files
committed
add spent amount reset item
1 parent fa6df8c commit 15f0494

File tree

2 files changed

+64
-53
lines changed

2 files changed

+64
-53
lines changed

scripts/vote_2026_04_08.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
1.19 Set soft-mode target validators limit to 0 for Node Operator Chorus One (ID = 3) in Curated Module (MODULE_ID = 1) in Staking Router 0xFdDf38947aFB03C621C71b06C9C70bce73f12999
2424
1.20 Grant MANAGE_SIGNING_KEYS role for Node Operator Consensys (ID = 21) in Curated Module 0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5 to address 0xF45C77EadD434612fCD93db978B3E36B0D58eC99
2525
1.21 Decrease the limit from 1000 to 150 stETH per 12 months on Gas Supply AllowedRecipientsRegistry 0x49d1363016aA899bba09ae972a1BF200dDf8C55F
26-
1.22 Raise CSM (MODULE_ID = 3) stake share limit from 750 BP to 850 BP and priority exit threshold from 900 BP to 1020 BP in Staking Router 0xFdDf38947aFB03C621C71b06C9C70bce73f12999
26+
1.22 Set the amount spent on Gas Supply AllowedRecipientsRegistry 0x49d1363016aA899bba09ae972a1BF200dDf8C55F to 0
27+
1.23 Raise CSM (MODULE_ID = 3) stake share limit from 750 BP to 850 BP and priority exit threshold from 900 BP to 1020 BP in Staking Router 0xFdDf38947aFB03C621C71b06C9C70bce73f12999
2728
2829
=== NON-DG ITEMS ===
2930
2. Remove old Simple DVT SubmitValidatorsExitRequestHashes factory 0xB7668B5485d0f826B86a75b0115e088bB9ee03eE from Easy Track 0xF0211b7660680B49De1A7E9f25C65660F0a13Fea
@@ -58,7 +59,7 @@
5859
encode_set_node_operator_name,
5960
encode_set_node_operator_reward_address,
6061
)
61-
from utils.allowed_recipients_registry import set_limit_parameters
62+
from utils.allowed_recipients_registry import set_limit_parameters, unsafe_set_spent_amount
6263
from utils.permissions import encode_permission_grant_p
6364
from utils.permission_parameters import Param, Op, ArgumentValue
6465

@@ -349,7 +350,13 @@ def get_dg_items() -> List[Tuple[str, str]]:
349350
),
350351
]
351352
),
352-
# 1.22 Raise CSM (MODULE_ID = 3) stake share limit from 750 BP to 850 BP and priority exit threshold from 900 BP to 1020 BP
353+
# 1.22 Set the amount spent on Gas Supply AllowedRecipientsRegistry 0x49d1363016aA899bba09ae972a1BF200dDf8C55F to 0
354+
agent_forward(
355+
[
356+
unsafe_set_spent_amount(spent_amount=0, registry_address=GAS_SUPPLY_ALLOWED_RECIPIENTS_REGISTRY),
357+
]
358+
),
359+
# 1.23 Raise CSM (MODULE_ID = 3) stake share limit from 750 BP to 850 BP and priority exit threshold from 900 BP to 1020 BP
353360
agent_forward(
354361
[
355362
(

tests/test_2026_04_08.py

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
)
3535
from utils.test.event_validators.proxy import validate_proxy_upgrade_event
3636
from utils.test.event_validators.permission import Permission, validate_permission_grantp_event
37-
from utils.test.event_validators.allowed_recipients_registry import validate_set_limit_parameter_event
37+
from utils.test.event_validators.allowed_recipients_registry import validate_set_limit_parameter_event, validate_set_spent_amount_event
3838
from utils.test.event_validators.staking_router import validate_staking_module_update_event, StakingModuleItem
3939
from utils.voting import find_metadata_by_vote_id
4040
from utils.ipfs import get_lido_vote_cid_from_str
@@ -114,23 +114,15 @@
114114
GAS_SUPPLY_TRUSTED_CALLER = "0x5181d5D56Af4f823b96FE05f062D7a09761a5a53"
115115
GAS_SUPPLY_TOP_UP_FACTORY = "0x200dA0b6a9905A377CF8D469664C65dB267009d1"
116116
GAS_SUPPLY_ALLOWED_RECIPIENTS_REGISTRY = "0x49d1363016aA899bba09ae972a1BF200dDf8C55F"
117+
GAS_SUPPLY_OLD_LIMIT = 1000 * 10**18
117118
GAS_SUPPLY_NEW_LIMIT = 150 * 10**18
118119
GAS_SUPPLY_PERIOD_DURATION_MONTHS = 12
119120
GAS_SUPPLY_PERIOD_START = 1704067200 # Jan 1, 2024 00:00:00 UTC
121+
GAS_SUPPLY_PERIOD_END = 1735689600 # Jan 1, 2025 00:00:00 UTC
120122

121-
122-
def get_gas_supply_period_start():
123-
period_start = GAS_SUPPLY_PERIOD_START
124-
if chain.time() >= 1767225600: # Jan 1, 2026 00:00:00 UTC
125-
period_start = 1767225600
126-
return period_start
127-
128-
129-
def get_gas_supply_period_end():
130-
period_end = 1767225600 # Jan 1, 2026 00:00:00 UTC
131-
if chain.time() >= 1767225600: # Jan 1, 2026 00:00:00 UTC
132-
period_end = 1798761600 # Jan 1, 2027 00:00:00 UTC
133-
return period_end
123+
GAS_SUPPLY_PERIOD_START_AFTER = 1767225600 # Jan 1, 2026 00:00:00 UTC
124+
GAS_SUPPLY_PERIOD_END_AFTER = 1798761600 # Jan 1, 2027 00:00:00 UTC
125+
GAS_SUPPLY_SPENT_AMOUNT_EXPECTED = 0
134126

135127
# Target limit mode
136128
NO_TARGET_LIMIT_SOFT_MODE = 1
@@ -177,8 +169,8 @@ def get_gas_supply_period_end():
177169
EXPECTED_VOTE_ID = 199
178170
EXPECTED_DG_PROPOSAL_ID = 9
179171
EXPECTED_VOTE_EVENTS_COUNT = 11 # 1 DG submit + 5 factory removes + 5 factory adds
180-
EXPECTED_DG_EVENTS_FROM_AGENT = 23
181-
EXPECTED_DG_EVENTS_COUNT = 23
172+
EXPECTED_DG_EVENTS_FROM_AGENT = 24
173+
EXPECTED_DG_EVENTS_COUNT = 24
182174
IPFS_DESCRIPTION_HASH = "" # TODO: add
183175
DG_PROPOSAL_METADATA = "Deactivate A41, update Stakin, upgrade LazyOracle/VaultHub/ZKSync bridge, rotate Chorus One oracle member, rotate Stakefish oracle member, set Chorus One target limit, grant MANAGE_SIGNING_KEYS to Consensys, decrease Gas Supply limit, raise CSM stake share limit and priority exit threshold"
184176

@@ -325,18 +317,11 @@ def alter_tiers_in_operator_grid_test(easy_track, trusted_address, stranger, ope
325317

326318

327319
def et_gas_supply_limit_test(easy_track, gas_supply_registry, stranger, accounts):
320+
chain.snapshot()
328321
trusted_caller_account = accounts.at(GAS_SUPPLY_TRUSTED_CALLER, force=True)
329322
steth = interface.ERC20(STETH_TOKEN)
330-
331-
# sleep past the current period end. Leaves the current period with 0 spendable
332-
_, _, period_start, period_end = gas_supply_registry.getPeriodState()
333-
chain.sleep(period_end - chain.time() + 1)
334-
chain.mine()
335-
336-
_, spendable, period_start, period_end = gas_supply_registry.getPeriodState()
337-
to_spend = gas_supply_registry.getLimitParameters()[0]
338-
if chain.time() >= period_start and chain.time() < period_end:
339-
to_spend = spendable
323+
spendable_left = 10 # wei
324+
to_spend = GAS_SUPPLY_NEW_LIMIT - spendable_left # leave 10 wei to check spendable balance after motion enact
340325

341326
create_and_enact_payment_motion(
342327
easy_track,
@@ -348,16 +333,28 @@ def et_gas_supply_limit_test(easy_track, gas_supply_registry, stranger, accounts
348333
stranger,
349334
)
350335

336+
(
337+
gas_supply_already_spent,
338+
gas_supply_spendable,
339+
gas_supply_period_start,
340+
gas_supply_period_end,
341+
) = gas_supply_registry.getPeriodState()
342+
assert gas_supply_already_spent == to_spend
343+
assert gas_supply_spendable == spendable_left
344+
assert gas_supply_period_start == GAS_SUPPLY_PERIOD_START_AFTER
345+
assert gas_supply_period_end == GAS_SUPPLY_PERIOD_END_AFTER
346+
351347
with reverts("SUM_EXCEEDS_SPENDABLE_BALANCE"):
352348
create_and_enact_payment_motion(
353349
easy_track,
354350
GAS_SUPPLY_TRUSTED_CALLER,
355351
GAS_SUPPLY_TOP_UP_FACTORY,
356352
steth,
357353
[trusted_caller_account],
358-
[1],
354+
[spendable_left + 1], # try to spend more than the spendable balance
359355
stranger,
360356
)
357+
chain.revert()
361358

362359

363360
def test_vote(helpers, accounts, ldo_holder, vote_ids_from_env, stranger, dual_governance_proposal_calls):
@@ -602,20 +599,21 @@ def test_vote(helpers, accounts, ldo_holder, vote_ids_from_env, stranger, dual_g
602599
CONSENSYS_MANAGE_SIGNING_KEYS_ADDRESS, MANAGE_SIGNING_KEYS, [perm_param_uint]
603600
)
604601

605-
# 1.21 Gas Supply limit before
602+
# 1.21-1.22 Gas Supply limit before
606603
limit_before, duration_before = gas_supply_registry.getLimitParameters()
607-
assert limit_before != GAS_SUPPLY_NEW_LIMIT
604+
assert limit_before == GAS_SUPPLY_OLD_LIMIT
608605
assert duration_before == GAS_SUPPLY_PERIOD_DURATION_MONTHS
609606
(
610-
gs_already_spent_before,
611-
gs_spendable_before,
612-
gs_period_start_before,
613-
_,
607+
gas_supply_already_spent_before,
608+
gas_supply_spendable_before,
609+
gas_supply_period_start_before,
610+
gas_supply_period_end_before,
614611
) = gas_supply_registry.getPeriodState()
615-
assert gs_spendable_before == limit_before - gs_already_spent_before
616-
assert gs_period_start_before == GAS_SUPPLY_PERIOD_START
612+
assert gas_supply_spendable_before == limit_before - gas_supply_already_spent_before
613+
assert gas_supply_period_start_before == GAS_SUPPLY_PERIOD_START
614+
assert gas_supply_period_end_before == GAS_SUPPLY_PERIOD_END
617615

618-
# 1.22 CSM stake share limit and priority exit threshold before
616+
# 1.23 CSM stake share limit and priority exit threshold before
619617
csm_module_before = staking_router.getStakingModule(CSM_MODULE_ID)
620618
assert csm_module_before["name"] == CSM_MODULE_NAME
621619
assert csm_module_before["stakingModuleAddress"] == CSM_MODULE_ADDRESS
@@ -820,13 +818,20 @@ def test_vote(helpers, accounts, ldo_holder, vote_ids_from_env, stranger, dual_g
820818
dg_events[21],
821819
limit=GAS_SUPPLY_NEW_LIMIT,
822820
period_duration_month=GAS_SUPPLY_PERIOD_DURATION_MONTHS,
823-
period_start_timestamp=get_gas_supply_period_start(),
821+
period_start_timestamp=GAS_SUPPLY_PERIOD_START_AFTER,
824822
emitted_by=GAS_SUPPLY_ALLOWED_RECIPIENTS_REGISTRY,
825823
)
826824

827-
# 1.22. CSM stake share limit and priority exit threshold update
828-
validate_staking_module_update_event(
825+
# 1.22. Gas Supply spent amount reset
826+
validate_set_spent_amount_event(
829827
dg_events[22],
828+
new_spent_amount=GAS_SUPPLY_SPENT_AMOUNT_EXPECTED,
829+
emitted_by=GAS_SUPPLY_ALLOWED_RECIPIENTS_REGISTRY,
830+
)
831+
832+
# 1.23. CSM stake share limit and priority exit threshold update
833+
validate_staking_module_update_event(
834+
dg_events[23],
830835
StakingModuleItem(
831836
id=CSM_MODULE_ID,
832837
name=CSM_MODULE_NAME,
@@ -896,24 +901,23 @@ def test_vote(helpers, accounts, ldo_holder, vote_ids_from_env, stranger, dual_g
896901
)
897902
assert no_registry.canPerform(CONSENSYS_MANAGE_SIGNING_KEYS_ADDRESS, MANAGE_SIGNING_KEYS, [perm_param_uint])
898903

899-
# 1.21 Gas Supply limit decreased
904+
# 1.21-1.22 Gas Supply limit decreased
900905
limit_after, duration_after = gas_supply_registry.getLimitParameters()
901906
assert limit_after == GAS_SUPPLY_NEW_LIMIT
902907
assert duration_after == GAS_SUPPLY_PERIOD_DURATION_MONTHS
903908
(
904-
gs_already_spent_after,
905-
_,
906-
gs_period_start_after,
907-
gs_period_end_after,
909+
gas_supply_already_spent_after,
910+
gas_supply_spendable_after,
911+
gas_supply_period_start_after,
912+
gas_supply_period_end_after,
908913
) = gas_supply_registry.getPeriodState()
909-
assert gs_already_spent_after == gs_already_spent_before
910-
assert gs_period_start_after == get_gas_supply_period_start()
911-
assert gs_period_end_after == get_gas_supply_period_end()
912-
chain.snapshot()
914+
assert gas_supply_already_spent_after == GAS_SUPPLY_SPENT_AMOUNT_EXPECTED
915+
assert gas_supply_spendable_after == GAS_SUPPLY_NEW_LIMIT
916+
assert gas_supply_period_start_after == GAS_SUPPLY_PERIOD_START_AFTER
917+
assert gas_supply_period_end_after == GAS_SUPPLY_PERIOD_END_AFTER
913918
et_gas_supply_limit_test(easy_track, gas_supply_registry, stranger, accounts)
914-
chain.revert()
915919

916-
# 1.22 CSM stake share limit and priority exit threshold raised
920+
# 1.23 CSM stake share limit and priority exit threshold raised
917921
csm_module_after = staking_router.getStakingModule(CSM_MODULE_ID)
918922
assert csm_module_after["stakeShareLimit"] == CSM_STAKE_SHARE_LIMIT_AFTER
919923
assert csm_module_after["priorityExitShareThreshold"] == CSM_PRIORITY_EXIT_SHARE_THRESHOLD_AFTER

0 commit comments

Comments
 (0)