Skip to content

Commit 6973d33

Browse files
committed
feat: Add 2026-04-07 voting
1 parent c7eca97 commit 6973d33

File tree

1 file changed

+192
-0
lines changed

1 file changed

+192
-0
lines changed

scripts/vote_2026_04_07.py

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
"""
2+
TODO Vote 2026_04_07
3+
4+
TODO <list of items synced with Notion>
5+
6+
TODO (after vote) Vote #{vote number} passed & executed on {date+time}, block {blockNumber}.
7+
"""
8+
9+
from brownie import interface
10+
from typing import Dict, List, Tuple
11+
12+
from utils.easy_track import add_evmscript_factory, create_permissions, remove_evmscript_factory
13+
from utils.voting import bake_vote_items, confirm_vote_script, create_vote
14+
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description
15+
from utils.config import get_deployer_account, get_is_live, get_priority_fee
16+
from utils.mainnet_fork import pass_and_exec_dao_vote
17+
from utils.dual_governance import submit_proposals
18+
19+
from utils.agent import agent_forward
20+
21+
22+
# ============================== Constants ===================================
23+
OLD_EASYTRACK_SDVT_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY = "0xB7668B5485d0f826B86a75b0115e088bB9ee03eE"
24+
OLD_EASYTRACK_CURATED_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY = "0x8aa34dAaF0fC263203A15Bcfa0Ed926D466e59F3"
25+
NEW_EASYTRACK_SDVT_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY = "0x58A59dDC6Aea9b1D5743D024E15DfA4badB56E37"
26+
NEW_EASYTRACK_CURATED_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY = "0x4F716AD3Cc7A3A5cdA2359e5B2c84335c171dCde"
27+
VALIDATORS_EXIT_BUS_ORACLE = "0x0De4Ea0184c2ad0BacA7183356Aea5B8d5Bf5c6e"
28+
OLD_CHORUS_ADDRESS = "0x285f8537e1daeedaf617e96c742f2cf36d63ccfb"
29+
NEW_CHORUS_ADDRESS = "0x8dB977C13CAA938BC58464bFD622DF0570564b78"
30+
31+
HASH_CONSENSUS_FOR_ACCOUNTING_ORACLE = "0xD624B08C83bAECF0807Dd2c6880C3154a5F0B288"
32+
HASH_CONSENSUS_FOR_VALIDATORS_EXIT_BUS_ORACLE = "0x7FaDB6358950c5fAA66Cb5EB8eE5147De3df355a"
33+
34+
HASH_CONSENSUS_FOR_ACCOUNTING_ORACLE_QUORUM = 5
35+
HASH_CONSENSUS_FOR_VALIDATORS_EXIT_BUS_ORACLE_QUORUM = 5
36+
37+
def encode_remove_accounting_oracle_member(member: str) -> Tuple[str, str]:
38+
hash_consensus = interface.HashConsensus(HASH_CONSENSUS_FOR_ACCOUNTING_ORACLE)
39+
40+
return (hash_consensus.address, hash_consensus.removeMember.encode_input(member, HASH_CONSENSUS_FOR_ACCOUNTING_ORACLE_QUORUM))
41+
42+
def encode_remove_validators_exit_bus_oracle_member(member: str) -> Tuple[str, str]:
43+
hash_consensus = interface.HashConsensus(HASH_CONSENSUS_FOR_VALIDATORS_EXIT_BUS_ORACLE)
44+
45+
return (hash_consensus.address, hash_consensus.removeMember.encode_input(member, HASH_CONSENSUS_FOR_VALIDATORS_EXIT_BUS_ORACLE_QUORUM))
46+
47+
def encode_add_accounting_oracle_member(member: str) -> Tuple[str, str]:
48+
hash_consensus = interface.HashConsensus(HASH_CONSENSUS_FOR_ACCOUNTING_ORACLE)
49+
50+
return (hash_consensus.address, hash_consensus.addMember.encode_input(member, HASH_CONSENSUS_FOR_ACCOUNTING_ORACLE_QUORUM))
51+
52+
53+
def encode_add_validators_exit_bus_oracle_member(member: str) -> Tuple[str, str]:
54+
hash_consensus = interface.HashConsensus(HASH_CONSENSUS_FOR_VALIDATORS_EXIT_BUS_ORACLE)
55+
56+
return (hash_consensus.address, hash_consensus.addMember.encode_input(member, HASH_CONSENSUS_FOR_VALIDATORS_EXIT_BUS_ORACLE_QUORUM))
57+
58+
59+
60+
# ============================= IPFS Description ==================================
61+
# TODO IPFS description text
62+
IPFS_DESCRIPTION = """
63+
"""
64+
65+
66+
# ================================ Main ======================================
67+
def get_dg_items() -> List[Tuple[str, str]]:
68+
# TODO set up interface objects
69+
70+
return [
71+
# TODO 1.1. item description
72+
agent_forward([
73+
encode_remove_accounting_oracle_member(rated_labs_oracle_member),
74+
encode_remove_validators_exit_bus_oracle_member(rated_labs_oracle_member),
75+
encode_add_accounting_oracle_member(matrixed_link_oracle_member),
76+
encode_add_validators_exit_bus_oracle_member(matrixed_link_oracle_member),
77+
]),
78+
]
79+
80+
81+
def get_vote_items() -> Tuple[List[str], List[Tuple[str, str]]]:
82+
83+
# TODO set up interface objects
84+
85+
# TODO in case of using smart-contract based omnibus, retrieve vote items from omnibus contract
86+
# voting_items = brownie.interface.SmartContractOmnibus(omnibus_contract).getVoteItems()
87+
# vote_desc_items = []
88+
# call_script_items = []
89+
# for desc, call_script in voting_items:
90+
# vote_desc_items.append(desc)
91+
# call_script_items.append((call_script[0], call_script[1].hex()))
92+
# return vote_desc_items, call_script_items
93+
#
94+
# OR
95+
#
96+
# vote_desc_items = []
97+
# call_script_items = []
98+
# # 1. receive DG vote items from omnibus contract
99+
# contract_dg_items = interface.V3LaunchOmnibus(OMNIBUS_CONTRACT).getVoteItems()
100+
# dg_items = []
101+
# for _, call_script in contract_dg_items:
102+
# dg_items.append((call_script[0], call_script[1].hex()))
103+
# dg_call_script = submit_proposals([
104+
# (dg_items, DG_PROPOSAL_DESCRIPTION)
105+
# ])
106+
# vote_desc_items.append(DG_SUBMISSION_DESCRIPTION)
107+
# call_script_items.append(dg_call_script[0])
108+
# # 2. receive non-DG vote items from omnibus contract
109+
# voting_items = interface.V3LaunchOmnibus(OMNIBUS_CONTRACT).getVotingVoteItems()
110+
# for desc, call_script in voting_items:
111+
# vote_desc_items.append(desc)
112+
# call_script_items.append((call_script[0], call_script[1].hex()))
113+
# return vote_desc_items, call_script_items
114+
validators_exit_bus_oracle = interface.ValidatorsExitBusOracle(VALIDATORS_EXIT_BUS_ORACLE)
115+
116+
dg_items = get_dg_items()
117+
118+
dg_call_script = submit_proposals([
119+
# TODO DG proposal description
120+
(dg_items, "DG proposal description")
121+
])
122+
123+
vote_desc_items, call_script_items = zip(
124+
(
125+
# TODO DG proposal description
126+
"1. DG proposal submition description",
127+
dg_call_script[0]
128+
),
129+
(
130+
"2. Remove old SubmitValidatorsExitRequestHashes (Simple DVT) EVM script factory from EasyTrack",
131+
remove_evmscript_factory(
132+
factory=OLD_EASYTRACK_SDVT_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY,
133+
),
134+
),
135+
(
136+
"3. Remove old SubmitValidatorsExitRequestHashes (Curated Module) EVM script factory from EasyTrack",
137+
remove_evmscript_factory(
138+
factory=OLD_EASYTRACK_CURATED_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY,
139+
),
140+
),
141+
(
142+
"4. Add SubmitValidatorsExitRequestHashes (Simple DVT) EVM script factory `0xB7668B5485d0f826B86a75b0115e088bB9ee03eE` to Easy Track `0xF0211b7660680B49De1A7E9f25C65660F0a13Fea` with permissions `submitExitRequestsHash`",
143+
add_evmscript_factory(
144+
factory=NEW_EASYTRACK_SDVT_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY,
145+
permissions=(create_permissions(validators_exit_bus_oracle, "submitExitRequestsHash")),
146+
),
147+
),
148+
(
149+
"5. Add SubmitValidatorsExitRequestHashes (Curated Module) EVM script factory `0x8aa34dAaF0fC263203A15Bcfa0Ed926D466e59F3` to Easy Track `0xF0211b7660680B49De1A7E9f25C65660F0a13Fea` with permissions `submitExitRequestsHash`",
150+
add_evmscript_factory(
151+
factory=NEW_EASYTRACK_CURATED_SUBMIT_VALIDATOR_EXIT_REQUEST_HASHES_FACTORY,
152+
permissions=(create_permissions(validators_exit_bus_oracle, "submitExitRequestsHash")),
153+
),
154+
),
155+
)
156+
157+
return vote_desc_items, call_script_items
158+
159+
160+
def start_vote(tx_params: Dict[str, str], silent: bool = False):
161+
vote_desc_items, call_script_items = get_vote_items()
162+
vote_items = bake_vote_items(list(vote_desc_items), list(call_script_items))
163+
164+
desc_ipfs = (
165+
calculate_vote_ipfs_description(IPFS_DESCRIPTION)
166+
if silent else upload_vote_ipfs_description(IPFS_DESCRIPTION)
167+
)
168+
169+
vote_id, tx = confirm_vote_script(vote_items, silent, desc_ipfs) and list(
170+
create_vote(vote_items, tx_params, desc_ipfs=desc_ipfs)
171+
)
172+
173+
return vote_id, tx
174+
175+
176+
def main():
177+
tx_params: Dict[str, str] = {"from": get_deployer_account().address}
178+
if get_is_live():
179+
tx_params["priority_fee"] = get_priority_fee()
180+
181+
vote_id, _ = start_vote(tx_params=tx_params, silent=False)
182+
vote_id >= 0 and print(f"Vote created: {vote_id}.")
183+
184+
185+
def start_and_execute_vote_on_fork_manual():
186+
if get_is_live():
187+
raise Exception("This script is for local testing only.")
188+
189+
tx_params = {"from": get_deployer_account()}
190+
vote_id, _ = start_vote(tx_params=tx_params, silent=True)
191+
print(f"Vote created: {vote_id}.")
192+
pass_and_exec_dao_vote(int(vote_id), step_by_step=True)

0 commit comments

Comments
 (0)