Merge branch 'main' into ci-test

This commit is contained in:
David Boreham 2023-05-30 22:33:37 -06:00
commit 40424cc3b6
7 changed files with 124 additions and 25 deletions

View File

@ -6,7 +6,7 @@ services:
- ../config/fixturenet-eth/fixturenet-eth.env - ../config/fixturenet-eth/fixturenet-eth.env
environment: environment:
RUN_BOOTNODE: "true" RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-plugeth:local image: cerc/fixturenet-plugeth-plugeth:local
volumes: volumes:
- fixturenet_plugeth_bootnode_geth_data:/root/ethdata - fixturenet_plugeth_bootnode_geth_data:/root/ethdata
- ../config/fixturenet-plugeth/plugins:/root/ethdata/plugins - ../config/fixturenet-plugeth/plugins:/root/ethdata/plugins
@ -26,7 +26,7 @@ services:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
env_file: env_file:
- ../config/fixturenet-eth/fixturenet-eth.env - ../config/fixturenet-eth/fixturenet-eth.env
image: cerc/fixturenet-eth-plugeth:local image: cerc/fixturenet-plugeth-plugeth:local
volumes: volumes:
- fixturenet_plugeth_geth_1_data:/root/ethdata - fixturenet_plugeth_geth_1_data:/root/ethdata
- ../config/fixturenet-plugeth/plugins:/root/ethdata/plugins - ../config/fixturenet-plugeth/plugins:/root/ethdata/plugins
@ -56,7 +56,7 @@ services:
CERC_KEEP_RUNNING_AFTER_GETH_EXIT: "true" CERC_KEEP_RUNNING_AFTER_GETH_EXIT: "true"
env_file: env_file:
- ../config/fixturenet-eth/fixturenet-eth.env - ../config/fixturenet-eth/fixturenet-eth.env
image: cerc/fixturenet-eth-plugeth:local image: cerc/fixturenet-plugeth-plugeth:local
depends_on: depends_on:
- fixturenet-eth-bootnode-geth - fixturenet-eth-bootnode-geth
volumes: volumes:
@ -68,7 +68,7 @@ services:
hostname: fixturenet-eth-bootnode-lighthouse hostname: fixturenet-eth-bootnode-lighthouse
environment: environment:
RUN_BOOTNODE: "true" RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-lighthouse:local image: cerc/fixturenet-plugeth-lighthouse:local
fixturenet-eth-lighthouse-1: fixturenet-eth-lighthouse-1:
restart: always restart: always
@ -85,7 +85,7 @@ services:
NODE_NUMBER: "1" NODE_NUMBER: "1"
ETH1_ENDPOINT: "http://fixturenet-eth-geth-1:8545" ETH1_ENDPOINT: "http://fixturenet-eth-geth-1:8545"
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-1:8551" EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-1:8551"
image: cerc/fixturenet-eth-lighthouse:local image: cerc/fixturenet-plugeth-lighthouse:local
volumes: volumes:
- fixturenet_plugeth_lighthouse_1_data:/opt/testnet/build/cl - fixturenet_plugeth_lighthouse_1_data:/opt/testnet/build/cl
depends_on: depends_on:
@ -112,7 +112,7 @@ services:
ETH1_ENDPOINT: "http://fixturenet-eth-geth-2:8545" ETH1_ENDPOINT: "http://fixturenet-eth-geth-2:8545"
EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-2:8551" EXECUTION_ENDPOINT: "http://fixturenet-eth-geth-2:8551"
LIGHTHOUSE_GENESIS_STATE_URL: "http://fixturenet-eth-lighthouse-1:8001/eth/v2/debug/beacon/states/0" LIGHTHOUSE_GENESIS_STATE_URL: "http://fixturenet-eth-lighthouse-1:8001/eth/v2/debug/beacon/states/0"
image: cerc/fixturenet-eth-lighthouse:local image: cerc/fixturenet-plugeth-lighthouse:local
volumes: volumes:
- fixturenet_plugeth_lighthouse_2_data:/opt/testnet/build/cl - fixturenet_plugeth_lighthouse_2_data:/opt/testnet/build/cl
depends_on: depends_on:

View File

@ -0,0 +1,34 @@
FROM sigp/lcli:v4.1.0 AS lcli
FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen
FROM cerc/fixturenet-plugeth-plugeth:local AS fnetgeth
FROM cerc/lighthouse:local
# cerc/lighthouse is based on Ubuntu
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
libssl-dev ca-certificates \
curl socat iproute2 telnet wget jq \
build-essential python3 python3-dev python3-pip gettext-base \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY genesis /opt/testnet
COPY run-cl.sh /opt/testnet/run.sh
COPY --from=lcli /usr/local/bin/lcli /usr/local/bin/lcli
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools
COPY --from=ethgen /apps /apps
COPY --from=fnetgeth /opt/testnet/el /opt/testnet/el
COPY --from=fnetgeth /opt/testnet/build/el /opt/testnet/build/el
RUN cd /opt/testnet && make genesis-cl
# Work around some bugs in lcli where the default path is always used.
RUN mkdir -p /root/.lighthouse && cd /root/.lighthouse && ln -s /opt/testnet/build/cl/testnet
RUN mkdir -p /scripts
COPY scripts/status-internal.sh /scripts
COPY scripts/status.sh /scripts
ENTRYPOINT ["/opt/testnet/run.sh"]

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Build cerc/fixturenet-plugeth-lighthouse
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ ! -d "${SCRIPT_DIR}/genesis" ]; then
cp -frp ${SCRIPT_DIR}/../cerc-fixturenet-eth-lighthouse/genesis ${SCRIPT_DIR}/genesis
fi
if [ ! -e "${SCRIPT_DIR}/run-cl.sh" ]; then
cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-lighthouse/run-cl.sh ${SCRIPT_DIR}/
fi
if [ ! -d "${SCRIPT_DIR}/scripts" ]; then
cp -frp ${SCRIPT_DIR}/../cerc-fixturenet-eth-lighthouse/scripts ${SCRIPT_DIR}/
fi
docker build -t cerc/fixturenet-plugeth-lighthouse:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR

View File

@ -0,0 +1,27 @@
FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen
FROM golang:1.19.4-bullseye AS delve
RUN go install github.com/go-delve/delve/cmd/dlv@latest
FROM ubuntu:22.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 python3-dev python3-pip curl wget jq gettext gettext-base openssl bash dnsutils postgresql-client make iproute2 netcat && \
rm -rf /var/lib/apt/lists/*
COPY --from=delve /go/bin/dlv /usr/local/bin/
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/
COPY --from=ethgen /apps /apps
RUN wget -O /usr/local/bin/geth https://github.com/openrelayxyz/plugeth/releases/download/v1.11.6.1.0/geth-linux-amd64-v1.1.0-v1.11.6.1.0 && chmod a+x /usr/local/bin/geth
RUN cd /apps/el-gen && pip3 install -r requirements.txt
COPY genesis /opt/testnet
COPY run-el.sh /opt/testnet/run.sh
RUN cd /opt/testnet && make genesis-el
RUN geth --datadir ~/ethdata init /opt/testnet/build/el/geth.json && rm -f ~/ethdata/geth/nodekey
ENTRYPOINT ["/opt/testnet/run.sh"]

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Build cerc/fixturenet-plugeth-plugeth
set -x
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ ! -d "${SCRIPT_DIR}/genesis" ]; then
cp -frp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/genesis ${SCRIPT_DIR}/genesis
fi
if [ ! -e "${SCRIPT_DIR}/run-el.sh" ]; then
cp -fp ${SCRIPT_DIR}/../cerc-fixturenet-eth-geth/run-el.sh ${SCRIPT_DIR}/
fi
docker build -t cerc/fixturenet-plugeth-plugeth:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR

View File

@ -5,8 +5,8 @@ repos:
- github.com/cerc-io/tx-spammer - github.com/cerc-io/tx-spammer
containers: containers:
- cerc/lighthouse - cerc/lighthouse
- cerc/fixturenet-eth-plugeth - cerc/fixturenet-plugeth-plugeth
- cerc/fixturenet-eth-lighthouse - cerc/fixturenet-plugeth-lighthouse
- cerc/tx-spammer - cerc/tx-spammer
pods: pods:
- fixturenet-plugeth - fixturenet-plugeth

View File

@ -1,41 +1,41 @@
# Pocket Fixturenet # Pocket Fixturenet
Instructions for deploying a local single-node Pocket chain alongside a geth + lighthouse blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator. Instructions for deploying a local single-node Pocket chain alongside a geth + lighthouse blockchain "fixturenet" for development and testing purposes using Stack Orchestrator.
## 1. Build Laconic Stack Orchestrator ## 1. Clone required repositories
Build this fork of Laconic Stack Orchestrator which includes the fixturenet-pocket stack:
```
$ scripts/build_shiv_package.sh
$ cd package
$ mv laconic-so-{version} /usr/local/bin/laconic-so # Or move laconic-so to ~/bin or your favorite on-path directory
```
## 2. Clone required repositories
``` ```
$ laconic-so --stack fixturenet-pocket setup-repositories $ laconic-so --stack fixturenet-pocket setup-repositories
``` ```
## 3. Build the stack's containers ## 2. Build the stack's containers
``` ```
$ laconic-so --stack fixturenet-pocket build-containers $ laconic-so --stack fixturenet-pocket build-containers
``` ```
## 4. Deploy the stack ## 3. Deploy the stack
``` ```
$ laconic-so --stack fixturenet-pocket deploy up $ laconic-so --stack fixturenet-pocket deploy up
``` ```
It may take up to 10 minutes for the Eth Fixturenet to fully come online and start producing blocks. It may take up to 10 minutes for the Eth Fixturenet to fully come online and start producing blocks.
## 5. Check status
## 4. Check status
**Eth Fixturenet:** **Eth Fixturenet:**
``` ```
$ laconic-so --stack fixturenet-pocket deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh $ laconic-so --stack fixturenet-pocket deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh
```
Response:
```
Waiting for geth to generate DAG.... done Waiting for geth to generate DAG.... done
Waiting for beacon phase0.... done Waiting for beacon phase0.... done
Waiting for beacon altair.... done Waiting for beacon altair.... done
Waiting for beacon bellatrix pre-merge.... done Waiting for beacon bellatrix pre-merge.... done
Waiting for beacon bellatrix merge.... done Waiting for beacon bellatrix merge.... done
``` ```
**Pocket node:** **Pocket node:**
``` ```
$ laconic-so --stack fixturenet-pocket deploy exec pocket "pocket query height" $ laconic-so --stack fixturenet-pocket deploy exec pocket "pocket query height"
```
Response:
```
2023/04/20 08:07:46 Initializing Pocket Datadir 2023/04/20 08:07:46 Initializing Pocket Datadir
2023/04/20 08:07:46 datadir = /home/app/.pocket 2023/04/20 08:07:46 datadir = /home/app/.pocket
http://localhost:8081/v1/query/height http://localhost:8081/v1/query/height
@ -43,17 +43,18 @@ http://localhost:8081/v1/query/height
"height": 4 "height": 4
} }
``` ```
or or see the full logs:
``` ```
$ laconic-so --stack fixturenet-pocket deploy logs pocket $ laconic-so --stack fixturenet-pocket deploy logs pocket
``` ```
## 6. Send a relay request to Pocket node ## 5. Send a relay request to Pocket node
The Pocket node serves relay requests at `http://localhost:8081/v1/client/sim` The Pocket node serves relay requests at `http://localhost:8081/v1/client/sim`
**Example request:**
Example request:
``` ```
$ curl -X POST --data '{"relay_network_id":"0021","payload":{"data":"{\"jsonrpc\": \"2.0\",\"id\": 1,\"method\": \"eth_blockNumber\",\"params\": []}","method":"POST","path":"","headers":{}}}' http://localhost:8081/v1/client/sim $ curl -X POST --data '{"relay_network_id":"0021","payload":{"data":"{\"jsonrpc\": \"2.0\",\"id\": 1,\"method\": \"eth_blockNumber\",\"params\": []}","method":"POST","path":"","headers":{}}}' http://localhost:8081/v1/client/sim
``` ```
**Response:** Response:
``` ```
"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x6fe\"}\n" "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x6fe\"}\n"
``` ```