Skip to content

Commit c6649df

Browse files
committed
feat: add missing constants and validate EasyTrack roles in TW vote tests
1 parent d01f447 commit c6649df

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

tests/test_vote_tw_csm2_hoodi.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@ def check_proxy_implementation(proxy_address, expected_impl):
162162
TRIGGERABLE_WITHDRAWALS_GATEWAY = "0x6679090D92b08a2a686eF8614feECD8cDFE209db"
163163
VALIDATOR_EXIT_VERIFIER = "0xFd4386A8795956f4B6D01cbb6dB116749731D7bD"
164164

165+
# Add missing constants
166+
OLD_GATE_SEAL_ADDRESS = "0x2168Ea6D948Ab49c3D34c667A7e02F92369F3A9C"
167+
NEW_WQ_GATE_SEAL = "0x73d76Bd3D589B2b2185c402da82cdAfbc18b958D"
168+
NEW_TW_GATE_SEAL = "0x368f2fcb593170823cc844F1B29e75E3d26879A1"
169+
RESEAL_MANAGER = "0x05172CbCDb7307228F781436b327679e4DAE166B"
170+
171+
# Add EasyTrack constants
172+
EASYTRACK_EVMSCRIPT_EXECUTOR = "0x79a20FD0FA36453B2F45eAbab19bfef43575Ba9E"
173+
EASYTRACK_SDVT_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY = "0xAa3D6A8B52447F272c1E8FAaA06EA06658bd95E2"
174+
EASYTRACK_CURATED_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY = "0x397206ecdbdcb1A55A75e60Fc4D054feC72E5f63"
175+
165176
# Oracle consensus versions
166177
AO_CONSENSUS_VERSION = 4
167178
VEBO_CONSENSUS_VERSION = 4
@@ -249,6 +260,15 @@ def test_tw_vote(helpers, accounts, vote_ids_from_env, stranger):
249260
# Step 8: Check TWG role for VEB initial state
250261
assert not triggerable_withdrawals_gateway.hasRole(add_full_withdrawal_request_role, contracts.validators_exit_bus_oracle), "VEBO should not have ADD_FULL_WITHDRAWAL_REQUEST_ROLE before upgrade"
251262

263+
# Step 9: Check EasyTrack VEB SUBMIT_REPORT_HASH_ROLE initial state
264+
submit_report_hash_role = web3.keccak(text="SUBMIT_REPORT_HASH_ROLE")
265+
assert not contracts.validators_exit_bus_oracle.hasRole(submit_report_hash_role, EASYTRACK_EVMSCRIPT_EXECUTOR), "EasyTrack executor should not have SUBMIT_REPORT_HASH_ROLE on VEBO before upgrade"
266+
267+
# Step 10: Check DualGovernance tiebreaker initial state
268+
tiebreaker_details = contracts.dual_governance.getTiebreakerDetails()
269+
initial_tiebreakers = tiebreaker_details[3] # sealableWithdrawalBlockers
270+
assert TRIGGERABLE_WITHDRAWALS_GATEWAY not in initial_tiebreakers, "TWG should not be in tiebreaker list before upgrade"
271+
252272
# Step 9: Check Withdrawal Vault implementation initial state
253273
assert withdrawal_vault_impl_before != WITHDRAWAL_VAULT_IMPL, "Withdrawal Vault implementation should be different before upgrade"
254274

@@ -263,6 +283,9 @@ def test_tw_vote(helpers, accounts, vote_ids_from_env, stranger):
263283
assert initial_ao_consensus_version < AO_CONSENSUS_VERSION, f"AO consensus version should be less than {AO_CONSENSUS_VERSION}"
264284
assert not contracts.accounting_oracle.hasRole(contracts.accounting_oracle.MANAGE_CONSENSUS_VERSION_ROLE(), contracts.agent), "Agent should not have MANAGE_CONSENSUS_VERSION_ROLE on AO before upgrade"
265285

286+
# Step 17: Check AO version before finalizeUpgrade_v3
287+
assert contracts.accounting_oracle.getContractVersion() == 2, "AO contract version should be 2 before finalizeUpgrade_v3"
288+
266289
# Step 15: Check Staking Router implementation initial state
267290
assert staking_router_impl_before != STAKING_ROUTER_IMPL, "Staking Router implementation should be different before upgrade"
268291

@@ -375,6 +398,19 @@ def test_tw_vote(helpers, accounts, vote_ids_from_env, stranger):
375398
# CSM Step 65: EasyTrack factories before vote (pre-vote state)
376399
initial_factories = contracts.easy_track.getEVMScriptFactories()
377400
assert EASYTRACK_CS_SET_VETTED_GATE_TREE_FACTORY not in initial_factories, "EasyTrack should not have CSMSetVettedGateTree factory before vote"
401+
assert EASYTRACK_SDVT_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY not in initial_factories, "EasyTrack should not have SDVT validator exit request hashes factory before vote"
402+
assert EASYTRACK_CURATED_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY not in initial_factories, "EasyTrack should not have Curated validator exit request hashes factory before vote"
403+
404+
# Gate Seals: Check initial states before vote
405+
assert contracts.withdrawal_queue.hasRole(contracts.withdrawal_queue.PAUSE_ROLE(), OLD_GATE_SEAL_ADDRESS), "Old GateSeal should have PAUSE_ROLE on WithdrawalQueue before vote"
406+
assert contracts.validators_exit_bus_oracle.hasRole(contracts.validators_exit_bus_oracle.PAUSE_ROLE(), OLD_GATE_SEAL_ADDRESS), "Old GateSeal should have PAUSE_ROLE on VEBO before vote"
407+
assert not contracts.withdrawal_queue.hasRole(contracts.withdrawal_queue.PAUSE_ROLE(), NEW_WQ_GATE_SEAL), "New WQ GateSeal should not have PAUSE_ROLE on WithdrawalQueue before vote"
408+
assert not contracts.validators_exit_bus_oracle.hasRole(contracts.validators_exit_bus_oracle.PAUSE_ROLE(), NEW_TW_GATE_SEAL), "New TW GateSeal should not have PAUSE_ROLE on VEBO before vote"
409+
assert not triggerable_withdrawals_gateway.hasRole(triggerable_withdrawals_gateway.PAUSE_ROLE(), NEW_TW_GATE_SEAL), "New TW GateSeal should not have PAUSE_ROLE on TWG before vote"
410+
411+
# ResealManager: Check initial states before vote
412+
assert not triggerable_withdrawals_gateway.hasRole(triggerable_withdrawals_gateway.PAUSE_ROLE(), RESEAL_MANAGER), "ResealManager should not have PAUSE_ROLE on TWG before vote"
413+
assert not triggerable_withdrawals_gateway.hasRole(triggerable_withdrawals_gateway.RESUME_ROLE(), RESEAL_MANAGER), "ResealManager should not have RESUME_ROLE on TWG before vote"
378414

379415
# START VOTE
380416
if len(vote_ids_from_env) > 0:
@@ -420,6 +456,14 @@ def test_tw_vote(helpers, accounts, vote_ids_from_env, stranger):
420456
assert triggerable_withdrawals_gateway.hasRole(add_full_withdrawal_request_role, cs_ejector), "CS Ejector should have ADD_FULL_WITHDRAWAL_REQUEST_ROLE on TWG"
421457
assert triggerable_withdrawals_gateway.hasRole(add_full_withdrawal_request_role, contracts.validators_exit_bus_oracle), "VEBO should have ADD_FULL_WITHDRAWAL_REQUEST_ROLE on TWG"
422458

459+
# Step 9: Validate EasyTrack VEB SUBMIT_REPORT_HASH_ROLE
460+
assert contracts.validators_exit_bus_oracle.hasRole(submit_report_hash_role, EASYTRACK_EVMSCRIPT_EXECUTOR), "EasyTrack executor should have SUBMIT_REPORT_HASH_ROLE on VEBO"
461+
462+
# Step 10: Validate DualGovernance tiebreaker connection
463+
final_tiebreaker_details = contracts.dual_governance.getTiebreakerDetails()
464+
final_tiebreakers = final_tiebreaker_details[3] # sealableWithdrawalBlockers
465+
assert TRIGGERABLE_WITHDRAWALS_GATEWAY in final_tiebreakers, "TWG should be in tiebreaker list after upgrade"
466+
423467
# Steps 9-10: Validate Withdrawal Vault upgrade
424468
assert get_wv_contract_proxy_impl(contracts.withdrawal_vault) == WITHDRAWAL_VAULT_IMPL, "Withdrawal Vault implementation should be updated"
425469
assert contracts.withdrawal_vault.getContractVersion() == 2, "Withdrawal Vault version should be 2 after finalizeUpgrade_v2"
@@ -429,6 +473,9 @@ def test_tw_vote(helpers, accounts, vote_ids_from_env, stranger):
429473
assert not contracts.accounting_oracle.hasRole(contracts.accounting_oracle.MANAGE_CONSENSUS_VERSION_ROLE(), contracts.agent), "Agent should not have MANAGE_CONSENSUS_VERSION_ROLE on AO"
430474
assert contracts.accounting_oracle.getConsensusVersion() == AO_CONSENSUS_VERSION, f"AO consensus version should be set to {AO_CONSENSUS_VERSION}"
431475

476+
# Step 17: Validate AO finalizeUpgrade_v3
477+
assert contracts.accounting_oracle.getContractVersion() == 3, "AO contract version should be 3 after finalizeUpgrade_v3"
478+
432479
# Steps 15-17: Validate Staking Router upgrade
433480
assert get_ossifiable_proxy_impl(contracts.staking_router) == STAKING_ROUTER_IMPL, "Staking Router implementation should be updated"
434481
assert contracts.staking_router.hasRole(contracts.staking_router.REPORT_VALIDATOR_EXITING_STATUS_ROLE(), VALIDATOR_EXIT_VERIFIER), "ValidatorExitVerifier should have REPORT_VALIDATOR_EXITING_STATUS_ROLE on SR"
@@ -530,10 +577,26 @@ def test_tw_vote(helpers, accounts, vote_ids_from_env, stranger):
530577
csm_priority_exit_threshold_after = csm_module_after['priorityExitShareThreshold']
531578
assert csm_priority_exit_threshold_after == CS_MODULE_NEW_PRIORITY_EXIT_THRESHOLD_BP, f"CSM priority exit threshold should be {CS_MODULE_NEW_PRIORITY_EXIT_THRESHOLD_BP} after vote, but got {csm_priority_exit_threshold_after}"
532579

580+
581+
# Steps 58-62: Validate Gate Seals updates
582+
assert not contracts.withdrawal_queue.hasRole(contracts.withdrawal_queue.PAUSE_ROLE(), OLD_GATE_SEAL_ADDRESS), "Old GateSeal should not have PAUSE_ROLE on WithdrawalQueue after vote"
583+
assert not contracts.validators_exit_bus_oracle.hasRole(contracts.validators_exit_bus_oracle.PAUSE_ROLE(), OLD_GATE_SEAL_ADDRESS), "Old GateSeal should not have PAUSE_ROLE on VEBO after vote"
584+
assert contracts.withdrawal_queue.hasRole(contracts.withdrawal_queue.PAUSE_ROLE(), NEW_WQ_GATE_SEAL), "New WQ GateSeal should have PAUSE_ROLE on WithdrawalQueue after vote"
585+
assert contracts.validators_exit_bus_oracle.hasRole(contracts.validators_exit_bus_oracle.PAUSE_ROLE(), NEW_TW_GATE_SEAL), "New TW GateSeal should have PAUSE_ROLE on VEBO after vote"
586+
assert triggerable_withdrawals_gateway.hasRole(triggerable_withdrawals_gateway.PAUSE_ROLE(), NEW_TW_GATE_SEAL), "New TW GateSeal should have PAUSE_ROLE on TWG after vote"
587+
588+
# Steps 63-64: Validate ResealManager roles
589+
assert triggerable_withdrawals_gateway.hasRole(triggerable_withdrawals_gateway.PAUSE_ROLE(), RESEAL_MANAGER), "ResealManager should have PAUSE_ROLE on TWG after vote"
590+
assert triggerable_withdrawals_gateway.hasRole(triggerable_withdrawals_gateway.RESUME_ROLE(), RESEAL_MANAGER), "ResealManager should have RESUME_ROLE on TWG after vote"
591+
533592
# Step 65: Add EasyTrack factory for CSSetVettedGateTree
534593
new_factories = contracts.easy_track.getEVMScriptFactories()
535594
assert EASYTRACK_CS_SET_VETTED_GATE_TREE_FACTORY in new_factories, "EasyTrack should have CSSetVettedGateTree factory after vote"
536595

596+
# Steps 66-67: Validate EasyTrack factories for validator exit request hashes
597+
assert EASYTRACK_SDVT_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY in new_factories, "EasyTrack should have SDVT validator exit request hashes factory after vote"
598+
assert EASYTRACK_CURATED_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY in new_factories, "EasyTrack should have Curated validator exit request hashes factory after vote"
599+
537600
# --- VALIDATE EVENTS ---
538601

539602
# voting_events = group_voting_events_from_receipt(vote_tx)

0 commit comments

Comments
 (0)