Skip to content

Commit aff7b64

Browse files
committed
feat: add separate script for holesky
Add a separate script for launching on Holesky and new vote items: - rotation of GateSeals - changing voting and objection time
1 parent 6fc67fb commit aff7b64

File tree

2 files changed

+407
-7
lines changed

2 files changed

+407
-7
lines changed
Lines changed: 332 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
"""
2+
Release part of the update before the Pectra upgrade
3+
4+
1. Grant MANAGE_CONSENSUS_VERSION_ROLE role on Accounting Oracle to Aragon Agent
5+
2. Update Accounting Oracle consensus version to 3
6+
3. Revoke MANAGE_CONSENSUS_VERSION_ROLE role on Accounting Oracle from Aragon Agent
7+
4. Grant MANAGE_CONSENSUS_VERSION_ROLE role on Validator Exit Bus Oracle to Aragon Agent
8+
5. Update Validator Exit Bus Oracle consensus version to 3
9+
6. Revoke MANAGE_CONSENSUS_VERSION_ROLE role on Validator Exit Bus Oracle from Aragon Agent
10+
7. Grant MANAGE_CONSENSUS_VERSION_ROLE role on CSFeeOracle to Aragon Agent
11+
8. Update CSFeeOracle consensus version to 2
12+
9. Revoke MANAGE_CONSENSUS_VERSION_ROLE role on CSFeeOracle from Aragon Agent
13+
10. Revoke VERIFIER_ROLE role on CSM from old CS Verifier
14+
11. Grant VERIFIER_ROLE role on CSM to new CS Verifier
15+
12. Create permission UNSAFELY_MODIFY_VOTE_TIME_ROLE for Aragon Voting
16+
13. Grant UNSAFELY_MODIFY_VOTE_TIME_ROLE to Aragon Voting
17+
14. Change vote time from 900 to 1080 on Aragon Voting
18+
15. Change objection phase time from 300 to 360 on Aragon Voting
19+
16. Revoke UNSAFELY_MODIFY_VOTE_TIME_ROLE from Aragon Voting
20+
17. Grant PAUSE_ROLE on WithdrawalQueue to the new GateSeal (0xAE6eCd77DCC656c5533c4209454Fd56fB46e1778)
21+
18. Grant PAUSE_ROLE on ValidatorsExitBusOracle to the new GateSeal (0xAE6eCd77DCC656c5533c4209454Fd56fB46e1778)
22+
19. Revoke PAUSE_ROLE on WithdrawalQueue from the old GateSeal (0xA34d620EA9F3e86bf8B8a7699B4dE44CD9D3202d)
23+
20. Revoke PAUSE_ROLE on ValidatorsExitBusOracle from the old GateSeal (0xA34d620EA9F3e86bf8B8a7699B4dE44CD9D3202d)
24+
"""
25+
26+
import time
27+
28+
try:
29+
from brownie import interface, accounts
30+
except ImportError:
31+
print("You're probably running inside Brownie console. Please call:")
32+
print("set_console_globals(interface=interface)")
33+
34+
35+
from typing import Dict, Tuple, Optional
36+
from utils.config import (
37+
get_deployer_account,
38+
get_is_live,
39+
get_priority_fee,
40+
contracts,
41+
CS_VERIFIER_ADDRESS_OLD,
42+
)
43+
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description
44+
from utils.permissions import (
45+
encode_oz_grant_role,
46+
encode_oz_revoke_role,
47+
encode_permission_grant,
48+
encode_permission_revoke,
49+
encode_permission_create
50+
)
51+
from utils.voting import bake_vote_items, confirm_vote_script, create_vote
52+
53+
from brownie.network.transaction import TransactionReceipt
54+
from utils.agent import agent_forward
55+
from utils.mainnet_fork import pass_and_exec_dao_vote
56+
57+
58+
# Consensus version
59+
60+
AO_CONSENSUS_VERSION = 3
61+
VEBO_CONSENSUS_VERSION = 3
62+
CS_FEE_ORACLE_CONSENSUS_VERSION = 2
63+
64+
# Vote duration
65+
NEW_VOTE_DURATION = 1080
66+
NEW_OBJECTION_PHASE_DURATION = 360
67+
68+
# GateSeals
69+
OLD_GATE_SEAL = "0xA34d620EA9F3e86bf8B8a7699B4dE44CD9D3202d"
70+
NEW_GATE_SEAL = "0xAE6eCd77DCC656c5533c4209454Fd56fB46e1778"
71+
72+
description = """
73+
"""
74+
75+
76+
def encode_ao_set_consensus_version() -> Tuple[str, str]:
77+
proxy = contracts.accounting_oracle
78+
return proxy.address, proxy.setConsensusVersion.encode_input(AO_CONSENSUS_VERSION)
79+
80+
81+
def encode_vebo_set_consensus_version() -> Tuple[str, str]:
82+
proxy = contracts.validators_exit_bus_oracle
83+
return proxy.address, proxy.setConsensusVersion.encode_input(VEBO_CONSENSUS_VERSION)
84+
85+
86+
def encode_cs_fee_oracle_set_consensus_version() -> Tuple[str, str]:
87+
proxy = contracts.cs_fee_oracle
88+
return proxy.address, proxy.setConsensusVersion.encode_input(CS_FEE_ORACLE_CONSENSUS_VERSION)
89+
90+
91+
def start_vote(tx_params: Dict[str, str], silent: bool) -> Tuple[int, Optional[TransactionReceipt]]:
92+
"""Prepare and run voting."""
93+
94+
vote_desc_items, call_script_items = zip(
95+
# Pre-pectra upgrade
96+
(
97+
"1. Grant MANAGE_CONSENSUS_VERSION_ROLE role on Accounting Oracle to Aragon Agent",
98+
agent_forward(
99+
[
100+
encode_oz_grant_role(
101+
contract=contracts.accounting_oracle,
102+
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
103+
grant_to=contracts.agent,
104+
)
105+
]
106+
),
107+
),
108+
(
109+
"2. Update Accounting Oracle consensus version to 3",
110+
agent_forward([encode_ao_set_consensus_version()]),
111+
),
112+
(
113+
"3. Revoke MANAGE_CONSENSUS_VERSION_ROLE role on Accounting Oracle from Aragon Agent",
114+
agent_forward(
115+
[
116+
encode_oz_revoke_role(
117+
contract=contracts.accounting_oracle,
118+
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
119+
revoke_from=contracts.agent,
120+
)
121+
]
122+
),
123+
),
124+
(
125+
"4. Grant MANAGE_CONSENSUS_VERSION_ROLE role on Validator Exit Bus Oracle to Aragon Agent",
126+
agent_forward(
127+
[
128+
encode_oz_grant_role(
129+
contract=contracts.validators_exit_bus_oracle,
130+
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
131+
grant_to=contracts.agent,
132+
)
133+
]
134+
),
135+
),
136+
(
137+
"5. Update Validator Exit Bus Oracle consensus version to 3",
138+
agent_forward([encode_vebo_set_consensus_version()]),
139+
),
140+
(
141+
"6. Revoke MANAGE_CONSENSUS_VERSION_ROLE role on Validator Exit Bus Oracle from Aragon Agent",
142+
agent_forward(
143+
[
144+
encode_oz_revoke_role(
145+
contract=contracts.validators_exit_bus_oracle,
146+
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
147+
revoke_from=contracts.agent,
148+
)
149+
]
150+
),
151+
),
152+
(
153+
"7. Grant MANAGE_CONSENSUS_VERSION_ROLE role on CSFeeOracle to Aragon Agent",
154+
agent_forward(
155+
[
156+
encode_oz_grant_role(
157+
contract=contracts.cs_fee_oracle,
158+
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
159+
grant_to=contracts.agent,
160+
)
161+
]
162+
),
163+
),
164+
(
165+
"8. Update CSFeeOracle consensus version to 2",
166+
agent_forward([encode_cs_fee_oracle_set_consensus_version()]),
167+
),
168+
(
169+
"9. Revoke MANAGE_CONSENSUS_VERSION_ROLE role on Validator Exit Bus Oracle from Aragon Agent",
170+
agent_forward(
171+
[
172+
encode_oz_revoke_role(
173+
contract=contracts.cs_fee_oracle,
174+
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
175+
revoke_from=contracts.agent,
176+
)
177+
]
178+
),
179+
),
180+
(
181+
"10. Revoke VERIFIER_ROLE role on CSM from old CS Verifier",
182+
agent_forward(
183+
[
184+
encode_oz_revoke_role(
185+
contract=contracts.csm,
186+
role_name="VERIFIER_ROLE",
187+
revoke_from=CS_VERIFIER_ADDRESS_OLD,
188+
)
189+
]
190+
),
191+
),
192+
(
193+
"11. Grant VERIFIER_ROLE role on CSM to new CS Verifier",
194+
agent_forward(
195+
[
196+
encode_oz_grant_role(
197+
contract=contracts.csm,
198+
role_name="VERIFIER_ROLE",
199+
grant_to=contracts.cs_verifier,
200+
)
201+
]
202+
),
203+
),
204+
205+
# Extend On-Chain Voting Duration
206+
(
207+
"12. Create permission UNSAFELY_MODIFY_VOTE_TIME_ROLE for Aragon Voting",
208+
encode_permission_create(
209+
entity=contracts.voting,
210+
target_app=contracts.voting,
211+
permission_name="UNSAFELY_MODIFY_VOTE_TIME_ROLE",
212+
manager=contracts.voting,
213+
)
214+
),
215+
(
216+
"13. Grant UNSAFELY_MODIFY_VOTE_TIME_ROLE on Aragon Voting to Aragon Voting",
217+
encode_permission_grant(
218+
target_app=contracts.voting,
219+
permission_name="UNSAFELY_MODIFY_VOTE_TIME_ROLE",
220+
grant_to=contracts.voting,
221+
)
222+
),
223+
(
224+
"14. Change vote time from 900 to 1080 on Aragon Voting",
225+
(
226+
contracts.voting.address,
227+
contracts.voting.unsafelyChangeVoteTime.encode_input(NEW_VOTE_DURATION),
228+
)
229+
),
230+
(
231+
"15. Change objection phase time from 300 to 360 on Aragon Voting",
232+
(
233+
contracts.voting.address,
234+
contracts.voting.unsafelyChangeObjectionPhaseTime.encode_input(NEW_OBJECTION_PHASE_DURATION),
235+
)
236+
),
237+
(
238+
"16. Revoke UNSAFELY_MODIFY_VOTE_TIME_ROLE on Aragon Voting from Aragon Voting",
239+
encode_permission_revoke(
240+
target_app=contracts.voting,
241+
permission_name="UNSAFELY_MODIFY_VOTE_TIME_ROLE",
242+
revoke_from=contracts.voting,
243+
)
244+
),
245+
246+
# Change GateSeal on WithdrawalQueue and ValidatorsExitBusOracle
247+
(
248+
"17. Grant PAUSE_ROLE on WithdrawalQueue to the new GateSeal (0xAE6eCd77DCC656c5533c4209454Fd56fB46e1778)",
249+
agent_forward(
250+
[
251+
encode_oz_grant_role(
252+
contract=contracts.withdrawal_queue,
253+
role_name="PAUSE_ROLE",
254+
grant_to="0xAE6eCd77DCC656c5533c4209454Fd56fB46e1778",
255+
)
256+
]
257+
),
258+
),
259+
(
260+
"18. Grant PAUSE_ROLE on ValidatorsExitBusOracle to the new GateSeal (0xAE6eCd77DCC656c5533c4209454Fd56fB46e1778)",
261+
agent_forward(
262+
[
263+
encode_oz_grant_role(
264+
contract=contracts.validators_exit_bus_oracle,
265+
role_name="PAUSE_ROLE",
266+
grant_to="0xAE6eCd77DCC656c5533c4209454Fd56fB46e1778",
267+
)
268+
]
269+
),
270+
),
271+
(
272+
"19. Revoke PAUSE_ROLE on WithdrawalQueue from the old GateSeal (0xA34d620EA9F3e86bf8B8a7699B4dE44CD9D3202d)",
273+
agent_forward(
274+
[
275+
encode_oz_revoke_role(
276+
contract=contracts.withdrawal_queue,
277+
role_name="PAUSE_ROLE",
278+
revoke_from="0xA34d620EA9F3e86bf8B8a7699B4dE44CD9D3202d",
279+
)
280+
]
281+
),
282+
),
283+
(
284+
"20. Revoke PAUSE_ROLE on ValidatorsExitBusOracle from the old GateSeal (0xA34d620EA9F3e86bf8B8a7699B4dE44CD9D3202d)",
285+
agent_forward(
286+
[
287+
encode_oz_revoke_role(
288+
contract=contracts.validators_exit_bus_oracle,
289+
role_name="PAUSE_ROLE",
290+
revoke_from="0xA34d620EA9F3e86bf8B8a7699B4dE44CD9D3202d",
291+
)
292+
]
293+
),
294+
),
295+
)
296+
297+
vote_items = bake_vote_items(list(vote_desc_items), list(call_script_items))
298+
299+
if silent:
300+
desc_ipfs = calculate_vote_ipfs_description(description)
301+
else:
302+
desc_ipfs = upload_vote_ipfs_description(description)
303+
304+
return confirm_vote_script(vote_items, silent, desc_ipfs) and list(
305+
create_vote(vote_items, tx_params, desc_ipfs=desc_ipfs)
306+
)
307+
308+
309+
def main():
310+
tx_params = {"from": get_deployer_account()}
311+
312+
if get_is_live():
313+
tx_params["priority_fee"] = get_priority_fee()
314+
315+
vote_id, _ = start_vote(tx_params=tx_params, silent=False)
316+
317+
vote_id >= 0 and print(f"Vote created: {vote_id}.")
318+
319+
time.sleep(5) # hack for waiting thread #2.
320+
321+
322+
def start_and_execute_vote_on_fork():
323+
if get_is_live():
324+
raise Exception("This script is for local testing only.")
325+
326+
tx_params = {"from": get_deployer_account()}
327+
vote_id, _ = start_vote(tx_params=tx_params, silent=True)
328+
329+
time.sleep(5) # hack for waiting thread #2.
330+
331+
print(f"Vote created: {vote_id}.")
332+
pass_and_exec_dao_vote(int(vote_id))

0 commit comments

Comments
 (0)