Skip to content

Commit a28641a

Browse files
outSHpetermetz
authored andcommitted
fix(indy-validator): fix package dependencies
- Update indy validator python dependencies. - Add README chapter on updating python dependencies to simplify this process in the future. - Use pinend ubuntu base image in indy-sdk-cli dockerfile. - Do some minor README improvements and cleanups. - Use pinned fabric-all-in-one versions in discounted-asset-trade. Tested with `discounted-asset-trade` (should work without an issue now, at least dockerless one) Depends on: #2596 Signed-off-by: Michal Bajer <[email protected]>
1 parent fb4231f commit a28641a

File tree

10 files changed

+142
-103
lines changed

10 files changed

+142
-103
lines changed

examples/cactus-example-discounted-asset-trade/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ For development purposes, it might be useful to run the sample application outsi
139139
- [Build the SDK from source](https://github.com/hyperledger/indy-sdk#how-to-build-indy-sdk-from-source)
140140
- Or use these steps for Ubuntu 20.04:
141141
```bash
142-
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \
142+
sudo apt-get install ca-certificates -y \
143+
&& sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \
143144
&& sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" \
144145
&& sudo apt-get update \
145146
&& sudo apt-get install -y \

examples/cactus-example-discounted-asset-trade/script-start-ledgers.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ CONFIG_VOLUME_PATH="./etc/cactus" # Docker volume with shared configuration
1010

1111
# Fabric Env Variables
1212
export CACTUS_FABRIC_ALL_IN_ONE_CONTAINER_NAME="asset_trade_faio2x_testnet"
13-
export CACTUS_FABRIC_ALL_IN_ONE_VERSION="2.2.0"
13+
export CACTUS_FABRIC_ALL_IN_ONE_VERSION="2.4.4"
14+
export CACTUS_FABRIC_ALL_IN_ONE_NODEENV_VERSION="2.4.2"
15+
export CACTUS_FABRIC_ALL_IN_ONE_CA_VERSION="1.5.3"
16+
export CACTUS_FABRIC_ALL_IN_ONE_COUCH_VERSION_FABRIC="0.4"
17+
export CACTUS_FABRIC_ALL_IN_ONE_COUCH_VERSION="3.2.2"
1418
export CACTUS_FABRIC_TEST_LOOSE_MEMBERSHIP=1
1519

1620
# Cert options

examples/cactus-example-discounted-asset-trade/transaction-indy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function getDataFromIndy(
3838
try {
3939
logger.debug(`getDataFromIndy: arg_request: ${arg_request}`);
4040
sendRequest(arg_request, identifier).then((result) => {
41-
logger.debug(`##getDataFromIndy: result: ${result}`);
41+
logger.debug(`##getDataFromIndy: result: ${JSON.stringify(result)}`);
4242

4343
return resolve(result);
4444
});
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,106 @@
11
# Indy Validator
2+
23
- Cactus socketio validator to integrate with Hyperledger Indy
34

45
## Build
6+
57
- By default, it assumes that indy pool is available at `172.16.0.2`
68
- You can modify this behavior by editing `Dockerfile` or by setting arg `pool_ip`
9+
710
```
811
./setup_indy.sh
912
```
1013

14+
## Updating the dependencies
15+
16+
- When updating depedency in `requirements.txt` make sure that it's dependencies are updated as well.
17+
- Make sure you update the package version in `setup.py` as well.
18+
- After each update build and run container to ensure it still works.
19+
- Follow this process when updating the package:
20+
21+
```bash
22+
# Go to package dir
23+
cd packages-python/cactus_validator_socketio_indy/validator-python
24+
25+
# Setup venv and install core dependencies
26+
python3 -m venv .venv
27+
source .venv/bin/activate
28+
pip install --upgrade setuptools wheel
29+
pip install Flask==2.3.2 Flask-SocketIO==5.1.1 PyJWT==2.4.0 PyYAML==5.4.1 python3-indy==1.16.0 eventlet==0.31.1 cryptography==41.0.3
30+
31+
# Freeze current package listing
32+
pip freeze > requirements.txt
33+
34+
# Copy the contents of requirements.txt to setup.py install_requires list (adjust formatting accordingly).
35+
```
36+
1137
## Test
38+
1239
- Use `testcli/testsock.js` to check basic communication pattern with the validator.
1340

1441
### How-To
42+
1543
1. Start indy testnet pool (follow instructions from `../../tools/docker/indy-testnet/` README). It should create docker network `indy-testnet_indy_net`, pool should be available at `172.16.0.2`.
1644
1. Generate proof and store it in local `/etc/cactus`:
17-
```
18-
rm -r /etc/cactus/validator_socketio_indy/*
19-
cd ../../examples/register-indy-data/
20-
./script-build-docker.sh
21-
docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" register-indy-data --proof_only
22-
```
45+
```
46+
rm -r /etc/cactus/validator_socketio_indy/*
47+
cd ../../examples/register-indy-data/
48+
./script-build-docker.sh
49+
docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" register-indy-data --proof_only
50+
```
2351
1. Copy indy validator config
24-
```
25-
cp -rf ./config/* /etc/cactus/validator_socketio_indy/
26-
```
52+
```
53+
cp -rf ./config/* /etc/cactus/validator_socketio_indy/
54+
```
2755
1. Generate validator certificate using OpenSSL tool
28-
```
29-
mkdir -p "/etc/cactus/validator_socketio_indy/CA/"
30-
openssl ecparam -genkey -name "prime256v1" -out "/etc/cactus/validator_socketio_indy/CA/connector.priv"
31-
openssl req -new -sha256 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \
32-
-out "/etc/cactus/validator_socketio_indy/CA/connector.csr" \
33-
-subj "/C=JP/ST=Tokyo/L=Minato-Ku/O=CactusSamples/CN=IndyValidator"
34-
openssl req -x509 -sha256 -days 365 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \
35-
-in "/etc/cactus/validator_socketio_indy/CA/connector.csr" \
36-
-out "/etc/cactus/validator_socketio_indy/CA/connector.crt"
37-
```
56+
```
57+
mkdir -p "/etc/cactus/validator_socketio_indy/CA/"
58+
openssl ecparam -genkey -name "prime256v1" -out "/etc/cactus/validator_socketio_indy/CA/connector.priv"
59+
openssl req -new -sha256 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \
60+
-out "/etc/cactus/validator_socketio_indy/CA/connector.csr" \
61+
-subj "/C=JP/ST=Tokyo/L=Minato-Ku/O=CactusSamples/CN=IndyValidator"
62+
openssl req -x509 -sha256 -days 365 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \
63+
-in "/etc/cactus/validator_socketio_indy/CA/connector.csr" \
64+
-out "/etc/cactus/validator_socketio_indy/CA/connector.crt"
65+
```
3866
1. Build and run validator container:
39-
```
40-
docker build . -t indy-validator
4167

42-
docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator
43-
```
68+
```
69+
docker build . -t indy-validator
70+
71+
docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator
72+
```
73+
4474
1. Open separate console, install dependencies and run the testing script:
45-
```
46-
cd testcli/
47-
ln -s /etc/cactus/validator_socketio_indy/CA/connector.crt .
48-
npm install
49-
node testsock.js
50-
```
51-
52-
Output should look like this:
53-
```
54-
connect
55-
AVE5voPzdLLEcm5kAAAD
56-
websocket
57-
call nop!
58-
call request2. get schema request.
59-
#[recv]response, res: [object Object]
60-
call verify()
61-
##signsignature: ....
62-
Authentication OK
63-
##decoded: {
64-
result: [
65-
'Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2',
66-
'{"ver":"1.0","id":"Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2","name":"Job-Certificate","version":"0.2","attrNames":["experience","last_name","salary","first_name","employee_status"],"seqNo":19}'
67-
]
68-
}
69-
OK - Done.
70-
```
75+
76+
```
77+
cd testcli/
78+
ln -s /etc/cactus/validator_socketio_indy/CA/connector.crt .
79+
npm install
80+
node testsock.js
81+
```
82+
83+
Output should look like this:
84+
85+
```
86+
connect
87+
AVE5voPzdLLEcm5kAAAD
88+
websocket
89+
call nop!
90+
call request2. get schema request.
91+
#[recv]response, res: [object Object]
92+
call verify()
93+
##signsignature: ....
94+
Authentication OK
95+
##decoded: {
96+
result: [
97+
'Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2',
98+
'{"ver":"1.0","id":"Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2","name":"Job-Certificate","version":"0.2","attrNames":["experience","last_name","salary","first_name","employee_status"],"seqNo":19}'
99+
]
100+
}
101+
OK - Done.
102+
```
71103

72104
## Manual Test
105+
73106
- Validator used by `cactus-example-discounted-asset-trade` sample app.

packages-python/cactus_validator_socketio_indy/setup.py

+17-24
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
with codecs.open(os.path.join(here, 'README.md'), encoding="utf-8") as fh:
99
LONG_DESCRIPTION = f'/n{fh.read()}'
10-
10+
1111
VERSION = '0.0.1'
1212
DESCRIPTION = 'Python Cactus Validator Indy'
1313

@@ -60,41 +60,34 @@
6060
include_package_data=True,
6161
url='https://github.com/hyperledger/cactus/tree/main/packages-python/cactus_validator_socketio_indy',
6262
install_requires=[
63-
'testresources==2.0.1',
64-
'base58==2.1.0',
65-
'bidict==0.21.4',
66-
'certifi==2023.7.22',
67-
'cffi==1.14.6',
68-
'charset-normalizer==2.0.3',
69-
'click==8.0.1',
63+
'base58==2.1.1',
64+
'bidict==0.22.1',
65+
'blinker==1.6.2',
66+
' cffi==1.15.1',
67+
'click==8.1.6',
7068
'cryptography==41.0.3',
7169
'dnspython==1.16.0',
7270
'eventlet==0.31.1',
7371
'Flask==2.3.2',
7472
'Flask-SocketIO==5.1.1',
75-
'gevent==21.1.2',
76-
'greenlet==1.1.0',
77-
'idna==3.2',
78-
'itsdangerous==2.0.1',
79-
'Jinja2==3.0.1',
80-
'MarkupSafe==2.0.1',
81-
'pycparser==2.20',
73+
'greenlet==2.0.2',
74+
'importlib-metadata==6.8.0',
75+
'itsdangerous==2.1.2',
76+
'Jinja2==3.1.2',
77+
'MarkupSafe==2.1.3',
78+
'pycparser==2.21',
8279
'PyJWT==2.4.0',
83-
'python-engineio==4.3.0',
84-
'python-socketio==5.5.0',
80+
'python-engineio==4.5.1',
81+
'python-socketio==5.8.0',
8582
'python3-indy==1.16.0',
8683
'PyYAML==5.4.1',
87-
'requests==2.31.0',
8884
'six==1.16.0',
89-
'urllib3==1.26.6',
90-
'websocket==0.2.1',
91-
'Werkzeug==2.2.3',
92-
'zope.event==4.5.0',
93-
'zope.interface==5.4.0'
85+
'Werkzeug==2.3.6',
86+
'zipp==3.16.2'
9487
],
9588
classifiers=[
9689
'Development Status :: Initial version',
9790
'Programming Language :: Python :: 3',
9891
'Intended Audience :: Developers'
9992
]
100-
)
93+
)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
__pycache__
22
*.log
3+
.venv
4+
venv
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1-
base58==2.1.0
2-
bidict==0.21.4
3-
certifi==2023.7.22
4-
cffi==1.14.6
5-
charset-normalizer==2.0.3
6-
click==8.0.1
1+
base58==2.1.1
2+
bidict==0.22.1
3+
blinker==1.6.2
4+
cffi==1.15.1
5+
click==8.1.6
76
cryptography==41.0.3
87
dnspython==1.16.0
98
eventlet==0.31.1
109
Flask==2.3.2
1110
Flask-SocketIO==5.1.1
12-
gevent==21.1.2
13-
greenlet==1.1.0
14-
idna==3.2
15-
itsdangerous==2.0.1
16-
Jinja2==3.0.1
17-
MarkupSafe==2.0.1
18-
pycparser==2.20
11+
greenlet==2.0.2
12+
importlib-metadata==6.8.0
13+
itsdangerous==2.1.2
14+
Jinja2==3.1.2
15+
MarkupSafe==2.1.3
16+
pycparser==2.21
1917
PyJWT==2.4.0
20-
python-engineio==4.3.0
21-
python-socketio==5.5.0
18+
python-engineio==4.5.1
19+
python-socketio==5.8.0
2220
python3-indy==1.16.0
2321
PyYAML==5.4.1
24-
requests==2.31.0
2522
six==1.16.0
26-
urllib3==1.26.6
27-
websocket==0.2.1
28-
Werkzeug==2.2.3
29-
zope.event==4.5.0
30-
zope.interface==5.4.0
23+
Werkzeug==2.3.6
24+
zipp==3.16.2

tools/docker/fabric-all-in-one/docker-compose-v2.x.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ services:
1717
- "8054:8054" # ca_org2
1818
- "9054:9054" # ca_orderer
1919
environment:
20-
- FABRIC_VERSION=${CACTUS_FABRIC_ALL_IN_ONE_VERSION:-2.2.0}
20+
- FABRIC_VERSION=${CACTUS_FABRIC_ALL_IN_ONE_VERSION:-2.4.4}
21+
- FABRIC_NODEENV_VERSION=${CACTUS_FABRIC_ALL_IN_ONE_NODEENV_VERSION:-2.4.2}
22+
- CA_VERSION=${CACTUS_FABRIC_ALL_IN_ONE_CA_VERSION:-1.5.3}
23+
- COUCH_VERSION_FABRIC=${CACTUS_FABRIC_ALL_IN_ONE_COUCH_VERSION_FABRIC:-0.4}
24+
- COUCH_VERSION=${CACTUS_FABRIC_ALL_IN_ONE_COUCH_VERSION:-3.2.2}
2125
- CACTUS_FABRIC_TEST_LOOSE_MEMBERSHIP=1
2226
networks:
2327
- testnet-2x

tools/docker/indy-sdk-cli/Dockerfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Indy-SDK CLI Image
22
# Contains node and python environments and indy SDK, can be used as base for indy development.
33

4-
FROM ubuntu:bionic
4+
FROM ubuntu:bionic-20230530
55

66
ENV DEBIAN_FRONTEND 'noninteractive'
77

8+
WORKDIR /home/setup
9+
810
RUN apt-get update \
911
&& apt-get install -y \
1012
gnupg \
@@ -13,15 +15,18 @@ RUN apt-get update \
1315
curl \
1416
dirmngr \
1517
apt-transport-https \
16-
lsb-release ca-certificates \
18+
lsb-release \
19+
ca-certificates \
1720
gcc \
1821
g++ \
1922
make \
2023
&& rm -rf /var/lib/apt/lists/*
2124

22-
# NodeJS and indy-sdk
23-
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
24-
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \
25+
# NodeJS
26+
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
27+
28+
# Indy-sdk
29+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \
2530
&& add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" \
2631
&& apt-get update && apt-get install -y \
2732
nodejs \

tools/docker/indy-sdk-cli/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
```
1313
docker build . -t indy-sdk-cli
1414
```
15+
16+
## Notes
17+
- In case of `gpg: keyserver receive failed: Cannot assign requested address` error - retry until it succeeds. This is some spurious error with keyserver connection.

0 commit comments

Comments
 (0)