1313)
1414from utils .dsm import UnvetArgs , to_bytes , set_single_guardian
1515from utils .staking_module import calc_module_reward_shares
16- from utils .test .csm_helpers import csm_add_node_operator , csm_upload_keys , get_ics_members , csm_add_ics_node_operator
16+ from utils .test .csm_helpers import (
17+ csm_add_node_operator , csm_upload_keys , csm_add_ics_node_operator ,
18+ csm_set_ics_tree_members ,
19+ )
1720from utils .test .deposits_helpers import fill_deposit_buffer
1821from utils .test .easy_track_helpers import _encode_calldata
1922from utils .test .helpers import ETH
@@ -90,7 +93,7 @@ def strikes():
9093def depositable_node_operator (csm , accounting , permissionless_gate , stranger ):
9194 increase_staking_module_share (module_id = CSM_MODULE_ID , share_multiplier = 2 )
9295 csm .cleanDepositQueue (2 * csm .getNonce (), {"from" : stranger .address })
93- for queue_priority in range (1 , 6 ):
96+ for queue_priority in range (0 , 6 ):
9497 deposit_batch = csm .depositQueueItem (queue_priority , csm .depositQueuePointers (queue_priority )["head" ])
9598 if deposit_batch :
9699 node_operator_id = (deposit_batch >> 192 ) & ((1 << 64 ) - 1 )
@@ -167,14 +170,17 @@ def get_sys_fee_to_eject():
167170 return int .from_bytes (val , "big" )
168171
169172
170- @pytest .mark .parametrize ("address, proof" , get_ics_members ())
171- def test_add_node_operator_ics (csm , vetted_gate , accounting , address , proof ):
172- no_id = csm_add_ics_node_operator (csm , vetted_gate , accounting , address , proof )
173- no = csm .getNodeOperator (no_id )
173+ def test_add_node_operators_ics (csm , vetted_gate , accounting , accounts ):
174+ members = [account .address for account in accounts [3 :5 ]]
175+ tree = csm_set_ics_tree_members (members )
176+ for address in members :
177+ proof = list (tree .tree .get_proof (tree .tree .find (tree .tree .leaf ([address ]))))
178+ no_id = csm_add_ics_node_operator (csm , vetted_gate , accounting , address , proof )
179+ no = csm .getNodeOperator (no_id )
174180
175- assert no ["managerAddress" ] == address
176- assert no ["rewardAddress" ] == address
177- assert accounting .getBondCurveId (no_id ) == vetted_gate .curveId ()
181+ assert no ["managerAddress" ] == address
182+ assert no ["rewardAddress" ] == address
183+ assert accounting .getBondCurveId (no_id ) == vetted_gate .curveId ()
178184
179185
180186def test_add_node_operator_permissionless (csm , permissionless_gate , accounting , accounts ):
@@ -424,18 +430,19 @@ def test_csm_remove_key(csm, parameters_registry, accounting, node_operator):
424430 assert "KeyRemovalChargeApplied" in tx .events
425431 assert "BondCharged" in tx .events
426432
433+ curve_id = accounting .getBondCurveId (node_operator )
427434 expected_charge_amount = contracts .lido .getPooledEthByShares (
428- contracts .lido .getSharesByPooledEth (parameters_registry .getKeyRemovalCharge (accounting . DEFAULT_BOND_CURVE_ID () ))
435+ contracts .lido .getSharesByPooledEth (parameters_registry .getKeyRemovalCharge (curve_id ))
429436 )
430437 assert tx .events ["BondCharged" ]["toChargeAmount" ] == expected_charge_amount
431438 no = csm .getNodeOperator (node_operator )
432439 assert no ["totalAddedKeys" ] == keys_before - 1
433440
434441
435- def test_eject_bad_performer (csm , ejector , strikes , node_operator , stranger ):
442+ def test_eject_bad_performer (csm , accounting , ejector , strikes , node_operator , stranger ):
436443 index_to_eject = 0
437444 pubkey_to_eject = csm .getSigningKeys (node_operator , index_to_eject , 1 )
438- leaf_to_eject = (node_operator , pubkey_to_eject , [1 , 1 , 1 , 0 , 0 , 0 ])
445+ leaf_to_eject = (node_operator , pubkey_to_eject , [1 , 1 , 1 , 1 , 1 , 1 ])
439446 another_pubkey = csm .getSigningKeys (node_operator , index_to_eject + 1 , 1 )
440447 strikes_tree = StrikesTree .new (
441448 [leaf_to_eject , (node_operator , another_pubkey , [1 , 1 , 0 , 0 , 0 , 0 ])]
@@ -450,7 +457,7 @@ def test_eject_bad_performer(csm, ejector, strikes, node_operator, stranger):
450457
451458 eject_payment_value = get_sys_fee_to_eject ()
452459
453- bad_performer = (node_operator , index_to_eject , [1 , 1 , 1 , 0 , 0 , 0 ])
460+ bad_performer = (node_operator , index_to_eject , [1 , 1 , 1 , 1 , 1 , 1 ])
454461 tx = strikes .processBadPerformanceProof (
455462 [bad_performer ],
456463 proof ,
@@ -461,7 +468,9 @@ def test_eject_bad_performer(csm, ejector, strikes, node_operator, stranger):
461468 assert "StrikesPenaltyProcessed" in tx .events
462469 assert tx .events ["StrikesPenaltyProcessed" ]["nodeOperatorId" ] == node_operator
463470 assert tx .events ["StrikesPenaltyProcessed" ]["pubkey" ] == pubkey_to_eject
464- penalty = contracts .cs_parameters_registry .defaultBadPerformancePenalty ()
471+
472+ curve_id = accounting .getBondCurveId (node_operator )
473+ penalty = contracts .cs_parameters_registry .getBadPerformancePenalty (curve_id )
465474 assert tx .events ["StrikesPenaltyProcessed" ]["strikesPenalty" ] == penalty
466475
467476 assert "TriggeredExitFeeRecorded" in tx .events
@@ -482,15 +491,17 @@ def test_voluntary_eject(csm, ejector, node_operator):
482491 assert "TriggeredExitFeeRecorded" not in tx .events
483492
484493
485- def test_report_validator_exit_delay (csm , node_operator ):
494+ def test_report_validator_exit_delay (csm , accounting , parameters_registry , node_operator ):
486495 pubkey = csm .getSigningKeys (node_operator , 0 , 1 )
487496 day_in_seconds = 60 * 60 * 24
488497
489498 tx = csm .reportValidatorExitDelay (node_operator , 0 , pubkey , 7 * day_in_seconds , {"from" : contracts .staking_router })
490499 assert "ValidatorExitDelayProcessed" in tx .events
491500 assert tx .events ["ValidatorExitDelayProcessed" ]["nodeOperatorId" ] == node_operator
492501 assert tx .events ["ValidatorExitDelayProcessed" ]["pubkey" ] == pubkey
493- penalty = contracts .cs_parameters_registry .defaultExitDelayPenalty ()
502+
503+ curve_id = accounting .getBondCurveId (node_operator )
504+ penalty = parameters_registry .getExitDelayPenalty (curve_id )
494505 assert tx .events ["ValidatorExitDelayProcessed" ]["delayPenalty" ] == penalty
495506
496507
0 commit comments