Skip to content

Commit 8cca7ce

Browse files
committed
feat: working on ropsten
1 parent 00bc7eb commit 8cca7ce

File tree

5 files changed

+53
-144
lines changed

5 files changed

+53
-144
lines changed

‎test/ping-pong/docker-compose.host.docker.internal.yml

+15-13
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ services:
2121
BLOCKCHAIN_PORT: 8546
2222
ETH_PRIVATE_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
2323
ETH_ADDRESS: '0xdb080dC48961bC1D67a0A4151572eCb824cC76E8'
24-
USE_ROPSTEN: enable
2524
GAS_PRICE: 20000000000
2625
# This is only needed for test purposes - it gives tokens to the user at startup
27-
USER_ETHEREUM_SIGNING_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
28-
USER_ADDRESS: '0xdb080dC48961bC1D67a0A4151572eCb824cC76E8'
26+
USER_ETHEREUM_ADDRESSES: 0xE35B7c8338E4B952C03E73B50f454B1df086fef2,0x4637Ee1126723e098A152f33F326fb767A6A2b8A
2927

3028
optimist:
3129
extra_hosts:
@@ -43,26 +41,30 @@ services:
4341
BLOCKCHAIN_PORT: 8546
4442
PROPOSER_ETHEREUM_SIGNING_KEY: 645ac79fa9fd87dd1cf30bdca51d326bd501cd328d6dbc9f5f517c7da0dafa6f
4543

46-
# user-local:
47-
# extra_hosts:
48-
# - 'host.docker.internal:host-gateway'
49-
# environment:
50-
# BLOCKCHAIN_WS_HOST: host.docker.internal
51-
# BLOCKCHAIN_PORT: 8546
52-
# USER_ETHEREUM_SIGNING_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
53-
5444
user-local1:
5545
extra_hosts:
5646
- 'host.docker.internal:host-gateway'
5747
environment:
5848
BLOCKCHAIN_WS_HOST: host.docker.internal
5949
BLOCKCHAIN_PORT: 8546
60-
USER_ETHEREUM_SIGNING_KEY: b0fa8745bd6e77a67ec6a27e701971d659937140cc3159d9f85210da3444eb45
50+
TEST_LENGTH: 3
51+
ERC20_NAME: ERC20Mock
52+
USER_ETHEREUM_SIGNING_KEY: adf9b65664deaa27d37f2c3bae4f70ca22cbe9d956a1be5873770f6fd68df271
53+
USER_ADDRESS: '0xE35B7c8338E4B952C03E73B50f454B1df086fef2'
54+
RECIPIENT_PKD: 0x105651c0c5bb97582b3270e0f5a07ca81410ffd1920e86697efddaec03dccef8,0x1ac3b61ecba1448e697b23d37efe290fb86554b2f905aaca3a6df59805eca366
55+
ZKP_MNEMONIC: tone shadow woman critic glare utility brass scheme edge brisk enforce champion
56+
6157

6258
user-local2:
6359
extra_hosts:
6460
- 'host.docker.internal:host-gateway'
6561
environment:
6662
BLOCKCHAIN_WS_HOST: host.docker.internal
6763
BLOCKCHAIN_PORT: 8546
68-
USER_ETHEREUM_SIGNING_KEY: d42905d0582c476c4b74757be6576ec323d715a0c7dcff231b6348b7ab0190eb
64+
USER_ETHEREUM_SIGNING_KEY: eed50965cbe8268a3ee0a24afc2f31c434a7d568bdff73a89783711c91ca1c67
65+
USER_ADDRESS: '0x4637Ee1126723e098A152f33F326fb767A6A2b8A'
66+
TEST_LENGTH: 3
67+
ERC20_NAME: ERC20Mock
68+
RECIPIENT_PKD: 0x193a37cd7973373aceae05d133f3d69ab6e7ef2f4321461173871ec7611244e2,0x27234a8721e73c9aa160154ee63d2470101fc5fd841221eeb675a91ec2d66e78
69+
ZKP_MNEMONIC:
70+
tiger victory velvet tank ritual column horse conduct athlete position soul shaft

‎test/ping-pong/docker-compose.ropsten.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
version: '3.5'
22
# Use this script for running up nightfall_3 with our geth node on ropsten
33
services:
4-
54
client:
65
environment:
76
BLOCKCHAIN_WS_HOST: ropsten1-ws.testnet.nightfall3.com
@@ -17,13 +16,10 @@ services:
1716
BLOCKCHAIN_WS_HOST: ropsten1-ws.testnet.nightfall3.com
1817
BLOCKCHAIN_PORT: 80
1918
ETH_PRIVATE_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
20-
# this should be the address corresponding to the above provate key
2119
ETH_ADDRESS: '0xdb080dC48961bC1D67a0A4151572eCb824cC76E8'
22-
USE_ROPSTEN: enable
2320
GAS_PRICE: 20000000000
2421
# This is only needed for test purposes - it gives tokens to the user at startup
25-
USER_ETHEREUM_SIGNING_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
26-
USER_ADDRESS: '0xdb080dC48961bC1D67a0A4151572eCb824cC76E8'
22+
USER_ETHEREUM_ADDRESSES: 0xE35B7c8338E4B952C03E73B50f454B1df086fef2,0x4637Ee1126723e098A152f33F326fb767A6A2b8A
2723

2824
optimist:
2925
environment:
@@ -37,9 +33,27 @@ services:
3733
BLOCKCHAIN_PORT: 80
3834
PROPOSER_ETHEREUM_SIGNING_KEY: 645ac79fa9fd87dd1cf30bdca51d326bd501cd328d6dbc9f5f517c7da0dafa6f
3935

40-
user-local:
36+
user-local1:
37+
environment:
38+
BLOCKCHAIN_WS_HOST: ropsten1-ws.testnet.nightfall3.com
39+
BLOCKCHAIN_PORT: 80
40+
TEST_LENGTH: 3
41+
ERC20_NAME: ERC20Mock
42+
USER_ETHEREUM_SIGNING_KEY: adf9b65664deaa27d37f2c3bae4f70ca22cbe9d956a1be5873770f6fd68df271
43+
USER_ADDRESS: '0xE35B7c8338E4B952C03E73B50f454B1df086fef2'
44+
RECIPIENT_PKD: 0x105651c0c5bb97582b3270e0f5a07ca81410ffd1920e86697efddaec03dccef8,0x1ac3b61ecba1448e697b23d37efe290fb86554b2f905aaca3a6df59805eca366
45+
ZKP_MNEMONIC: tone shadow woman critic glare utility brass scheme edge brisk enforce champion
46+
TX_WAIT: 120000
47+
48+
49+
user-local2:
4150
environment:
4251
BLOCKCHAIN_WS_HOST: ropsten1-ws.testnet.nightfall3.com
4352
BLOCKCHAIN_PORT: 80
44-
USER_ETHEREUM_SIGNING_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
45-
USER_ADDRESS: '0xdb080dC48961bC1D67a0A4151572eCb824cC76E8'
53+
USER_ETHEREUM_SIGNING_KEY: eed50965cbe8268a3ee0a24afc2f31c434a7d568bdff73a89783711c91ca1c67
54+
USER_ADDRESS: '0x4637Ee1126723e098A152f33F326fb767A6A2b8A'
55+
TEST_LENGTH: 3
56+
ERC20_NAME: ERC20Mock
57+
RECIPIENT_PKD: 0x193a37cd7973373aceae05d133f3d69ab6e7ef2f4321461173871ec7611244e2,0x27234a8721e73c9aa160154ee63d2470101fc5fd841221eeb675a91ec2d66e78
58+
ZKP_MNEMONIC: tiger victory velvet tank ritual column horse conduct athlete position soul shaft
59+
TX_WAIT: 120000

‎test/ping-pong/docker-compose.standalone.ganache.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ services:
1111
ganache-cli --defaultBalanceEther=0 --gasLimit=0xbebc20 --deterministic -i 4378921 -p 8546
1212
--account="0xabf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce,10000000000000000000000"
1313
--account="0x645ac79fa9fd87dd1cf30bdca51d326bd501cd328d6dbc9f5f517c7da0dafa6f,10000000000000000000000"
14-
--account="0xb0fa8745bd6e77a67ec6a27e701971d659937140cc3159d9f85210da3444eb45,10000000000000000000000"
15-
--account="0xd42905d0582c476c4b74757be6576ec323d715a0c7dcff231b6348b7ab0190eb,10000000000000000000000"
14+
--account="0xadf9b65664deaa27d37f2c3bae4f70ca22cbe9d956a1be5873770f6fd68df271,10000000000000000000000"
15+
--account="0xeed50965cbe8268a3ee0a24afc2f31c434a7d568bdff73a89783711c91ca1c67,10000000000000000000000"

‎test/ping-pong/docker-compose.yml

+8-113
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ version: '3.5'
33
services:
44
client:
55
image: ghcr.io/eyblockchain/nightfall3-client:latest
6+
build:
7+
dockerfile: client.Dockerfile
8+
context: ../../
69
volumes:
710
- type: volume
811
source: build
@@ -12,9 +15,6 @@ services:
1215
target: /app/mongodb
1316
networks:
1417
- pong_network
15-
# ports:
16-
# - 27017:27017
17-
# - 8080:80
1818
depends_on:
1919
- worker
2020
- rabbitmq
@@ -37,20 +37,16 @@ services:
3737

3838
rabbitmq:
3939
image: rabbitmq
40-
# ports:
41-
# - '15674:15674'
42-
# - '5672:5672'
4340
networks:
4441
- pong_network
4542

4643
optimist:
4744
image: ghcr.io/eyblockchain/nightfall3-optimist:latest
45+
build:
46+
dockerfile: optimist.Dockerfile
47+
context: ../../
4848
networks:
4949
- pong_network
50-
# ports:
51-
# - 8081:80
52-
# websocket port for Optimist is on localhost:8082
53-
# - 8082:8080
5450
volumes:
5551
- type: volume
5652
source: build
@@ -67,25 +63,6 @@ services:
6763
TIMBER_PORT: 80
6864
command: ['npm', 'run', 'dev']
6965

70-
# # Temporary container to deploy contracts and circuits and populate volumes
71-
# deployer:
72-
# image: ghcr.io/eyblockchain/nightfall3-deployer
73-
# volumes:
74-
# - type: volume
75-
# source: build
76-
# target: /app/build/
77-
# networks:
78-
# - nightfall_network
79-
# environment:
80-
# LOG_LEVEL: debug
81-
# # ETH_NETWORK sets the network selected by Truffle from truffle-config.js
82-
# # startup routines will wait for a blockchain client to be reachable on this network
83-
# ETH_NETWORK: blockchain1
84-
# BLOCKCHAIN_WS_HOST: blockchain1
85-
# BLOCKCHAIN_PORT: 8546
86-
# ZOKRATES_WORKER_HOST: worker
87-
# USE_STUBS: 'false'
88-
8966
# Temporary container to deploy contracts and circuits and populate volumes
9067
deployer:
9168
image: ghcr.io/eyblockchain/nightfall3-deployer:latest
@@ -96,30 +73,6 @@ services:
9673
- type: volume
9774
source: build
9875
target: /app/build/
99-
- type: bind
100-
source: ../../nightfall-deployer/contracts
101-
target: /app/contracts/
102-
- type: bind
103-
source: ../../nightfall-deployer/circuits
104-
target: /app/circuits/
105-
- type: bind
106-
source: ../../nightfall-deployer/src
107-
target: /app/src/
108-
- type: bind
109-
source: ../../common-files
110-
target: /common-files
111-
- type: bind
112-
source: ../../config/default.js
113-
target: /app/config/default.js
114-
- type: bind
115-
source: ../../nightfall-deployer/migrations
116-
target: /app/migrations
117-
- type: bind
118-
source: ../../nightfall-deployer/truffle-config.js
119-
target: /app/truffle-config.js
120-
- type: bind
121-
source: ../../nightfall-deployer/entrypoint.sh
122-
target: /app/entrypoint.sh
12376
networks:
12477
- pong_network
12578
environment:
@@ -131,8 +84,6 @@ services:
13184
BLOCKCHAIN_PORT: 8546
13285
ZOKRATES_WORKER_HOST: worker
13386
USE_STUBS: 'false'
134-
USER_ETHEREUM_ADDRESSES: 0x4ca4902a6f456b488947074ad4140317c7e21996,0xfCb059A4dB5B961d3e48706fAC91a55Bad0035C9
135-
ETH_ADDRESS: '0xdb080dC48961bC1D67a0A4151572eCb824cC76E8'
13687

13788
worker:
13889
image: ghcr.io/eyblockchain/nightfall3-worker:latest
@@ -155,13 +106,6 @@ services:
155106
context: ../../
156107
networks:
157108
- pong_network
158-
# volumes:
159-
# - type: bind
160-
# source: ../../common-files
161-
# target: /app/common-files
162-
# - type: bind
163-
# source: ./proposer/src
164-
# target: /app/test/ping-pong/proposer/src
165109
environment:
166110
OPTIMIST_HOST: optimist
167111
OPTIMIST_WS_PORT: 8080
@@ -171,44 +115,13 @@ services:
171115
BLOCKCHAIN_WS_HOST: blockchain1
172116
BLOCKCHAIN_PORT: 8546
173117

174-
# user-local:
175-
# image: ghcr.io/eyblockchain/nightfall3-user-local:latest
176-
# build:
177-
# dockerfile: user-local.Dockerfile
178-
# context: ../../
179-
# networks:
180-
# - pong_network
181-
# # volumes:
182-
# # - type: bind
183-
# # source: ../../common-files
184-
# # target: /app/common-files
185-
# # - type: bind
186-
# # source: ./user-local/src
187-
# # target: /app/test/ping-pong/user-local/src
188-
# environment:
189-
# OPTIMIST_HOST: optimist
190-
# OPTIMIST_WS_PORT: 8080
191-
# OPTIMIST_HTTP_PORT: 80
192-
# CLIENT_HOST: client
193-
# CLIENT_PORT: 80
194-
# BLOCKCHAIN_WS_HOST: blockchain1
195-
# BLOCKCHAIN_PORT: 8546
196-
# ZKP_MNEMONIC: tiger victory velvet tank ritual column horse conduct athlete position soul shaft
197-
198118
user-local1:
199-
# image: ghcr.io/eyblockchain/nightfall3-user-local1:latest
119+
image: ghcr.io/eyblockchain/nightfall3-user-local1:latest
200120
build:
201121
dockerfile: user-local1.Dockerfile
202122
context: ../../
203123
networks:
204124
- pong_network
205-
# volumes:
206-
# - type: bind
207-
# source: ../../common-files
208-
# target: /app/common-files
209-
# - type: bind
210-
# source: ./user-local1/src
211-
# target: /app/test/ping-pong/user-local1/src
212125
environment:
213126
OPTIMIST_HOST: optimist
214127
OPTIMIST_WS_PORT: 8080
@@ -217,26 +130,14 @@ services:
217130
CLIENT_PORT: 80
218131
BLOCKCHAIN_WS_HOST: blockchain1
219132
BLOCKCHAIN_PORT: 8546
220-
TEST_LENGTH: 3
221-
ERC20_NAME: ERC20Mock
222-
USER_ETHEREUM_SIGNING_KEY: '0xb0fa8745bd6e77a67ec6a27e701971d659937140cc3159d9f85210da3444eb45'
223-
RECIPIENT_PKD: 0x105651c0c5bb97582b3270e0f5a07ca81410ffd1920e86697efddaec03dccef8,0x1ac3b61ecba1448e697b23d37efe290fb86554b2f905aaca3a6df59805eca366
224-
ZKP_MNEMONIC: tone shadow woman critic glare utility brass scheme edge brisk enforce champion
225133

226134
user-local2:
227-
# image: ghcr.io/eyblockchain/nightfall3-user-local1:latest
135+
image: ghcr.io/eyblockchain/nightfall3-user-local2:latest
228136
build:
229137
dockerfile: user-local1.Dockerfile
230138
context: ../../
231139
networks:
232140
- pong_network
233-
# volumes:
234-
# - type: bind
235-
# source: ../../common-files
236-
# target: /app/common-files
237-
# - type: bind
238-
# source: ./user-local1/src
239-
# target: /app/test/ping-pong/user-local1/src
240141
environment:
241142
OPTIMIST_HOST: optimist
242143
OPTIMIST_WS_PORT: 8080
@@ -245,12 +146,6 @@ services:
245146
CLIENT_PORT: 80
246147
BLOCKCHAIN_WS_HOST: blockchain1
247148
BLOCKCHAIN_PORT: 8546
248-
TEST_LENGTH: 3
249-
ERC20_NAME: ERC20Mock
250-
USER_ETHEREUM_SIGNING_KEY: '0xd42905d0582c476c4b74757be6576ec323d715a0c7dcff231b6348b7ab0190eb'
251-
RECIPIENT_PKD: 0x193a37cd7973373aceae05d133f3d69ab6e7ef2f4321461173871ec7611244e2,0x27234a8721e73c9aa160154ee63d2470101fc5fd841221eeb675a91ec2d66e78
252-
ZKP_MNEMONIC:
253-
tiger victory velvet tank ritual column horse conduct athlete position soul shaft
254149

255150
volumes:
256151
mongodb:

‎test/ping-pong/user-local1/src/index.mjs

+6-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {
1919
TRANSACTIONS_PER_BLOCK,
2020
} = config;
2121

22-
const { TEST_LENGTH, ERC20_NAME } = process.env;
22+
const { TEST_LENGTH, ERC20_NAME, TX_WAIT = 10000 } = process.env;
2323
const recipientPkd = process.env.RECIPIENT_PKD.split(',');
2424

2525
/**
@@ -31,13 +31,11 @@ async function localTest() {
3131
const tokenType = 'ERC20';
3232
const value = 1;
3333
const tokenId = '0x0000000000000000000000000000000000000000000000000000000000000000';
34-
const nf3 = new Nf3(
35-
clientBaseUrl,
36-
optimistBaseUrl,
34+
const nf3 = new Nf3(web3WsUrl, userEthereumSigningKey, {
35+
clientApiUrl: clientBaseUrl,
36+
optimistApiUrl: optimistBaseUrl,
3737
optimistWsUrl,
38-
web3WsUrl,
39-
userEthereumSigningKey,
40-
);
38+
});
4139

4240
await nf3.init(zkpMnemonic);
4341
if (await nf3.healthcheck('client')) logger.info('Healthcheck passed');
@@ -56,7 +54,7 @@ async function localTest() {
5654
await waitForSufficientBalance(nf3, value);
5755
await nf3.transfer(false, ercAddress, tokenType, value, tokenId, recipientPkd);
5856
await nf3.deposit(ercAddress, tokenType, value, tokenId);
59-
await new Promise(resolve => setTimeout(resolve, 10000));
57+
await new Promise(resolve => setTimeout(resolve, TX_WAIT)); // this may need to be longer on a real blockchain
6058
}
6159

6260
// Wait for sometime at the end to retrieve balance to include any transactions sent by the other use

0 commit comments

Comments
 (0)