mirror of
https://gitlab.com/pulsechaincom/staking-deposit-cli.git
synced 2024-12-22 19:50:34 +00:00
Update script and readme
1. deposit.sh two steps: (i) install (ii) run tool 2. Update readme for all known usages
This commit is contained in:
parent
b105e464c7
commit
10080093b6
@ -5,7 +5,7 @@ tox_common: &tox_common
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: tox-deps2-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
key: tox-deps3-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||||
- run:
|
- run:
|
||||||
name: install dependencies
|
name: install dependencies
|
||||||
command: pip install --user tox
|
command: pip install --user tox
|
||||||
@ -16,12 +16,13 @@ tox_common: &tox_common
|
|||||||
paths:
|
paths:
|
||||||
- .tox
|
- .tox
|
||||||
- ./eggs
|
- ./eggs
|
||||||
key: tox-deps2-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
key: tox-deps3-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||||
|
|
||||||
orbs:
|
orbs:
|
||||||
win: circleci/windows@2.2.0 # The Windows orb give you everything you need to start using the Windows executor.
|
win: circleci/windows@2.2.0 # The Windows orb give you everything you need to start using the Windows executor.
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
# Job(s) with Linux OS
|
||||||
venv_build:
|
venv_build:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/python:3.8
|
- image: circleci/python:3.8
|
||||||
@ -29,12 +30,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||||
- run:
|
- run:
|
||||||
name: Install requirements in venv
|
name: Install requirements in venv
|
||||||
command: make venv_build_test
|
command: make venv_build_test
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||||
paths:
|
paths:
|
||||||
- ./venv
|
- ./venv
|
||||||
venv_pytest:
|
venv_pytest:
|
||||||
@ -44,7 +45,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||||
- run:
|
- run:
|
||||||
name: Run tests with venv
|
name: Run tests with venv
|
||||||
command: make venv_test
|
command: make venv_test
|
||||||
@ -60,7 +61,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||||
- run:
|
- run:
|
||||||
name: Run linter with venv
|
name: Run linter with venv
|
||||||
command: make venv_lint
|
command: make venv_lint
|
||||||
@ -76,7 +77,6 @@ jobs:
|
|||||||
- image: circleci/python:3.8
|
- image: circleci/python:3.8
|
||||||
environment:
|
environment:
|
||||||
TOXENV: py38-core
|
TOXENV: py38-core
|
||||||
# Linux
|
|
||||||
tox-py37-script:
|
tox-py37-script:
|
||||||
<<: *tox_common
|
<<: *tox_common
|
||||||
docker:
|
docker:
|
||||||
@ -89,7 +89,7 @@ jobs:
|
|||||||
- image: circleci/python:3.8
|
- image: circleci/python:3.8
|
||||||
environment:
|
environment:
|
||||||
TOXENV: py38-script
|
TOXENV: py38-script
|
||||||
# Windows
|
# Job(s) with Windows OS
|
||||||
win-py37-script:
|
win-py37-script:
|
||||||
executor:
|
executor:
|
||||||
name: win/default
|
name: win/default
|
||||||
|
1
Makefile
1
Makefile
@ -22,6 +22,7 @@ clean:
|
|||||||
|
|
||||||
$(VENV_NAME)/bin/activate: requirements.txt
|
$(VENV_NAME)/bin/activate: requirements.txt
|
||||||
@test -d $(VENV_NAME) || python3 -m venv --clear $(VENV_NAME)
|
@test -d $(VENV_NAME) || python3 -m venv --clear $(VENV_NAME)
|
||||||
|
${VENV_NAME}/bin/python setup.py install
|
||||||
${VENV_NAME}/bin/python -m pip install -r requirements.txt
|
${VENV_NAME}/bin/python -m pip install -r requirements.txt
|
||||||
${VENV_NAME}/bin/python -m pip install -r requirements_test.txt
|
${VENV_NAME}/bin/python -m pip install -r requirements_test.txt
|
||||||
@touch $(VENV_NAME)/bin/activate
|
@touch $(VENV_NAME)/bin/activate
|
||||||
|
90
README.md
90
README.md
@ -1,13 +1,101 @@
|
|||||||
# eth2.0-deposit-cli
|
# eth2.0-deposit-cli
|
||||||
|
|
||||||
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
|
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||||
|
|
||||||
|
- [Tutorial for users](#tutorial-for-users)
|
||||||
|
- [Requirements](#requirements)
|
||||||
|
- [For Linux or MacOS users](#for-linux-or-macos-users)
|
||||||
|
- [Step 1. Install deposit-cli dependencies](#step-1-install-deposit-cli-dependencies)
|
||||||
|
- [Step 2. Create your keys and deposit data](#step-2-create-your-keys-and-deposit-data)
|
||||||
|
- [For Windows users](#for-windows-users)
|
||||||
|
- [Step 1. Install deposit-cli dependencies](#step-1-install-deposit-cli-dependencies-1)
|
||||||
|
- [Step 2. Create your keys and deposit data](#step-2-create-your-keys-and-deposit-data-1)
|
||||||
|
- [For `venv` users](#for-venv-users)
|
||||||
|
- [Development](#development)
|
||||||
|
- [Install basic requirements](#install-basic-requirements)
|
||||||
|
- [Install testing requirements](#install-testing-requirements)
|
||||||
|
- [Run tests](#run-tests)
|
||||||
|
|
||||||
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
## Tutorial for users
|
## Tutorial for users
|
||||||
|
|
||||||
### Create deposits
|
### Requirements
|
||||||
|
|
||||||
|
- [Python **3.7+**](https://www.python.org/about/gettingstarted/)
|
||||||
|
- [pip3](https://pip.pypa.io/en/stable/installing/)
|
||||||
|
|
||||||
|
### For Linux or MacOS users
|
||||||
|
|
||||||
|
#### Step 1. Install deposit-cli dependencies
|
||||||
|
|
||||||
|
If it's your first time to use this tool, you need to install the Python library dependencies:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./deposit.sh install
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 2. Create your keys and deposit data
|
||||||
|
|
||||||
|
Run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./deposit.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also run the tool with optional arguments:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./deposit.sh --num_validators=<NUM_VALIDATORS> --mnemonic_language=english --password=<YOUR_PASSWORD> --folder=<YOUR_FOLDER_PATH>
|
./deposit.sh --num_validators=<NUM_VALIDATORS> --mnemonic_language=english --password=<YOUR_PASSWORD> --folder=<YOUR_FOLDER_PATH>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### For Windows users
|
||||||
|
|
||||||
|
#### Step 1. Install deposit-cli dependencies
|
||||||
|
|
||||||
|
If it's your first time to use this tool, you need to install the Python library dependencies:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sh deposit.sh install
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Step 2. Create your keys and deposit data
|
||||||
|
|
||||||
|
Run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sh deposit.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also run the tool with optional arguments:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sh deposit.sh --num_validators=<NUM_VALIDATORS> --mnemonic_language=english --password=<YOUR_PASSWORD> --folder=<YOUR_FOLDER_PATH>
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see the following messages after successfully generated the keystore(s) and the deposit(s):
|
||||||
|
|
||||||
|
```
|
||||||
|
Creating your keys.
|
||||||
|
Saving your keystore(s).
|
||||||
|
Creating your deposit(s).
|
||||||
|
Verifying your keystore(s).
|
||||||
|
Verifying your deposit(s).
|
||||||
|
|
||||||
|
Success!
|
||||||
|
Your keys can be found at: <YOUR_FOLDER_PATH>
|
||||||
|
```
|
||||||
|
|
||||||
|
### For `venv` users
|
||||||
|
|
||||||
|
If you want to use Python [`venv`](https://docs.python.org/3.7/library/venv.html), just run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make venv_deposit
|
||||||
|
```
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Install basic requirements
|
### Install basic requirements
|
||||||
|
38
deposit.sh
38
deposit.sh
@ -1,30 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
case "$(uname -s)" in
|
if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
echo $OSTYPE
|
||||||
|
|
||||||
Darwin)
|
if [[ $1 == install ]]; then
|
||||||
echo 'Mac OS X'
|
python3 -m pip3 install -r requirements.txt
|
||||||
python3 -m pip install -r requirements.txt
|
|
||||||
python3 setup.py install
|
python3 setup.py install
|
||||||
python3 ./eth2deposit/deposit.py "$@"
|
exit 1
|
||||||
;;
|
fi
|
||||||
|
|
||||||
Linux)
|
python3 ./eth2deposit/deposit.py "$@"
|
||||||
echo 'Linux'
|
|
||||||
python3 -m pip install -r requirements.txt
|
|
||||||
python3 setup.py install
|
|
||||||
python3 ./eth2deposit/deposit.py "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
|
||||||
echo 'MS Windows'
|
echo $OSTYPE
|
||||||
|
if [[ $1 == install ]]; then
|
||||||
python -m pip install -r requirements.txt
|
python -m pip install -r requirements.txt
|
||||||
python setup.py install
|
python setup.py install
|
||||||
python ./eth2deposit/deposit.py "$@"
|
exit 1
|
||||||
;;
|
fi
|
||||||
|
|
||||||
*)
|
python ./eth2deposit/deposit.py "$@"
|
||||||
echo 'Other OS'
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
else
|
||||||
|
echo "Sorry, to run deposit-cli on" $(uname -s)", please see the trouble-shooting on https://github.com/ethereum/eth2.0-deposit-cli"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
fi
|
||||||
|
@ -12,7 +12,7 @@ async def main():
|
|||||||
|
|
||||||
if os.name == 'nt': # Windows
|
if os.name == 'nt': # Windows
|
||||||
script = 'sh deposit.sh'
|
script = 'sh deposit.sh'
|
||||||
else:
|
else: # Mac or Linux
|
||||||
script = './deposit.sh'
|
script = './deposit.sh'
|
||||||
|
|
||||||
cmd_args = [
|
cmd_args = [
|
||||||
|
@ -47,6 +47,12 @@ async def test_script():
|
|||||||
if not os.path.exists(my_folder_path):
|
if not os.path.exists(my_folder_path):
|
||||||
os.mkdir(my_folder_path)
|
os.mkdir(my_folder_path)
|
||||||
|
|
||||||
|
proc = await asyncio.create_subprocess_shell(
|
||||||
|
'./deposit.sh install',
|
||||||
|
stdin=asyncio.subprocess.PIPE,
|
||||||
|
stdout=asyncio.subprocess.PIPE,
|
||||||
|
)
|
||||||
|
|
||||||
cmd_args = [
|
cmd_args = [
|
||||||
'./deposit.sh',
|
'./deposit.sh',
|
||||||
'--num_validators', '1',
|
'--num_validators', '1',
|
||||||
|
8
tox.ini
8
tox.ini
@ -12,19 +12,15 @@ extras = test
|
|||||||
basepython=
|
basepython=
|
||||||
py37: python3.7
|
py37: python3.7
|
||||||
py38: python3.8
|
py38: python3.8
|
||||||
|
|
||||||
[common-install]
|
|
||||||
deps=
|
deps=
|
||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/requirements_test.txt
|
-r{toxinidir}/requirements_test.txt
|
||||||
|
|
||||||
[common-core]
|
[common-core]
|
||||||
deps={[common-install]deps}
|
|
||||||
commands=
|
commands=
|
||||||
pytest {posargs:tests}
|
pytest {posargs:tests}
|
||||||
|
|
||||||
[common-lint]
|
[common-lint]
|
||||||
deps={[common-install]deps}
|
|
||||||
commands=
|
commands=
|
||||||
flake8 --config={toxinidir}/flake8.ini {toxinidir}/cli {toxinidir}/tests
|
flake8 --config={toxinidir}/flake8.ini {toxinidir}/cli {toxinidir}/tests
|
||||||
mypy --config-file {toxinidir}/mypy.ini -p eth2deposit
|
mypy --config-file {toxinidir}/mypy.ini -p eth2deposit
|
||||||
@ -36,19 +32,15 @@ commands=
|
|||||||
python {toxinidir}/test_deposit_script.py
|
python {toxinidir}/test_deposit_script.py
|
||||||
|
|
||||||
[testenv:py37-core]
|
[testenv:py37-core]
|
||||||
deps={[common-core]deps}
|
|
||||||
commands={[common-core]commands}
|
commands={[common-core]commands}
|
||||||
|
|
||||||
[testenv:py38-core]
|
[testenv:py38-core]
|
||||||
deps={[common-core]deps}
|
|
||||||
commands={[common-core]commands}
|
commands={[common-core]commands}
|
||||||
|
|
||||||
[testenv:py37-lint]
|
[testenv:py37-lint]
|
||||||
deps={[common-lint]deps}
|
|
||||||
commands={[common-lint]commands}
|
commands={[common-lint]commands}
|
||||||
|
|
||||||
[testenv:py38-lint]
|
[testenv:py38-lint]
|
||||||
deps={[common-lint]deps}
|
|
||||||
commands={[common-lint]commands}
|
commands={[common-lint]commands}
|
||||||
|
|
||||||
[testenv:py37-script]
|
[testenv:py37-script]
|
||||||
|
Loading…
Reference in New Issue
Block a user