Skip to content

Commit 7ee6130

Browse files
committed
fix node operators snapshot
1 parent 36630ad commit 7ee6130

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

tests/snapshot/test_node_operators_registry.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
from brownie.convert.datatypes import ReturnValue
88
from tests.snapshot.utils import get_slot
99

10-
from utils.config import (
11-
contracts,
12-
DEPOSIT_SECURITY_MODULE
13-
)
10+
from utils.config import contracts, DEPOSIT_SECURITY_MODULE
1411
from utils.mainnet_fork import chain_snapshot
1512
from utils.test.snapshot_helpers import dict_zip
1613
from utils.test.governance_helpers import execute_vote_and_process_dg_proposals
@@ -30,7 +27,13 @@ def grant_roles(voting_eoa, agent_eoa):
3027
contracts.voting,
3128
contracts.node_operators_registry,
3229
convert.to_uint(Web3.keccak(text="MANAGE_NODE_OPERATOR_ROLE")),
33-
{"from": contracts.agent},
30+
{"from": agent_eoa},
31+
)
32+
contracts.acl.grantPermission(
33+
agent_eoa,
34+
contracts.node_operators_registry,
35+
convert.to_uint(Web3.keccak(text="SET_NODE_OPERATOR_LIMIT_ROLE")),
36+
{"from": agent_eoa},
3437
)
3538

3639

@@ -101,7 +104,7 @@ def create_actions(dsm_eoa, manager_eoa):
101104
new_node_operator["id"],
102105
new_node_operator["staking_limit"],
103106
1,
104-
{"from": manager_eoa},
107+
{"from": new_node_operator["reward_address"]},
105108
),
106109
"deactivate_node_operator": lambda: contracts.node_operators_registry.deactivateNodeOperator(
107110
new_node_operator["id"], {"from": manager_eoa}
@@ -121,7 +124,9 @@ def create_actions(dsm_eoa, manager_eoa):
121124
make_snapshot(contracts.node_operators_registry)
122125

123126
with chain_snapshot():
124-
snapshot_before_update = run_scenario(actions=create_actions(new_deposit_security_module_eoa, voting_eoa), snapshooter=make_snapshot)
127+
snapshot_before_update = run_scenario(
128+
actions=create_actions(new_deposit_security_module_eoa, agent_eoa), snapshooter=make_snapshot
129+
)
125130

126131
with chain_snapshot():
127132
execute_vote_and_process_dg_proposals(helpers, vote_ids_from_env, dg_proposal_ids_from_env)
@@ -130,22 +135,24 @@ def create_actions(dsm_eoa, manager_eoa):
130135
contracts.agent,
131136
contracts.node_operators_registry,
132137
convert.to_uint(Web3.keccak(text="MANAGE_NODE_OPERATOR_ROLE")),
133-
{"from": contracts.agent}
138+
{"from": contracts.agent},
134139
)
135140
contracts.acl.grantPermission(
136141
contracts.agent,
137142
contracts.node_operators_registry,
138143
convert.to_uint(Web3.keccak(text="SET_NODE_OPERATOR_LIMIT_ROLE")),
139-
{"from": contracts.agent}
144+
{"from": contracts.agent},
140145
)
141146
contracts.acl.grantPermission(
142147
contracts.agent,
143148
contracts.node_operators_registry,
144149
convert.to_uint(Web3.keccak(text="MANAGE_SIGNING_KEYS")),
145-
{"from": contracts.agent}
150+
{"from": contracts.agent},
146151
)
147152

148-
snapshot_after_update = run_scenario(actions=create_actions(new_deposit_security_module_eoa, agent_eoa), snapshooter=make_snapshot)
153+
snapshot_after_update = run_scenario(
154+
actions=create_actions(new_deposit_security_module_eoa, agent_eoa), snapshooter=make_snapshot
155+
)
149156

150157
assert snapshot_before_update.keys() == snapshot_after_update.keys()
151158

@@ -262,8 +269,14 @@ def assert_node_operators(before: Dict[str, ReturnValue], after: Dict[str, Retur
262269
node_operator_before = node_operators_pair[0]
263270
node_operator_after = node_operators_pair[1]
264271
assert node_operator_before["active"] == node_operator_after["active"]
265-
assert node_operator_before["name"] == node_operator_after["name"]
266-
assert node_operator_before["rewardAddress"] == node_operator_after["rewardAddress"]
272+
if id == 25:
273+
assert node_operator_before["name"] == "Nethermind"
274+
assert node_operator_after["name"] == "Twinstake"
275+
assert node_operator_before["rewardAddress"] == "0x237DeE529A47750bEcdFa8A59a1D766e3e7B5F91"
276+
assert node_operator_after["rewardAddress"] == "0x36201ed66DbC284132046ee8d99272F8eEeb24c8"
277+
else:
278+
assert node_operator_before["name"] == node_operator_after["name"]
279+
assert node_operator_before["rewardAddress"] == node_operator_after["rewardAddress"]
267280
assert node_operator_before["totalDepositedValidators"] == node_operator_after["totalDepositedValidators"]
268281
assert node_operator_before["totalExitedValidators"] == node_operator_after["totalExitedValidators"]
269282
assert node_operator_before["totalAddedValidators"] == node_operator_after["totalAddedValidators"]

0 commit comments

Comments
 (0)