-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
""" | ||
Release part of the update following the Pectra upgrade | ||
1. Grant role `EXITED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` to Aragon Agent on `OracleReportSanityChecker` contract | ||
2. Set `exitedValidatorsPerDayLimit` sanity checker parameter to 3600 | ||
3. Revoke role `EXITED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` on `OracleReportSanityChecker` from Aragon Agent | ||
4. Grant role `APPEARED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` to Aragon Agent on `OracleReportSanityChecker` contract | ||
5. Set `appearedValidatorsPerDayLimit` sanity checker parameter to 1800 | ||
6. Revoke role `APPEARED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` on `OracleReportSanityChecker` from Aragon Agent | ||
7. Grant role `INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE` to Aragon Agent on `OracleReportSanityChecker` contract | ||
8. Set `initialSlashingAmountPWei` sanity checker parameter to 8 | ||
9. Revoke role `INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE` on `OracleReportSanityChecker` from Aragon Agent | ||
""" | ||
|
||
import time | ||
|
||
try: | ||
from brownie import interface, accounts | ||
except ImportError: | ||
print("You're probably running inside Brownie console. Please call:") | ||
print("set_console_globals(interface=interface)") | ||
|
||
|
||
from typing import Dict, Tuple, Optional | ||
from utils.config import ( | ||
get_deployer_account, | ||
get_is_live, | ||
get_priority_fee, | ||
contracts, | ||
) | ||
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description | ||
from utils.permissions import encode_oz_grant_role, encode_oz_revoke_role | ||
from utils.voting import bake_vote_items, confirm_vote_script, create_vote | ||
|
||
from brownie.network.transaction import TransactionReceipt | ||
from utils.agent import agent_forward | ||
from utils.mainnet_fork import pass_and_exec_dao_vote | ||
|
||
# Oracle sanity checker params | ||
|
||
NEW_INITIAL_SLASHING_AMOUNT_PWEI = 8 | ||
UNCHANGED_INACTIVITY_PENATIES_AMOUNT_PWEI = 101 | ||
NEW_EXITED_VALIDATORS_PER_DAY_LIMIT = 3600 | ||
NEW_APPEARED_VALIDATORS_PER_DAY_LIMIT = 1800 | ||
|
||
description = """ | ||
""" | ||
|
||
|
||
def start_vote(tx_params: Dict[str, str], silent: bool) -> Tuple[int, Optional[TransactionReceipt]]: | ||
"""Prepare and run voting.""" | ||
|
||
vote_desc_items, call_script_items = zip( | ||
( | ||
"1) Grant role `EXITED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` role to Aragon Agent on `OracleReportSanityChecker` contract", | ||
agent_forward( | ||
[ | ||
encode_oz_grant_role( | ||
contract=contracts.oracle_report_sanity_checker, | ||
role_name="EXITED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE", | ||
grant_to=contracts.agent, | ||
) | ||
] | ||
), | ||
), | ||
( | ||
"2) Set `exitedValidatorsPerDayLimit` sanity checker parameter to 3600", | ||
agent_forward( | ||
[ | ||
( | ||
contracts.oracle_report_sanity_checker.address, | ||
contracts.oracle_report_sanity_checker.setExitedValidatorsPerDayLimit.encode_input( | ||
NEW_EXITED_VALIDATORS_PER_DAY_LIMIT | ||
), | ||
), | ||
] | ||
), | ||
), | ||
( | ||
"3. Revoke role `EXITED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` on `OracleReportSanityChecker` from Aragon Agent", | ||
agent_forward( | ||
[ | ||
encode_oz_revoke_role( | ||
contract=contracts.oracle_report_sanity_checker, | ||
role_name="EXITED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE", | ||
revoke_from=contracts.agent, | ||
) | ||
] | ||
), | ||
), | ||
( | ||
"4) Grant role `APPEARED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` role to Aragon Agent on `OracleReportSanityChecker` contract", | ||
agent_forward( | ||
[ | ||
encode_oz_grant_role( | ||
contract=contracts.oracle_report_sanity_checker, | ||
role_name="APPEARED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE", | ||
grant_to=contracts.agent, | ||
) | ||
] | ||
), | ||
), | ||
( | ||
"5) Set `appearedValidatorsPerDayLimit` sanity checker parameter to 1800", | ||
agent_forward( | ||
[ | ||
( | ||
contracts.oracle_report_sanity_checker.address, | ||
contracts.oracle_report_sanity_checker.setAppearedValidatorsPerDayLimit.encode_input( | ||
NEW_APPEARED_VALIDATORS_PER_DAY_LIMIT | ||
), | ||
), | ||
] | ||
), | ||
), | ||
( | ||
"6) Revoke role `APPEARED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE` on `OracleReportSanityChecker` from Aragon Agent", | ||
agent_forward( | ||
[ | ||
encode_oz_revoke_role( | ||
contract=contracts.oracle_report_sanity_checker, | ||
role_name="APPEARED_VALIDATORS_PER_DAY_LIMIT_MANAGER_ROLE", | ||
revoke_from=contracts.agent, | ||
) | ||
] | ||
), | ||
), | ||
( | ||
"7) Grant role `INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE` role to Aragon Agent on `OracleReportSanityChecker` contract", | ||
agent_forward( | ||
[ | ||
encode_oz_grant_role( | ||
contract=contracts.oracle_report_sanity_checker, | ||
role_name="INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE", | ||
grant_to=contracts.agent, | ||
) | ||
] | ||
), | ||
), | ||
( | ||
"8) Set `initialSlashingAmountPWei` sanity checker parameter to 8", | ||
agent_forward( | ||
[ | ||
( | ||
contracts.oracle_report_sanity_checker.address, | ||
contracts.oracle_report_sanity_checker.setInitialSlashingAndPenaltiesAmount.encode_input( | ||
NEW_INITIAL_SLASHING_AMOUNT_PWEI, | ||
UNCHANGED_INACTIVITY_PENATIES_AMOUNT_PWEI, | ||
), | ||
), | ||
] | ||
), | ||
), | ||
( | ||
"9) Revoke role `INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE` on `OracleReportSanityChecker` from Aragon Agent", | ||
agent_forward( | ||
[ | ||
encode_oz_revoke_role( | ||
contract=contracts.oracle_report_sanity_checker, | ||
role_name="INITIAL_SLASHING_AND_PENALTIES_MANAGER_ROLE", | ||
revoke_from=contracts.agent, | ||
) | ||
] | ||
), | ||
), | ||
) | ||
|
||
vote_items = bake_vote_items(list(vote_desc_items), list(call_script_items)) | ||
|
||
if silent: | ||
desc_ipfs = calculate_vote_ipfs_description(description) | ||
else: | ||
desc_ipfs = upload_vote_ipfs_description(description) | ||
|
||
return confirm_vote_script(vote_items, silent, desc_ipfs) and list( | ||
create_vote(vote_items, tx_params, desc_ipfs=desc_ipfs) | ||
) | ||
|
||
|
||
def main(): | ||
tx_params = {"from": get_deployer_account()} | ||
|
||
if get_is_live(): | ||
tx_params["priority_fee"] = get_priority_fee() | ||
|
||
vote_id, _ = start_vote(tx_params=tx_params, silent=False) | ||
|
||
vote_id >= 0 and print(f"Vote created: {vote_id}.") | ||
|
||
time.sleep(5) # hack for waiting thread #2. | ||
|
||
|
||
def start_and_execute_vote_on_fork(): | ||
if get_is_live(): | ||
raise Exception("This script is for local testing only.") | ||
|
||
tx_params = {"from": get_deployer_account()} | ||
vote_id, _ = start_vote(tx_params=tx_params, silent=True) | ||
|
||
time.sleep(5) # hack for waiting thread #2. | ||
|
||
print(f"Vote created: {vote_id}.") | ||
pass_and_exec_dao_vote(int(vote_id)) |
Oops, something went wrong.