Skip to content

Commit 83fd284

Browse files
committed
Add staking support
1 parent 7ac7350 commit 83fd284

39 files changed

+741
-148
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ help:
2727
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
2828

2929
cov: ## check code coverage
30-
poetry run coverage run --source pycardano -m pytest
30+
poetry run coverage run --source pycardano -m pytest -n 4
3131
poetry run coverage report -m
3232

3333
cov-html: cov ## check code coverage and generate an html report
@@ -56,7 +56,7 @@ clean-test: ## remove test and coverage artifacts
5656
rm -fr .pytest_cache
5757

5858
test: ## runs tests
59-
poetry run pytest
59+
poetry run pytest -n 4
6060

6161
qa: ## runs static analysis with flake8
6262
poetry run flake8 pycardano

docs/requirements.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or pyth
44
babel==2.10.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
55
black==22.3.0; python_full_version >= "3.6.2"
66
blockfrost-python==0.4.4; python_version >= "3.7" and python_version < "4"
7-
cbor2==5.4.2.post1; python_version >= "3.6"
8-
certifi==2021.10.8; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
7+
cbor2==5.4.3; python_version >= "3.7"
8+
certifi==2022.5.18.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
99
cffi==1.15.0; python_version >= "3.6"
1010
charset-normalizer==2.0.12; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
11-
click==8.1.2; python_version >= "3.7" and python_full_version >= "3.6.2"
11+
click==8.1.3; python_version >= "3.7" and python_full_version >= "3.6.2"
1212
colorama==0.4.4; sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.6.2" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6") and platform_system == "Windows"
13-
coverage==6.3.2; python_version >= "3.7"
13+
coverage==6.3.3; python_version >= "3.7"
1414
decorator==5.1.1; python_version >= "3.5"
1515
docutils==0.17.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
16+
execnet==1.9.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
1617
flake8==4.0.1; python_version >= "3.6"
17-
flask==2.1.1; python_version >= "3.7"
18+
flask==2.1.2; python_version >= "3.7"
1819
idna==3.3; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
1920
imagesize==1.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
2021
importlib-metadata==4.2.0; python_version < "3.8" and python_version >= "3.7" and python_full_version >= "3.6.2"
2122
iniconfig==1.1.1; python_version >= "3.7"
2223
isort==5.10.1; python_full_version >= "3.6.1" and python_version < "4.0"
2324
itsdangerous==2.1.2; python_version >= "3.7"
24-
jinja2==3.1.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
25+
jinja2==3.1.2; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
2526
markupsafe==2.1.1; python_version >= "3.7"
2627
mccabe==0.6.1; python_version >= "3.6"
2728
mypy-extensions==0.4.3; python_full_version >= "3.6.2"
@@ -35,8 +36,10 @@ pycparser==2.21; python_version >= "3.6" and python_full_version < "3.0.0" or py
3536
pyflakes==2.4.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
3637
pygments==2.12.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
3738
pynacl==1.5.0; python_version >= "3.6"
38-
pyparsing==3.0.8; python_full_version >= "3.6.8" and python_version >= "3.7"
39+
pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.7"
3940
pytest-cov==3.0.0; python_version >= "3.6"
41+
pytest-forked==1.4.0; python_version >= "3.6"
42+
pytest-xdist==2.5.0; python_version >= "3.6"
4043
pytest==7.1.2; python_version >= "3.7"
4144
pytz==2022.1; python_version >= "3.6"
4245
requests==2.27.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
@@ -57,5 +60,5 @@ typeguard==2.13.3; python_full_version >= "3.5.3"
5760
typing-extensions==4.2.0; python_version < "3.8" and python_full_version >= "3.6.2" and python_version >= "3.7"
5861
urllib3==1.26.9; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
5962
websocket-client==1.3.2; python_version >= "3.7"
60-
werkzeug==2.1.1; python_version >= "3.7"
63+
werkzeug==2.1.2; python_version >= "3.7"
6164
zipp==3.8.0; python_version < "3.8" and python_version >= "3.7"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Certificate
2+
==============================
3+
4+
.. automodule:: pycardano.certificate
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ making it a light-weight library that is easy and fast to set up in all kinds of
3232

3333
api/pycardano.address
3434
api/pycardano.backend.base
35+
api/pycardano.certificate
3536
api/pycardano.coinselection
3637
api/pycardano.exception
3738
api/pycardano.hash

integration-test/configs/local-alonzo/shelley-genesis.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"maxLovelaceSupply": 1000000000000,
33
"securityParam": 1000000000,
4-
"slotsPerKESPeriod": 129600,
4+
"slotsPerKESPeriod": 1000000000,
55
"updateQuorum": 2,
66
"activeSlotsCoeff": 0.5,
77
"protocolParams": {
@@ -18,15 +18,15 @@
1818
"maxTxSize": 16384,
1919
"nOpt": 100,
2020
"maxBlockHeaderSize": 1100,
21-
"keyDeposit": 0,
21+
"keyDeposit": 1000000,
2222
"protocolVersion": {
2323
"minor": 0,
2424
"major": 5
2525
},
26-
"poolDeposit": 0,
26+
"poolDeposit": 1000000,
2727
"a0": 0.0,
2828
"rho": 0.1,
29-
"decentralisationParam": 1.0
29+
"decentralisationParam": 0.1
3030
},
3131
"networkMagic": 42,
3232
"initialFunds": {
@@ -46,5 +46,5 @@
4646
"pools": {},
4747
"stake": {}
4848
},
49-
"epochLength": 500
49+
"epochLength": 2
5050
}

integration-test/docker-compose.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,31 @@ services:
66
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-1.34.1}
77
entrypoint: bash
88
environment:
9-
NETWORK: "${NETWORK:-local}"
9+
NETWORK: "${NETWORK:-local-alonzo}"
1010
command: /code/run_node.sh
1111

1212
volumes:
1313
- .:/code
1414
- node-db:/data/db
1515
- node-ipc:/ipc
16+
ports:
17+
- ${BFT_NODE_PORT:-3000}:3000
18+
logging:
19+
driver: "json-file"
20+
options:
21+
max-size: "200k"
22+
max-file: "10"
23+
24+
cardano-pool:
25+
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-1.34.1}
26+
entrypoint: bash
27+
environment:
28+
NETWORK: "${NETWORK:-local-alonzo}"
29+
command: /code/run_pool.sh
30+
31+
volumes:
32+
- .:/code
33+
- node-ipc:/ipc
1634
logging:
1735
driver: "json-file"
1836
options:
@@ -22,7 +40,7 @@ services:
2240
ogmios:
2341
image: cardanosolutions/ogmios:latest
2442
environment:
25-
NETWORK: "${NETWORK:-local}"
43+
NETWORK: "${NETWORK:-local-alonzo}"
2644

2745
command: [
2846
"--host", "0.0.0.0",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "NodeOperationalCertificateIssueCounter",
3+
"description": "Next certificate issue number: 0",
4+
"cborHex": "820058202f896875fd81ee621cd8ef450c46a4e3c62a7b68ae0cc7b4372c2b02774cf759"
5+
}

integration-test/keys/pool/cold.skey

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "StakePoolSigningKey_ed25519",
3+
"description": "Stake Pool Operator Signing Key",
4+
"cborHex": "58201a516a8fd768f95c919917f4151a82ad62abb2080400f921da4b8808fae42dcf"
5+
}

integration-test/keys/pool/cold.vkey

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "StakePoolVerificationKey_ed25519",
3+
"description": "Stake Pool Operator Verification Key",
4+
"cborHex": "58202f896875fd81ee621cd8ef450c46a4e3c62a7b68ae0cc7b4372c2b02774cf759"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "CertificateShelley",
3+
"description": "Stake Address Delegation Certificate",
4+
"cborHex": "83028200581c4828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d69581cc2105401f5b4e8dfcc3b04f7a2722f72a8f6c4b1c00f9b5b8f46dd5e"
5+
}

0 commit comments

Comments
 (0)