Skip to content

Commit 1963cac

Browse files
committed
Configuration update for Arbitrum (#154)
1 parent a33431a commit 1963cac

File tree

5 files changed

+75
-61
lines changed

5 files changed

+75
-61
lines changed

.github/workflows/devnet_deploy_chain.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,21 @@ jobs:
5050
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
5151
ECR_REPOSITORY_CHAIN: ${{ secrets.ECR_REPOSITORY_CHAIN }}
5252
with:
53-
host: ${{ secrets.EC2_HOST_CHAIN }}
54-
username: ${{ secrets.EC2_USERNAME_CHAIN }}
55-
key: ${{ secrets.EC2_PRIVATE_KEY_CHAIN }}
53+
host: ${{ secrets.DEVNET_EC2_HOST_CHAIN }}
54+
username: ${{ secrets.DEVNET_EC2_USERNAME_CHAIN }}
55+
key: ${{ secrets.DEVNET_EC2_PRIVATE_KEY_CHAIN }}
5656
envs: ECR_REGISTRY, ECR_REPOSITORY_CHAIN
5757
script_stop: true
5858
script: |
5959
docker stop chain || true
6060
docker rm chain || true
6161
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
6262
docker system prune -af
63+
docker system prune --volumes -f
6364
docker pull $ECR_REGISTRY/$ECR_REPOSITORY_CHAIN:latest
6465
docker run \
6566
-d \
6667
--restart always \
68+
--privileged \
6769
--name chain \
68-
-v /data/chain:/data/chain \
6970
$ECR_REGISTRY/$ECR_REPOSITORY_CHAIN:latest

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
hardhat/node_modules
22
hardhat/artifacts
33
hardhat/cache
4-
hardhat/deployments/hardhat
5-
hardhat/deployments/localhost
6-
hardhat/deployments/geth
7-
hardhat/deployments
4+
hardhat/deployments/*
85
hardhat/typechain-types
96
node_modules/*
107
# Ignore the binary executable

docker/chain/Dockerfile

Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,75 @@
11
ARG expose_via=local
2+
ARG arch=amd64
23

3-
FROM golang:1.22.3 AS base
4+
FROM docker:24.0.5-dind AS base
5+
ARG admin_address="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
46

5-
ARG arch=amd64
6-
ARG cloudflare_token_http="not-a-token"
7-
ARG cloudflare_token_ws="not-a-token"
8-
ARG geth_version=v1.13.5
9-
10-
WORKDIR /geth
11-
12-
RUN git clone --quiet --branch ${geth_version} --depth 1 https://github.com/ethereum/go-ethereum .
13-
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go run build/ci.go install -static ./cmd/geth
14-
15-
RUN /geth/build/bin/geth version
16-
RUN mv /geth/build/bin/geth /usr/local/bin/
17-
18-
ARG admin_address="0x0"
19-
20-
RUN touch fund-admin
21-
RUN echo "#!/bin/bash" >> fund-admin
22-
RUN echo "geth --exec \"eth.sendTransaction({from: eth.coinbase, to: \\\"${admin_address}\\\", value: new web3.BigNumber(eth.getBalance(eth.coinbase)).minus(web3.toWei(1, \\\"ether\\\")) })\" attach /data/chain/geth.ipc" >> fund-admin
23-
RUN chmod +x fund-admin
24-
25-
RUN touch run-node
26-
RUN echo "#!/bin/bash" >> run-node
27-
RUN echo "geth --datadir /data/chain --dev --ws --ws.api web3,eth,net --ws.addr 0.0.0.0 --ws.port 8546 --ws.origins '*' --http --http.api web3,eth,net --http.addr 0.0.0.0 --http.corsdomain '*' --http.port 8545 --http.vhosts '*' &" >> run-node
28-
RUN chmod +x run-node
29-
30-
RUN touch reset
31-
RUN echo "#!/bin/bash" >> reset
32-
RUN echo "echo '- Kill geth'" >> reset
33-
RUN echo "pkill -INT geth" >> reset
34-
RUN echo "sleep 5" >> reset
35-
RUN echo "echo '- Clear data'" >> reset
36-
RUN echo "rm -rf /data/chain/*" >> reset
37-
RUN echo "echo '- Restart geth'" >> reset
38-
RUN echo "./run-node" >> reset
39-
RUN echo "sleep 5" >> reset
40-
RUN echo "echo '- Fund admin'" >> reset
41-
RUN echo "./fund-admin" >> reset
42-
RUN echo "echo '- Done'" >> reset
43-
RUN chmod +x reset
447

8+
RUN apk update
9+
RUN apk add bash
10+
RUN apk add nodejs
11+
RUN apk add npm
12+
13+
WORKDIR /l2chain
14+
COPY . .
4515
RUN touch run
4616
RUN echo "#!/bin/bash" >> run
17+
RUN echo "dockerd-entrypoint.sh & " >> run
18+
RUN echo "until docker info >/dev/null 2>&1; do " >> run
19+
RUN echo " echo 'Waiting for Docker to start...'" >> run
20+
RUN echo " sleep 1" >> run
21+
RUN echo "done" >> run
22+
23+
RUN echo "docker pull offchainlabs/nitro-node:v2.3.4-b4cc111 " >> run
24+
25+
RUN echo "docker run -d --name devnet -p 0.0.0.0:8547:8547 -p 0.0.0.0:8548:8548 offchainlabs/nitro-node:v2.3.4-b4cc111 "\
26+
" --init.dev-init " \
27+
" --init.dev-init-address $admin_address "\
28+
" --node.dangerous.no-l1-listener "\
29+
" --node.parent-chain-reader.enable=false "\
30+
" --parent-chain.id=1337 "\
31+
" --chain.id=412346 "\
32+
" --persistent.chain /tmp/dev-test "\
33+
" --node.sequencer "\
34+
" --execution.sequencer.enable "\
35+
" --node.dangerous.no-sequencer-coordinator "\
36+
" --node.staker.enable=false "\
37+
" --init.empty=false "\
38+
" --http.port 8547 "\
39+
" --http.addr 0.0.0.0 "\
40+
" --ws.port 8548 "\
41+
" --ws.addr 0.0.0.0 "\
42+
" --http.corsdomain=* "\
43+
" --http.vhosts=* "\
44+
" --ws.origins=* "\
45+
" " >> run
46+
47+
RUN echo "until wget -qO- http://0.0.0.0:8547 >/dev/null 2>&1; do " >> run
48+
RUN echo " echo 'Waiting for Nitro to start...'" >> run
49+
RUN echo " sleep 1" >> run
50+
RUN echo "done" >> run
51+
52+
RUN echo "cd hardhat" >> run
53+
RUN echo "npm install" >> run
54+
RUN echo "npx hardhat deploy --network devnet" >> run
55+
RUN echo "npx hardhat run scripts/fund-services-ether.ts --network devnet" >> run
56+
RUN echo "npx hardhat run scripts/fund-services-tokens.ts --network devnet " >> run
57+
RUN echo "npx hardhat run scripts/print-l2-config.ts --network devnet" >> run
4758

4859
FROM base AS expose-cloudflare
49-
RUN curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${arch}.deb
50-
RUN dpkg -i cloudflared.deb
51-
RUN echo "cloudflared tunnel --metrics 0.0.0.0:11111 run --token $cloudflare_token_http --url http://localhost:8545 &" >> run
52-
RUN echo "cloudflared tunnel --metrics 0.0.0.0:11112 run --token $cloudflare_token_ws --url http://localhost:8546 &" >> run
60+
ARG cloudflare_token_http="not-a-token"
61+
ARG cloudflare_token_ws="not-a-token"
62+
63+
RUN wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
64+
RUN echo "cd .." >> run
65+
RUN echo "./cloudflared-linux-amd64 tunnel run --token $cloudflare_token_http &" >> run
66+
RUN echo "./cloudflared-linux-amd64 tunnel run --token $cloudflare_token_ws &" >> run
67+
RUN chmod +x cloudflared-linux-amd64
5368

5469
FROM base AS expose-local
55-
EXPOSE 8545
56-
EXPOSE 8546
70+
RUN echo "cd .." >> run
5771

58-
FROM expose-$expose_via AS final
59-
RUN echo "./run-node" >> run
60-
RUN echo "sleep infinity" >> run
72+
FROM expose-$expose_via AS FINAL
6173
RUN chmod +x run
62-
63-
CMD ["/bin/bash", "./run"]
74+
RUN echo "wait -n" >> run
75+
ENTRYPOINT ["bash", "./run"]

hardhat/hardhat.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ const config: HardhatUserConfig = {
3434
chainId: CHAIN_ID,
3535
accounts: [getAccount('admin').privateKey],
3636
},
37-
37+
devnet: {
38+
url: 'http://0.0.0.0:8547',
39+
chainId: 412346,
40+
accounts: [getAccount('admin').privateKey],
41+
},
3842
},
3943
etherscan: {
4044
apiKey: process.env.ETHERSCAN_API_KEY,

stack

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,4 @@ function run() {
288288
doppler run --preserve-env -p run -c dev -- go run . run "$@"
289289
}
290290

291-
eval "$@"
291+
eval "$@"

0 commit comments

Comments
 (0)