Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vote 08.10.2024 #253

Merged
merged 65 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
dbbf25a
upgrade L1 optimism bridge
kovalgek Apr 8, 2024
b181576
add optimism contracts upgrade actions
kovalgek Apr 8, 2024
1e712fe
feat: mvp code to run the voting on Sepolia
arwer13 Jul 3, 2024
e818d6a
fix l2 actions, add function to run vote for fork
kovalgek Jul 24, 2024
5298b0d
add upgrade finalization to l1, l2 bridges and l2 wstETH
kovalgek Jul 24, 2024
b979169
add tests
kovalgek Jul 26, 2024
8e7a763
add tests for oracle report and token rate notifier
kovalgek Aug 1, 2024
e51378f
fix small comments
kovalgek Aug 1, 2024
e5b453c
rename files
kovalgek Aug 8, 2024
4277d8f
disable tests for mainnet that are for sepolia state only, rename files
kovalgek Aug 9, 2024
c7375e1
feat(stETH on optimism): add fallback vote script for enabling deposits
arwer13 Aug 22, 2024
56b9b02
feat(stETH on optimism): add mvp of the upgrade script
arwer13 Aug 24, 2024
1598211
feat(stETH on optimism): add fallback vote script if L2 upgrade fails
arwer13 Aug 24, 2024
f8ac524
fix: import brownie to mitigate reverts failure
TheDZhon Sep 12, 2024
5765220
fix voting for executing on forks
kovalgek Sep 12, 2024
16537ad
top up contract balances for london hardfork
kovalgek Sep 13, 2024
abdaa2d
top up balances in fixtures
kovalgek Sep 16, 2024
d752529
use middleware to top up balances
kovalgek Sep 16, 2024
befebcb
fix typo
kovalgek Sep 17, 2024
126a1f1
fix constants
kovalgek Sep 17, 2024
1cb3aad
update description and voting text
kovalgek Sep 18, 2024
4568af1
fix test by considering gas usage in tx
kovalgek Sep 20, 2024
b27f41f
add pause and resume help methods
kovalgek Sep 20, 2024
77fd946
fix el reward test by considering gas usage in tx
kovalgek Sep 20, 2024
a678104
remove block check in snapshot test
kovalgek Sep 20, 2024
7eae83f
feat: use london hardfork for mainnet-fork instead of istanbul
Ivan-Feofanov Sep 26, 2024
88d2504
increase precision to fix the test
kovalgek Sep 27, 2024
235e523
fix: use common hardhat and anvil setBalance method
Ivan-Feofanov Sep 27, 2024
579efae
remove comment
kovalgek Sep 30, 2024
a44e546
Merge pull request #245 from lidofinance/feat/vote-steth-optimism
Ivan-Feofanov Sep 30, 2024
ce0346d
raise large action timeout to 2h 30min
Ivan-Feofanov Sep 30, 2024
b80febb
fix: node operator 33 is not exited anymore
Ivan-Feofanov Sep 30, 2024
7129442
fix: load TokenRateNotifier contract to catch error
Ivan-Feofanov Oct 1, 2024
82139e4
Merge pull request #256 from lidofinance/feat/next-vote_fix-trn-error
Ivan-Feofanov Oct 1, 2024
a84843f
Merge branch 'master' into feat/next-vote
Ivan-Feofanov Oct 1, 2024
27ce7d6
refactor steth vote script
kovalgek Oct 2, 2024
b878488
move check functions to tests, don't use addresses from config file
kovalgek Oct 2, 2024
9922c51
Merge pull request #258 from lidofinance/feat/steth_op_vote_refactoring
Ivan-Feofanov Oct 3, 2024
105d8a1
fix: get last exited validator index from the network to avoid real w…
Ivan-Feofanov Oct 3, 2024
93c2688
alliance vote and tests blocks added
kate-aleksseeva Oct 3, 2024
e5329bf
vote description fixed
kate-aleksseeva Oct 3, 2024
75f85a8
check all events
kovalgek Oct 3, 2024
3823533
small refactoring
kovalgek Oct 3, 2024
e2ea68b
Merge pull request #261 from lidofinance/feat/check_events_in_steth_o…
Ivan-Feofanov Oct 3, 2024
298bb79
Merge branch 'feat/next-vote' into feat/next-vote-alliance
Ivan-Feofanov Oct 4, 2024
3f57a0f
feat: balance check
Ivan-Feofanov Oct 4, 2024
be96b7e
Merge pull request #259 from lidofinance/feat/next-vote-alliance
Ivan-Feofanov Oct 4, 2024
db1e7b4
description is changed, contract addresses for tests added, displayin…
kate-aleksseeva Oct 4, 2024
7ee676a
use for wstETH on L2 version instead of
kovalgek Oct 4, 2024
de6ac45
fix: temporary disable easy-track snapshot test
Ivan-Feofanov Oct 4, 2024
7899b5c
Merge pull request #262 from lidofinance/feat/fix_l2_wst_version
Ivan-Feofanov Oct 4, 2024
451bbb9
fix: update metadata CID
Ivan-Feofanov Oct 4, 2024
62f1b71
call optimism portal to load events
kovalgek Oct 6, 2024
05a6e54
Merge pull request #263 from lidofinance/feat/optimism_event
kovalgek Oct 7, 2024
e3c856e
feedback fixes
kovalgek Oct 7, 2024
b47e4ae
Merge pull request #264 from lidofinance/feat/steth-on-op-feedback
kovalgek Oct 8, 2024
6d077bf
fix feedback part 2
kovalgek Oct 8, 2024
d3d1798
fix test
kovalgek Oct 8, 2024
d0929c7
Merge pull request #266 from lidofinance/feat/steth-on-op-feedback2
Psirex Oct 8, 2024
b1170bd
use env to setup vote id in fork upgrade rehearsal
kovalgek Oct 8, 2024
5b5100d
fix getting env
kovalgek Oct 11, 2024
488b2a1
Merge pull request #267 from lidofinance/feat/steth-on-op-improve-for…
kovalgek Oct 11, 2024
83c6a8c
fix: return EasyTrack check
Ivan-Feofanov Oct 14, 2024
f9371c5
feat: archive 2024_10_08 upgrade files
arwer13 Oct 14, 2024
e0495ee
Merge pull request #272 from lidofinance/feat/archive-upgrade-2024_10_08
Ivan-Feofanov Oct 14, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/large_vote_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run-tests-large:
name: Brownie fork LARGE tests
runs-on: [protocol-heavy-runners]
timeout-minutes: 100
timeout-minutes: 150
steps:
- uses: actions/checkout@v3
- name: Main action
Expand Down
64 changes: 64 additions & 0 deletions archive/scripts/fallback_2024_10_08_enable_deposits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""
Fallback voting xx/xx/2024.

1. Enable deposits on Optimism L1 Token Bridge

"""
import time
from brownie import interface
from typing import Dict
from brownie.network.transaction import TransactionReceipt
from utils.voting import bake_vote_items, confirm_vote_script, create_vote
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description
from utils.agent import agent_forward
from utils.config import (
get_deployer_account,
get_is_live,
get_priority_fee,
L1_OPTIMISM_TOKENS_BRIDGE,
)

description = """
Fallback voting xx/xx/2024.

Enable deposits on Optimism L1 Token Bridge

"""


def start_vote(tx_params: Dict[str, str], silent: bool) -> bool | list[int | TransactionReceipt | None]:
"""Prepare and run voting."""

l1_token_bridge = interface.L1LidoTokensBridge(L1_OPTIMISM_TOKENS_BRIDGE)

call_script_items = [
# 1. Enable deposits on Optimism L1 Token Bridge
agent_forward([(l1_token_bridge.address, l1_token_bridge.enableDeposits.encode_input())]),
]

vote_desc_items = [
"1) Enable deposits on Optimism L1 Token Bridge",
]

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.
101 changes: 101 additions & 0 deletions archive/scripts/fallback_2024_10_08_rollback_l1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"""
Rollback voting if L2 part of the upgrade failed.

TODO

"""

import time
import eth_abi
from brownie import interface, web3
from typing import Dict
from brownie.network.transaction import TransactionReceipt
from utils.voting import bake_vote_items, confirm_vote_script, create_vote
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description
from utils.agent import agent_forward
from utils.config import (
get_deployer_account,
get_is_live,
get_priority_fee,
L1_OPTIMISM_CROSS_DOMAIN_MESSENGER,
L1_EMERGENCY_BRAKES_MULTISIG,
LIDO_LOCATOR,
LIDO_LOCATOR_IMPL,
L1_OPTIMISM_TOKENS_BRIDGE,
L1_OPTIMISM_TOKENS_BRIDGE_IMPL,
)


DESCRIPTION = """

Upgrade back L1Bridge, LidoLocator and revokeRole for deposit pause on L1Bridge

"""

DEPOSITS_ENABLER_ROLE = "0x4b43b36766bde12c5e9cbbc37d15f8d1f769f08f54720ab370faeb4ce893753a"

def start_vote(tx_params: Dict[str, str], silent: bool) -> bool | list[int | TransactionReceipt | None]:
"""Prepare and run voting."""

l1_token_bridge_as_proxy = interface.OssifiableProxy(L1_OPTIMISM_TOKENS_BRIDGE)
lido_locator_as_proxy = interface.OssifiableProxy(LIDO_LOCATOR)
l1_token_bridge = interface.L1LidoTokensBridge(L1_OPTIMISM_TOKENS_BRIDGE)

call_script_items = [
# 1. L1 TokenBridge upgrade proxy
agent_forward(
[
(
l1_token_bridge_as_proxy.address,
l1_token_bridge_as_proxy.proxy__upgradeTo.encode_input(L1_OPTIMISM_TOKENS_BRIDGE_IMPL),
)
]
),
# 2. Rollback L1 LidoLocator implementation
agent_forward(
[
(
lido_locator_as_proxy.address,
lido_locator_as_proxy.proxy__upgradeTo.encode_input(LIDO_LOCATOR_IMPL),
)
]
),
# 3. Revoke DEPOSITS_ENABLER_ROLE for Emergency Brakes Committee multisig
agent_forward(
[
(
l1_token_bridge.address,
l1_token_bridge.revokeRole.encode_input(DEPOSITS_ENABLER_ROLE, L1_EMERGENCY_BRAKES_MULTISIG),
)
]
),
]

vote_desc_items = [
"1) Rollback Optimism L1 Bridge implementation",
"2) Upgrade LidoLocator implementation",
"3) Revoke DEPOSITS_ENABLER_ROLE from Emergency Brakes Committee multisig",
]

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.
85 changes: 85 additions & 0 deletions archive/scripts/fork_utils_2024_10_08.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import time
import os
from scripts.upgrade_2024_10_08 import start_vote
from brownie import interface, accounts, network
from tests.conftest import Helpers
from utils.config import (
contracts,
get_deployer_account,
get_is_live,
get_priority_fee,
network_name,
L1_OPTIMISM_TOKENS_BRIDGE,
AGENT
)

ENV_OMNIBUS_VOTE_IDS = "OMNIBUS_VOTE_IDS"

def pause_deposits():
if not network_name() in ("mainnet-fork",):
return

network.gas_price("2 gwei")

accounts[0].transfer(AGENT, "2 ethers")

l1_token_bridge = interface.L1LidoTokensBridge(L1_OPTIMISM_TOKENS_BRIDGE)
agent = accounts.at(AGENT, force=True)
l1_token_bridge.disableDeposits({"from": agent})
assert not l1_token_bridge.isDepositsEnabled()

def resume_deposits():
if not network_name() in ("mainnet-fork",):
return

network.gas_price("2 gwei")

accounts[0].transfer(AGENT, "2 ethers")

l1_token_bridge = interface.L1LidoTokensBridge(L1_OPTIMISM_TOKENS_BRIDGE)
agent = accounts.at(AGENT, force=True)
l1_token_bridge.enableDeposits({"from": agent})
assert l1_token_bridge.isDepositsEnabled()

def start_and_execute_for_fork_upgrade():
if not network_name() in ("mainnet-fork",):
return

l1_token_bridge = interface.L1LidoTokensBridge(L1_OPTIMISM_TOKENS_BRIDGE)
if l1_token_bridge.isDepositsEnabled():
pause_deposits()

deployerAccount = get_deployer_account()

# Top up accounts
accounts[0].transfer(AGENT, "2 ethers")
accounts[0].transfer(deployerAccount.address, "2 ethers")

tx_params = {"from": deployerAccount}
if get_is_live():
tx_params["priority_fee"] = get_priority_fee()

if len(vote_ids_from_env()) > 0:
vote_id = vote_ids_from_env()[0]
else:
vote_id, _ = start_vote(tx_params=tx_params, silent=True)

vote_tx = Helpers.execute_vote(accounts, vote_id, contracts.voting)

print(f"voteId = {vote_id}, gasUsed = {vote_tx.gas_used}")

vote_id >= 0 and print(f"Vote created: {vote_id}.")

time.sleep(5) # hack for waiting thread #2.

def vote_ids_from_env() -> [int]:
if os.getenv(ENV_OMNIBUS_VOTE_IDS):
try:
vote_ids_str = os.getenv(ENV_OMNIBUS_VOTE_IDS)
vote_ids = [int(s) for s in vote_ids_str.split(",")]
print(f"OMNIBUS_VOTE_IDS env var is set, using existing votes {vote_ids}")
return vote_ids
except:
pass

return []
Loading
Loading