Skip to content

Commit

Permalink
Merge pull request #194 from lidofinance/vote_2024_01_16
Browse files Browse the repository at this point in the history
Vote 2024-01-16 & 2024-01-23
  • Loading branch information
Psirex authored Jan 29, 2024
2 parents d03210d + ea13519 commit c3dad6b
Show file tree
Hide file tree
Showing 15 changed files with 2,708 additions and 11 deletions.
452 changes: 452 additions & 0 deletions archive/scripts/vote_2024_01_16.py

Large diffs are not rendered by default.

452 changes: 452 additions & 0 deletions archive/scripts/vote_2024_01_23.py

Large diffs are not rendered by default.

836 changes: 836 additions & 0 deletions archive/tests/test_2024_01_16.py

Large diffs are not rendered by default.

836 changes: 836 additions & 0 deletions archive/tests/test_2024_01_23.py

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions configs/config_mainnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"0x637572617465642d6f6e636861696e2d76310000000000000000000000000000"
)
CURATED_STAKING_MODULE_OPERATORS_COUNT = 39
CURATED_STAKING_MODULE_OPERATORS_ACTIVE_COUNT = 39
CURATED_STAKING_MODULE_OPERATORS_ACTIVE_COUNT = 37

# OracleDaemonConfig
ORACLE_DAEMON_CONFIG = "0xbf05A929c3D7885a6aeAd833a992dA6E5ac23b09"
Expand Down Expand Up @@ -195,14 +195,15 @@
ORACLE_QUORUM = 5
ORACLE_COMMITTEE = (
"0x140Bd8FbDc884f48dA7cb1c09bE8A2fAdfea776E",
"0x1d0813bf088BE3047d827D98524fBf779Bc25F00",
# "0x1d0813bf088BE3047d827D98524fBf779Bc25F00", Excluded from members in vote 2024/01/16
"0xA7410857ABbf75043d61ea54e07D57A6EB6EF186",
"0x404335BcE530400a5814375E7Ec1FB55fAff3eA2",
"0x946D3b081ed19173dC83Cd974fC69e1e760B7d78",
"0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5",
"0xEC4BfbAF681eb505B94E4a7849877DC6c600Ca3A",
"0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8",
"0x1Ca0fEC59b86F549e1F1184d97cb47794C8Af58d",
"0xA7410857ABbf75043d61ea54e07D57A6EB6EF186",
"0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf", # Added into members in vote 2024/01/16
)

# WithdrawalQueueERC721
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/test_accounting_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ def test_accounting_hash_consensus(contract):
assert consensus.getQuorum() == ORACLE_QUORUM

members = consensus.getMembers()
assert members["addresses"] == ORACLE_COMMITTEE
assert sorted(members["addresses"]) == sorted(ORACLE_COMMITTEE)
2 changes: 1 addition & 1 deletion tests/acceptance/test_accounting_oracle_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def aragon_agent() -> Account:
return contracts.agent


@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def consensus_member():
return accounts.at(
contracts.hash_consensus_for_accounting_oracle.getFastLaneMembers()[0][0],
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/test_node_operators_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_nor_state(contract):
for id in range(node_operators_count):
node_operator = contract.getNodeOperator(id, True)

deactivated_node_operators = []
deactivated_node_operators = [12, 1] # on vote 24-01-16

assert node_operator["active"] == (id not in deactivated_node_operators)
assert node_operator["name"] is not None
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/test_veb_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ def test_vebo_hash_consensus(contract):
assert consensus.getQuorum() == ORACLE_QUORUM

members = consensus.getMembers()
assert members["addresses"] == ORACLE_COMMITTEE
assert sorted(members["addresses"]) == sorted(ORACLE_COMMITTEE)
4 changes: 2 additions & 2 deletions tests/regression/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def protocol_permissions():
"state": {"getMembers": (ORACLE_COMMITTEE, contracts.hash_consensus_for_accounting_oracle.getMembers()[1])},
"roles": {
"DEFAULT_ADMIN_ROLE": [contracts.agent],
"MANAGE_MEMBERS_AND_QUORUM_ROLE": [],
"MANAGE_MEMBERS_AND_QUORUM_ROLE": [contracts.agent],
"DISABLE_CONSENSUS_ROLE": [],
"MANAGE_FRAME_CONFIG_ROLE": [],
"MANAGE_FAST_LANE_CONFIG_ROLE": [],
Expand All @@ -145,7 +145,7 @@ def protocol_permissions():
},
"roles": {
"DEFAULT_ADMIN_ROLE": [contracts.agent],
"MANAGE_MEMBERS_AND_QUORUM_ROLE": [],
"MANAGE_MEMBERS_AND_QUORUM_ROLE": [contracts.agent],
"DISABLE_CONSENSUS_ROLE": [],
"MANAGE_FRAME_CONFIG_ROLE": [],
"MANAGE_FAST_LANE_CONFIG_ROLE": [],
Expand Down
22 changes: 22 additions & 0 deletions utils/allowed_recipients_registry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from typing import Tuple
from brownie import interface

from utils.config import contracts
from .easy_track import create_permissions


def set_limit_parameters(registry_address: str, limit: int, period_duration_months: int) -> Tuple[str, str]:
registry = interface.AllowedRecipientRegistry(registry_address)
return (registry.address, registry.setLimitParameters.encode_input(limit, period_duration_months))


def update_spent_amount(registry_address: str, spent_amount: int) -> Tuple[str, str]:
registry = interface.AllowedRecipientRegistry(registry_address)
return (registry.address, registry.updateSpentAmount.encode_input(spent_amount))


def create_top_up_allowed_recipient_permission(registry_address: str) -> str:
return (
create_permissions(contracts.finance, "newImmediatePayment")
+ create_permissions(interface.AllowedRecipientRegistry(registry_address), "updateSpentAmount")[2:]
)
7 changes: 7 additions & 0 deletions utils/node_operators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Tuple
from utils.evm_script import encode_call_script

from utils.config import contracts
Expand Down Expand Up @@ -43,3 +44,9 @@ def _encode_add_operator(address, name, registry):

def encode_add_operator_lido(address, name):
return _encode_add_operator(address, name, contracts.node_operators_registry)


def deactivate_node_operator(id: int) -> Tuple[str, str]:
curated_sm = contracts.node_operators_registry
return (curated_sm.address, curated_sm.deactivateNodeOperator.encode_input(id))

28 changes: 28 additions & 0 deletions utils/oracle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from typing import Tuple
from brownie import interface

from utils.config import contracts


def add_accounting_oracle_member(member: str, quorum: int) -> Tuple[str, str]:
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_accounting_oracle

return (hash_consensus.address, hash_consensus.addMember.encode_input(member, quorum))


def remove_accounting_oracle_member(member: str, quorum: int) -> Tuple[str, str]:
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_accounting_oracle

return (hash_consensus.address, hash_consensus.removeMember.encode_input(member, quorum))


def add_validators_exit_bus_oracle_member(member: str, quorum: int) -> Tuple[str, str]:
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_validators_exit_bus_oracle

return (hash_consensus.address, hash_consensus.addMember.encode_input(member, quorum))


def remove_validators_exit_bus_oracle_member(member: str, quorum: int) -> Tuple[str, str]:
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_validators_exit_bus_oracle

return (hash_consensus.address, hash_consensus.removeMember.encode_input(member, quorum))
16 changes: 14 additions & 2 deletions utils/test/easy_track_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from brownie import chain, accounts
from brownie import chain, accounts, interface
from eth_abi.abi import encode_single
from utils.config import (
contracts,
Expand Down Expand Up @@ -29,7 +29,19 @@ def create_and_enact_payment_motion(

recievers_addresses = [reciever.address for reciever in recievers]

calldata = _encode_calldata("(address,address[],uint256[])", [token.address, recievers_addresses, transfer_amounts])
is_stables_factory = True
try:
# New TopUpFactories has a getter to return the tokens registry in contrast to the old version.
# If the request fails, work with it as with an old factory version.
interface.TopUpAllowedRecipients(factory).allowedTokensRegistry()
except:
is_stables_factory = False

calldata = (
_encode_calldata("(address,address[],uint256[])", [token.address, recievers_addresses, transfer_amounts])
if is_stables_factory
else _encode_calldata("(address[],uint256[])", [recievers_addresses, transfer_amounts])
)

tx = easy_track.createMotion(factory, calldata, {"from": trusted_caller})

Expand Down
51 changes: 51 additions & 0 deletions utils/test/event_validators/allowed_recipients_registry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from brownie.network.event import EventDict
from .common import validate_events_chain


def validate_set_limit_parameter_event(
event: EventDict, limit: int, period_duration_month: int, period_start_timestamp: int
):
_events_chain = [
"LogScriptCall",
"LogScriptCall",
"CurrentPeriodAdvanced",
"LimitsParametersChanged",
"ScriptResult",
]

validate_events_chain([e.name for e in event], _events_chain)

assert event.count("CurrentPeriodAdvanced") == 1
assert event["CurrentPeriodAdvanced"]["_periodStartTimestamp"] == period_start_timestamp

assert event.count("LimitsParametersChanged") == 1
assert event["LimitsParametersChanged"]["_limit"] == limit
assert event["LimitsParametersChanged"]["_periodDurationMonths"] == period_duration_month


def validate_update_spent_amount_event(
event: EventDict,
already_spent_amount: int,
spendable_balance_in_period: int,
period_start_timestamp: int,
period_end_timestamp: int,
is_period_advanced: bool = False,
):
_events_chain = (
["LogScriptCall", "LogScriptCall", "CurrentPeriodAdvanced", "SpendableAmountChanged", "ScriptResult"]
if is_period_advanced
else ["LogScriptCall", "LogScriptCall", "SpendableAmountChanged", "ScriptResult"]
)

validate_events_chain([e.name for e in event], _events_chain)

if is_period_advanced:
assert event.count("CurrentPeriodAdvanced") == 1
assert event["CurrentPeriodAdvanced"]["_periodStartTimestamp"] == period_start_timestamp

assert event.count("SpendableAmountChanged") == 1
assert event["SpendableAmountChanged"]["_alreadySpentAmount"] == already_spent_amount
assert event["SpendableAmountChanged"]["_spendableBalance"] == spendable_balance_in_period
assert event["SpendableAmountChanged"]["_spendableBalance"] == spendable_balance_in_period
assert event["SpendableAmountChanged"]["_periodStartTimestamp"] == period_start_timestamp
assert event["SpendableAmountChanged"]["_periodEndTimestamp"] == period_end_timestamp

0 comments on commit c3dad6b

Please sign in to comment.