Skip to content

Commit 2d8f3c0

Browse files
cyc60evgeny-stakewiseantares-swtsudmijoethechicken
authored
Dev (#292)
* Add oracles cache (#238) * Add oracles cache * Review fix * Use separate tasks for main functions (#230) * Use separate tasks for main functions Signed-off-by: cyc60 <avsysoev60@gmail.com> * Refactored func names Signed-off-by: cyc60 <avsysoev60@gmail.com> * Run HarvestTask only if needed Signed-off-by: cyc60 <avsysoev60@gmail.com> * Review fix Signed-off-by: cyc60 <avsysoev60@gmail.com> * Move interrupt_handler processing to tasks Signed-off-by: cyc60 <avsysoev60@gmail.com> --------- Signed-off-by: cyc60 <avsysoev60@gmail.com> * Move ipfs retries to client (#252) * Move ipfs retries to client * Fix test * Add settings for genesis validators ipfs client * Increase default GENESIS_VALIDATORS_IPFS_RETRY_TIMEOUT * Refactored keystores (#249) * Refactored keystores Signed-off-by: cyc60 <avsysoev60@gmail.com> * Fix tests Signed-off-by: cyc60 <avsysoev60@gmail.com> * Remove unused comment Signed-off-by: cyc60 <avsysoev60@gmail.com> * Remove double log Signed-off-by: cyc60 <avsysoev60@gmail.com> * Update packages in prod build (#256) * Update packages in prod build * Fix * Remove goerli network (#257) Signed-off-by: cyc60 <avsysoev60@gmail.com> --------- Signed-off-by: cyc60 <avsysoev60@gmail.com> Co-authored-by: antares-sw <23400824+antares-sw@users.noreply.github.com> * Log format (#260) * Add json log formatter Signed-off-by: cyc60 <avsysoev60@gmail.com> * Poetry update Signed-off-by: cyc60 <avsysoev60@gmail.com> * Use record.created for json logs Signed-off-by: cyc60 <avsysoev60@gmail.com> * Review fixes Signed-off-by: cyc60 <avsysoev60@gmail.com> * Review fix Signed-off-by: cyc60 <avsysoev60@gmail.com> * Remove int conversion Signed-off-by: cyc60 <avsysoev60@gmail.com> --------- Signed-off-by: cyc60 <avsysoev60@gmail.com> * Add log envs to example (#262) Signed-off-by: cyc60 <avsysoev60@gmail.com> * Fixes after merge * Rework signature rotation parallel (#273) * Add flake8-datetimez plugin (#274) * Add flake8-datetimez plugin * Fix poetry.lock after merge * Update execution.py (#284) Signed-off-by: Dmitri Tsumak <tsumak.dmitri@gmail.com> * Add setup_logging (#285) * Add execution_transaction_timeout setting (#272) Signed-off-by: cyc60 <avsysoev60@gmail.com> * Update README.md (#275) Signed-off-by: joethechicken <143952437+joethechicken@users.noreply.github.com> * Add latest on tag (#276) * Add latest on tag * Empty * Fix * Fix lint * Release v1.0.8 (#277) Signed-off-by: cyc60 <avsysoev60@gmail.com> * Add permissions to token (#279) * Add setup_logging (#283) * Fix after merge * Fix pip-audit --------- Signed-off-by: cyc60 <avsysoev60@gmail.com> Signed-off-by: joethechicken <143952437+joethechicken@users.noreply.github.com> Co-authored-by: Alexander Sysoev <avsysoev60@gmail.com> Co-authored-by: joethechicken <143952437+joethechicken@users.noreply.github.com> Co-authored-by: antares-sw <23400824+antares-sw@users.noreply.github.com> * Rework remote signer (#288) * Add signature shares logic * Del remote signer config * Add --log-level arg * Review fixes, fix timeout * Adapt remote_db * Adapt tests * Review fixes 2 * Review fixes 2 * Fix tests * Add interruptible sleep (#290) * Add --pool-size arg to start command (#291) * Add --pool-size arg to start command * Del annotations * Del pip-audit ignore (#294) * Rework remote db (#293) * Del parent-public-key in remote-db * Rename test_tasks -> test_commands * Fixes * Add web3_log_level setting (#295) * Add api for obol (#280) * Add api for obol * Uvicorn logging and signals * Fix log message * Fix lint * Add test_exit_signature_shards_without_keystore * Add run_check_deposit_data_root * Fix pydantic version * Fix naming, add docstring * Move endpoints.py to api/ * Del skip_validator_registration_tx * Use secrets * Warm up oracles cache * Del todo * Add register_and_remove_pending_validators * Fixes after merge * Fix pip-audit starlette * Add start-api command * Review fixes * Move signatures encryption out of keystore * Fix grammar * Fix tests * Moved get_exit_signature_shards out of keystore * Revert "Fix tests" This reverts commit 97154d7. * Adapt tests * Del enable_api * Rename tests * Moved hashi vault tests * Rename test_signing.py -> test_common.py * Review fixes * Rename approvals -> registration requests * Fix slicing * goerli to holesky rename (#297) Signed-off-by: exe.cute <98374381+execute237@users.noreply.github.com> * Fix tx confirm (#300) * Fix _fetch_outdated_indexes (#302) * Fix pip-audit (#303) * Fix validators check (#304) * Add priority fee (#301) * Fix tx confirm * Add priority fee setting * Del custom priority fee from harvest tx * Fix custom_priority_fee * Add max-priority-fee to network config * Revert "Add max-priority-fee to network config" This reverts commit 141d349. * Del max_priority_fee_per_gas_gwei setting * Del _calculate_median_priority_fee * Review fixes * Add fee settings * Add rounding * Bump version v1.1.0 (#305) * Bump version v1.1.0 * Upd version everywhere * Docker Hub (#296) (#306) Co-authored-by: antares-sw <23400824+antares-sw@users.noreply.github.com> --------- Signed-off-by: cyc60 <avsysoev60@gmail.com> Signed-off-by: Dmitri Tsumak <tsumak.dmitri@gmail.com> Signed-off-by: joethechicken <143952437+joethechicken@users.noreply.github.com> Signed-off-by: exe.cute <98374381+execute237@users.noreply.github.com> Co-authored-by: evgeny-stakewise <123374581+evgeny-stakewise@users.noreply.github.com> Co-authored-by: antares-sw <23400824+antares-sw@users.noreply.github.com> Co-authored-by: Evgeny Gusarov <evgeny@stakewise.io> Co-authored-by: Dmitri Tsumak <tsumak.dmitri@gmail.com> Co-authored-by: joethechicken <143952437+joethechicken@users.noreply.github.com> Co-authored-by: exe.cute <98374381+execute237@users.noreply.github.com>
1 parent 642c2b5 commit 2d8f3c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2695
-1985
lines changed

.env.example

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CONSENSUS_ENDPOINTS=http://localhost:3500
2121
# METRICS_HOST=127.0.0.1
2222
# METRICS_PORT=9100
2323

24-
# The network of the Vault. Choices are: mainnet, gnosis, goerli
24+
# The network of the Vault. Choices are: mainnet, gnosis, holesky
2525
# Default value will be taken from vault config
2626
# NETWORK=mainnet
2727

@@ -68,3 +68,8 @@ CONSENSUS_ENDPOINTS=http://localhost:3500
6868
# HOT_WALLET_FILE=/home/user/.stakewise/${VAULT_CONTRACT_ADDRESS}/wallet/wallet.json
6969
# Default is ${DATA_DIR}/${VAULT_CONTRACT_ADDRESS}/wallet/password.txt
7070
# HOT_WALLET_PASSWORD_FILE=/home/user/.stakewise/${VAULT_CONTRACT_ADDRESS}/wallet/password.txt
71+
72+
# Log level
73+
# LOG_LEVEL=INFO
74+
# Log record format. Can be "plain" or "json". Default is "plain"
75+
# LOG_FORMAT=plain

.github/workflows/ci.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,3 @@ jobs:
122122
- uses: pypa/gh-action-pip-audit@v1.0.7
123123
with:
124124
inputs: audit_requirements.txt
125-
ignore-vulns: PYSEC-2022-43059

README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# StakeWise V3 Operator
23

34
1. [What is V3 Operator?](#what-is-v3-operator)
@@ -42,12 +43,13 @@ The validator registration process consists of the following steps:
4243
1. Check whether Vault has accumulated enough assets to register a validator (e.g., 32 ETH for Ethereum)
4344
2. Get the next free validator public key from the deposit data file attached to the operator. The validators are
4445
registered in the same order as specified in the deposit data file.
45-
3. Share the exit signature of the validator with StakeWise Oracles:
46-
1. Using [Shamir's secret sharing](https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing), generate shares for the
47-
validator's BLS private key. The number of shares is equal to the number of oracles.
48-
2. Sign the exit message with every private key share and encrypt exit signatures with oracles' public keys.
46+
3. Obtain BLS signature for exit message using local keystores or remote signer.
47+
4. Share the exit signature of the validator with StakeWise Oracles:
48+
1. Using [Shamir's secret sharing](https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing), split
49+
validator's BLS signature. The number of shares is equal to the number of oracles.
50+
2. Encrypt exit signatures with oracles' public keys.
4951
3. Send encrypted exit signatures to all the oracles and receive registration signatures from them.
50-
4. Send transaction to Vault contract to register the validator.
52+
5. Send transaction to Vault contract to register the validator.
5153

5254
### Exit signatures rotation
5355

@@ -147,22 +149,22 @@ Head to [Usage](#usage) to launch your operator service.
147149
Pull the latest docker operator docker image:
148150

149151
```bash
150-
docker pull europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.0.8
152+
docker pull europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.1.0
151153
```
152154

153155
You can also build the docker image from source by cloning this repo and executing the following command from within
154156
the `v3-operator` folder:
155157

156158
```bash
157-
docker build --pull -t europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.0.8 .
159+
docker build --pull -t europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.1.0 .
158160
```
159161

160162
You will execute Operator Service commands using the format below (note the use of flags are optional):
161163

162164
```bash
163165
docker run --rm -ti \
164166
-v ~/.stakewise/:/data \
165-
europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.0.8 \
167+
europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.1.0 \
166168
src/main.py COMMAND \
167169
--flagA=123 \
168170
--flagB=xyz
@@ -384,7 +386,7 @@ below:
384386
```bash
385387
docker run --restart on-failure:10 \
386388
-v ~/.stakewise/:/data \
387-
europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.0.8 \
389+
europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.1.0 \
388390
src/main.py start \
389391
--vault=0x3320ad928c20187602a2b2c04eeaa813fa899468 \
390392
--data-dir=/data \

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
operator:
55
build:
66
context: .
7-
dockerfile: europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.0.8
7+
dockerfile: europe-west4-docker.pkg.dev/stakewiselabs/public/v3-operator:v1.1.0
88
image: v3-operator
99
container_name: v3-operator
1010
command: ["src/main.py", "start"]

poetry.lock

+428-206
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "v3-operator"
3-
version = "v1.0.8"
3+
version = "v1.1.0"
44
description = "StakeWise operator service for registering vault validators"
55
authors = ["StakeWise Labs <info@stakewise.io>"]
66

@@ -9,8 +9,8 @@ python = ">=3.10,<3.11"
99
python-decouple = "==3.8"
1010
sentry-sdk = "==1.32.0"
1111
py-ecc = "==6.0.0"
12-
multiproof = { git = "https://github.com/stakewise/multiproof.git", rev = "v0.1.6" }
13-
sw-utils = { git = "https://github.com/stakewise/sw-utils.git", rev = "v0.3.31" }
12+
multiproof = { git = "https://github.com/stakewise/multiproof.git", rev = "v0.1.7" }
13+
sw-utils = { git = "https://github.com/stakewise/sw-utils.git", rev = "v0.6.1" }
1414
staking-deposit = { git = "https://github.com/ethereum/staking-deposit-cli.git", rev = "v2.4.0" }
1515
pycryptodomex = "3.19.1"
1616
milagro-bls-binding = "==1.9.0"
@@ -21,6 +21,10 @@ prometheus-client = "==0.17.1"
2121
psycopg2 = "==2.9.9"
2222
pyyaml = "==6.0.1"
2323
aiohttp = "==3.9.3"
24+
python-json-logger = "==2.0.7"
25+
starlette = "==0.36.2"
26+
uvicorn = "==0.27.0"
27+
pydantic = "==2.5.3"
2428

2529
[tool.poetry.group.dev.dependencies]
2630
pylint = "==3.0.1"
@@ -34,8 +38,8 @@ bandit = { version = "==1.7.5", extras = ["toml"] }
3438
black = { version = "==23.10.0", extras = ["d"] }
3539
pyinstaller = "==5.13.2"
3640
faker = "==19.11.0"
37-
flake8-datetime-utcnow-plugin = "==0.1.2"
3841
flake8-print = "==5.0.0"
42+
flake8-datetimez = "==20.10.0"
3943
types-pyyaml = "==6.0.12.12"
4044
coverage = "==7.3.2"
4145
aioresponses = "^0.7.4"

scripts/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ http_copy() {
281281
github_release() {
282282
owner_repo=$1
283283
version=$2
284-
test -z "$version" && version="v1.0.8"
284+
test -z "$version" && version="v1.1.0"
285285
giturl="https://github.com/${owner_repo}/releases/${version}"
286286
json=$(http_copy "$giturl" "Accept:application/json")
287287
test -z "$json" && return 1

src/api.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from starlette.applications import Starlette
2+
from starlette.routing import Route
3+
4+
from src.validators.api.endpoints import get_validators, submit_validators
5+
6+
app = Starlette(
7+
routes=[
8+
Route('/validators', get_validators, methods=['GET']),
9+
Route('/validators', submit_validators, methods=['POST']),
10+
]
11+
)

src/commands/create_keys.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
@click.option(
5050
'--pool-size',
5151
help='Number of processes in a pool.',
52-
# do not prompt
52+
envvar='POOL_SIZE',
5353
type=int,
5454
)
5555
@click.command(help='Creates the validator keys from the mnemonic.')

src/commands/recover.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from src.common.contracts import v2_pool_contract, vault_contract
1111
from src.common.credentials import CredentialManager
1212
from src.common.execution import SECONDS_PER_MONTH
13-
from src.common.logging import setup_logging
13+
from src.common.logging import LOG_LEVELS, setup_logging
1414
from src.common.password import generate_password, get_or_create_password_file
1515
from src.common.utils import greenify, log_verbose
1616
from src.common.validators import validate_eth_address, validate_mnemonic
@@ -76,6 +76,16 @@
7676
case_sensitive=False,
7777
),
7878
)
79+
@click.option(
80+
'--log-level',
81+
type=click.Choice(
82+
LOG_LEVELS,
83+
case_sensitive=False,
84+
),
85+
default='INFO',
86+
envvar='LOG_LEVEL',
87+
help='The log level.',
88+
)
7989
# pylint: disable-next=too-many-arguments
8090
def recover(
8191
data_dir: str,
@@ -86,6 +96,7 @@ def recover(
8696
execution_endpoints: str,
8797
per_keystore_password: bool,
8898
no_confirm: bool,
99+
log_level: str,
89100
) -> None:
90101
# pylint: disable=duplicate-code
91102
config = VaultConfig(
@@ -106,6 +117,7 @@ def recover(
106117
vault=vault,
107118
network=network,
108119
vault_dir=config.vault_dir,
120+
log_level=log_level,
109121
)
110122

111123
try:

0 commit comments

Comments
 (0)