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

ATC, PML & Stonks limits + Simply staking reward address #320

Merged
merged 118 commits into from
Dec 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
5a8aff0
feat: add Dockerfile and step-by-step on how to use it
Oct 22, 2024
c498bf2
feat: add self-verification for versions
Oct 22, 2024
39bf4bf
feat: add sshd
Oct 22, 2024
c6e8ca2
feat: add comments & refactor
Oct 22, 2024
6676bed
fix: CMD comment
Oct 22, 2024
e85efe3
feat: Update README.md for Docker
iamnp Oct 22, 2024
516f91c
fix: remove temp files & fix docs
Oct 23, 2024
215c505
docs: add git info
iamnp Oct 23, 2024
a98bfb0
docs: add full dev env docs
iamnp Oct 23, 2024
430f07e
docs: move docs upwards
iamnp Oct 23, 2024
4b8247c
fix: remove recursive rm & downlaod solc at build stage
Oct 23, 2024
0a5c97d
feat: add precompiled compilers for arm64 and update Dockerfile
Oct 24, 2024
9d52f27
feat: add 0.8.4 solc compiler and fix comments in Dockerfile
Oct 24, 2024
be733a2
fix: vyper lib
Oct 24, 2024
34c0285
Update README.md
iamnp Oct 25, 2024
3dfd290
Update README.md
iamnp Oct 25, 2024
99123dd
Update Dockerfile
iamnp Oct 25, 2024
8708221
Update README.md
iamnp Oct 26, 2024
053fd9b
Update README.md
iamnp Oct 26, 2024
8f3c45b
feat: compile arm64 solc in Dockerfile
Oct 26, 2024
2bc8bf9
feat: remove pre-built solc compilers
Oct 26, 2024
fa03262
feat: add comments to Dockerfile
iamnp Oct 26, 2024
1b6d326
Change visual part of README.md
Oct 28, 2024
4cbd15c
feat: check solc compiled commit
iamnp Oct 30, 2024
e61700d
feat: set default ssh password for container
iamnp Oct 30, 2024
36e75e0
docs: use default password
iamnp Oct 30, 2024
6d719e3
feat: mount host dir to container
Oct 30, 2024
9051818
Update README.md
iamnp Oct 30, 2024
767d482
Update README.md
iamnp Oct 30, 2024
0386e73
Update Dockerfile
iamnp Oct 30, 2024
369f46c
feat: auto-init deps on startup
Oct 30, 2024
296190a
feat: fix init script
Oct 30, 2024
bd5a731
Update README.md
iamnp Oct 30, 2024
36831ff
Update Dockerfile
iamnp Oct 30, 2024
2f77460
feat: fixed startup script pos
Oct 30, 2024
23d858d
feat: fixed startup script pos
Oct 30, 2024
658a721
Update README.md
iamnp Oct 30, 2024
4c0f57b
feat: remove ssh
Oct 31, 2024
a486337
Revert "feat: remove ssh"
Oct 31, 2024
fc8944a
Update README.md
iamnp Oct 31, 2024
5556c23
Update README.md
iamnp Oct 31, 2024
2ed94a1
Update README.md
iamnp Oct 31, 2024
1ad4c24
Update README.md
iamnp Oct 31, 2024
d07983e
Merge branch 'feat/next-vote' into feat/docker
Oct 31, 2024
ff7169d
Added solc v0.4.24
Nov 6, 2024
fccbadb
feat: build solc faster
iamnp Nov 6, 2024
02baef3
Update Dockerfile
iamnp Nov 8, 2024
f0cf3ab
feat: added script + tests for Nov aragon
Nov 8, 2024
006f1aa
feat: update test desc
Nov 8, 2024
9f26bb4
Update Dockerfile
iamnp Nov 8, 2024
e9e5e71
Update Dockerfile
iamnp Nov 8, 2024
0475067
Update Dockerfile
iamnp Nov 8, 2024
28cc53b
Update Dockerfile
iamnp Nov 8, 2024
2001f67
Update Dockerfile
iamnp Nov 8, 2024
11caa26
feat: more tests
Nov 8, 2024
1bf3f96
feat: add 2 solc versions
Nov 9, 2024
be3ad37
Update Dockerfile
iamnp Nov 9, 2024
4a8669b
Update Dockerfile
iamnp Nov 9, 2024
53501de
Update Dockerfile
iamnp Nov 9, 2024
bdcc929
Merge branch 'feat/docker' into feat/aragon-nov
Nov 9, 2024
b8c7d2b
feat: more tests
Nov 9, 2024
5e91ebf
feat: less literals
Nov 9, 2024
cbfdc88
feat: fixed comments
Nov 9, 2024
9f275f2
feat: fixed usdc/usdt transfers
Nov 9, 2024
3ef12ca
feat: fixed tests
Nov 10, 2024
c0aac9a
Update Dockerfile
iamnp Nov 10, 2024
287b345
Update README.md
iamnp Nov 10, 2024
7be8629
fix unstable shares check in csm claim
skhomuti Nov 12, 2024
27ae0b0
Merge branch 'feat/next-vote' into feat/docker
Nov 12, 2024
ffd060b
Merge branch 'feat/next-vote' into feat/docker
Nov 13, 2024
e529aaa
Merge branch 'feat/docker' into feat/aragon-nov
Nov 13, 2024
85925e1
Merge pull request #310 from lidofinance/feat/docker
iamnp Nov 18, 2024
878e5e6
Merge pull request #319 from lidofinance/feat/aragon-nov
iamnp Nov 18, 2024
ac44d12
feat: refactoring
Nov 18, 2024
c6f89bb
feat: add holesky script
Nov 18, 2024
34cacca
fix: holesky script
Nov 18, 2024
87df7be
fix: holesky script (ii)
Nov 18, 2024
6959805
fix: docker versions
Nov 18, 2024
5dbd291
test: add period checks
Nov 19, 2024
7b9589d
fix: change ipfs desc
Nov 20, 2024
42691b1
fix: change vote file header
Nov 20, 2024
80061f9
fix: allow to transfer more stETH at once for tests
Nov 20, 2024
057f5b5
fix: event timestamp for test_validator_exit_bus_happy_path tests
avsetsin Nov 21, 2024
b352448
fix: test for not started oracle report processing
avsetsin Nov 21, 2024
c486424
Merge pull request #321 from lidofinance/fix/next-vote-tests
iamnp Nov 22, 2024
690bfd3
fix: tmc -> stonks
Nov 22, 2024
52b469a
fix: tmc -> stonks for tests
Nov 22, 2024
7dcce03
test: add events and ipfs check
Nov 22, 2024
15b24a6
fix: to_eip2098 r, s asserts
avsetsin Nov 25, 2024
8c2efc5
Merge pull request #322 from lidofinance/fix/next-vote-tests
iamnp Nov 25, 2024
a020b63
fix: code review
Nov 25, 2024
f80dc12
fix: move chain modifications after the vote
Nov 25, 2024
c988af9
fix: code review 2
Nov 25, 2024
8f745f0
fix: code review 3
Nov 25, 2024
a5babcd
take into account claimable shares from the previous reward trees
skhomuti Nov 27, 2024
64a5093
Merge pull request #324 from lidofinance/csm-fix
iamnp Nov 27, 2024
47af77c
Add did not reach quorum mark
iamnp Dec 2, 2024
8bca2f1
archive vote 2024_11_26
Dec 2, 2024
b7c490e
fix oracle report for exited keys in CSM
skhomuti Dec 3, 2024
fc226db
Merge pull request #325 from lidofinance/fix-exited-csm
iamnp Dec 3, 2024
916b2b2
move vote back from archive for re-run
Dec 3, 2024
3fe3906
fix: Unbuffered is not emitted if deposits count == 0
avsetsin Dec 5, 2024
235f2cb
fix: update changed pml limits
Dec 5, 2024
20644ad
Merge pull request #326 from lidofinance/fix/unbuffered-event
iamnp Dec 6, 2024
f350f32
fix: Python version check
Dec 10, 2024
e53b978
fix: initial pml balance check
Dec 10, 2024
f5c9b4c
fix: after vote pml balance check
Dec 10, 2024
a60f1b0
fix: up limits
Dec 10, 2024
1186f5c
fix: rename
Dec 12, 2024
bea0e00
fix: dates
Dec 12, 2024
c51d9f4
fix: hardcoded stuck and exited keys values in test_accounting_oracle…
avsetsin Dec 12, 2024
5a2c0af
Merge pull request #327 from lidofinance/fix/test-accounting-oracle-n…
iamnp Dec 13, 2024
aa3f4b0
Update README.md
iamnp Dec 13, 2024
4f96e0c
fix: up treasury transfer limits
Dec 20, 2024
ef08547
fix: remove stake limit while submiting ETH to cover withdrawals
Dec 20, 2024
afc28c6
Merge pull request #330 from lidofinance/fix/stake-limit
iamnp Dec 20, 2024
207b98d
feat: add enact comment
Dec 20, 2024
1595bd3
feat: move vote_2024_12_17 to archive
Dec 20, 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
Prev Previous commit
Next Next commit
feat: more tests
Nikita P committed Nov 9, 2024
commit b8c7d2bdcc57f530d68b5c80fbc610afb019882f
122 changes: 96 additions & 26 deletions tests/test_2024_11_26.py
Original file line number Diff line number Diff line change
@@ -3,30 +3,23 @@
"""

from scripts.vote_2024_11_26 import start_vote
from brownie import interface, ZERO_ADDRESS, reverts, web3, accounts, convert
from brownie import interface, reverts
from utils.test.tx_tracing_helpers import *
from utils.voting import find_metadata_by_vote_id
from utils.ipfs import get_lido_vote_cid_from_str
from utils.config import contracts, LDO_HOLDER_ADDRESS_FOR_TESTS, network_name
from utils.easy_track import create_permissions
from utils.config import contracts, LDO_HOLDER_ADDRESS_FOR_TESTS
from utils.config import contracts
from utils.test.easy_track_helpers import create_and_enact_payment_motion, check_add_and_remove_recipient_with_voting
from utils.test.event_validators.easy_track import (
validate_evmscript_factory_added_event,
EVMScriptFactoryAdded,
validate_evmscript_factory_removed_event,
)
from utils.test.easy_track_helpers import create_and_enact_payment_motion
from utils.test.event_validators.allowed_recipients_registry import (
validate_set_limit_parameter_event
validate_set_limit_parameter_event,
validate_set_spent_amount_event,
)
from configs.config_mainnet import (
DAI_TOKEN,
USDC_TOKEN,
USDT_TOKEN,
from utils.test.event_validators.node_operators_registry import (
validate_node_operator_reward_address_set_event,
NodeOperatorRewardAddressSetItem
)
from configs.config_mainnet import ( USDC_TOKEN )


def test_vote(helpers, accounts, vote_ids_from_env, stranger, ldo_holder, bypass_events_decoding):
def test_vote(helpers, accounts, vote_ids_from_env, stranger):

easy_track = interface.EasyTrack("0xF0211b7660680B49De1A7E9f25C65660F0a13Fea")

@@ -42,9 +35,19 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger, ldo_holder, bypass

# Item 2
pml_allowed_recipients_registry = interface.AllowedRecipientRegistry("0xDFfCD3BF14796a62a804c1B16F877Cf7120379dB")
pml_multisig_acc = accounts.at("0x17F6b2C738a63a8D3A113a228cfd0b373244633D", force=True)
pml_trusted_caller_acc = pml_multisig_acc
pml_top_up_evm_script_factory = interface.TopUpAllowedRecipients("0x92a27C4e5e35cFEa112ACaB53851Ec70e2D99a8D")
pmlBudgetLimitAfterExpected = 4_000_000 * 10**18
pmlSpendLimitAfterExpected = 3_000_000 * 10**18

# Item 3, 4
tmc_allowed_recipients_registry = interface.AllowedRecipientRegistry("0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0")
tmc_multisig = accounts.at("0xa02FC823cCE0D016bD7e17ac684c9abAb2d6D647", force=True)
tmc_trusted_caller = tmc_multisig
tmc_top_up_evm_script_factory = interface.TopUpAllowedRecipients("0x6e04aED774B7c89BB43721AcDD7D03C872a51B69")
stETH_token = interface.ERC20("0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84")
stonks_steth_contract = accounts.at("0x3e2D251275A92a8169A3B17A2C49016e2de492a7", force=True)
kate-aleksseeva marked this conversation as resolved.
Show resolved Hide resolved

# Item 5
# NO's data indexes
@@ -64,11 +67,13 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger, ldo_holder, bypass
atcBudgetLimitBefore, atcPeriodDurationMonthsBefore = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getLimitParameters()
assert atcBudgetLimitBefore == 1_500_000 * 10 ** 18
assert atcPeriodDurationMonthsBefore == 3
assert 0 == interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).spendableBalance()
iamnp marked this conversation as resolved.
Show resolved Hide resolved

# Item 2
pmlBudgetLimitBefore, pmlPeriodDurationMonthsBefore = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getLimitParameters()
assert pmlBudgetLimitBefore == 6_000_000 * 10 ** 18
assert pmlPeriodDurationMonthsBefore == 3
assert 5_000_000 * 10**18 == interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).spendableBalance()

# Item 3
tmcBudgetLimitBefore, tmcPeriodDurationMonthsBefore = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).getLimitParameters()
@@ -97,31 +102,69 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger, ldo_holder, bypass

# Item 1
atcBudgetLimitAfter, atcPeriodDurationMonthsAfter = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getLimitParameters()
(already_spent, spend_limit, period_start, period_end) = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getPeriodState()
atc_spend_limit_after = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).getPeriodState()[1]
atcSpendableBalanceAfter = interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).spendableBalance()
assert atcBudgetLimitAfter == atcBudgetLimitAfterExpected
assert atcPeriodDurationMonthsAfter == 3
assert spend_limit == atcSpendLimitAfterExpected
assert atc_spend_limit_after == atcSpendLimitAfterExpected
assert interface.AllowedRecipientRegistry(atc_allowed_recipients_registry).isUnderSpendableBalance(atcSpendableBalanceAfter, 3)
assert atcSpendableBalanceAfter == atcSpendLimitAfterExpected
limit_test(easy_track, int(atcSpendableBalanceAfter / (10**18)), atc_trusted_caller_acc, atc_top_up_evm_script_factory, atc_multisig_acc, stranger)

# Item 2
pmlBudgetLimitAfter, pmlPeriodDurationMonthsAfter = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getLimitParameters()
assert pmlBudgetLimitAfter == 4_000_000 * 10 ** 18
pml_spend_limit_after = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).getPeriodState()[1]
pmlSpendableBalanceAfter = interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).spendableBalance()
assert pmlBudgetLimitAfter == pmlBudgetLimitAfterExpected
assert pmlPeriodDurationMonthsAfter == 3
# TODO limit_test
assert pml_spend_limit_after == pmlSpendLimitAfterExpected
assert interface.AllowedRecipientRegistry(pml_allowed_recipients_registry).isUnderSpendableBalance(pmlSpendableBalanceAfter, 3)
assert pmlSpendableBalanceAfter == pmlSpendLimitAfterExpected
# TODO
#limit_test(easy_track, int(pmlSpendableBalanceAfter / (10**18)), pml_trusted_caller_acc, pml_top_up_evm_script_factory, pml_multisig_acc, stranger)

# Item 3
tmcBudgetLimitAfter, tmcPeriodDurationMonthsAfter = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).getLimitParameters()
assert tmcBudgetLimitAfter == 12_000 * 10 ** 18
assert tmcPeriodDurationMonthsAfter == 6
# TODO limit_test

# Item 4
alreadySpentAmountAfter, spendableBalanceInPeriodAfter, periodStartTimestampAfter, periodEndTimestampAfter = tmc_allowed_recipients_registry.getPeriodState()
assert alreadySpentAmountAfter == 0
# TODO limit_test
tmcSpendableBalanceAfter = interface.AllowedRecipientRegistry(tmc_allowed_recipients_registry).spendableBalance()
assert tmcSpendableBalanceAfter == 12_000 * 10 ** 18
with reverts("SUM_EXCEEDS_SPENDABLE_BALANCE"):
create_and_enact_payment_motion(
easy_track,
tmc_trusted_caller,
tmc_top_up_evm_script_factory,
stETH_token,
[stonks_steth_contract],
[12_000 * 10 ** 18 + 1],
stranger,
)

for i in range (0, 12):
create_and_enact_payment_motion(
easy_track,
tmc_trusted_caller,
tmc_top_up_evm_script_factory,
stETH_token,
[stonks_steth_contract],
[1_000 * 10 ** 18],
stranger,
)

with reverts("SUM_EXCEEDS_SPENDABLE_BALANCE"):
create_and_enact_payment_motion(
easy_track,
tmc_trusted_caller,
tmc_top_up_evm_script_factory,
stETH_token,
[stonks_steth_contract],
[1],
stranger,
)

# Item 5
iamnp marked this conversation as resolved.
Show resolved Hide resolved
SimplyStakingDataAfter = nor.getNodeOperator(SimplyStakingId, True)
@@ -130,7 +173,6 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger, ldo_holder, bypass
assert SimplyStakingDataBefore[activeIndex] == SimplyStakingDataAfter[activeIndex]
assert SimplyStakingDataBefore[stakingLimitIndex] == SimplyStakingDataAfter[stakingLimitIndex]
assert SimplyStakingDataBefore[stoppedValidatorsIndex] == SimplyStakingDataAfter[stoppedValidatorsIndex]
# TODO limit_test


# events
@@ -143,7 +185,29 @@ def test_vote(helpers, accounts, vote_ids_from_env, stranger, ldo_holder, bypass
period_duration_month=3,
period_start_timestamp=1727740800,
)
# TODO more events
validate_set_limit_parameter_event(
evs[1],
limit=pmlBudgetLimitAfterExpected,
period_duration_month=3,
period_start_timestamp=1727740800,
)
validate_set_limit_parameter_event(
evs[2],
limit=12_000 * 10 ** 18,
period_duration_month=6,
period_start_timestamp=1719792000,
)
validate_set_spent_amount_event(
evs[3],
new_spent_amount=0,
)
validate_node_operator_reward_address_set_event(
evs[4],
NodeOperatorRewardAddressSetItem(
nodeOperatorId=SimplyStakingId,
reward_address=SimplyStakingNewRewardAddress
)
)

def limit_test(easy_track, to_spend, trusted_caller_acc, top_up_evm_script_factory, multisig_acc, stranger):

@@ -162,7 +226,7 @@ def limit_test(easy_track, to_spend, trusted_caller_acc, top_up_evm_script_facto
[multisig_acc],
[to_spend_usdc + 1],
stranger,
)
)

# spend all USDC step by step (at most 2M each time)
while to_spend_usdc > 0:
@@ -175,8 +239,14 @@ def limit_test(easy_track, to_spend, trusted_caller_acc, top_up_evm_script_facto
[min(max_usdc_spend_at_once, to_spend_usdc)],
stranger,
)
print("HERE1")
print (max_usdc_spend_at_once)
print (to_spend_usdc)
to_spend_usdc -= min(max_usdc_spend_at_once, to_spend_usdc)


print ('NEXT')

# make sure there is nothing left so that you can't spend anymore
with reverts("SUM_EXCEEDS_SPENDABLE_BALANCE"):
create_and_enact_payment_motion(
13 changes: 13 additions & 0 deletions utils/test/event_validators/allowed_recipients_registry.py
Original file line number Diff line number Diff line change
@@ -49,3 +49,16 @@ def validate_update_spent_amount_event(
assert event["SpendableAmountChanged"]["_spendableBalance"] == spendable_balance_in_period
assert event["SpendableAmountChanged"]["_periodStartTimestamp"] == period_start_timestamp
assert event["SpendableAmountChanged"]["_periodEndTimestamp"] == period_end_timestamp

def validate_set_spent_amount_event(
event: EventDict,
new_spent_amount: int,
):
_events_chain = (
["LogScriptCall", "LogScriptCall", "SpentAmountChanged", "ScriptResult"]
)

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

assert event.count("SpentAmountChanged") == 1
assert event["SpentAmountChanged"]["_newSpentAmount"] == new_spent_amount
2 changes: 1 addition & 1 deletion utils/test/event_validators/node_operators_registry.py
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ def validate_node_operator_name_set_event(
def validate_node_operator_reward_address_set_event(
event: EventDict, node_operator_reward_address_item: NodeOperatorRewardAddressSetItem
):
_events_chain = ["LogScriptCall", "KeysOpIndexSet", "NodeOperatorRewardAddressSet"]
_events_chain = ["LogScriptCall", "LogScriptCall", "NodeOperatorRewardAddressSet", "ScriptResult"]

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