Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions configs/config_mainnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@

# OracleReportSanityChecker
ORACLE_REPORT_SANITY_CHECKER = "0x6232397ebac4f5772e53285B26c47914E9461E75"
APPEARED_VALIDATORS_PER_DAY_LIMIT = 43200
EXITED_VALIDATORS_PER_DAY_LIMIT = 9000
APPEARED_VALIDATORS_PER_DAY_LIMIT = 1800
EXITED_VALIDATORS_PER_DAY_LIMIT = 3600
ANNUAL_BALANCE_INCREASE_BP_LIMIT = 1000 # 10%
SIMULATED_SHARE_RATE_DEVIATION_BP_LIMIT = 50 # 0.5%
MAX_VALIDATOR_EXIT_REQUESTS_PER_REPORT = 600
MAX_ITEMS_PER_EXTRA_DATA_TRANSACTION = 8
MAX_NODE_OPERATORS_PER_EXTRA_DATA_ITEM = 24
REQUEST_TIMESTAMP_MARGIN = 7680 # 2 hours rounded to epoch length
MAX_POSITIVE_TOKEN_REBASE = 750000
INITIAL_SLASHING_AMOUNT_PWEI = 1000
INITIAL_SLASHING_AMOUNT_PWEI = 8
INACTIVITY_PENALTIES_AMOUNT_PWEI = 101
CL_BALANCE_ORACLES_ERROR_UPPER_BP_LIMIT = 50

Expand Down
203 changes: 203 additions & 0 deletions scripts/after_pectra_upgrade.py
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))
Loading
Loading