From 988f4d73faf983916b0c71e380270abe19fc6ebb Mon Sep 17 00:00:00 2001 From: Trang Tran Date: Wed, 6 Jul 2022 22:42:27 +0700 Subject: [PATCH 1/8] add avalenche image --- ops/docker-compose-avalanche.yml | 34 ++++++++++++++++++++++++++++++++ ops/docker/Dockerfile.avalanche | 20 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 ops/docker-compose-avalanche.yml create mode 100644 ops/docker/Dockerfile.avalanche diff --git a/ops/docker-compose-avalanche.yml b/ops/docker-compose-avalanche.yml new file mode 100644 index 0000000..5c9d42e --- /dev/null +++ b/ops/docker-compose-avalanche.yml @@ -0,0 +1,34 @@ +version: "3" + +# Since avalanche use IPv6, we need to turn on ipv6 for docker +# 1. Add the following lines to daemon configuration +# { +# "fixed-cidr-v6": "fd00::/80", +# "ipv6": true, +# } +# +# 2. Restart docker +# +# 3. Then create a ipV6 network first +# docker network create --ipv6 \ +# --subnet="fd00:1::/80" \ +# --gateway="fd00:1::1" \ +# ava-network + +services: + l1_chain: + image: bobanetwork/avalanche:latest + build: + context: ./docker + dockerfile: Dockerfile.avalanche + ports: + # expose the service to the host for integration testing + - ${L1CHAIN_HTTP_PORT:-9545}:8545 + networks: + - ava-network + +networks: + ava-network: + external: true + + diff --git a/ops/docker/Dockerfile.avalanche b/ops/docker/Dockerfile.avalanche new file mode 100644 index 0000000..9be53d4 --- /dev/null +++ b/ops/docker/Dockerfile.avalanche @@ -0,0 +1,20 @@ +# Build Geth in a stock Go builder container +FROM golang:1.17.9-alpine + +RUN apk add --no-cache git bash gcc musl-dev curl + +WORKDIR $GOPATH +RUN mkdir -p src/github.com/ava-labs/avalanchego && cd src/github.com/ava-labs +WORKDIR $GOPATH/src/github.com/ava-labs + +# RUN curl -sSfL https://raw.githubusercontent.com/ava-labs/avalanche-cli/main/scripts/install.sh | sh -s +RUN git clone https://github.com/ava-labs/avalanchego +RUN cd avalanchego && ./scripts/build.sh + +RUN git clone https://github.com/ava-labs/avalanche-network-runner.git +WORKDIR $GOPATH/src/github.com/ava-labs/avalanche-network-runner +RUN go mod vendor + +EXPOSE 9650 9652 9654 9656 9658 +ENV AVALANCHEGO_EXEC_PATH $GOPATH/src/github.com/ava-labs/avalanchego/bin/avalanche +ENTRYPOINT ["go", "run", "examples/local/fivenodenetwork/main.go"] From 98fee73a9a22167d8d7d97442467427bc77fd91c Mon Sep 17 00:00:00 2001 From: Trang Tran Date: Tue, 12 Jul 2022 00:39:31 +0700 Subject: [PATCH 2/8] Configure to listen on loop interface instead of localhost --- ops/docker-compose-avalanche.yml | 22 +++++++++++----------- ops/docker/Dockerfile.avalanche | 9 ++++++++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ops/docker-compose-avalanche.yml b/ops/docker-compose-avalanche.yml index 5c9d42e..1d523fd 100644 --- a/ops/docker-compose-avalanche.yml +++ b/ops/docker-compose-avalanche.yml @@ -7,28 +7,28 @@ version: "3" # "ipv6": true, # } # -# 2. Restart docker -# -# 3. Then create a ipV6 network first -# docker network create --ipv6 \ -# --subnet="fd00:1::/80" \ -# --gateway="fd00:1::1" \ -# ava-network services: l1_chain: image: bobanetwork/avalanche:latest + container_name: l1_chain build: context: ./docker dockerfile: Dockerfile.avalanche ports: # expose the service to the host for integration testing - - ${L1CHAIN_HTTP_PORT:-9545}:8545 + - "9650:9650" + - "9652:9652" + - "9654:9654" + - "9656:9656" + - "9658:9658" networks: - ava-network networks: ava-network: - external: true - - + enable_ipv6: true + ipam: + config: + - subnet: "fd00:1::/64" + # gateway: "fd00:1::1" diff --git a/ops/docker/Dockerfile.avalanche b/ops/docker/Dockerfile.avalanche index 9be53d4..bd7ce39 100644 --- a/ops/docker/Dockerfile.avalanche +++ b/ops/docker/Dockerfile.avalanche @@ -1,7 +1,7 @@ # Build Geth in a stock Go builder container FROM golang:1.17.9-alpine -RUN apk add --no-cache git bash gcc musl-dev curl +RUN apk add --no-cache git bash gcc musl-dev curl jq WORKDIR $GOPATH RUN mkdir -p src/github.com/ava-labs/avalanchego && cd src/github.com/ava-labs @@ -14,6 +14,13 @@ RUN cd avalanchego && ./scripts/build.sh RUN git clone https://github.com/ava-labs/avalanche-network-runner.git WORKDIR $GOPATH/src/github.com/ava-labs/avalanche-network-runner RUN go mod vendor +RUN sed -i 's/127.0.0.1/0.0.0.0/g' local/default/node0/config.json local/default/node1/config.json local/default/node2/config.json local/default/node3/config.json local/default/node4/config.json +RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node0/config.json > local/default/node0/config.json.tmp && mv local/default/node0/config.json.tmp local/default/node0/config.json +RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node1/config.json > local/default/node1/config.json.tmp && mv local/default/node1/config.json.tmp local/default/node1/config.json +RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node2/config.json > local/default/node2/config.json.tmp && mv local/default/node2/config.json.tmp local/default/node2/config.json +RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node3/config.json > local/default/node3/config.json.tmp && mv local/default/node3/config.json.tmp local/default/node3/config.json +RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node4/config.json > local/default/node4/config.json.tmp && mv local/default/node4/config.json.tmp local/default/node4/config.json + EXPOSE 9650 9652 9654 9656 9658 ENV AVALANCHEGO_EXEC_PATH $GOPATH/src/github.com/ava-labs/avalanchego/bin/avalanche From 08f23944b38605cc231ca3f11980c5caf362474b Mon Sep 17 00:00:00 2001 From: Trang Tran Date: Tue, 12 Jul 2022 02:45:27 +0700 Subject: [PATCH 3/8] add more accounts to genesis --- ops/docker/Dockerfile.avalanche | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ops/docker/Dockerfile.avalanche b/ops/docker/Dockerfile.avalanche index bd7ce39..75f2fb3 100644 --- a/ops/docker/Dockerfile.avalanche +++ b/ops/docker/Dockerfile.avalanche @@ -20,6 +20,8 @@ RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node1/config. RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node2/config.json > local/default/node2/config.json.tmp && mv local/default/node2/config.json.tmp local/default/node2/config.json RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node3/config.json > local/default/node3/config.json.tmp && mv local/default/node3/config.json.tmp local/default/node3/config.json RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node4/config.json > local/default/node4/config.json.tmp && mv local/default/node4/config.json.tmp local/default/node4/config.json +RUN jq --argjson key "[{\"ethAddr\":\"0x56faE09531C4985188BA78B7fB93739eaf1fBF98\",\"avaxAddr\":\"X-custom1etenrecgr0lhywpcuvdc7crkgu4f7pdgx7qrdx\",\"initialAmount\":300000000000000000,\"unlockSchedule\":[{\"amount\":20000000000000000},{\"amount\":10000000000000000,\"locktime\":1633824000}]},{\"ethAddr\":\"0x4FC1c7D869fc4AE45FC8FC671c32f1E17f60A34F\",\"avaxAddr\":\"X-custom17qjusw0fy9d52tgwpjpak2p6qgu9pc2y6qgpqy\",\"initialAmount\":300000000000000000,\"unlockSchedule\":[{\"amount\":20000000000000000},{\"amount\":10000000000000000,\"locktime\":1633824000}]},{\"ethAddr\":\"0xdae74D7327d123a1E1732C14a75599ceAd1aeeC0\",\"avaxAddr\":\"X-custom1mp5hjf2vlpvk50e7ma4f8lss08w39y9m6gw43e\",\"initialAmount\":300000000000000000,\"unlockSchedule\":[{\"amount\":20000000000000000},{\"amount\":10000000000000000,\"locktime\":1633824000}]}]" '.allocations += $key' local/default/genesis.json > local/default/genesis.json.new && mv local/default/genesis.json.new local/default/genesis.json +RUN jq --arg key "{\"config\":{\"chainId\":43112,\"homesteadBlock\":0,\"daoForkBlock\":0,\"daoForkSupport\":true,\"eip150Block\":0,\"eip150Hash\":\"0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0\",\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"apricotPhase1BlockTimestamp\":0,\"apricotPhase2BlockTimestamp\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x5f5e100\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC\":{\"balance\":\"0x295BE96E64066972000000\"},\"56faE09531C4985188BA78B7fB93739eaf1fBF98\":{\"balance\":\"0x295BE96E64066972000000\"},\"4FC1c7D869fc4AE45FC8FC671c32f1E17f60A34F\":{\"balance\":\"0x295BE96E64066972000000\"},\"dae74D7327d123a1E1732C14a75599ceAd1aeeC0\":{\"balance\":\"0x295BE96E64066972000000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}" '.cChainGenesis = $key' local/default/genesis.json > local/default/genesis.json.new && mv local/default/genesis.json.new local/default/genesis.json EXPOSE 9650 9652 9654 9656 9658 From c695e6a30ea6e315a1b626722d96487dc0f1fb44 Mon Sep 17 00:00:00 2001 From: Trang Tran Date: Tue, 12 Jul 2022 02:49:32 +0700 Subject: [PATCH 4/8] add accounts info --- ops/docker-compose-avalanche.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ops/docker-compose-avalanche.yml b/ops/docker-compose-avalanche.yml index 1d523fd..8c9790d 100644 --- a/ops/docker-compose-avalanche.yml +++ b/ops/docker-compose-avalanche.yml @@ -8,6 +8,31 @@ version: "3" # } # + +# PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN +# 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 + + +# PUB KEY 7EdyWHDoMHykMKNSfRaFtxfCT7gDPuB8pifvrptdYiFojCAaTH +# Ava ADDRESS C-custom1etenrecgr0lhywpcuvdc7crkgu4f7pdgx7qrdx +# Ava PRIV KEY PrivateKey-8kqXG11uHXie4oWep5b4ivm2S5TRzSz6yfiamqeENnQT2rmXv +# ETH Address 0x56faE09531C4985188BA78B7fB93739eaf1fBF98 +# C-Chain PrivKey 119c49b6a55123600ce73fbfad852f45c015d328b593fb20aca9a68f1588bd7e + + +# PUB KEY 6c7qB6S7k6EPweWCfgfXMrC8SAJcss6rrjizjvALMYaJCZGYZJ +# Ava ADDRESS C-custom17qjusw0fy9d52tgwpjpak2p6qgu9pc2y6qgpqy +# Ava PRIV KEY PrivateKey-2M3bTSt99e24dwS7E6i7qkxyBxMZZsipBWQjBXBjVaabjyZJNM +# ETH Address 0x4FC1c7D869fc4AE45FC8FC671c32f1E17f60A34F +# C-Chain PrivKey b135c8deb7e4f283ad3b8a5e8b557d88f32ccdca730a7d1ee6a02263d565c39c + + +# PUB KEY 7nfXp7SfoWuexpuawJtyMiSTetUpSDWpR8pVT8bCuqFiQzGeYF +# Ava ADDRESS C-custom1mp5hjf2vlpvk50e7ma4f8lss08w39y9m6gw43e +# Ava PRIV KEY PrivateKey-2p38JqqbFQ3yruv22mFQFToPfMeZVKPa3Vud2wvorCkHetNxr9 +# ETH Address 0xdae74D7327d123a1E1732C14a75599ceAd1aeeC0 +# C-Chain PrivKey ee7fa2988cf373f3f6b96e622e740734f5b6a969435f037c7f4f58feea419437 + services: l1_chain: image: bobanetwork/avalanche:latest From 9bc1526673398b5dce11883ed6f16988532e0ddb Mon Sep 17 00:00:00 2001 From: Trang Tran Date: Tue, 12 Jul 2022 21:10:07 +0700 Subject: [PATCH 5/8] Add three more accounts --- ops/docker-compose-avalanche.yml | 22 ++++++++++++++++++++++ ops/docker/Dockerfile.avalanche | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ops/docker-compose-avalanche.yml b/ops/docker-compose-avalanche.yml index 8c9790d..8bd7c1a 100644 --- a/ops/docker-compose-avalanche.yml +++ b/ops/docker-compose-avalanche.yml @@ -33,6 +33,28 @@ version: "3" # ETH Address 0xdae74D7327d123a1E1732C14a75599ceAd1aeeC0 # C-Chain PrivKey ee7fa2988cf373f3f6b96e622e740734f5b6a969435f037c7f4f58feea419437 + +# PUB KEY 7wxExVLHmceCuno8pGuTy1zs5fqNFmwTdep3tXqrNB8SiYCCrn +# ADDRESS C-custom1pckvggf8rl8pq6utu30psm7nd5m8c0uzd665ls +# PRIV KEY PrivateKey-2UaBWxCEeVjzo2314c62CEcujuRocQxdQgcBoWbbQFsiD4DikJ +# ETH Address 0xb57255024fa928e3d296c41528171b5f67e8d447 +# C-Chain PrivKey c24d497a9fb2501e120c756b12794fd34da92d15b8bbbed71564d8e497103e4c + + +# PUB KEY 6D1Fs4Ty4PFLq5DnvymnMvtTnHxRWT3uPLqRZejd1WrkMavTc7 +# ADDRESS C-custom1eeftxyzhjlu6hx95ycvskcvwnj6vxx7rkaujas +# PRIV KEY PrivateKey-Vmr4BTLYkPKcaw4nYW6SxEbr275chp3MBktoGkc5auUhjV7wM +# ETH Address 0x91ef3b19cdb344c5010358718e9347dd5cb2f362 +# C-Chain PrivKey 4155448d8ac3d7054291ff85e091dbc43f6c12ca6cf5e3bcfbde1ede7acd564a + + +# PUB KEY 64h63VM7DaBc1t9QHg7kwqoLroSjrsZXyy7MwSxTo6eCseFQbn +# ADDRESS C-custom1qq26q3pp2qrgyte0hquqdeh4pau82z0tk2l0pc +# PRIV KEY PrivateKey-nnqZLTSthVBRQbc1kzLt7LMC68XiWcnVbDukKbJHrBSfBiFK6 +# ETH Address 0xf31ca20d67bf4e3ddb4d7546c4a0983f3fa6ffea +# C-Chain PrivKey 67f8f3c9fa467b28ead9e08c4e78d089166ebe871f482330860d1c71f613de9e + + services: l1_chain: image: bobanetwork/avalanche:latest diff --git a/ops/docker/Dockerfile.avalanche b/ops/docker/Dockerfile.avalanche index 75f2fb3..5e185d6 100644 --- a/ops/docker/Dockerfile.avalanche +++ b/ops/docker/Dockerfile.avalanche @@ -21,7 +21,7 @@ RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node2/config. RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node3/config.json > local/default/node3/config.json.tmp && mv local/default/node3/config.json.tmp local/default/node3/config.json RUN jq --arg val "0.0.0.0" '. + {"http-host": $val}' local/default/node4/config.json > local/default/node4/config.json.tmp && mv local/default/node4/config.json.tmp local/default/node4/config.json RUN jq --argjson key "[{\"ethAddr\":\"0x56faE09531C4985188BA78B7fB93739eaf1fBF98\",\"avaxAddr\":\"X-custom1etenrecgr0lhywpcuvdc7crkgu4f7pdgx7qrdx\",\"initialAmount\":300000000000000000,\"unlockSchedule\":[{\"amount\":20000000000000000},{\"amount\":10000000000000000,\"locktime\":1633824000}]},{\"ethAddr\":\"0x4FC1c7D869fc4AE45FC8FC671c32f1E17f60A34F\",\"avaxAddr\":\"X-custom17qjusw0fy9d52tgwpjpak2p6qgu9pc2y6qgpqy\",\"initialAmount\":300000000000000000,\"unlockSchedule\":[{\"amount\":20000000000000000},{\"amount\":10000000000000000,\"locktime\":1633824000}]},{\"ethAddr\":\"0xdae74D7327d123a1E1732C14a75599ceAd1aeeC0\",\"avaxAddr\":\"X-custom1mp5hjf2vlpvk50e7ma4f8lss08w39y9m6gw43e\",\"initialAmount\":300000000000000000,\"unlockSchedule\":[{\"amount\":20000000000000000},{\"amount\":10000000000000000,\"locktime\":1633824000}]}]" '.allocations += $key' local/default/genesis.json > local/default/genesis.json.new && mv local/default/genesis.json.new local/default/genesis.json -RUN jq --arg key "{\"config\":{\"chainId\":43112,\"homesteadBlock\":0,\"daoForkBlock\":0,\"daoForkSupport\":true,\"eip150Block\":0,\"eip150Hash\":\"0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0\",\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"apricotPhase1BlockTimestamp\":0,\"apricotPhase2BlockTimestamp\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x5f5e100\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC\":{\"balance\":\"0x295BE96E64066972000000\"},\"56faE09531C4985188BA78B7fB93739eaf1fBF98\":{\"balance\":\"0x295BE96E64066972000000\"},\"4FC1c7D869fc4AE45FC8FC671c32f1E17f60A34F\":{\"balance\":\"0x295BE96E64066972000000\"},\"dae74D7327d123a1E1732C14a75599ceAd1aeeC0\":{\"balance\":\"0x295BE96E64066972000000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}" '.cChainGenesis = $key' local/default/genesis.json > local/default/genesis.json.new && mv local/default/genesis.json.new local/default/genesis.json +RUN jq --arg key "{\"config\":{\"chainId\":43112,\"homesteadBlock\":0,\"daoForkBlock\":0,\"daoForkSupport\":true,\"eip150Block\":0,\"eip150Hash\":\"0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0\",\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"apricotPhase1BlockTimestamp\":0,\"apricotPhase2BlockTimestamp\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x5f5e100\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC\":{\"balance\":\"0x295BE96E64066972000000\"},\"56faE09531C4985188BA78B7fB93739eaf1fBF98\":{\"balance\":\"0x295BE96E64066972000000\"},\"4FC1c7D869fc4AE45FC8FC671c32f1E17f60A34F\":{\"balance\":\"0x295BE96E64066972000000\"},\"dae74D7327d123a1E1732C14a75599ceAd1aeeC0\":{\"balance\":\"0x295BE96E64066972000000\"},\"b57255024fa928e3d296c41528171b5f67e8d447\":{\"balance\":\"0x295BE96E64066972000000\"},\"91ef3b19cdb344c5010358718e9347dd5cb2f362\":{\"balance\":\"0x295BE96E64066972000000\"},\"f31ca20d67bf4e3ddb4d7546c4a0983f3fa6ffea\":{\"balance\":\"0x295BE96E64066972000000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}" '.cChainGenesis = $key' local/default/genesis.json > local/default/genesis.json.new && mv local/default/genesis.json.new local/default/genesis.json EXPOSE 9650 9652 9654 9656 9658 From f67f570792c492215ff6e5be86a824a4352c095f Mon Sep 17 00:00:00 2001 From: Trang Tran Date: Tue, 12 Jul 2022 21:45:25 +0700 Subject: [PATCH 6/8] Add other services --- ops/docker-compose-avalanche.yml | 412 ++++++++++++++++++++++++++++++- 1 file changed, 401 insertions(+), 11 deletions(-) diff --git a/ops/docker-compose-avalanche.yml b/ops/docker-compose-avalanche.yml index 8bd7c1a..d0de8c9 100644 --- a/ops/docker-compose-avalanche.yml +++ b/ops/docker-compose-avalanche.yml @@ -9,50 +9,80 @@ version: "3" # +# Deployer # PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN -# 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 - +# 0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 +# Relayer # PUB KEY 7EdyWHDoMHykMKNSfRaFtxfCT7gDPuB8pifvrptdYiFojCAaTH # Ava ADDRESS C-custom1etenrecgr0lhywpcuvdc7crkgu4f7pdgx7qrdx # Ava PRIV KEY PrivateKey-8kqXG11uHXie4oWep5b4ivm2S5TRzSz6yfiamqeENnQT2rmXv # ETH Address 0x56faE09531C4985188BA78B7fB93739eaf1fBF98 -# C-Chain PrivKey 119c49b6a55123600ce73fbfad852f45c015d328b593fb20aca9a68f1588bd7e - +# C-Chain PrivKey 0x119c49b6a55123600ce73fbfad852f45c015d328b593fb20aca9a68f1588bd7e +# Fast Relayer # PUB KEY 6c7qB6S7k6EPweWCfgfXMrC8SAJcss6rrjizjvALMYaJCZGYZJ # Ava ADDRESS C-custom17qjusw0fy9d52tgwpjpak2p6qgu9pc2y6qgpqy # Ava PRIV KEY PrivateKey-2M3bTSt99e24dwS7E6i7qkxyBxMZZsipBWQjBXBjVaabjyZJNM # ETH Address 0x4FC1c7D869fc4AE45FC8FC671c32f1E17f60A34F -# C-Chain PrivKey b135c8deb7e4f283ad3b8a5e8b557d88f32ccdca730a7d1ee6a02263d565c39c - +# C-Chain PrivKey 0xb135c8deb7e4f283ad3b8a5e8b557d88f32ccdca730a7d1ee6a02263d565c39c +# Integration PK # PUB KEY 7nfXp7SfoWuexpuawJtyMiSTetUpSDWpR8pVT8bCuqFiQzGeYF # Ava ADDRESS C-custom1mp5hjf2vlpvk50e7ma4f8lss08w39y9m6gw43e # Ava PRIV KEY PrivateKey-2p38JqqbFQ3yruv22mFQFToPfMeZVKPa3Vud2wvorCkHetNxr9 # ETH Address 0xdae74D7327d123a1E1732C14a75599ceAd1aeeC0 -# C-Chain PrivKey ee7fa2988cf373f3f6b96e622e740734f5b6a969435f037c7f4f58feea419437 +# C-Chain PrivKey 0xee7fa2988cf373f3f6b96e622e740734f5b6a969435f037c7f4f58feea419437 +# Integration PK 2 # PUB KEY 7wxExVLHmceCuno8pGuTy1zs5fqNFmwTdep3tXqrNB8SiYCCrn # ADDRESS C-custom1pckvggf8rl8pq6utu30psm7nd5m8c0uzd665ls # PRIV KEY PrivateKey-2UaBWxCEeVjzo2314c62CEcujuRocQxdQgcBoWbbQFsiD4DikJ # ETH Address 0xb57255024fa928e3d296c41528171b5f67e8d447 -# C-Chain PrivKey c24d497a9fb2501e120c756b12794fd34da92d15b8bbbed71564d8e497103e4c +# C-Chain PrivKey 0xc24d497a9fb2501e120c756b12794fd34da92d15b8bbbed71564d8e497103e4c +# Integration PK 3 # PUB KEY 6D1Fs4Ty4PFLq5DnvymnMvtTnHxRWT3uPLqRZejd1WrkMavTc7 # ADDRESS C-custom1eeftxyzhjlu6hx95ycvskcvwnj6vxx7rkaujas # PRIV KEY PrivateKey-Vmr4BTLYkPKcaw4nYW6SxEbr275chp3MBktoGkc5auUhjV7wM # ETH Address 0x91ef3b19cdb344c5010358718e9347dd5cb2f362 -# C-Chain PrivKey 4155448d8ac3d7054291ff85e091dbc43f6c12ca6cf5e3bcfbde1ede7acd564a +# C-Chain PrivKey 0x4155448d8ac3d7054291ff85e091dbc43f6c12ca6cf5e3bcfbde1ede7acd564a +# Integration PK 4 # PUB KEY 64h63VM7DaBc1t9QHg7kwqoLroSjrsZXyy7MwSxTo6eCseFQbn # ADDRESS C-custom1qq26q3pp2qrgyte0hquqdeh4pau82z0tk2l0pc # PRIV KEY PrivateKey-nnqZLTSthVBRQbc1kzLt7LMC68XiWcnVbDukKbJHrBSfBiFK6 # ETH Address 0xf31ca20d67bf4e3ddb4d7546c4a0983f3fa6ffea -# C-Chain PrivKey 67f8f3c9fa467b28ead9e08c4e78d089166ebe871f482330860d1c71f613de9e +# C-Chain PrivKey 0x67f8f3c9fa467b28ead9e08c4e78d089166ebe871f482330860d1c71f613de9e + + +x-deployer_pk: &deployer_pk + DEPLOYER_PRIVATE_KEY: '0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027' + +x-relayer_pk: &relayer_pk + RELAYER_PRIVATE_KEY: '0x119c49b6a55123600ce73fbfad852f45c015d328b593fb20aca9a68f1588bd7e' + +# Account #9 +x-fast-relayer_pk: &fast-relayer_pk + FAST_RELAYER_PRIVATE_KEY: '0xb135c8deb7e4f283ad3b8a5e8b557d88f32ccdca730a7d1ee6a02263d565c39c' + +# Account #0 - allows the fee test +x-integration_pk: &integration_pk + PRIVATE_KEY: '0xee7fa2988cf373f3f6b96e622e740734f5b6a969435f037c7f4f58feea419437' + +# Account #10 - allows the fee test +x-integration_2_pk: &integration_2_pk + PRIVATE_KEY_2: '0xc24d497a9fb2501e120c756b12794fd34da92d15b8bbbed71564d8e497103e4c' + +# Account #7 - allows the fee test +x-integration_3_pk: &integration_3_pk + PRIVATE_KEY_3: '0x4155448d8ac3d7054291ff85e091dbc43f6c12ca6cf5e3bcfbde1ede7acd564a' + +x-integration_4_pk: &integration_4_pk + GAS_PRICE_ORACLE_PRIVATE_KEY: '0x67f8f3c9fa467b28ead9e08c4e78d089166ebe871f482330860d1c71f613de9e' services: @@ -72,10 +102,370 @@ services: networks: - ava-network + deployer: + depends_on: + - l1_chain + - dtl + image: bobanetwork/deployer:latest + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.deployer + container_name: deployer + entrypoint: ./deployer.sh + environment: + FRAUD_PROOF_WINDOW_SECONDS: 0 + L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + # these keys are hardhat's first 2 accounts, DO NOT use in production + << : *deployer_pk + << : *relayer_pk + SEQUENCER_ADDRESS: "0x6236C601FfD52c4793e3B49B15bcdc1137E6339D" + PROPOSER_ADDRESS: "0x814B1fac2aE5AbBf40Bb289b263ED4c367C50AA9" + # setting the whitelist owner to address(0) disables the whitelist + WHITELIST_OWNER: "0x0000000000000000000000000000000000000000" + L1_FEE_WALLET_ADDRESS: "0x391716d440c151c42cdf1c95c1d83a5427bca52c" + L2_CHAIN_ID: 31338 + L2_BLOCK_GAS_LIMIT: 11000000 + BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" + GAS_PRICE_ORACLE_OWNER: "0xbA77c1e7d75aE7e34e2378641FE45EEC7Ad87935" + GAS_PRICE_ORACLE_OVERHEAD: "2750" + GAS_PRICE_ORACLE_SCALAR: "1500000" + GAS_PRICE_ORACLE_L1_BASE_FEE: "1" + GAS_PRICE_ORACLE_GAS_PRICE: "1000000000" + GAS_PRICE_ORACLE_DECIMALS: "6" + L1_NATIVE_TOKEN_NAME: "Avalanche" + L1_NATIVE_TOKEN_SYMBOL: "AVAX" + L1_NATIVE_TOKEN_DECIMALS: "18" + # skip compilation when run in docker-compose, since the contracts + # were already compiled in the builder step + NO_COMPILE: 1 + DTL_REGISTRY_URL: http://dtl:8081/addresses.json + DTL_STATE_DUMP_REGISTRY_URL: http://dtl:8081/state-dump.latest.json + ports: + # expose the service to the host for getting the contract addrs + - ${DEPLOYER_PORT:-8077}:8082 + networks: + - ava-network + + # deploys boba contracts and serves contract addresses + boba_deployer: + depends_on: + - l1_chain + - dtl + - l2geth + image: bobanetwork/boba_deployer:latest + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.boba_deployer + container_name: boba_deployer + environment: + L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + L2_NODE_WEB3_URL: http://l2geth:8545 + ADDRESS_MANAGER_ADDRESS: "0xf536cAF1a894E09945E649FCE3032E8E03ECb9A0" + URL: http://dtl:8081/addresses.json + # DO NOT use in production + << : *deployer_pk + << : *relayer_pk + << : *fast-relayer_pk + RETRIES: 200 + DTL_REGISTRY_URL: http://dtl:8081/boba-addr.json + # skip compilation when run in docker-compose, since the contracts + # were already compiled in the builder step + NO_COMPILE: 1 + networks: + - ava-network + + + + dtl: + depends_on: + - l1_chain + image: bobanetwork/data-transport-layer:latest + container_name: dtl + entrypoint: ./dtl.sh + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.data-transport-layer + # override with the dtl script and the env vars required for it + env_file: + - ./envs/dtl.env + # set the rest of the env vars for the network whcih do not + # depend on the docker-compose setup + environment: + URL: http://deployer:8082/addresses.json + # connect to the 2 layers + DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: http://l1_chain:9650/ext/bc/C/rpc + DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: http://l2geth:8545 + DATA_TRANSPORT_LAYER__SYNC_FROM_L2: 'true' + DATA_TRANSPORT_LAYER__L2_CHAIN_ID: 31338 + DATA_TRANSPORT_LAYER__BSS_HARDFORK_1_INDEX: 0 + DATA_TRANSPORT_LAYER__ETH1_CTC_DEPLOYMENT_HEIGHT: 0 + RETRIES: 200 + # if no need to support Turing v0 set height of v0 = v1 + DATA_TRANSPORT_LAYER__TURING_V0_HEIGHT: 0 + DATA_TRANSPORT_LAYER__TURING_V1_HEIGHT: 0 + ports: + - ${DTL_PORT:-7878}:7878 + - ${REGISTRY_PORT:-8080}:8081 + networks: + - ava-network + + + + l2geth: + depends_on: + - l1_chain + - dtl + image: bobanetwork/l2geth:latest + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.geth + container_name: l2geth + # override with the geth script and the env vars required for it + entrypoint: sh ./geth.sh + env_file: + - ./envs/geth.env + restart: always + environment: + ETH1_HTTP: http://l1_chain:9650/ext/bc/C/rpc + ROLLUP_TIMESTAMP_REFRESH: 5s + ROLLUP_STATE_DUMP_PATH: http://dtl:8081/state-dump.latest.json + # connecting to the DTL + ROLLUP_CLIENT_HTTP: http://dtl:7878 + ETH1_CTC_DEPLOYMENT_HEIGHT: 8 + RETRIES: 200 + # no need to keep this secret, only used internally to sign blocks + BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" + BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" + TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020" + EMERGENCY_FORK_NUMBER: 0 + L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023" + BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024" + ports: + - ${L2GETH_HTTP_PORT:-8545}:8545 + - ${L2GETH_WS_PORT:-8546}:8546 + networks: + - ava-network + + + # relayer: + # depends_on: + # - l1_chain + # - dtl + # - l2geth + # image: bobanetwork/message-relayer:latest + # build: + # context: .. + # dockerfile: ./ops/docker/Dockerfile.message-relayer + # entrypoint: ./relayer.sh + # environment: + # L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + # L2_NODE_WEB3_URL: http://l2geth:8545 + # URL: http://dtl:8081/addresses.json + # # a funded hardhat account + # << : *relayer_pk + # RETRIES: 200 + # POLLING_INTERVAL: 6000 + # GET_LOGS_INTERVAL: 500 + # FILTER_ENDPOINT: http://dtl:8081/boba-addr.json #this will fail early, but then start to work + # FILTER_POLLING_INTERVAL: 30000 + # MAX_WAIT_TIME_S: 5 + # MAX_WAIT_TX_TIME_S: 5 + # RESUBMISSION_TIMEOUT: 5 + # MULTI_RELAY_LIMIT: 5 + + # # a second relay system for messages that need to get to L1 quickly + # # NOTE - all withdrawal messages use the standard relayer with its 7 day window + # boba_message-relayer-fast: + # depends_on: + # - l1_chain + # - dtl + # - l2geth + # image: bobanetwork/boba_message-relayer-fast:latest + # build: + # context: .. + # dockerfile: ./ops/docker/Dockerfile.message-relayer + # entrypoint: ["./wait-for-l1-and-l2.sh", "./relayer-fast.sh"] + # environment: + # L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + # L2_NODE_WEB3_URL: http://l2geth:8545 + # URL: http://dtl:8081/addresses.json + # BOBA_URL: http://dtl:8081/boba-addr.json + # # This is who pays for the fast message relayer + # << : *fast-relayer_pk + # RETRIES: 200 + # POLLING_INTERVAL: 6000 + # GET_LOGS_INTERVAL: 500 + # FILTER_ENDPOINT: http://dtl:8081/boba-addr.json + # FILTER_POLLING_INTERVAL: 30000 + # MAX_WAIT_TIME_S: 5 + # MAX_WAIT_TX_TIME_S: 5 + # RESUBMISSION_TIMEOUT: 5 + # MULTI_RELAY_LIMIT: 5 + # FAST_RELAYER: 'true' + + # batch_submitter: + # restart: always + # depends_on: + # - l1_chain + # - dtl + # - l2geth + # - kms + # image: bobanetwork/go-batch-submitter:latest + # build: + # context: .. + # dockerfile: ./ops/docker/Dockerfile.batch-submitter + # entrypoint: ./batch-submitter.sh + # env_file: + # - ./envs/batch-submitter.env + # environment: + # L1_ETH_RPC: http://l1_chain:9650/ext/bc/C/rpc + # L2_ETH_RPC: http://l2geth:8545 + # URL: http://dtl:8081/addresses.json + # RETRIES: 200 + # #KMS access setup + # AWS_ACCESS_KEY_ID: "1" + # AWS_SECRET_ACCESS_KEY: "11" + # BATCH_SUBMITTER_KMS_ENDPOINT: http://kms:8888/ + # BATCH_SUBMITTER_KMS_REGION: us-east-1 + # #aliases are setup, check seed.yml + # BATCH_SUBMITTER_SEQUENCER_KEY_ID: "0x6236C601FfD52c4793e3B49B15bcdc1137E6339D" + # BATCH_SUBMITTER_PROPOSER_KEY_ID: "0x814B1fac2aE5AbBf40Bb289b263ED4c367C50AA9" + + # integration_tests: + # image: bobanetwork/integration-tests:latest + # deploy: + # replicas: 0 + # build: + # context: .. + # dockerfile: ./ops/docker/Dockerfile.integration-tests + # entrypoint: ./integration-tests.sh + # environment: + # VERIFIER_URL: http://verifier:8545 + # REPLICA_URL: http://replica:8545 + # L1_URL: http://l1_chain:9650/ext/bc/C/rpc + # L2_URL: http://l2geth:8545 + # URL: http://dtl:8081/addresses.json + # BASE_URL: http://dtl:8081/addresses.json + # BOBA_URL: http://dtl:8081/boba-addr.json + # ENABLE_GAS_REPORT: 1 + # NO_NETWORK: 1 + # L2_CHAINID: 31338 #unfortunately, elsewhere the L2_CHAINID is called CHAIN_ID + # RETRIES: 200 + # << : *integration_pk + # << : *integration_2_pk + # << : *integration_3_pk + # << : *integration_4_pk + + # replica: + # depends_on: + # - dtl + # - l2geth + # image: bobanetwork/l2geth:latest + # deploy: + # replicas: 1 + # build: + # context: .. + # dockerfile: ./ops/docker/Dockerfile.geth + # entrypoint: sh ./geth.sh + # env_file: + # - ./envs/geth.env + # environment: + # ETH1_HTTP: http://l1_chain:9650/ext/bc/C/rpc + # ROLLUP_TIMESTAMP_REFRESH: 5s + # ROLLUP_STATE_DUMP_PATH: http://dtl:8081/state-dump.latest.json + # ROLLUP_CLIENT_HTTP: http://dtl:7878 + # ROLLUP_BACKEND: 'l2' + # ROLLUP_VERIFIER_ENABLE: 'true' + # RETRIES: 60 + # # CTC height + # ETH1_CTC_DEPLOYMENT_HEIGHT: 8 + # # no need to keep this secret, only used internally to sign blocks + # BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" + # BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" + # ROLLUP_POLL_INTERVAL_FLAG: "10s" + # TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020" + # SEQUENCER_CLIENT_HTTP: http://l2geth:8545 + # EMERGENCY_FORK_NUMBER: 0 + # L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023" + # BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024" + # ports: + # - ${L2GETH_HTTP_PORT:-8549}:8545 + # - ${L2GETH_WS_PORT:-8550}:8546 + + # verifier: + # depends_on: + # - dtl + # image: bobanetwork/l2geth:latest + # deploy: + # replicas: 1 + # build: + # context: .. + # dockerfile: ./ops/docker/Dockerfile.geth + # entrypoint: sh ./geth.sh + # env_file: + # - ./envs/geth.env + # environment: + # ETH1_HTTP: http://l1_chain:9650/ext/bc/C/rpc + # ROLLUP_TIMESTAMP_REFRESH: 5s + # ROLLUP_STATE_DUMP_PATH: http://dtl:8081/state-dump.latest.json + # ROLLUP_CLIENT_HTTP: http://dtl:7878 + # ROLLUP_BACKEND: 'l1' + # ROLLUP_VERIFIER_ENABLE: 'true' + # RETRIES: 60 + # # CTC height + # ETH1_CTC_DEPLOYMENT_HEIGHT: 8 + # # no need to keep this secret, only used internally to sign blocks + # BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" + # BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" + # ROLLUP_POLL_INTERVAL_FLAG: "10s" + # TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020" + # EMERGENCY_FORK_NUMBER: 0 + # L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023" + # BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024" + # ports: + # - ${VERIFIER_HTTP_PORT:-8547}:8545 + # - ${VERIFIER_WS_PORT:-8548}:8546 + + # fraud-detector: + # depends_on: + # - verifier + # - dtl + # image: bobanetwork/fraud-detector:latest + # deploy: + # replicas: 1 + # build: + # context: .. + # dockerfile: ./boba_community/fraud-detector/docker/Dockerfile.fraud-detector + # environment: + # L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + # L1_CONFIRMATIONS: 8 + # L2_NODE_WEB3_URL: http://l2geth:8545 + # L2_CHECK_INTERVAL: 10 + # VERIFIER_WEB3_URL: http://verifier:8545 + # ADDRESS_MANAGER_ADDRESS: "0xf536cAF1a894E09945E649FCE3032E8E03ECb9A0" + # L1_DEPLOYMENT_BLOCK: 8 + # L2_START_BLOCK: 1 + # ports: + # - ${FRAUD_CHECKER_HTTP_PORT:-8555}:8555 + + # #in no way should this be running in production + # kms: + # image: bobanetwork/local-kms:latest + # environment: + # PORT: "8888" + # KMS_REGION: "us-east-1" + # volumes: + # - type: bind + # source: ./seed-fantom.yaml + # target: /init/seed.yaml + # ports: + # - 8888:8888 + + networks: ava-network: enable_ipv6: true ipam: config: - subnet: "fd00:1::/64" - # gateway: "fd00:1::1" + # gateway: "fd00:1::1":w From de170f7566c37b733851740dac2030fad9bfe319 Mon Sep 17 00:00:00 2001 From: cby3149 Date: Wed, 13 Jul 2022 14:08:49 -0700 Subject: [PATCH 7/8] Add circle tests --- .circleci/config.yml | 32 ++++++++++++++++ ops/scripts/build-ci-avalanche.sh | 10 +++++ ops/up_local_avalanche.sh | 64 +++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100755 ops/scripts/build-ci-avalanche.sh create mode 100755 ops/up_local_avalanche.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index f4dc41e..3b361a3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,8 +64,40 @@ jobs: docker-compose -f docker-compose-fantom.yml run integration_tests $(cat splits.txt) working_directory: ops + integration-tests-avalanche: + machine: + image: ubuntu-2004:202111-02 + docker_layer_caching: true + environment: + DOCKER_BUILDKIT: 1 + parallelism: 4 + steps: + - checkout + - run: + name: Bring up the stack + command: | + ./scripts/build-ci-avalanche.sh + BUILD=2 DAEMON=1 ./up_local_avalanche.sh + working_directory: ops + - run: + name: Start background logging + working_directory: ops + background: true + command: docker-compose -f docker-compose-avalanche.yml logs --follow + - run: + name: Wait for sequencer + command: bash scripts/wait-for-sequencer.sh docker-compose-avalanche.yml + working_directory: ops + - run: + name: Run integration tests + command: | + circleci tests glob "../integration-tests/test/*.spec.ts" | circleci tests split | tee splits.txt + docker-compose -f docker-compose-avalanche.yml run integration_tests $(cat splits.txt) + working_directory: ops + workflows: main: jobs: - integration-tests-moonbeam - integration-tests-fantom + - integration-tests-avalanche diff --git a/ops/scripts/build-ci-avalanche.sh b/ops/scripts/build-ci-avalanche.sh new file mode 100755 index 0000000..0e02633 --- /dev/null +++ b/ops/scripts/build-ci-avalanche.sh @@ -0,0 +1,10 @@ +yarn +yarn build + +docker-compose -f docker-compose-avalanche.yml build --parallel -- builder l2geth l1_chain +docker-compose -f docker-compose-avalanche.yml build --parallel -- deployer dtl batch_submitter relayer integration_tests +docker-compose -f docker-compose-avalanche.yml build --parallel -- boba_message-relayer-fast boba_deployer fraud-detector + +docker ps + +wait diff --git a/ops/up_local_avalanche.sh b/ops/up_local_avalanche.sh new file mode 100755 index 0000000..249df58 --- /dev/null +++ b/ops/up_local_avalanche.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +#if ! [ -x "$(command -v yq)" ]; then +# echo 'Error: yq is not installed. brew install yq' >&2 +# exit 1 +#fi + +if [[ $BUILD == 2 ]]; then + echo 'You set BUILD to 2, which means that we will use existing docker images on your computer' +fi + +if [[ $BUILD == 1 ]]; then + echo 'You set BUILD to 1, which means that all your dockers will be (re)built' +fi + +if [[ $BUILD == 0 ]]; then + echo 'You set BUILD to 0, which means that you want to pull Docker images from Dockerhub' +fi + +if [[ $DAEMON == 1 ]]; then + echo 'You set DAEMON to 1, which means that your local L1/L2 will run in the background' +fi + +if [[ $DAEMON == 0 ]]; then + echo 'You set DAEMON to 0, which means that your local L1/L2 will run in the front and you will see all the debug log information' +fi + +if [[ $(uname -m) == 'arm64' ]]; then + echo 'Building for Mac silicon using linux/arm64' +fi + +#Build dependencies, if needed +if [[ $BUILD == 1 ]]; then + yarn + yarn build +fi + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" +DOCKERFILE="docker-compose-avalanche.yml" + +if [[ $BUILD == 1 ]]; then + docker-compose -f docker-compose-avalanche.yml build --parallel -- builder l2geth l1_chain + docker-compose -f docker-compose-avalanche.yml build --parallel -- deployer dtl batch_submitter relayer integration_tests + docker-compose -f docker-compose-avalanche.yml build -- boba_message-relayer-fast + docker-compose -f docker-compose-avalanche.yml build -- gas_oracle + docker-compose -f docker-compose-avalanche.yml build -- boba_deployer + docker-compose -f docker-compose-avalanche.yml build -- fraud-detector + docker-compose -f docker-compose-avalanche.yml build -- monitor + docker-compose -f docker-compose-avalanche.yml build -- verifier + docker-compose -f docker-compose-avalanche.yml build -- replica +elif [[ $BUILD == 0 ]]; then + docker-compose -f $DIR/$DOCKERFILE pull + echo 1 +fi + +if [[ $DAEMON == 1 ]]; then + docker-compose \ + -f $DIR/$DOCKERFILE \ + up --no-build --detach -V +else + docker-compose \ + -f $DIR/$DOCKERFILE \ + up --no-build -V +fi From b8413ee9008fa0f3495935b625d330d7bba8a546 Mon Sep 17 00:00:00 2001 From: cby3149 Date: Wed, 13 Jul 2022 15:59:22 -0700 Subject: [PATCH 8/8] Enable all services --- ops/docker-compose-avalanche.yml | 426 +++++++++++++++---------------- 1 file changed, 213 insertions(+), 213 deletions(-) diff --git a/ops/docker-compose-avalanche.yml b/ops/docker-compose-avalanche.yml index d0de8c9..9491ff4 100644 --- a/ops/docker-compose-avalanche.yml +++ b/ops/docker-compose-avalanche.yml @@ -247,219 +247,219 @@ services: - ava-network - # relayer: - # depends_on: - # - l1_chain - # - dtl - # - l2geth - # image: bobanetwork/message-relayer:latest - # build: - # context: .. - # dockerfile: ./ops/docker/Dockerfile.message-relayer - # entrypoint: ./relayer.sh - # environment: - # L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc - # L2_NODE_WEB3_URL: http://l2geth:8545 - # URL: http://dtl:8081/addresses.json - # # a funded hardhat account - # << : *relayer_pk - # RETRIES: 200 - # POLLING_INTERVAL: 6000 - # GET_LOGS_INTERVAL: 500 - # FILTER_ENDPOINT: http://dtl:8081/boba-addr.json #this will fail early, but then start to work - # FILTER_POLLING_INTERVAL: 30000 - # MAX_WAIT_TIME_S: 5 - # MAX_WAIT_TX_TIME_S: 5 - # RESUBMISSION_TIMEOUT: 5 - # MULTI_RELAY_LIMIT: 5 - - # # a second relay system for messages that need to get to L1 quickly - # # NOTE - all withdrawal messages use the standard relayer with its 7 day window - # boba_message-relayer-fast: - # depends_on: - # - l1_chain - # - dtl - # - l2geth - # image: bobanetwork/boba_message-relayer-fast:latest - # build: - # context: .. - # dockerfile: ./ops/docker/Dockerfile.message-relayer - # entrypoint: ["./wait-for-l1-and-l2.sh", "./relayer-fast.sh"] - # environment: - # L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc - # L2_NODE_WEB3_URL: http://l2geth:8545 - # URL: http://dtl:8081/addresses.json - # BOBA_URL: http://dtl:8081/boba-addr.json - # # This is who pays for the fast message relayer - # << : *fast-relayer_pk - # RETRIES: 200 - # POLLING_INTERVAL: 6000 - # GET_LOGS_INTERVAL: 500 - # FILTER_ENDPOINT: http://dtl:8081/boba-addr.json - # FILTER_POLLING_INTERVAL: 30000 - # MAX_WAIT_TIME_S: 5 - # MAX_WAIT_TX_TIME_S: 5 - # RESUBMISSION_TIMEOUT: 5 - # MULTI_RELAY_LIMIT: 5 - # FAST_RELAYER: 'true' - - # batch_submitter: - # restart: always - # depends_on: - # - l1_chain - # - dtl - # - l2geth - # - kms - # image: bobanetwork/go-batch-submitter:latest - # build: - # context: .. - # dockerfile: ./ops/docker/Dockerfile.batch-submitter - # entrypoint: ./batch-submitter.sh - # env_file: - # - ./envs/batch-submitter.env - # environment: - # L1_ETH_RPC: http://l1_chain:9650/ext/bc/C/rpc - # L2_ETH_RPC: http://l2geth:8545 - # URL: http://dtl:8081/addresses.json - # RETRIES: 200 - # #KMS access setup - # AWS_ACCESS_KEY_ID: "1" - # AWS_SECRET_ACCESS_KEY: "11" - # BATCH_SUBMITTER_KMS_ENDPOINT: http://kms:8888/ - # BATCH_SUBMITTER_KMS_REGION: us-east-1 - # #aliases are setup, check seed.yml - # BATCH_SUBMITTER_SEQUENCER_KEY_ID: "0x6236C601FfD52c4793e3B49B15bcdc1137E6339D" - # BATCH_SUBMITTER_PROPOSER_KEY_ID: "0x814B1fac2aE5AbBf40Bb289b263ED4c367C50AA9" - - # integration_tests: - # image: bobanetwork/integration-tests:latest - # deploy: - # replicas: 0 - # build: - # context: .. - # dockerfile: ./ops/docker/Dockerfile.integration-tests - # entrypoint: ./integration-tests.sh - # environment: - # VERIFIER_URL: http://verifier:8545 - # REPLICA_URL: http://replica:8545 - # L1_URL: http://l1_chain:9650/ext/bc/C/rpc - # L2_URL: http://l2geth:8545 - # URL: http://dtl:8081/addresses.json - # BASE_URL: http://dtl:8081/addresses.json - # BOBA_URL: http://dtl:8081/boba-addr.json - # ENABLE_GAS_REPORT: 1 - # NO_NETWORK: 1 - # L2_CHAINID: 31338 #unfortunately, elsewhere the L2_CHAINID is called CHAIN_ID - # RETRIES: 200 - # << : *integration_pk - # << : *integration_2_pk - # << : *integration_3_pk - # << : *integration_4_pk - - # replica: - # depends_on: - # - dtl - # - l2geth - # image: bobanetwork/l2geth:latest - # deploy: - # replicas: 1 - # build: - # context: .. - # dockerfile: ./ops/docker/Dockerfile.geth - # entrypoint: sh ./geth.sh - # env_file: - # - ./envs/geth.env - # environment: - # ETH1_HTTP: http://l1_chain:9650/ext/bc/C/rpc - # ROLLUP_TIMESTAMP_REFRESH: 5s - # ROLLUP_STATE_DUMP_PATH: http://dtl:8081/state-dump.latest.json - # ROLLUP_CLIENT_HTTP: http://dtl:7878 - # ROLLUP_BACKEND: 'l2' - # ROLLUP_VERIFIER_ENABLE: 'true' - # RETRIES: 60 - # # CTC height - # ETH1_CTC_DEPLOYMENT_HEIGHT: 8 - # # no need to keep this secret, only used internally to sign blocks - # BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" - # BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" - # ROLLUP_POLL_INTERVAL_FLAG: "10s" - # TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020" - # SEQUENCER_CLIENT_HTTP: http://l2geth:8545 - # EMERGENCY_FORK_NUMBER: 0 - # L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023" - # BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024" - # ports: - # - ${L2GETH_HTTP_PORT:-8549}:8545 - # - ${L2GETH_WS_PORT:-8550}:8546 - - # verifier: - # depends_on: - # - dtl - # image: bobanetwork/l2geth:latest - # deploy: - # replicas: 1 - # build: - # context: .. - # dockerfile: ./ops/docker/Dockerfile.geth - # entrypoint: sh ./geth.sh - # env_file: - # - ./envs/geth.env - # environment: - # ETH1_HTTP: http://l1_chain:9650/ext/bc/C/rpc - # ROLLUP_TIMESTAMP_REFRESH: 5s - # ROLLUP_STATE_DUMP_PATH: http://dtl:8081/state-dump.latest.json - # ROLLUP_CLIENT_HTTP: http://dtl:7878 - # ROLLUP_BACKEND: 'l1' - # ROLLUP_VERIFIER_ENABLE: 'true' - # RETRIES: 60 - # # CTC height - # ETH1_CTC_DEPLOYMENT_HEIGHT: 8 - # # no need to keep this secret, only used internally to sign blocks - # BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" - # BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" - # ROLLUP_POLL_INTERVAL_FLAG: "10s" - # TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020" - # EMERGENCY_FORK_NUMBER: 0 - # L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023" - # BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024" - # ports: - # - ${VERIFIER_HTTP_PORT:-8547}:8545 - # - ${VERIFIER_WS_PORT:-8548}:8546 - - # fraud-detector: - # depends_on: - # - verifier - # - dtl - # image: bobanetwork/fraud-detector:latest - # deploy: - # replicas: 1 - # build: - # context: .. - # dockerfile: ./boba_community/fraud-detector/docker/Dockerfile.fraud-detector - # environment: - # L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc - # L1_CONFIRMATIONS: 8 - # L2_NODE_WEB3_URL: http://l2geth:8545 - # L2_CHECK_INTERVAL: 10 - # VERIFIER_WEB3_URL: http://verifier:8545 - # ADDRESS_MANAGER_ADDRESS: "0xf536cAF1a894E09945E649FCE3032E8E03ECb9A0" - # L1_DEPLOYMENT_BLOCK: 8 - # L2_START_BLOCK: 1 - # ports: - # - ${FRAUD_CHECKER_HTTP_PORT:-8555}:8555 - - # #in no way should this be running in production - # kms: - # image: bobanetwork/local-kms:latest - # environment: - # PORT: "8888" - # KMS_REGION: "us-east-1" - # volumes: - # - type: bind - # source: ./seed-fantom.yaml - # target: /init/seed.yaml - # ports: - # - 8888:8888 + relayer: + depends_on: + - l1_chain + - dtl + - l2geth + image: bobanetwork/message-relayer:latest + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.message-relayer + entrypoint: ./relayer.sh + environment: + L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + L2_NODE_WEB3_URL: http://l2geth:8545 + URL: http://dtl:8081/addresses.json + # a funded hardhat account + << : *relayer_pk + RETRIES: 200 + POLLING_INTERVAL: 6000 + GET_LOGS_INTERVAL: 500 + FILTER_ENDPOINT: http://dtl:8081/boba-addr.json #this will fail early, but then start to work + FILTER_POLLING_INTERVAL: 30000 + MAX_WAIT_TIME_S: 5 + MAX_WAIT_TX_TIME_S: 5 + RESUBMISSION_TIMEOUT: 5 + MULTI_RELAY_LIMIT: 5 + + # a second relay system for messages that need to get to L1 quickly + # NOTE - all withdrawal messages use the standard relayer with its 7 day window + boba_message-relayer-fast: + depends_on: + - l1_chain + - dtl + - l2geth + image: bobanetwork/boba_message-relayer-fast:latest + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.message-relayer + entrypoint: ["./wait-for-l1-and-l2.sh", "./relayer-fast.sh"] + environment: + L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + L2_NODE_WEB3_URL: http://l2geth:8545 + URL: http://dtl:8081/addresses.json + BOBA_URL: http://dtl:8081/boba-addr.json + # This is who pays for the fast message relayer + << : *fast-relayer_pk + RETRIES: 200 + POLLING_INTERVAL: 6000 + GET_LOGS_INTERVAL: 500 + FILTER_ENDPOINT: http://dtl:8081/boba-addr.json + FILTER_POLLING_INTERVAL: 30000 + MAX_WAIT_TIME_S: 5 + MAX_WAIT_TX_TIME_S: 5 + RESUBMISSION_TIMEOUT: 5 + MULTI_RELAY_LIMIT: 5 + FAST_RELAYER: 'true' + + batch_submitter: + restart: always + depends_on: + - l1_chain + - dtl + - l2geth + - kms + image: bobanetwork/go-batch-submitter:latest + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.batch-submitter + entrypoint: ./batch-submitter.sh + env_file: + - ./envs/batch-submitter.env + environment: + L1_ETH_RPC: http://l1_chain:9650/ext/bc/C/rpc + L2_ETH_RPC: http://l2geth:8545 + URL: http://dtl:8081/addresses.json + RETRIES: 200 + #KMS access setup + AWS_ACCESS_KEY_ID: "1" + AWS_SECRET_ACCESS_KEY: "11" + BATCH_SUBMITTER_KMS_ENDPOINT: http://kms:8888/ + BATCH_SUBMITTER_KMS_REGION: us-east-1 + #aliases are setup, check seed.yml + BATCH_SUBMITTER_SEQUENCER_KEY_ID: "0x6236C601FfD52c4793e3B49B15bcdc1137E6339D" + BATCH_SUBMITTER_PROPOSER_KEY_ID: "0x814B1fac2aE5AbBf40Bb289b263ED4c367C50AA9" + + integration_tests: + image: bobanetwork/integration-tests:latest + deploy: + replicas: 0 + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.integration-tests + entrypoint: ./integration-tests.sh + environment: + VERIFIER_URL: http://verifier:8545 + REPLICA_URL: http://replica:8545 + L1_URL: http://l1_chain:9650/ext/bc/C/rpc + L2_URL: http://l2geth:8545 + URL: http://dtl:8081/addresses.json + BASE_URL: http://dtl:8081/addresses.json + BOBA_URL: http://dtl:8081/boba-addr.json + ENABLE_GAS_REPORT: 1 + NO_NETWORK: 1 + L2_CHAINID: 31338 #unfortunately, elsewhere the L2_CHAINID is called CHAIN_ID + RETRIES: 200 + << : *integration_pk + << : *integration_2_pk + << : *integration_3_pk + << : *integration_4_pk + + replica: + depends_on: + - dtl + - l2geth + image: bobanetwork/l2geth:latest + deploy: + replicas: 1 + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.geth + entrypoint: sh ./geth.sh + env_file: + - ./envs/geth.env + environment: + ETH1_HTTP: http://l1_chain:9650/ext/bc/C/rpc + ROLLUP_TIMESTAMP_REFRESH: 5s + ROLLUP_STATE_DUMP_PATH: http://dtl:8081/state-dump.latest.json + ROLLUP_CLIENT_HTTP: http://dtl:7878 + ROLLUP_BACKEND: 'l2' + ROLLUP_VERIFIER_ENABLE: 'true' + RETRIES: 60 + # CTC height + ETH1_CTC_DEPLOYMENT_HEIGHT: 8 + # no need to keep this secret, only used internally to sign blocks + BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" + BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" + ROLLUP_POLL_INTERVAL_FLAG: "10s" + TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020" + SEQUENCER_CLIENT_HTTP: http://l2geth:8545 + EMERGENCY_FORK_NUMBER: 0 + L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023" + BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024" + ports: + - ${L2GETH_HTTP_PORT:-8549}:8545 + - ${L2GETH_WS_PORT:-8550}:8546 + + verifier: + depends_on: + - dtl + image: bobanetwork/l2geth:latest + deploy: + replicas: 1 + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.geth + entrypoint: sh ./geth.sh + env_file: + - ./envs/geth.env + environment: + ETH1_HTTP: http://l1_chain:9650/ext/bc/C/rpc + ROLLUP_TIMESTAMP_REFRESH: 5s + ROLLUP_STATE_DUMP_PATH: http://dtl:8081/state-dump.latest.json + ROLLUP_CLIENT_HTTP: http://dtl:7878 + ROLLUP_BACKEND: 'l1' + ROLLUP_VERIFIER_ENABLE: 'true' + RETRIES: 60 + # CTC height + ETH1_CTC_DEPLOYMENT_HEIGHT: 8 + # no need to keep this secret, only used internally to sign blocks + BLOCK_SIGNER_KEY: "6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27" + BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" + ROLLUP_POLL_INTERVAL_FLAG: "10s" + TURING_CREDIT_ADDRESS: "0x4200000000000000000000000000000000000020" + EMERGENCY_FORK_NUMBER: 0 + L2_BOBA_TOKEN_ADDRESS: "0x4200000000000000000000000000000000000023" + BOBA_GAS_PRICE_ORACLE_ADDRESS: "0x4200000000000000000000000000000000000024" + ports: + - ${VERIFIER_HTTP_PORT:-8547}:8545 + - ${VERIFIER_WS_PORT:-8548}:8546 + + fraud-detector: + depends_on: + - verifier + - dtl + image: bobanetwork/fraud-detector:latest + deploy: + replicas: 1 + build: + context: .. + dockerfile: ./boba_community/fraud-detector/docker/Dockerfile.fraud-detector + environment: + L1_NODE_WEB3_URL: http://l1_chain:9650/ext/bc/C/rpc + L1_CONFIRMATIONS: 8 + L2_NODE_WEB3_URL: http://l2geth:8545 + L2_CHECK_INTERVAL: 10 + VERIFIER_WEB3_URL: http://verifier:8545 + ADDRESS_MANAGER_ADDRESS: "0xf536cAF1a894E09945E649FCE3032E8E03ECb9A0" + L1_DEPLOYMENT_BLOCK: 8 + L2_START_BLOCK: 1 + ports: + - ${FRAUD_CHECKER_HTTP_PORT:-8555}:8555 + + #in no way should this be running in production + kms: + image: bobanetwork/local-kms:latest + environment: + PORT: "8888" + KMS_REGION: "us-east-1" + volumes: + - type: bind + source: ./seed-fantom.yaml + target: /init/seed.yaml + ports: + - 8888:8888 networks: