-
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.
add new voting with node 27 renaming and top up ballance of RCC, PML,…
… ATC
- Loading branch information
Showing
2 changed files
with
209 additions
and
0 deletions.
There are no files selected for viewing
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,109 @@ | ||
""" | ||
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 | ||
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 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. |
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,100 @@ | ||
""" | ||
Tests for voting 07/11/2023 | ||
""" | ||
|
||
from scripts.vote_2023_11_07 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=272 * (10**18)) | ||
pml_fund_payout = Payout(token_addr=LIDO, from_addr=contracts.agent, to_addr=pml_multisig_address, amount=434 * (10**18)) | ||
atc_fund_payout = Payout(token_addr=LIDO, from_addr=contracts.agent, to_addr=atc_multisig_address, amount=380 * (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"] |