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

SR + CSM + Negative Rebase #280

Merged
merged 274 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 228 commits
Commits
Show all changes
274 commits
Select commit Hold shift + click to select a range
09ac11e
test: fix test_permissions
mkurayan Jun 25, 2024
7f64e9f
Merge commit '2106f303141490ddc12799a30bda6452ac696b6f' into fix/stak…
mkurayan Jun 25, 2024
facea16
fix: submit correct part of voting script
Amuhar Jun 25, 2024
9bc7dda
fix: removed duplicated script
Amuhar Jun 25, 2024
72c5e5e
fix: config for new forks
krogla Jun 25, 2024
e388562
Merge branch 'fix/staking-router-v2' of github.com:lidofinance/script…
krogla Jun 25, 2024
632de1c
fix: refactor vote scripts
krogla Jun 25, 2024
43e575f
fix: add holesky vote test
krogla Jun 25, 2024
1122e60
fix: vote script paths
krogla Jun 25, 2024
939d5dc
Merge commit '7f64e9fb7747d7c11dfe034bc65641ec8ce0f161' into fix/stak…
mkurayan Jun 26, 2024
f9cd31d
feat: update interfaces
mkurayan Jun 26, 2024
e968086
fest: set accint balance with Anvil
mkurayan Jun 26, 2024
0404406
feat: make sure that LDO_HOLDER_ADDRESS_FOR_TESTS has some eth before…
mkurayan Jun 26, 2024
be02029
fix: parse events from receipts
avsetsin Jun 26, 2024
89a022b
Merge pull request #233 from lidofinance/fix/parse-events-from-receipt
Amuhar Jun 26, 2024
d3804f5
fix: group logs from receipt
avsetsin Jun 27, 2024
62178cb
fix: add easy track for csm
Amuhar Jun 26, 2024
3e3c1f6
fix: group of events
Amuhar Jun 27, 2024
7b3c339
fix: events grouping
avsetsin Jun 27, 2024
c11e66a
fix: part of tests on holesky
Amuhar Jun 27, 2024
b36b31e
fix: remaining part of tests
Amuhar Jun 27, 2024
fae472f
fix: remaining part of tests
Amuhar Jun 27, 2024
fc9c901
fix: more tests
Amuhar Jun 27, 2024
6f89637
test: update NOR version
mkurayan Jun 27, 2024
02a2a9b
test: fix dsm
mkurayan Jun 27, 2024
fbbd772
test: update constants
mkurayan Jun 27, 2024
1cc02b3
test: replace isTargetLimitActive to targetLimitMode
mkurayan Jun 27, 2024
819c2ce
fix: deploy params
eddort Jun 27, 2024
c7c719b
Merge pull request #234 from lidofinance/fix/staking-router-v2-deploy
Amuhar Jun 27, 2024
653b511
test: update limits
mkurayan Jun 28, 2024
4156966
test: fix sdvt module version
mkurayan Jun 28, 2024
2e71524
reff: rename expected limits
mkurayan Jun 28, 2024
465992c
test: fix staking router version
mkurayan Jun 28, 2024
cfd1e5d
test: rename targetShare to stakeShareLimit
mkurayan Jun 28, 2024
504f136
test: update vebo consensus version
mkurayan Jun 28, 2024
907d7ae
test: increase diff
mkurayan Jul 1, 2024
2178362
test: set address balance
mkurayan Jul 1, 2024
cef713c
refactor: use set_balance for setting stranger account balance
mkurayan Jul 1, 2024
35878b5
test: add middleware for updating account balance if insufficient
mkurayan Jul 1, 2024
d2c4818
test: fix happy path, include transaction cost
mkurayan Jul 1, 2024
f425a6a
test: fix test_el_rewards
mkurayan Jul 1, 2024
3fe989e
test: use AO consensus version constant
mkurayan Jul 2, 2024
f7b633b
test: fix test_node_operators_flow
mkurayan Jul 2, 2024
eef09c3
test: remove tests for deleted pause and resume contract methods
mkurayan Jul 2, 2024
526e15c
fix: removed STAKING_MODULE_MANAGE_ROLE revoke/grant
Amuhar Jul 2, 2024
e3c3d6a
test: sanity checker remove agent from roles
mkurayan Jul 2, 2024
1ffd721
test: fix sdvt happy path
mkurayan Jul 2, 2024
daf0884
test: fix staking module happy path
mkurayan Jul 2, 2024
3a1a155
test: update enum name
mkurayan Jul 2, 2024
d3cff86
test: use targetLimitMode instead of obsolete isTargetLimitActive
mkurayan Jul 3, 2024
d317741
test: fix staking_router_stake_distribution tests
mkurayan Jul 3, 2024
4b5b89a
test: use common helper for event parsing
mkurayan Jul 3, 2024
b0d13c0
fix: add sdvt factory , remove old, add vote tests
Amuhar Jul 4, 2024
0d411a4
fix: csm part in voting on mainnet
Amuhar Jul 4, 2024
9d8a9b8
fix: added all checks for csm except factory
Amuhar Jul 4, 2024
cd938b6
fix: csm factory event check
Amuhar Jul 4, 2024
93fa9ae
fix: revert configs
Amuhar Jul 4, 2024
9f3fc5a
Merge pull request #235 from lidofinance/fix/mainnet-voting-script
Amuhar Jul 5, 2024
febe14c
feat: restore legacy updateTargetValidatorsLimits method
mkurayan Jul 8, 2024
a4f6571
fix: read constants from vote file
Amuhar Jul 5, 2024
17a7b96
test: fixes after negative rebase merge
mkurayan Jul 10, 2024
6b24e34
test: anvil fix submitConsensusReport test
mkurayan Jul 22, 2024
6d10360
test: fix set address balance
mkurayan Jul 23, 2024
33e5a11
test: nor.updateTargetValidatorsLimits specify method signature
mkurayan Jul 23, 2024
ea7d49a
test: return account from set_balance
mkurayan Jul 23, 2024
7ba295b
test: anvil fix enact motion
mkurayan Jul 24, 2024
e152339
test: update sanity checker permissions
mkurayan Jul 25, 2024
640a180
test: rename sanity checker limits
mkurayan Jul 25, 2024
a86518b
test: update SimpleDVT interface
mkurayan Jul 25, 2024
19ad57d
feat: create permissions for overloaded method
mkurayan Jul 26, 2024
8676fc9
fix: combine add address and method signature
mkurayan Jul 26, 2024
9383240
test: deactivate all operators in sDVT module
mkurayan Jul 28, 2024
0fbef4d
test: accounting oracle finalizeUpgrade_v2
mkurayan Jul 29, 2024
ce47de9
test: NOR finalizeUpgrade_v3
mkurayan Jul 29, 2024
bbd6cfd
test: DSM version
mkurayan Jul 29, 2024
e9243c5
test: DSM not paused
mkurayan Jul 29, 2024
0d67c63
feat: move vote to root folder
mkurayan Jul 31, 2024
c0c2141
test: staking router, check new parameters for modules
mkurayan Jul 31, 2024
b07a55a
test: staking router finalize upgrade v2
mkurayan Jul 31, 2024
ca401a5
test: test_update_target_validators_limits
mkurayan Jul 31, 2024
8400790
Add CSM acceptance test suite
skhomuti Jul 29, 2024
b09e9fd
Revert some changes
skhomuti Aug 1, 2024
50718c9
removed unused imports
skhomuti Aug 1, 2024
8fd374c
Merge pull request #238 from lidofinance/csm-tests
skhomuti Aug 1, 2024
59fddd7
test: update target limit test for both curated and csm modules
mkurayan Aug 1, 2024
e4dec2f
test: decrease vetted signing keys count
mkurayan Aug 1, 2024
b4e15e4
test: move staking modules tests to regression
mkurayan Aug 2, 2024
06e8b41
test: test unvet message prefix
mkurayan Aug 5, 2024
b68c039
test: add tests for dsm unvet signing keys
mkurayan Aug 6, 2024
83fd25a
test: add dsm tests
mkurayan Aug 6, 2024
23f6b3d
refactor: oracle report helper extra data multi transaction
mkurayan Aug 7, 2024
7d58f82
test: test extra data splited on multiple items
mkurayan Aug 7, 2024
49b76d6
test: invalid sort order inside accounting extra data report
mkurayan Aug 7, 2024
7a08e80
test: accounting oracle extra data tests
mkurayan Aug 8, 2024
2d2fe3e
test: add addition assert to extra data test
mkurayan Aug 8, 2024
de2a91e
- fix csverifier
skhomuti Aug 12, 2024
67f3e5d
- add a bunch of csm regression tests
skhomuti Aug 14, 2024
55d51ae
Merge pull request #242 from lidofinance/csm-regression
skhomuti Aug 27, 2024
27ba48a
feat: update maxNodeOperatorsPerExtraDataItemCount
mkurayan Sep 5, 2024
1755465
fix: parameters
Amuhar Sep 30, 2024
7db0eef
Merge commit '1d8b264943a906c31859a95c6999fbb1f43198d7' into fix/stak…
mkurayan Oct 2, 2024
5886ab9
test: fix post merge errors.
mkurayan Oct 3, 2024
999b674
test: add basic negative rebase test
vp4242 Aug 7, 2024
f218f96
test: add more than 54 days of reports
vp4242 Aug 8, 2024
98d0d99
test: fix deploy parameters
mkurayan Oct 3, 2024
71bf0f4
fix for staking modules test
skhomuti Sep 24, 2024
11e699d
add claim rewards tests
skhomuti Sep 25, 2024
c8353ee
fixes for review comments
skhomuti Sep 25, 2024
f021db5
fixed extra data full list test
skhomuti Sep 26, 2024
ccbacb8
added test for worst extra data report in terms of gas usage
skhomuti Sep 27, 2024
baf5dc7
upd merkle proof
skhomuti Oct 3, 2024
07f3bb4
fix conflicts
skhomuti Oct 3, 2024
2d11f02
feat: add csm delploy params
mkurayan Oct 3, 2024
1f804d5
Merge pull request #251 from lidofinance/next-csm-tests
mkurayan Oct 3, 2024
7babcf1
test: fix negative rebase for multiple staking modules
vp4242 Oct 3, 2024
879ea9a
test: second opinion oracle is zero address
vp4242 Oct 3, 2024
f7a3133
test: block large negative rebase
vp4242 Oct 4, 2024
663c02f
test: fix code style
vp4242 Oct 4, 2024
7875736
test: negative balance stored correctly
vp4242 Oct 4, 2024
0bcd086
test: split second opinion is empty test
vp4242 Oct 4, 2024
cb41789
fix: sr+csm vote description
avsetsin Oct 4, 2024
957df24
Merge pull request #240 from lidofinance/fix/sr-v2-neg-rebase
vp4242 Oct 4, 2024
79515e1
test: fix accounting tests
mkurayan Oct 6, 2024
682bfb4
test: check burn shares permission for csm accounting contract
mkurayan Oct 9, 2024
910d3aa
vote: update share thresholds
mkurayan Oct 9, 2024
b044b1e
vote: update easy track target limit factory address
mkurayan Oct 9, 2024
8629b59
vote: sr-v2 vote update contract addresses
mkurayan Oct 9, 2024
f520840
test: fix csm oracle report frame
mkurayan Oct 9, 2024
402f835
test: update oracle error upper limit
mkurayan Oct 9, 2024
78fe7aa
vote: rename vote file
mkurayan Oct 9, 2024
0c75b6b
fix stale proof
skhomuti Oct 10, 2024
035bb8c
mainnet addresses
skhomuti Oct 11, 2024
246434f
fix: top up agent address with eth when run on fork
avsetsin Oct 12, 2024
3568d55
Merge pull request #269 from lidofinance/csm-fixes
mkurayan Oct 13, 2024
679d8d1
feat: add start_and_execute_vote_on_fork script for sr+csm upgrade
avsetsin Oct 13, 2024
8a45fc1
fix: new locator implementation address
avsetsin Oct 14, 2024
6932a2d
fix: change address csm settle el rewards factory
Amuhar Oct 14, 2024
6c6f070
test: fix dsm snapshot
mkurayan Oct 14, 2024
5b3ea61
fix: Remove redundant comments
dgusakov Oct 14, 2024
e939890
test: fix nor shapshot test
mkurayan Oct 14, 2024
5601bf7
fix: expand description
Amuhar Oct 14, 2024
d346a28
free savings
skhomuti Oct 14, 2024
7d27a04
fix csm tests to not fail when the module is on live
skhomuti Oct 14, 2024
7a33a05
fix: fix contract addresses and prameters in a voting test
Amuhar Oct 14, 2024
a9549f2
downgrade pytest-check to fix internal error with pytest 6.* incompat…
skhomuti Oct 15, 2024
c07ee2e
fix: review
Amuhar Oct 15, 2024
fd1260e
Merge pull request #273 from lidofinance/fix/upgrade-sr-read-confs-file
Amuhar Oct 15, 2024
e56e8e1
take into account new easytrack motion in the snapshot tests
skhomuti Oct 15, 2024
07eebf7
Merge remote-tracking branch 'refs/remotes/origin/fix/staking-router-…
skhomuti Oct 15, 2024
60a1f39
revert extra change
skhomuti Oct 15, 2024
fdb2412
Merge pull request #271 from lidofinance/optimizations-and-fixes
skhomuti Oct 15, 2024
8dc8c50
tests: update easy track target validators limit factory test
mkurayan Oct 15, 2024
fd6b826
Merge commit '42e5f0a5f9e3d973b90f2f7dd7ffcd4c835afb14' into fix/stak…
mkurayan Oct 16, 2024
f12587a
add new csm checks
skhomuti Oct 16, 2024
28db355
Merge pull request #274 from lidofinance/csm-improvements
skhomuti Oct 16, 2024
0c2d26e
add missed csm tests
skhomuti Oct 16, 2024
40eb32c
test: fix event parsing
mkurayan Oct 16, 2024
3f3d22b
Merge pull request #275 from lidofinance/missed-csm-checks
skhomuti Oct 16, 2024
afd96d2
test: remove reporting for zero exited validators value
vp4242 Oct 16, 2024
90209b6
Merge branch 'fix/staking-router-v2' of git-ldo:lidofinance/scripts i…
vp4242 Oct 16, 2024
77167d3
Merge pull request #276 from lidofinance/fix/fix-event-parsing
mkurayan Oct 16, 2024
298b117
upgrade hardfork version to shanghai
mkurayan Oct 16, 2024
48a3758
Merge pull request #278 from lidofinance/master
Ivan-Feofanov Oct 16, 2024
57095b9
fix test_stake_distribution
skhomuti Oct 16, 2024
cefce6f
Merge pull request #277 from lidofinance/fix/staking-router-v2
Ivan-Feofanov Oct 16, 2024
7a2df94
fix incorrect keys count calculation
skhomuti Oct 16, 2024
ce06b22
Merge pull request #281 from lidofinance/fix-extra-data-test
Ivan-Feofanov Oct 16, 2024
100faa9
doc: sr+csm voting description
avsetsin Oct 17, 2024
d280220
Merge pull request #282 from lidofinance/feat/next-vote-description
avsetsin Oct 17, 2024
83ab26a
add more eth to local deployer
skhomuti Oct 17, 2024
8e56946
Merge pull request #283 from lidofinance/fix-local-deployer-balance
skhomuti Oct 17, 2024
099c57b
fix: resolve todo, cehck sr version after enact
Amuhar Oct 17, 2024
4ef3ed7
Merge pull request #284 from lidofinance/feat/voting-test-sr2
Amuhar Oct 17, 2024
159f283
fix: error descr
Amuhar Oct 17, 2024
76849d3
test: add pause deposits tests for dsm
mkurayan Oct 17, 2024
d819500
Merge pull request #285 from lidofinance/fix/voting-test-sr2
Amuhar Oct 17, 2024
840db3f
fix: description
Amuhar Oct 18, 2024
0c945ab
Merge pull request #287 from lidofinance/fix/vote-items
Amuhar Oct 18, 2024
ada8c24
Merge pull request #286 from lidofinance/feat/add-dsm-pause-deposits-…
mkurayan Oct 18, 2024
4169f38
fix: remove silent false
avsetsin Oct 18, 2024
7cd9dee
Merge pull request #288 from lidofinance/feat/next-vote-silent-false
avsetsin Oct 18, 2024
30e2026
add new vote desc items
zuzueeka Oct 18, 2024
51e7c08
fill correct module with keys up to target share
skhomuti Oct 18, 2024
da64cdd
fix: topup 10 ether to execute votes by default
skhomuti Oct 18, 2024
57eaab0
Merge pull request #291 from lidofinance/fix-execute-topup
avsetsin Oct 18, 2024
c045ab2
Merge pull request #289 from lidofinance/fix/feat/next-vote_New-vote-…
avsetsin Oct 18, 2024
790f3e6
fix: add more voting tests
Amuhar Oct 18, 2024
a0729cd
fix: comments to tests, epoch before vote check
Amuhar Oct 19, 2024
f46282a
Merge pull request #290 from lidofinance/target-share-distribution-fix
mkurayan Oct 19, 2024
9f85455
test: restore deleted test
mkurayan Oct 19, 2024
6460be6
Merge pull request #293 from lidofinance/feat/next-vote-restore-delet…
mkurayan Oct 19, 2024
de86a70
Merge pull request #292 from lidofinance/feat/add-more-voting-tests
Amuhar Oct 19, 2024
1923368
feat: add oracle rotation
Amuhar Oct 19, 2024
45e18c3
Merge branch 'feat/next-vote' into feat/oracle-rotation-items
Amuhar Oct 19, 2024
85b8e2d
fix: add new oracle address, removed MANAGE_MEMBERS_AND_QUORUM_ROLE r…
Amuhar Oct 19, 2024
6f624f9
test: rotate oracle member
mkurayan Oct 19, 2024
9721c1d
Update scripts/upgrade_sr_v2.py
Amuhar Oct 20, 2024
2d6dfbf
Update scripts/upgrade_sr_v2.py
Amuhar Oct 20, 2024
47c32b2
Update scripts/upgrade_sr_v2.py
Amuhar Oct 20, 2024
5b79386
Update scripts/upgrade_sr_v2.py
Amuhar Oct 20, 2024
dcc8026
Update scripts/upgrade_sr_v2.py
Amuhar Oct 20, 2024
710be0d
fix: small comment fixes
Amuhar Oct 20, 2024
38509b9
fix: add events tests for oracle rotation
Amuhar Oct 20, 2024
a4ed0a2
Merge pull request #294 from lidofinance/feat/oracle-rotation-items
Amuhar Oct 20, 2024
732d669
fix: minor fix of item desc
Amuhar Oct 21, 2024
aaa09ec
fix: removed space
Amuhar Oct 21, 2024
9c2c5e4
Merge pull request #296 from lidofinance/fix/items-desc-minor-fix
Amuhar Oct 21, 2024
4fbd777
fix: remove file added by mistake
Amuhar Oct 21, 2024
0d53bec
Merge pull request #297 from lidofinance/fix/remove-test-rules-file
Amuhar Oct 21, 2024
c3d0a71
fix: review changes in csm tests
skhomuti Oct 21, 2024
b3e724b
fix: return EasyTrack check
Ivan-Feofanov Oct 21, 2024
ffa8677
Merge pull request #299 from lidofinance/fix/add-swap
Ivan-Feofanov Oct 21, 2024
74ee60b
fix: rm rm
Ivan-Feofanov Oct 21, 2024
3890ea3
Merge pull request #300 from lidofinance/fix/add-swap
Ivan-Feofanov Oct 21, 2024
cb00e69
test: simplify staking router helper
mkurayan Oct 21, 2024
856a0e1
Merge pull request #301 from lidofinance/feat/next-vote-simplify-stak…
mkurayan Oct 21, 2024
1935412
Merge pull request #298 from lidofinance/csm-review-fixes
skhomuti Oct 21, 2024
0a8a650
update snapshot test after editing hash consensus members in the vote
skhomuti Oct 21, 2024
f55db6a
fix: added nor/sdvt version tests
Amuhar Oct 21, 2024
d79c8ee
Merge pull request #302 from lidofinance/fix-snapshot-hashconsensus
mkurayan Oct 21, 2024
c4fc926
Merge pull request #303 from lidofinance/feat/nor-sdvt-version-check
Amuhar Oct 21, 2024
8c63308
fix accounting tests not preparing csm depositable keys if there is a…
skhomuti Oct 21, 2024
e2274f8
docs: update vote description
avsetsin Oct 21, 2024
04201d7
Merge pull request #305 from lidofinance/feat/next-vote-new-description
avsetsin Oct 21, 2024
8b814d5
docs: update items
avsetsin Oct 21, 2024
ad488bb
move vote script and tests to archive
mkurayan Oct 23, 2024
7d31bb6
Merge pull request #304 from lidofinance/accounting-tests-fix
avsetsin Oct 25, 2024
eae0ed8
prefetch simple dvt contract events
skhomuti Oct 25, 2024
751ff4d
Merge pull request #309 from lidofinance/prefetch-simpledvt
avsetsin Oct 25, 2024
c8e00be
add vote execution time
mkurayan Oct 25, 2024
67e1785
Merge pull request #307 from lidofinance/feat/next-vote-clean-up
mkurayan Oct 25, 2024
03a9f84
clean up
mkurayan Oct 25, 2024
f8cd02a
Merge pull request #311 from lidofinance/feat/next-vote-clean-up-test…
mkurayan Oct 25, 2024
df20586
upload csm keys with batches
skhomuti Oct 29, 2024
b8b8470
fix happy path test, add expected csm transfer event
skhomuti Oct 30, 2024
5a3e0d0
Merge pull request #312 from lidofinance/fix-csm-post-vote
mkurayan Oct 30, 2024
8bb06ae
fix unstable shares check in csm claim
skhomuti Nov 12, 2024
6d72479
Merge pull request #315 from lidofinance/fix-csm-test
iamnp Nov 12, 2024
d587fc7
fix: not enough eth to make transaction
Nov 12, 2024
63cc9fe
fix: revert gas price
Nov 12, 2024
b895c8d
fix: eth check
Nov 12, 2024
b344d00
Merge pull request #316 from lidofinance/fix/ensure-balance
iamnp Nov 13, 2024
de875a7
fix: ensure balance (ii)
Nov 13, 2024
678e83c
fix: remove balance_check middleware side effects
TheDZhon Nov 14, 2024
b9dec0b
fix: add finally block
TheDZhon Nov 14, 2024
50383fc
chore: print out balance when can't set it up
TheDZhon Nov 15, 2024
89b19f8
fix: sync the oracle simulation code + override
TheDZhon Nov 15, 2024
7c2b44c
fix: update the negative rebase test
TheDZhon Nov 15, 2024
1d111db
fix: set initial balance for stranger
TheDZhon Nov 15, 2024
ae58f35
Merge pull request #318 from lidofinance/fix/balance-check-fixture
iamnp Nov 15, 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
398 changes: 398 additions & 0 deletions archive/scripts/vote_sr_v2_holesky.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,398 @@
"""
SR V2
1. Update locator implementation
2. Revoke pause role from old DSM
3. Revoke resume role from old DSM
4. Grant unvetting role to new DSM
5. Update SR implementation
6. Call finalize upgrade on SR
7. Publish new `NodeOperatorsRegistry` implementation in NodeOperatorsRegistry app APM repo
8. Update `NodeOperatorsRegistry` implementation
9. Finalize NOR upgrade
10. Publish new `SimpleDVT` implementation in SimpleDVT app APM repo
11. Update `SimpleDVT` implementation
12. Finalize SimpleDVT upgrade
13. Publish new `Sandbox` implementation in Sandbox app APM repo
14. Update `Sandbox` implementation
15. Finalize Sandbox upgrade
16. Update AO implementation to ${ACCOUNTING_ORACLE_IMPL}`,
17. Finalize AO upgrade and set consensus version to ${AO_CONSENSUS_VERSION}`,
18. Grant manage consensus role to agent ${AGENT}`
19. Update VEBO consensus version to ${VEBO_CONSENSUS_VERSION}`
20. Revoke manage consensus role from agent ${AGENT}"

CSM

21. Add staking module
22. Grant request burn role to CSAccounting contract
23. Grant resume role to agent
24. Resume staking module
25. Revoke resume role from agent
26. Update initial epoch
27. Add CS settle EL stealing factory to ET
"""

import time

try:
from brownie import interface, accounts
except ImportError:
print("You're probably running inside Brownie console. Please call:")
print("set_console_globals(interface=interface)")


from typing import Dict, Tuple, Optional
from utils.config import (
get_deployer_account,
get_is_live,
get_priority_fee,
contracts,
NODE_OPERATORS_REGISTRY_ARAGON_APP_ID,
SIMPLE_DVT_ARAGON_APP_ID,
SANDBOX_APP_ID,
LIDO_LOCATOR_IMPL,
STAKING_ROUTER_IMPL,
ACCOUNTING_ORACLE_IMPL,
NODE_OPERATORS_REGISTRY_IMPL,
CS_ACCOUNTING_ADDRESS,
)
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description
from utils.repo import (
add_implementation_to_nor_app_repo,
add_implementation_to_sdvt_app_repo,
add_implementation_to_sandbox_app_repo,
)
from utils.permissions import encode_oz_grant_role, encode_oz_revoke_role
from utils.easy_track import add_evmscript_factory, create_permissions
from utils.kernel import update_app_implementation
from utils.voting import bake_vote_items, confirm_vote_script, create_vote

from brownie.network.transaction import TransactionReceipt
from utils.agent import agent_forward


# SR
PRIORITY_EXIT_SHARE_THRESHOLDS_BP = [10_000, 10_000, 10_000]
MAX_DEPOSITS_PER_BLOCK = [150, 50, 50]
MIN_DEPOSIT_BLOCK_DISTANCES = [25, 25, 25]
NOR_VERSION = ["2", "0", "0"]
SDVT_VERSION = ["2", "0", "0"]
SANDBOX_VERSION = ["2", "0", "0"]
AO_CONSENSUS_VERSION = 2
VEBO_CONSENSUS_VERSION = 2

# CSM
CS_MODULE_NAME = "Community Staking"
CS_STAKE_SHARE_LIMIT = 1000
CS_PRIORITY_EXIT_SHARE_THRESHOLD = 2000
CS_STAKING_MODULE_FEE = 700
CS_TREASURY_FEE = 300
CS_MAX_DEPOSITS_PER_BLOCK = 30
CS_MIN_DEPOSIT_BLOCK_DISTANCE = 25
CS_ORACLE_INITIAL_EPOCH = 63055

EASYTRACK_CSM_SETTLE_EL_REWARDS_STEALING_PENALTY_FACTORY = "0x07696EA8A5b53C3E35d9cce10cc62c6c79C4691D"


description = """
Proposal to support DSM 2.0 and CSM Module
"""


def encode_locator_proxy_update(implementation: str) -> Tuple[str, str]:
proxy = interface.OssifiableProxy(contracts.lido_locator)
return proxy.address, proxy.proxy__upgradeTo.encode_input(implementation)


def encode_staking_router_proxy_update(implementation: str) -> Tuple[str, str]:
proxy = interface.OssifiableProxy(contracts.staking_router)
return proxy.address, proxy.proxy__upgradeTo.encode_input(implementation)


def encode_staking_router_finalize() -> Tuple[str, str]:
proxy = interface.StakingRouter(contracts.staking_router)
return proxy.address, proxy.finalizeUpgrade_v2.encode_input(
PRIORITY_EXIT_SHARE_THRESHOLDS_BP, MAX_DEPOSITS_PER_BLOCK, MIN_DEPOSIT_BLOCK_DISTANCES
)


def encode_nor_finalize() -> Tuple[str, str]:
proxy = interface.NodeOperatorsRegistry(contracts.node_operators_registry)
return proxy.address, proxy.finalizeUpgrade_v3.encode_input()


def encode_sdvt_finalize() -> Tuple[str, str]:
proxy = interface.NodeOperatorsRegistry(contracts.simple_dvt)
return proxy.address, proxy.finalizeUpgrade_v3.encode_input()


def encode_sandbox_finalize() -> Tuple[str, str]:
proxy = interface.NodeOperatorsRegistry(contracts.sandbox)
return proxy.address, proxy.finalizeUpgrade_v3.encode_input()


def encode_ao_proxy_update(implementation: str) -> Tuple[str, str]:
proxy = interface.OssifiableProxy(contracts.accounting_oracle)
return proxy.address, proxy.proxy__upgradeTo.encode_input(implementation)


def encode_ao_finalize() -> Tuple[str, str]:
proxy = interface.AccountingOracle(contracts.accounting_oracle)
return proxy.address, proxy.finalizeUpgrade_v2.encode_input(AO_CONSENSUS_VERSION)


def encode_set_consensus_version() -> Tuple[str, str]:
proxy = interface.ValidatorsExitBusOracle(contracts.validators_exit_bus_oracle)
return proxy.address, proxy.setConsensusVersion.encode_input(VEBO_CONSENSUS_VERSION)


def get_repo_uri(repo_address: str) -> str:
contract = interface.Repo(repo_address).getLatest()
return contract["contentURI"]


def get_repo_version(repo_address: str) -> tuple[int, int, int]:
contract = interface.Repo(repo_address).getLatest()
return contract["semanticVersion"]


def start_vote(tx_params: Dict[str, str], silent: bool) -> Tuple[int, Optional[TransactionReceipt]]:
"""Prepare and run voting."""
nor_repo = contracts.nor_app_repo.address
simple_dvt_repo = contracts.simple_dvt_app_repo.address
sandbox_repo = contracts.sandbox_repo.address

nor_uri = get_repo_uri(nor_repo)
simple_dvt_uri = get_repo_uri(simple_dvt_repo)
sandbox_uri = get_repo_uri(sandbox_repo)

vote_desc_items, call_script_items = zip(
#
# SR 2
#
(
"1. Update locator implementation",
agent_forward([encode_locator_proxy_update(LIDO_LOCATOR_IMPL)]),
),
(
"2. Revoke pause role from old DSM",
agent_forward(
[
encode_oz_revoke_role(
contract=contracts.staking_router,
role_name="STAKING_MODULE_PAUSE_ROLE",
revoke_from=contracts.deposit_security_module_v2,
)
]
),
),
(
"3. Revoke resume role from old DSM",
agent_forward(
[
encode_oz_revoke_role(
contract=contracts.staking_router,
role_name="STAKING_MODULE_RESUME_ROLE",
revoke_from=contracts.deposit_security_module_v2,
)
]
),
),
(
"4. Grant unvetting role to new DSM",
agent_forward(
[
encode_oz_grant_role(
contract=contracts.staking_router,
role_name="STAKING_MODULE_UNVETTING_ROLE",
grant_to=contracts.deposit_security_module,
)
]
),
),
(
"5. Update SR implementation",
agent_forward([encode_staking_router_proxy_update(STAKING_ROUTER_IMPL)]),
),
(
"6. Call finalize upgrade on SR",
encode_staking_router_finalize(),
),
(
"7. Publish new `NodeOperatorsRegistry` implementation in NodeOperatorsRegistry app APM repo",
add_implementation_to_nor_app_repo(NOR_VERSION, NODE_OPERATORS_REGISTRY_IMPL, nor_uri),
),
(
"8. Update `NodeOperatorsRegistry` implementation",
update_app_implementation(NODE_OPERATORS_REGISTRY_ARAGON_APP_ID, NODE_OPERATORS_REGISTRY_IMPL),
),
(
"9. Finalize NOR upgrade",
encode_nor_finalize(),
),
(
"10. Publish new `SimpleDVT` implementation in SimpleDVT app APM repo",
add_implementation_to_sdvt_app_repo(SDVT_VERSION, NODE_OPERATORS_REGISTRY_IMPL, simple_dvt_uri),
),
(
"11. Update `SimpleDVT` implementation",
update_app_implementation(SIMPLE_DVT_ARAGON_APP_ID, NODE_OPERATORS_REGISTRY_IMPL),
),
(
"12. Finalize SimpleDVT upgrade",
encode_sdvt_finalize(),
),
(
"13. Publish new `Sandbox` implementation in Sandbox app APM repo",
add_implementation_to_sandbox_app_repo(SANDBOX_VERSION, NODE_OPERATORS_REGISTRY_IMPL, sandbox_uri),
),
(
"14. Update `Sandbox` implementation",
update_app_implementation(SANDBOX_APP_ID, NODE_OPERATORS_REGISTRY_IMPL),
),
(
"15. Finalize Sandbox upgrade",
encode_sandbox_finalize(),
),
(
"16. Update AO implementation to ${ACCOUNTING_ORACLE_IMPL}",
agent_forward([encode_ao_proxy_update(ACCOUNTING_ORACLE_IMPL)]),
),
(
"17. Finalize AO upgrade and set consensus version to ${AO_CONSENSUS_VERSION}",
encode_ao_finalize(),
),
(
"18. Grant manage consensus role to agent ${AGENT}",
agent_forward(
[
encode_oz_grant_role(
contract=contracts.validators_exit_bus_oracle,
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
grant_to=contracts.agent,
)
]
),
),
(
"19. Update VEBO consensus version to ${VEBO_CONSENSUS_VERSION}",
agent_forward([encode_set_consensus_version()]),
),
(
"20. Revoke manage consensus role from agent ${AGENT}",
agent_forward(
[
encode_oz_revoke_role(
contract=contracts.validators_exit_bus_oracle,
role_name="MANAGE_CONSENSUS_VERSION_ROLE",
revoke_from=contracts.agent,
)
]
),
),
#
# CSM
#
(
"21. Add staking module",
agent_forward(
[
(
contracts.staking_router.address,
contracts.staking_router.addStakingModule.encode_input(
CS_MODULE_NAME,
contracts.csm.address,
CS_STAKE_SHARE_LIMIT,
CS_PRIORITY_EXIT_SHARE_THRESHOLD,
CS_STAKING_MODULE_FEE,
CS_TREASURY_FEE,
CS_MAX_DEPOSITS_PER_BLOCK,
CS_MIN_DEPOSIT_BLOCK_DISTANCE,
),
),
]
),
),
(
"22. Grant request burn role to CSAccounting contract",
agent_forward(
[
encode_oz_grant_role(
contract=contracts.burner,
role_name="REQUEST_BURN_SHARES_ROLE",
grant_to=CS_ACCOUNTING_ADDRESS,
)
]
),
),
(
"23. Grant resume role to agent",
agent_forward(
[
encode_oz_grant_role(
contract=contracts.csm,
role_name="RESUME_ROLE",
grant_to=contracts.agent,
)
]
),
),
(
"24. Resume staking module",
agent_forward([(contracts.csm.address, contracts.csm.resume.encode_input())]),
),
(
"25. Revoke resume role from agent",
agent_forward(
[
encode_oz_revoke_role(
contract=contracts.csm,
role_name="RESUME_ROLE",
revoke_from=contracts.agent,
)
]
),
),
(
"26. Update initial epoch",
agent_forward(
[
(
contracts.csmHashConsensus.address,
contracts.csmHashConsensus.updateInitialEpoch.encode_input(CS_ORACLE_INITIAL_EPOCH),
)
]
),
),
(
"27. Add CS settle EL stealing factory to ET",
add_evmscript_factory(
factory=EASYTRACK_CSM_SETTLE_EL_REWARDS_STEALING_PENALTY_FACTORY,
permissions=(create_permissions(contracts.csm, "settleELRewardsStealingPenalty")),
),
),
)

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=True) # disable IPFS description for Holesky

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

time.sleep(10) # hack for waiting thread #2.
Loading
Loading