Skip to content

Commit

Permalink
clients: add portal network client definitions (ethereum#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
KolbyML authored and Eikix committed Mar 1, 2024
1 parent 86ccb97 commit 38d2631
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clients/fluffy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG branch=amd64-master-latest

FROM statusim/nimbus-fluffy:$branch

ADD fluffy.sh /fluffy.sh
RUN chmod +x /fluffy.sh

RUN echo "latest" > /version.txt

EXPOSE 8545 9009/udp

ENTRYPOINT ["/fluffy.sh"]
23 changes: 23 additions & 0 deletions clients/fluffy/fluffy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Immediately abort the script on any error encountered
set -e

IP_ADDR=$(hostname -i | awk '{print $1}')
FLAGS=""

if [ "$HIVE_PORTAL_NETWORKS_SELECTED" != "" ]; then
if [[ $HIVE_PORTAL_NETWORKS_SELECTED =~ "beacon" ]]; then
# Providing atrusted block root is required currently to enable the beacon network.
# It can be a made up value for now as tests are not doing any sync.
FLAGS="$FLAGS --trusted-block-root:0x0000000000000000000000000000000000000000000000000000000000000000"
fi
fi


if [ "$HIVE_CLIENT_PRIVATE_KEY" != "" ]; then
FLAGS="$FLAGS --netkey-unsafe=0x$HIVE_CLIENT_PRIVATE_KEY"
fi

# Fluffy runs all networks by default, so we can not configure to run networks individually
fluffy --rpc --rpc-address="0.0.0.0" --nat:extip:"$IP_ADDR" --network=none --log-level="debug" $FLAGS
19 changes: 19 additions & 0 deletions clients/trin-bridge/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM portalnetwork/trin:latest-bridge

ADD https://github.com/raw/ethereum/portal-spec-tests/master/tests/mainnet/history/hive/test_data_collection_of_forks_blocks.yaml /test_data_collection_of_forks_blocks.yaml
ADD trin_bridge.sh /trin_bridge.sh
RUN chmod +x /trin_bridge.sh

ADD trin_bridge_version.sh /trin_bridge_version.sh
RUN chmod +x /trin_bridge_version.sh

RUN /trin_bridge_version.sh > /version.txt

# Export the usual networking ports to allow outside access to the node
EXPOSE 8545 9009/udp

# add fake secrets for bridge activation
ENV PANDAOPS_CLIENT_ID=xxx
ENV PANDAOPS_CLIENT_SECRET=xxx

ENTRYPOINT ["/trin_bridge.sh"]
16 changes: 16 additions & 0 deletions clients/trin-bridge/trin_bridge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Immediately abort the script on any error encountered
set -e

IP_ADDR=$(hostname -i | awk '{print $1}')
FLAGS=""

if [ "$HIVE_BOOTNODES" != "" ]; then
FLAGS="$FLAGS --bootnodes=$HIVE_BOOTNODES"
else
echo "Warning: HIVE_BOOTNODES wasn't provided"
exit 1
fi

RUST_LOG=debug portal-bridge --node-count 1 $FLAGS --executable-path ./usr/bin/trin --mode test:/test_data_collection_of_forks_blocks.yaml --external-ip $IP_ADDR --epoch-accumulator-path . trin
7 changes: 7 additions & 0 deletions clients/trin-bridge/trin_bridge_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Immediately abort the script on any error encountered
set -e

#trin --version | tail -1 | sed "s/ /\//g"
echo "latest"
16 changes: 16 additions & 0 deletions clients/trin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG branch=latest

FROM portalnetwork/trin:$branch

ADD trin.sh /trin.sh
RUN chmod +x /trin.sh

ADD trin_version.sh /trin_version.sh
RUN chmod +x /trin_version.sh

RUN /trin_version.sh > /version.txt

# Export the usual networking ports to allow outside access to the node
EXPOSE 8545 9009/udp

ENTRYPOINT ["/trin.sh"]
19 changes: 19 additions & 0 deletions clients/trin/trin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Immediately abort the script on any error encountered
set -e

IP_ADDR=$(hostname -i | awk '{print $1}')
FLAGS=""

if [ "$HIVE_CLIENT_PRIVATE_KEY" != "" ]; then
FLAGS="$FLAGS --unsafe-private-key 0x$HIVE_CLIENT_PRIVATE_KEY"
fi

if [ "$HIVE_PORTAL_NETWORKS_SELECTED" != "" ]; then
FLAGS="$FLAGS --networks $HIVE_PORTAL_NETWORKS_SELECTED"
else
FLAGS="$FLAGS --networks history"
fi

RUST_LOG=debug trin --web3-transport http --web3-http-address http://0.0.0.0:8545 --external-address "$IP_ADDR":9009 --bootnodes none $FLAGS
7 changes: 7 additions & 0 deletions clients/trin/trin_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Immediately abort the script on any error encountered
set -e

#trin --version | tail -1 | sed "s/ /\//g"
echo "latest"
11 changes: 11 additions & 0 deletions clients/ultralight/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ghcr.io/ethereumjs/ultralight:latest

COPY ultralight.sh /ultralight.sh
RUN chmod +x /ultralight.sh

RUN echo "latest" > /version.txt

# Export the usual networking ports to allow outside access to the node
EXPOSE 8545 9000/udp

ENTRYPOINT ["/ultralight.sh"]
19 changes: 19 additions & 0 deletions clients/ultralight/ultralight.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Immediately abort the script on any error encountered
set -e

IP_ADDR=$(hostname -i | awk '{print $1}')
FLAGS=""

if [ "$HIVE_CLIENT_PRIVATE_KEY" != "" ]; then
FLAGS="$FLAGS --pk=0x1a2408021220$HIVE_CLIENT_PRIVATE_KEY"
fi

if [ "$HIVE_PORTAL_NETWORKS_SELECTED" != "" ]; then
FLAGS="$FLAGS --networks=$HIVE_PORTAL_NETWORKS_SELECTED"
else
FLAGS="$FLAGS --networks=history"
fi

DEBUG=* node /ultralight/packages/cli/dist/index.js --bindAddress="$IP_ADDR:9000" --dataDir="./data" --rpcPort=8545 $FLAGS

0 comments on commit 38d2631

Please sign in to comment.