Skip to content

Commit 3ff04ec

Browse files
authored
Merge pull request #121 from iExecBlockchainComputing/feature/nethermind-test
Created the files coressponding to nethermind poco chain
2 parents a53a2f1 + ce2d35b commit 3ff04ec

File tree

10 files changed

+1176
-15
lines changed

10 files changed

+1176
-15
lines changed

.drone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ pipeline:
6060
auto_tag: true
6161
auto_tag_suffix: native
6262
when:
63-
ref: [refs/tags/v*]
63+
ref: [refs/tags/v*]

Jenkinsfile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ pipeline {
124124
}
125125
steps {
126126
script {
127-
openethereumNative1secImage = docker.build(
127+
nethermindNative1secImage = docker.build(
128128
registry + "/poco-chain:native-${TAG_NAME}",
129-
"--file testchains/openethereum.dockerfile" \
129+
"--file testchains/nethermind.dockerfile" \
130130
+ " --build-arg \"MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final\"" \
131131
+ " --build-arg CHAIN_TYPE=native" \
132132
+ " --build-arg CHAIN_BLOCK_TIME=1" \
@@ -135,7 +135,7 @@ pipeline {
135135
}
136136
script {
137137
docker.withRegistry("https://" + registry, "nexus") {
138-
openethereumNative1secImage.push()
138+
nethermindNative1secImage.push()
139139
}
140140
}
141141
}
@@ -149,9 +149,9 @@ pipeline {
149149
}
150150
steps {
151151
script {
152-
openethereumToken1secImage = docker.build(
152+
nethermindToken1secImage = docker.build(
153153
registry + "/poco-chain:token-${TAG_NAME}",
154-
"--file testchains/openethereum.dockerfile" \
154+
"--file testchains/nethermind.dockerfile" \
155155
+ " --build-arg \"MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final\"" \
156156
+ " --build-arg CHAIN_TYPE=token" \
157157
+ " --build-arg CHAIN_BLOCK_TIME=1" \
@@ -160,23 +160,23 @@ pipeline {
160160
}
161161
script {
162162
docker.withRegistry("https://" + registry, "nexus") {
163-
openethereumToken1secImage.push()
163+
nethermindToken1secImage.push()
164164
}
165165
}
166166
}
167167
}
168168

169-
stage("Native 5s image") {
169+
stage("Native 5s image ") {
170170
when {
171171
expression {
172172
env.TAG_NAME != null && env.TAG_NAME.toString().contains(buildWhenTagContains)
173173
}
174174
}
175175
steps {
176176
script {
177-
openethereumNative5secImage = docker.build(
177+
nethermindNative5secImage = docker.build(
178178
registry + "/poco-chain:native-${TAG_NAME}-5s",
179-
"--file testchains/openethereum.dockerfile" \
179+
"--file testchains/nethermind.dockerfile" \
180180
+ " --build-arg \"MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final\"" \
181181
+ " --build-arg CHAIN_TYPE=native" \
182182
+ " --build-arg CHAIN_BLOCK_TIME=5" \
@@ -185,7 +185,7 @@ pipeline {
185185
}
186186
script {
187187
docker.withRegistry("https://" + registry, "nexus") {
188-
openethereumNative5secImage.push()
188+
nethermindNative5secImage.push()
189189
}
190190
}
191191
}
@@ -199,9 +199,9 @@ pipeline {
199199
}
200200
steps {
201201
script {
202-
openethereumNative5secImage = docker.build(
202+
nethermindNative5secImage = docker.build(
203203
registry + "/poco-chain:token-${TAG_NAME}-5s",
204-
"--file testchains/openethereum.dockerfile" \
204+
"--file testchains/nethermind.dockerfile" \
205205
+ " --build-arg \"MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final\"" \
206206
+ " --build-arg CHAIN_TYPE=token" \
207207
+ " --build-arg CHAIN_BLOCK_TIME=5" \
@@ -210,10 +210,10 @@ pipeline {
210210
}
211211
script {
212212
docker.withRegistry("https://" + registry, "nexus") {
213-
openethereumNative5secImage.push()
213+
nethermindNative5secImage.push()
214214
}
215215
}
216216
}
217217
}
218218
}
219-
}
219+
}

nethermind.drone.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
pipeline:
2+
3+
test:
4+
image: node:16
5+
pull: true
6+
commands:
7+
- npm ci --production=false
8+
- npm run autotest fast
9+
- KYC=1 npm run autotest fast
10+
11+
docker_token_nethermind:
12+
image: plugins/docker
13+
repo: iexechub/poco-chaintest
14+
secrets: [docker_username, docker_password]
15+
dockerfile: testchains/nethermind.dockerfile
16+
build_args:
17+
- MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final
18+
- CHAIN_TYPE=token
19+
- CHAIN_BLOCK_TIME=1
20+
- CHAIN_FORCE_SEALING=false
21+
auto_tag: true
22+
auto_tag_suffix: token-nethermind
23+
when:
24+
ref: [refs/tags/v*]
25+
26+
docker_native_nethermind:
27+
image: plugins/docker
28+
repo: iexechub/poco-chaintest
29+
secrets: [docker_username, docker_password]
30+
dockerfile: testchains/nethermind.dockerfile
31+
build_args:
32+
- MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final
33+
- CHAIN_TYPE=native
34+
- CHAIN_BLOCK_TIME=1
35+
- CHAIN_FORCE_SEALING=false
36+
auto_tag: true
37+
auto_tag_suffix: native-nethermind
38+
when:
39+
ref: [refs/tags/v*]
40+
41+
docker_token_ganache:
42+
image: plugins/docker
43+
repo: iexechub/poco-chaintest
44+
secrets: [docker_username, docker_password]
45+
dockerfile: testchains/Dockerfile_token_ganache
46+
build_args:
47+
- MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final
48+
auto_tag: true
49+
auto_tag_suffix: token
50+
when:
51+
ref: [refs/tags/v*]
52+
53+
docker_native_ganache:
54+
image: plugins/docker
55+
repo: iexechub/poco-chaintest
56+
secrets: [docker_username, docker_password]
57+
dockerfile: testchains/Dockerfile_native_ganache
58+
build_args:
59+
- MNEMONIC=actual surround disorder swim upgrade devote digital misery truly verb slide final
60+
auto_tag: true
61+
auto_tag_suffix: native
62+
when:
63+
ref: [refs/tags/v*]

testchains/nethermind.dockerfile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
###
2+
## docker image build \
3+
## --file testchains/nethermind.dockerfile \
4+
## --tag nexus.iex.ec/poco-chain:native-vX.Y.Z-some-fork.0 \
5+
## --build-arg CHAIN_TYPE=native \
6+
## --build-arg CHAIN_BLOCK_TIME=1 \
7+
## --build-arg CHAIN_FORCE_SEALING=true \
8+
## .
9+
###
10+
FROM iexechub/nethermind:1.14.1-patch.0
11+
USER root
12+
RUN apt-get update && apt-get install bash jq nodejs npm -y
13+
# Add git required to install ethereumjs-abi from github (https://github.com/MetaMask/web3-provider-engine/issues/345)
14+
#
15+
# ├─┬ @truffle/[email protected]
16+
# └─┬ [email protected]
17+
# └─┬ [email protected]
18+
# └─┬ [email protected]
19+
# └── [email protected] (git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0)
20+
RUN apt-get install git -y
21+
RUN echo -e "Node: `node -v` - npm: `npm -v`"
22+
23+
###
24+
## Get build configuration.
25+
###
26+
# Type of the blockchain to build.
27+
# "native" or "token".
28+
ARG CHAIN_TYPE
29+
# New blocks creating interval in seconds.
30+
# "1", "5", "20", ...
31+
ARG CHAIN_BLOCK_TIME
32+
# Always create new blocks (even without txs).
33+
# "true" or "false"
34+
35+
###
36+
## Log build configuration.
37+
###
38+
ENV MESSAGE="\n##########\n"
39+
ENV MESSAGE="${MESSAGE}### CHAIN_TYPE: ${CHAIN_TYPE} \n"
40+
ENV MESSAGE="${MESSAGE}### CHAIN_BLOCK_TIME: ${CHAIN_BLOCK_TIME} \n"
41+
ENV MESSAGE="${MESSAGE}########## \n"
42+
RUN echo -e ${MESSAGE}
43+
44+
###
45+
## Copy files and setup the chain config.
46+
###
47+
ENV BASE_DIR="/iexec-poco/testchains/nethermind"
48+
RUN mkdir /iexec-poco
49+
COPY . /iexec-poco
50+
COPY ./testchains/nethermind/keystore/key-c08c3def622af1476f2db0e3cc8ccaead07be3bb /nethermind/keystore/
51+
RUN mv /iexec-poco/config/config_${CHAIN_TYPE}.json /iexec-poco/config/config.json
52+
RUN sed -i "s/@stepDuration@/${CHAIN_BLOCK_TIME}/" ${BASE_DIR}/spec.json
53+
# remove eip1559 for sidechains
54+
RUN if [ "${CHAIN_TYPE}" = "native" ] ; \
55+
then \
56+
sed -i "/eip1559/d" ${BASE_DIR}/spec.json; \
57+
fi
58+
###
59+
## Run migration
60+
###
61+
ARG DEV_NODE
62+
ARG MNEMONIC
63+
RUN echo "MNEMONIC: ${MNEMONIC}"
64+
# Choose migration file according to chain type.
65+
# native -> migrate.sh
66+
# token -> migrate-all.sh
67+
RUN if [ "${CHAIN_TYPE}" = "native" ] ; \
68+
then \
69+
echo "Migration file: ${BASE_DIR}/migrate.sh"; \
70+
bash ${BASE_DIR}/migrate.sh; \
71+
else \
72+
echo "Migration file: ${BASE_DIR}/migrate-all.sh"; \
73+
bash ${BASE_DIR}/migrate-all.sh; \
74+
fi
75+
76+
# ###
77+
## Configure entrypoint
78+
###
79+
ENTRYPOINT [ "../../nethermind/Nethermind.Runner" ]
80+
CMD [ "--config=/iexec-poco/testchains/nethermind/authority.cfg" ]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"Init": {
3+
"ChainSpecPath": "/iexec-poco/testchains/nethermind/spec.json",
4+
"IsMining": true,
5+
"StoreReceipts": true,
6+
"BaseDbPath":"/iexec-poco/testchains/nethermind/chain-data"
7+
},
8+
"Mining": {
9+
"MinGasPrice": 0
10+
},
11+
"Network": {
12+
"ActivePeersMaxCount": 100,
13+
"DiscoveryPort": 30303,
14+
"StaticPeers": null,
15+
"DiagTracerEnabled": false
16+
},
17+
18+
"JsonRpc": {
19+
"Enabled": true,
20+
"EnabledModules": [
21+
"Eth",
22+
"Subscribe",
23+
"Trace",
24+
"TxPool",
25+
"Web3",
26+
"Personal",
27+
"Proof",
28+
"Net",
29+
"Parity",
30+
"Health"
31+
],
32+
"Host": "0.0.0.0",
33+
"Port": 8545,
34+
"WebSocketsPort": 8546
35+
},
36+
"Aura": {
37+
"ForceSealing": true,
38+
"AllowAuraPrivateChains":true
39+
},
40+
"KeyStore": {
41+
"UnlockAccounts": [
42+
"0xc08c3def622af1476f2db0e3cc8ccaead07be3bb"
43+
],
44+
"PasswordFiles":"/iexec-poco/testchains/nethermind/keystore/validator-wallet-password",
45+
"EnodeAccount":"0xc08c3def622af1476f2db0e3cc8ccaead07be3bb",
46+
"EnodeKeyFile":"/iexec-poco/testchains/nethermind/keystore/validator-wallet-password",
47+
"BlockAuthorAccount": "0xc08c3def622af1476f2db0e3cc8ccaead07be3bb",
48+
},
49+
"Sync": {
50+
"WitnessProtocolEnabled": true,
51+
"FastSyncCatchUpHeightDelta": "10000000000"
52+
}
53+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"id":"42dd2cfb-ac7c-6682-1c2d-43d4b5eebb44","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"e2e45028efacbbddf28480e38a8cb124"},"ciphertext":"a3e5739c698512ab7dd1815036d6d540134678d72f7d7323a4305f97022f2ce7","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"a1795024f43c9a6b21709fcdcf28ef7b43130b045ecbf74fdd18b71e7046df3e"},"mac":"e151f9a0131e4cc109fea27a41338c18453026dea43a12717cda17d8b797c8a7"},"address":"c08c3def622af1476f2db0e3cc8ccaead07be3bb","name":"","meta":"{}"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cLYaO6/petgU0NqdvQo6i6bBWDM7SzZw
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
#!/usr/bin/env bash
3+
echo "========== STARTING BLOCKCHAIN =========="
4+
5+
./Nethermind.Runner --config=${BASE_DIR}/authority.cfg \
6+
-d /iexec-poco/testchains/nethermind/chain-data > deployed.txt 2>&1 &
7+
8+
sleep 4
9+
10+
cd /iexec-poco && \
11+
echo "========== INSTALL DEPENDENCIES ==========" && \
12+
bash -i -c "npm ci --production=false" && \
13+
echo "========== STANDARD DEPLOYMENT ==========" && \
14+
jq . config/config.json && \
15+
bash -i -c "./node_modules/.bin/truffle migrate" && \
16+
echo "========== SET RLC IN CONFIG ==========" && \
17+
echo $(jq ". | .chains.default.token = $(jq '.networks."65535".address' build/contracts/RLC.json)" config/config.json) > config/config.json && \
18+
rm -R build && \
19+
echo "========== ENTERPRISE DEPLOYMENT ==========" && \
20+
jq . config/config.json && \
21+
bash -i -c "KYC=1 PROXY_SALT=0x0000000000000000000000000000000000000000000000000000000000000001 ./node_modules/.bin/truffle migrate" && \
22+
rm -R build && \
23+
echo "========== CLEANUP ==========" && \
24+
rm -R contracts && \
25+
echo "========== DONE ==========";

testchains/nethermind/migrate.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
./Nethermind.Runner \
4+
--config=${BASE_DIR}/authority.cfg \
5+
-d /iexec-poco/testchains/nethermind/chain-data > deployed.txt 2>&1 &
6+
7+
# Wait for the chain to start
8+
sleep 4
9+
10+
# Install node packages and deploy PoCo's smart contracts
11+
cd /iexec-poco && \
12+
sed -i '/ethereumjs-util/d' package.json && \
13+
bash -i -c "npm ci --production=false" && \
14+
bash -i -c "./node_modules/.bin/truffle migrate" && \
15+
rm -R contracts && \
16+
rm -R build

0 commit comments

Comments
 (0)