Skip to content

Commit ac86165

Browse files
authored
Merge pull request #320 ATC, PML & Stonks limits + Simply staking reward address
ATC, PML & Stonks limits + Simply staking reward address
2 parents 0aa3f1a + 1595bd3 commit ac86165

13 files changed

+1160
-57
lines changed

Dockerfile

Lines changed: 318 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,55 @@
1414

1515
Lido DAO Aragon omnibus voting scripts.
1616

17-
## 🏁 Getting started
18-
1917
- This project uses Brownie development framework. Learn more about
2018
[Brownie](https://eth-brownie.readthedocs.io/en/stable/index.html).
2119
- [Poetry](https://python-poetry.org/) dependency and packaging manager is used
2220
to bootstrap environment and keep the repo sane.
21+
</br>
22+
23+
## 🐳 Docker: quick and easy environment setup
24+
**The no-brainer workflow for setting up a Docker container to run scripts & tests**
25+
26+
#### Step 1. Clone the fresh repo and build an image:
27+
```shell
28+
git clone git@github.com:lidofinance/scripts.git
29+
cd scripts
30+
docker build -t scenv .
31+
```
32+
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.*
33+
34+
#### Step 2. Set up the ENV VARs, for example:
35+
- `WEB3_INFURA_PROJECT_ID` - **mandatory** for the execution of tests
36+
37+
#### Step 3. Run the container
38+
Run the container in the `scripts` directory and specify any ENV VARs:
39+
```shell
40+
docker run --name scripts -v "$(pwd)":/root/scripts -e WEB3_INFURA_PROJECT_ID -d -p 2222:22 scenv
41+
```
42+
Note: *It may take up to 1 minute for the container to initialize properly the first time.*
43+
#### Step 4. Now connect to the running container using SSH:
44+
```shell
45+
ssh root@localhost -p 2222 # password: 1234
46+
```
47+
> [!NOTE]
48+
> If you see a 'REMOTE HOST IDENTIFICATION HAS CHANGED' error - `ssh-keygen -R "[localhost]:2222"`
49+
>
50+
> If you are asked 'Are you sure you want to continue connecting' - type `yes` and hit `<ENTER>`
51+
52+
</br>
53+
54+
You now have a fully functional environment to run scripts & tests in, which is linked to your local scripts repo, for example:
55+
```shell
56+
poetry run brownie test tests/acceptance/test_accounting_oracle.py -s
57+
```
58+
If your container has been stopped (for example, by a system reboot), start it:
59+
```shell
60+
docker start scripts
61+
```
62+
63+
</br>
64+
65+
## 🏁 Manual installation
2366

2467
### Prerequisites
2568

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

74+
</br>
75+
3176
#### Step 1. Install Poetry
3277

3378
Use the following command to install poetry:
@@ -75,6 +120,8 @@ need it.
75120
poetry shell
76121
```
77122

123+
</br>
124+
78125
## ⚗️ Workflow
79126

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

110158
### Environment variables setup
111159

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

221+
</br>
222+
173223
## Tests structure
174224

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

189239
Tests for current voting
190240

241+
</br>
242+
191243
### Test run
192244

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

269+
</br>
270+
217271
## Code style
218272

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

279+
</br>
280+
225281
## Repository housekeeping
226282

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

286+
</br>
287+
230288
## Use cases and scripts examples
231289

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

293+
</br>
294+
235295
## Troubleshooting
236296

237297
### Invalid hashes (step 2)
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
"""
2+
Voting 26/11/2024.
3+
4+
I. Change the limits for ET on ATC & PML
5+
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
6+
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
7+
8+
II. [NO HOLESKY] TMC limits update
9+
3. [NO HOLESKY] Update TMC limit to 12,000 stETH on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0` for 6 mos
10+
4. [NO HOLESKY] Reset the TMC amount spent on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0`
11+
12+
III. Simply staking reward address change
13+
5. Change staking reward address to `0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82` for node operator with id = 16
14+
"""
15+
16+
import time
17+
18+
from typing import Dict, Tuple, Optional, List
19+
20+
from brownie import interface
21+
from brownie.network.transaction import TransactionReceipt
22+
from utils.voting import bake_vote_items, confirm_vote_script, create_vote
23+
from utils.easy_track import add_evmscript_factory, create_permissions
24+
from utils.permission_parameters import Param, SpecialArgumentID, ArgumentValue, Op
25+
from utils.ipfs import upload_vote_ipfs_description, calculate_vote_ipfs_description
26+
from utils.node_operators import encode_set_node_operator_reward_address
27+
28+
from utils.config import (
29+
get_deployer_account,
30+
contracts,
31+
get_is_live,
32+
get_priority_fee,
33+
)
34+
35+
from utils.easy_track import (
36+
add_evmscript_factory,
37+
create_permissions,
38+
remove_evmscript_factory
39+
)
40+
from utils.allowed_recipients_registry import (
41+
set_limit_parameters,
42+
update_spent_amount,
43+
unsafe_set_spent_amount
44+
)
45+
46+
from utils.agent import agent_forward
47+
48+
description = """
49+
Voting 26/11/2024.
50+
51+
I. Change the limits for ET on ATC & PML
52+
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
53+
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
54+
55+
II. [NO HOLESKY] TMC limits update
56+
3. [NO HOLESKY] Update TMC limit to 12,000 stETH on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0` for 6 mos
57+
4. [NO HOLESKY] Reset the TMC amount spent on TMC registry `0x1a7cFA9EFB4D5BfFDE87B0FaEb1fC65d653868C0`
58+
59+
III. Simply staking reward address change
60+
5. Change staking reward address to `0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82` for node operator with id = 16
61+
"""
62+
63+
def start_vote(tx_params: Dict[str, str], silent: bool) -> bool | list[int | TransactionReceipt | None]:
64+
"""Prepare and run voting."""
65+
66+
atc_registry = interface.AllowedRecipientRegistry("0x37675423796D39C19351c5C322C3692b23a3d9bd")
67+
pml_registry = interface.AllowedRecipientRegistry("0x580B23a97F827F2b6E51B3DEc270Ef522Ccf520c")
68+
69+
NO_registry = contracts.node_operators_registry
70+
simply_staking_id = 16
71+
simply_staking_new_reward_address = "0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82"
72+
73+
vote_desc_items, call_script_items = zip(
74+
#
75+
# I. Change the limits for ET on ATC & PML
76+
#
77+
(
78+
"1. Set 7'000'000 limit on ATC registry `0x37675423796D39C19351c5C322C3692b23a3d9bd` for 3 mos",
79+
agent_forward(
80+
[
81+
set_limit_parameters(
82+
registry_address=atc_registry,
83+
limit=7_000_000 * 10 ** 18,
84+
period_duration_months=3
85+
),
86+
]
87+
),
88+
),
89+
(
90+
"2. Set 4'000'000 limit on PML registry `0x580B23a97F827F2b6E51B3DEc270Ef522Ccf520c` for 3 mos",
91+
agent_forward(
92+
[
93+
set_limit_parameters(
94+
registry_address=pml_registry,
95+
limit=4_000_000 * 10 ** 18,
96+
period_duration_months=3
97+
),
98+
]
99+
),
100+
),
101+
#
102+
# III. Simply staking reward address change
103+
#
104+
(
105+
"5. Change staking reward address to `0x1EC3Cbe8fb1D8019092500CcA2111C158a35bC82` for node operator with id = 16",
106+
agent_forward(
107+
[
108+
encode_set_node_operator_reward_address(
109+
simply_staking_id,
110+
simply_staking_new_reward_address,
111+
NO_registry
112+
),
113+
]
114+
),
115+
),
116+
)
117+
118+
vote_items = bake_vote_items(list(vote_desc_items), list(call_script_items))
119+
120+
if silent:
121+
desc_ipfs = calculate_vote_ipfs_description(description)
122+
else:
123+
desc_ipfs = upload_vote_ipfs_description(description)
124+
125+
return confirm_vote_script(vote_items, silent, desc_ipfs) and list(
126+
create_vote(vote_items, tx_params, desc_ipfs=desc_ipfs)
127+
)
128+
129+
130+
def main():
131+
tx_params = {"from": get_deployer_account()}
132+
133+
if get_is_live():
134+
tx_params["priority_fee"] = get_priority_fee()
135+
136+
vote_id, _ = start_vote(tx_params=tx_params, silent=False)
137+
138+
vote_id >= 0 and print(f"Vote created: {vote_id}.")
139+
140+
time.sleep(5) # hack for waiting thread #2.

0 commit comments

Comments
 (0)