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 2023-11-07 #190

Merged
merged 27 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
13ef4db
add draft script and tests to remove 3 easy track factories for RCC, …
kovalgek Oct 20, 2023
a24f584
add script and tests for new factories but with old addresses
kovalgek Oct 20, 2023
a68403d
add usdt and usdc permissions
kovalgek Oct 25, 2023
13af5d4
test: fix negative report test cases
TheDZhon Oct 25, 2023
eb4ebf5
test: fix vebo and ao edge cases
TheDZhon Oct 25, 2023
6bcefd5
add balance limit tests
kovalgek Oct 25, 2023
7e3a825
check registry limits
kovalgek Oct 25, 2023
7a24f24
change node operator name
kovalgek Oct 25, 2023
b5074e5
add stETH to registries
kovalgek Oct 25, 2023
7fd8f52
refactoring + remove node renaming
kovalgek Oct 26, 2023
4604658
fixes: additional check for registiries, steth from agent to rcc, pml…
kovalgek Oct 27, 2023
f8c36ea
update fabric addresses, fix tests
kovalgek Oct 27, 2023
e97169a
update description
kovalgek Oct 30, 2023
9c05fea
remove factories, add node renaming
kovalgek Oct 31, 2023
36dc722
update description, fix tests
kovalgek Oct 31, 2023
616b3b3
fix tests for correct events when forward agent node renaming
kovalgek Oct 31, 2023
4bb7951
add node operator number
kovalgek Oct 31, 2023
58335cd
update steth amounts
kovalgek Oct 31, 2023
4923cf6
update timeout gas limit
bulbozaur Oct 31, 2023
c8ab7ff
fix gas limit
bulbozaur Oct 31, 2023
92904d3
reject and archive voting
kovalgek Nov 3, 2023
66e0be4
add new voting with node 27 renaming and top up ballance of RCC, PML,…
kovalgek Nov 7, 2023
bef5ec5
fix lido validator test
kovalgek Nov 7, 2023
a928251
update description
kovalgek Nov 7, 2023
65b6825
update vyper version to 0.3.7 in contracts
kovalgek Nov 7, 2023
439f7eb
fix events parsing
bulbozaur Nov 7, 2023
edcd94c
mark and move vote to archive
kovalgek Nov 10, 2023
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
109 changes: 109 additions & 0 deletions archive/scripts/vote_2023_10_31.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
"""
Voting 31/10/2023.

I. stETH transfers to RCC PML ATC
1. Transfer 279 stETH to RCC 0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437
2. Transfer 447 stETH to PML 0x17F6b2C738a63a8D3A113a228cfd0b373244633D
3. Transfer 391 stETH to ATC 0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956

II. Change the on-chain name of node operator with id 27 from 'Prysmatic Labs' to 'Prysm Team at Offchain Labs'
4. Change node operator name from Prysmatic Labs to Prysm Team at Offchain Labs

The vote REJECTED.
"""

import time

from typing import Dict
from brownie import interface
from brownie.network.transaction import TransactionReceipt
from utils.agent import agent_forward
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.node_operators import encode_set_node_operator_name
from utils.finance import make_steth_payout
from utils.config import (
contracts,
get_deployer_account,
get_is_live,
get_priority_fee,
)

description = """
### Omnibus on-chain vote contains:

1. stETH transfer to the [Lido Contributors Group multisigs](https://research.lido.fi/t/ref-introducing-the-lido-contributors-group-including-pool-maintenance-labs-and-argo-technology-consulting/3069) ([RCC](https://app.safe.global/settings/setup?safe=eth:0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437), [PML](https://app.safe.global/settings/setup?safe=eth:0x17F6b2C738a63a8D3A113a228cfd0b373244633D), and [ATC](https://app.safe.global/settings/setup?safe=eth:0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956)), as previously [requested on the forum](https://research.lido.fi/t/lido-v2-may-1-2023-december-31-2023-lido-ongoing-grant-request/4476/11). Items 1-3.
2. Changing the Node Operator's (#id - 27) name, as [requested on the forum](https://research.lido.fi/t/node-operator-registry-name-reward-address-change/4170/16). Item 4.
"""

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

rcc_multisig_address = "0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437"
pml_multisig_address = "0x17F6b2C738a63a8D3A113a228cfd0b373244633D"
atc_multisig_address = "0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956"

NO_registry = interface.NodeOperatorsRegistry(contracts.node_operators_registry)
prysmatic_labs_node_id = 27
prysmatic_labs_node_new_name = "Prysm Team at Offchain Labs"

call_script_items = [
# I. stETH transfers to RCC PML ATC
# 1. Transfer 279 stETH to RCC 0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437
make_steth_payout(
target_address=rcc_multisig_address,
steth_in_wei=279 * (10**18),
reference="Fund RCC multisig"
),
# 2. Transfer 447 stETH to PML 0x17F6b2C738a63a8D3A113a228cfd0b373244633D
make_steth_payout(
target_address=pml_multisig_address,
steth_in_wei=447 * (10**18),
reference="Fund PML multisig"
),
# 3. Transfer 391 stETH to ATC 0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956
make_steth_payout(
target_address=atc_multisig_address,
steth_in_wei=391 * (10**18),
reference="Fund ATC multisig"
),
# II. Change the on-chain name of node operator with id 27 from 'Prysmatic Labs' to 'Prysm Team at Offchain Labs'
# 4. Change node operator #27 name from `Prysmatic Labs` to `Prysm Team at Offchain Labs`
agent_forward([
encode_set_node_operator_name(
prysmatic_labs_node_id,
prysmatic_labs_node_new_name,
NO_registry
)
])
]

vote_desc_items = [
f"1) Transfer 279 stETH to RCC 0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437",
f"2) Transfer 447 stETH to PML 0x17F6b2C738a63a8D3A113a228cfd0b373244633D",
f"3) Transfer 391 stETH to ATC 0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956",
f"4) Change the on-chain name of node operator with id 27 from 'Prysmatic Labs' to 'Prysm Team at Offchain Labs'",
]

vote_items = bake_vote_items(vote_desc_items, 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.
111 changes: 111 additions & 0 deletions archive/scripts/vote_2023_11_07.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
"""
Voting 07/11/2023.

I. stETH transfers to RCC PML ATC
1. Transfer 272 stETH to RCC 0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437
2. Transfer 434 stETH to PML 0x17F6b2C738a63a8D3A113a228cfd0b373244633D
3. Transfer 380 stETH to ATC 0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956

II. Change the on-chain name of node operator with id 27 from 'Prysmatic Labs' to 'Prysm Team at Offchain Labs'
4. Change node operator name from Prysmatic Labs to Prysm Team at Offchain Labs

Vote passed & executed on Nov-10-2023 02:43:23 PM +UTC, block 18542216
"""

import time

from typing import Dict
from brownie import interface
from brownie.network.transaction import TransactionReceipt
from utils.agent import agent_forward
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.node_operators import encode_set_node_operator_name
from utils.finance import make_steth_payout
from utils.config import (
contracts,
get_deployer_account,
get_is_live,
get_priority_fee,
)

description = """
### Omnibus on-chain vote contains:

1. stETH transfer to the [Lido Contributors Group multisigs](https://research.lido.fi/t/ref-introducing-the-lido-contributors-group-including-pool-maintenance-labs-and-argo-technology-consulting/3069) ([RCC](https://app.safe.global/settings/setup?safe=eth:0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437), [PML](https://app.safe.global/settings/setup?safe=eth:0x17F6b2C738a63a8D3A113a228cfd0b373244633D), and [ATC](https://app.safe.global/settings/setup?safe=eth:0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956)), as previously [requested on the forum](https://research.lido.fi/t/lido-v2-may-1-2023-december-31-2023-lido-ongoing-grant-request/4476/11). Items 1-3.
2. Changing the Node Operator's (#id - 27) name, as [requested on the forum](https://research.lido.fi/t/node-operator-registry-name-reward-address-change/4170/16). Item 4.

That's a rerun of [vote #166](https://vote.lido.fi/vote/166).
"""

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

rcc_multisig_address = "0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437"
pml_multisig_address = "0x17F6b2C738a63a8D3A113a228cfd0b373244633D"
atc_multisig_address = "0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956"

NO_registry = interface.NodeOperatorsRegistry(contracts.node_operators_registry)
prysmatic_labs_node_id = 27
prysmatic_labs_node_new_name = "Prysm Team at Offchain Labs"

call_script_items = [
# I. stETH transfers to RCC PML ATC
# 1. Transfer 272 stETH to RCC 0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437
make_steth_payout(
target_address=rcc_multisig_address,
steth_in_wei=272 * (10**18),
reference="Fund RCC multisig"
),
# 2. Transfer 434 stETH to PML 0x17F6b2C738a63a8D3A113a228cfd0b373244633D
make_steth_payout(
target_address=pml_multisig_address,
steth_in_wei=434 * (10**18),
reference="Fund PML multisig"
),
# 3. Transfer 380 stETH to ATC 0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956
make_steth_payout(
target_address=atc_multisig_address,
steth_in_wei=380 * (10**18),
reference="Fund ATC multisig"
),
# II. Change the on-chain name of node operator with id 27 from 'Prysmatic Labs' to 'Prysm Team at Offchain Labs'
# 4. Change node operator #27 name from `Prysmatic Labs` to `Prysm Team at Offchain Labs`
agent_forward([
encode_set_node_operator_name(
prysmatic_labs_node_id,
prysmatic_labs_node_new_name,
NO_registry
)
])
]

vote_desc_items = [
f"1) Transfer 272 stETH to RCC 0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437",
f"2) Transfer 434 stETH to PML 0x17F6b2C738a63a8D3A113a228cfd0b373244633D",
f"3) Transfer 380 stETH to ATC 0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956",
f"4) Change the on-chain name of node operator with id 27 from 'Prysmatic Labs' to 'Prysm Team at Offchain Labs'",
]

vote_items = bake_vote_items(vote_desc_items, 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.
100 changes: 100 additions & 0 deletions archive/tests/test_2023_10_31.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"""
Tests for voting 31/10/2023

"""

from scripts.vote_2023_10_31 import start_vote
from brownie import interface
from utils.test.tx_tracing_helpers import *
from utils.test.event_validators.payout import (
Payout,
validate_token_payout_event
)
from utils.test.event_validators.permission import Permission
from utils.test.event_validators.node_operators_registry import (
validate_node_operator_name_set_event,
NodeOperatorNameSetItem,
)
from utils.config import (
contracts,
LDO_HOLDER_ADDRESS_FOR_TESTS,
LIDO,
AGENT
)

def test_vote(
helpers,
accounts,
vote_ids_from_env
):
rcc_multisig_address = "0xDE06d17Db9295Fa8c4082D4f73Ff81592A3aC437"
pml_multisig_address = "0x17F6b2C738a63a8D3A113a228cfd0b373244633D"
atc_multisig_address = "0x9B1cebF7616f2BC73b47D226f90b01a7c9F86956"

rcc_multisig_balance_before = contracts.lido.balanceOf(rcc_multisig_address)
pml_multisig_balance_before = contracts.lido.balanceOf(pml_multisig_address)
atc_multisig_balance_before = contracts.lido.balanceOf(atc_multisig_address)
dao_balance_before = contracts.lido.balanceOf(AGENT)

NO_registry = interface.NodeOperatorsRegistry(contracts.node_operators_registry)
prysmatic_labs_node_id = 27
prysmatic_labs_node_old_name = "Prysmatic Labs"
prysmatic_labs_node_new_name = "Prysm Team at Offchain Labs"
prysmatic_labs_node_data_before_voting = NO_registry.getNodeOperator(prysmatic_labs_node_id, True)

# Check node operator name before
assert prysmatic_labs_node_data_before_voting["name"] == prysmatic_labs_node_old_name, "Incorrect NO#27 name before"

# START VOTE
if len(vote_ids_from_env) > 0:
(vote_id,) = vote_ids_from_env
else:
tx_params = {"from": LDO_HOLDER_ADDRESS_FOR_TESTS}
vote_id, _ = start_vote(tx_params, silent=True)

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

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

rcc_multisig_balance_after = contracts.lido.balanceOf(rcc_multisig_address)
pml_multisig_balance_after = contracts.lido.balanceOf(pml_multisig_address)
atc_multisig_balance_after = contracts.lido.balanceOf(atc_multisig_address)
dao_balance_after = contracts.lido.balanceOf(AGENT)

rcc_fund_payout = Payout(token_addr=LIDO, from_addr=contracts.agent, to_addr=rcc_multisig_address, amount=279 * (10**18))
pml_fund_payout = Payout(token_addr=LIDO, from_addr=contracts.agent, to_addr=pml_multisig_address, amount=447 * (10**18))
atc_fund_payout = Payout(token_addr=LIDO, from_addr=contracts.agent, to_addr=atc_multisig_address, amount=391 * (10**18))

steth_balance_checker(rcc_multisig_balance_after - rcc_multisig_balance_before, rcc_fund_payout.amount)
steth_balance_checker(pml_multisig_balance_after - pml_multisig_balance_before, pml_fund_payout.amount)
steth_balance_checker(atc_multisig_balance_after - atc_multisig_balance_before, atc_fund_payout.amount)
steth_balance_checker(dao_balance_before - dao_balance_after, rcc_fund_payout.amount + pml_fund_payout.amount + atc_fund_payout.amount)

# node operator name
prysmatic_labs_node_data_after_voting = NO_registry.getNodeOperator(prysmatic_labs_node_id, True)

assert prysmatic_labs_node_data_before_voting["active"] == prysmatic_labs_node_data_after_voting["active"]
assert prysmatic_labs_node_data_after_voting["name"] == prysmatic_labs_node_new_name, "Incorrect NO#27 name after"
assert prysmatic_labs_node_data_before_voting["rewardAddress"] == prysmatic_labs_node_data_after_voting["rewardAddress"]
compare_NO_validators_data(prysmatic_labs_node_data_before_voting, prysmatic_labs_node_data_after_voting)

# validate vote events
assert count_vote_items_by_events(vote_tx, contracts.voting) == 4, "Incorrect voting items count"

display_voting_events(vote_tx)

evs = group_voting_events(vote_tx)

validate_token_payout_event(evs[0], rcc_fund_payout, True)
validate_token_payout_event(evs[1], pml_fund_payout, True)
validate_token_payout_event(evs[2], atc_fund_payout, True)
validate_node_operator_name_set_event(evs[3], NodeOperatorNameSetItem(nodeOperatorId=prysmatic_labs_node_id, name=prysmatic_labs_node_new_name))

def steth_balance_checker(lhs_value: int, rhs_value: int):
assert (lhs_value + 5) // 10 == (rhs_value + 5) // 10

def compare_NO_validators_data(data_before, data_after):
assert data_before["totalVettedValidators"] == data_after["totalVettedValidators"]
assert data_before["totalExitedValidators"] == data_after["totalExitedValidators"]
assert data_before["totalAddedValidators"] == data_after["totalAddedValidators"]
assert data_before["totalDepositedValidators"] == data_after["totalDepositedValidators"]
Loading