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
Show file tree
Hide file tree
Changes from 88 commits
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
318 changes: 318 additions & 0 deletions Dockerfile

Large diffs are not rendered by default.

64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,55 @@

Lido DAO Aragon omnibus voting scripts.

## 🏁 Getting started

- This project uses Brownie development framework. Learn more about
[Brownie](https://eth-brownie.readthedocs.io/en/stable/index.html).
- [Poetry](https://python-poetry.org/) dependency and packaging manager is used
to bootstrap environment and keep the repo sane.
</br>

## 🐳 Docker: quick and easy environment setup
**The no-brainer workflow for setting up a Docker container to run scripts & tests**

#### Step 1. Clone the fresh repo and build an image:
```shell
git clone [email protected]:lidofinance/scripts.git
cd scripts
docker build -t scenv .
```
Note: *If you are running on an arm64 processor (including Apple Silicon) - you will have to wait up to 4 hours while the Solidity compilers compile.*

#### Step 2. Set up the ENV VARs, for example:
- `WEB3_INFURA_PROJECT_ID` - **mandatory** for the execution of tests

#### Step 3. Run the container
Run the container in the `scripts` directory and specify any ENV VARs:
```shell
docker run --name scripts -v "$(pwd)":/root/scripts -e WEB3_INFURA_PROJECT_ID -d -p 2222:22 scenv
```
Note: *It may take up to 1 minute for the container to initialize properly the first time.*
#### Step 4. Now connect to the running container using SSH:
```shell
ssh root@localhost -p 2222 # password: 1234
```
> [!NOTE]
> If you see a 'REMOTE HOST IDENTIFICATION HAS CHANGED' error - `ssh-keygen -R [localhost]:2222`
>
> If you are asked 'Are you sure you want to continue connecting' - type `yes` and hit `<ENTER>`

</br>

You now have a fully functional environment to run scripts & tests in, which is linked to your local scripts repo, for example:
```shell
poetry run brownie test tests/acceptance/test_accounting_oracle.py -s
```
If your container has been stopped (for example, by a system reboot), start it:
```shell
docker start scripts
```

</br>

## 🏁 Manual installation

### Prerequisites

Expand All @@ -28,6 +71,8 @@ Lido DAO Aragon omnibus voting scripts.
- Node >= 16.0
- yarn >= 1.22

</br>

#### Step 1. Install Poetry

Use the following command to install poetry:
Expand Down Expand Up @@ -75,6 +120,8 @@ need it.
poetry shell
```

</br>

## ⚗️ Workflow

### Network setup
Expand Down Expand Up @@ -106,6 +153,7 @@ it also could be useful to go with `holesky` and `holesky-fork` testnets first.
> **Sepolia is partially supported.**
> At the moment not all parameters are set in `configs/config_sepolia.py` and acceptance/regression/snapshot tests are not operational.

</br>

### Environment variables setup

Expand Down Expand Up @@ -170,6 +218,8 @@ To make default report for acceptance and regression tests after voting executio
export REPORT_AFTER_VOTE=1
```

</br>

## Tests structure

### `tests/acceptance`
Expand All @@ -188,6 +238,8 @@ Directory contains snapshot-scenario tests. This tests run only if there are any

Tests for current voting

</br>

### Test run

To run all the test on `mainnet-fork` execute
Expand All @@ -214,6 +266,8 @@ See [here](tests/README.md) to learn more about tests
- To re-use multiple created votes list the ids comma-separated (e.g. `OMNIBUS_VOTE_IDS=104,105`)
- To force the large CI runner usage, please name your branch with the `large-vote_` prefix.

</br>

## Code style

Please, use the shared pre-commit hooks to maintain code style:
Expand All @@ -222,16 +276,22 @@ Please, use the shared pre-commit hooks to maintain code style:
poetry run pre-commit install
```

</br>

## Repository housekeeping

Please move your outdated scripts into `archive/scripts` and outdated tests into
`archive/tests` directories.

</br>

## Use cases and scripts examples

- [Node operators management](usecase/node_operators_management.md)
- [Reward manager tokens recovery](usecase/reward_manager_tokens_recovery.md)

</br>

## Troubleshooting

### Invalid hashes (step 2)
Expand Down
140 changes: 140 additions & 0 deletions archive/scripts/vote_2024_11_26_holesky.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
"""
Voting 26/11/2024.

I. Change the limits for ET on ATC & PML
1. ATC: increase from 1,5m per quarter to 7m USDC/USDT/DAI per quarter - set 7'000'000 limit on ATC registry `0x37675423796D39C19351c5C322C3692b23a3d9bd` for 3 mos
2. PML: decrease from 6m per quarter to 4m USDC/USDT/DAI per quarter - set 4'000'000 limit on PML registry `0x580B23a97F827F2b6E51B3DEc270Ef522Ccf520c` for 3 mos

II. [NO HOLESKY] TMC limits update
3. [NO HOLESKY] Update TMC limit to 12,000 stETH on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0` for 6 mos
4. [NO HOLESKY] Reset the TMC amount spent on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0`

III. Simply staking reward address change
5. Change staking reward address to `0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82` for node operator with id = 16
"""

import time

from typing import Dict, Tuple, Optional, List

from brownie import interface
from brownie.network.transaction import TransactionReceipt
from utils.voting import bake_vote_items, confirm_vote_script, create_vote
from utils.easy_track import add_evmscript_factory, create_permissions
from utils.permission_parameters import Param, SpecialArgumentID, ArgumentValue, Op
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description
from utils.node_operators import encode_set_node_operator_reward_address

from utils.config import (
get_deployer_account,
contracts,
get_is_live,
get_priority_fee,
)

from utils.easy_track import (
add_evmscript_factory,
create_permissions,
remove_evmscript_factory
)
from utils.allowed_recipients_registry import (
set_limit_parameters,
update_spent_amount,
unsafe_set_spent_amount
)

from utils.agent import agent_forward

description = """
Voting 26/11/2024.

I. Change the limits for ET on ATC & PML
1. ATC: increase from 1,5m per quarter to 7m USDC/USDT/DAI per quarter - set 7'000'000 limit on ATC registry `0x37675423796D39C19351c5C322C3692b23a3d9bd` for 3 mos
2. PML: decrease from 6m per quarter to 4m USDC/USDT/DAI per quarter - set 4'000'000 limit on PML registry `0x580B23a97F827F2b6E51B3DEc270Ef522Ccf520c` for 3 mos

II. [NO HOLESKY] TMC limits update
3. [NO HOLESKY] Update TMC limit to 12,000 stETH on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0` for 6 mos
4. [NO HOLESKY] Reset the TMC amount spent on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0`

III. Simply staking reward address change
5. Change staking reward address to `0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82` for node operator with id = 16
"""

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

atc_registry = interface.AllowedRecipientRegistry("0x37675423796D39C19351c5C322C3692b23a3d9bd")
pml_registry = interface.AllowedRecipientRegistry("0x580B23a97F827F2b6E51B3DEc270Ef522Ccf520c")

NO_registry = contracts.node_operators_registry
simply_staking_id = 16
simply_staking_new_reward_address = "0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82"

vote_desc_items, call_script_items = zip(
#
# I. Change the limits for ET on ATC & PML
#
(
"1. Set 7'000'000 limit on ATC registry `0x37675423796D39C19351c5C322C3692b23a3d9bd` for 3 mos",
agent_forward(
[
set_limit_parameters(
registry_address=atc_registry,
limit=7_000_000 * 10 ** 18,
period_duration_months=3
),
]
),
),
(
"2. Set 4'000'000 limit on PML registry `0x580B23a97F827F2b6E51B3DEc270Ef522Ccf520c` for 3 mos",
agent_forward(
[
set_limit_parameters(
registry_address=pml_registry,
limit=4_000_000 * 10 ** 18,
period_duration_months=3
),
]
),
),
#
# III. Simply staking reward address change
#
(
"5. Change staking reward address to `0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82` for node operator with id = 16",
agent_forward(
[
encode_set_node_operator_reward_address(
simply_staking_id,
simply_staking_new_reward_address,
NO_registry
),
]
),
),
)

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=False)

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

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