Skip to content

Commit

Permalink
Merge branch 'master' into wait-for-blob-inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
ak88 committed Oct 5, 2023
2 parents 2d911cd + 6472650 commit 02aa290
Show file tree
Hide file tree
Showing 259 changed files with 8,223 additions and 3,196 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ indent_size = 2
[*.sh]
indent_size = 2

# YAML files
[*.{yml,yaml}]
indent_size = 2

###############################
# Override Visual Studio #
###############################
Expand Down
152 changes: 32 additions & 120 deletions .github/workflows/sync-testnets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@ name: Sync Testnets

on:
push:
branches: ["master"]
branches: [master]
workflow_dispatch:

jobs:
chiado:
name: "Run sync of chiado testnet"
testnet-sync:
strategy:
matrix:
include:
- network: "chiado"
checkpoint-sync-url: "http://139.144.26.89:4000/"
cl-client: "lighthouse"
el-client: "nethermind:current_branch_image"
- network: "sepolia"
checkpoint-sync-url: "https://beaconstate-sepolia.chainsafe.io"
cl-client: "lighthouse"
el-client: "nethermind:current_branch_image"
name: "Run sync of ${{ matrix.network }} testnet"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Configure settings
id: settings
run: |
echo "BUILD_TIMESTAMP=$(date '+%s')" >> $GITHUB_OUTPUT
echo "COMMIT_HASH=$(git describe --always --exclude=* --abbrev=40)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand All @@ -43,150 +54,51 @@ jobs:
echo 'Generating sedge docker...'
./build/sedge deps install
./build/sedge generate --logging none -p $GITHUB_WORKSPACE/sedge \
full-node --map-all --no-mev-boost --no-validator --network chiado \
-c lighthouse:sigp/lighthouse:latest -e nethermind:current_branch_image \
full-node --map-all --no-mev-boost --no-validator --network ${{ matrix.network }} \
-c ${{ matrix.cl-client }} -e ${{ matrix.el-client }} \
--el-extra-flag Sync.NonValidatorNode=true --el-extra-flag Sync.DownloadBodiesInFastSync=false \
--el-extra-flag Sync.DownloadReceiptsInFastSync=false \
--el-extra-flag JsonRpc.EnabledModules=[Eth,Subscribe,Trace,TxPool,Web3,Personal,Proof,Net,Parity,Health,Rpc,Debug] \
--cl-extra-flag checkpoint-sync-url=http://139.144.26.89:4000/
--checkpoint-sync-url=${{ matrix.checkpoint-sync-url }}
echo 'Running sedge...'
docker compose up -d
- name: Wait for Chiado to sync
- name: Wait for ${{ matrix.network }} to sync
id: wait
timeout-minutes: 90
run: |
set +e
declare -A bad_logs
bad_logs["Invalid"]=1
bad_logs["Exception"]=1
bad_logs["Corrupted"]=1

declare -A good_logs
good_logs["Valid. Result of a new payload:"]=0
good_logs["FCU - block"]=0

declare -A required_count
required_count["Valid. Result of a new payload:"]=20
required_count["FCU - block"]=20

echo "Starting Docker logs monitoring..."
docker logs -f sedge-execution-client | while read -r line; do
echo "$line"

for bad_log in "${!bad_logs[@]}"; do
if [[ "$line" == *"$bad_log"* ]]; then
echo "Error: $bad_log found in Docker logs."
exit 1
fi
done

for good_log in "${!good_logs[@]}"; do
if [[ "$line" == *"$good_log"* ]]; then
((good_logs["$good_log"]++))
fi
done

# Check if all good logs have reached the required count
all_reached_required_count=true
for good_log in "${!good_logs[@]}"; do
if [[ ${good_logs[$good_log]} -lt ${required_count[$good_log]} ]]; then
all_reached_required_count=false
break
fi
done

if $all_reached_required_count; then
echo "All required logs found."
break
fi
done

echo "Node is synced."

sepolia:
name: "Run sync of sepolia testnet"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Configure settings
id: settings
run: |
echo "BUILD_TIMESTAMP=$(date '+%s')" >> $GITHUB_OUTPUT
echo "COMMIT_HASH=$(git describe --always --exclude=* --abbrev=40)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docker image
run: docker buildx build --platform=linux/amd64 -t current_branch_image -f Dockerfile --build-arg COMMIT_HASH=${{ steps.settings.outputs.COMMIT_HASH }} --build-arg BUILD_TIMESTAMP=${{ steps.settings.outputs.BUILD_TIMESTAMP}} --load .

- name: Setup Go environment
uses: actions/setup-go@v4.0.0

- name: Install Sedge environment
run: |
echo "Downloading sedge sources..."
git clone https://github.com/NethermindEth/sedge.git sedge --branch main --single-branch
echo "Sources downloaded."
cd sedge
echo "Building sedge..."
make compile
- name: Run Sedge
working-directory: sedge
run: |
echo 'Generating sedge docker...'
./build/sedge deps install
./build/sedge generate --logging none -p $GITHUB_WORKSPACE/sedge \
full-node --map-all --no-mev-boost --no-validator --network sepolia \
-c lighthouse:sigp/lighthouse:latest -e nethermind:current_branch_image \
--el-extra-flag Sync.NonValidatorNode=true --el-extra-flag Sync.DownloadBodiesInFastSync=false \
--el-extra-flag Sync.DownloadReceiptsInFastSync=false \
--el-extra-flag JsonRpc.EnabledModules=[Eth,Subscribe,Trace,TxPool,Web3,Personal,Proof,Net,Parity,Health,Rpc,Debug] \
--cl-extra-flag checkpoint-sync-url=https://beaconstate-sepolia.chainsafe.io
echo 'Running sedge...'
docker compose up -d
- name: Wait for Sepolia to sync
id: wait
timeout-minutes: 90
run: |
set +e
declare -A bad_logs
bad_logs["Invalid"]=1
bad_logs["Exception"]=1
bad_logs["Corrupted"]=1
declare -A good_logs
good_logs["Valid. Result of a new payload:"]=0
good_logs["FCU - block"]=0
good_logs["Synced chain Head"]=0
good_logs["Processed"]=0
declare -A required_count
required_count["Valid. Result of a new payload:"]=20
required_count["FCU - block"]=20
required_count["Synced chain Head"]=20
required_count["Processed"]=20
echo "Starting Docker logs monitoring..."
docker logs -f sedge-execution-client | while read -r line; do
echo "$line"
for bad_log in "${!bad_logs[@]}"; do
if [[ "$line" == *"$bad_log"* ]]; then
echo "Error: $bad_log found in Docker logs."
exit 1
fi
done
for good_log in "${!good_logs[@]}"; do
if [[ "$line" == *"$good_log"* ]]; then
((good_logs["$good_log"]++))
fi
done
# Check if all good logs have reached the required count
all_reached_required_count=true
for good_log in "${!good_logs[@]}"; do
Expand All @@ -195,11 +107,11 @@ jobs:
break
fi
done
if $all_reached_required_count; then
echo "All required logs found."
break
fi
done
echo "Node is synced."
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Nethermind documentation is available at [docs.nethermind.io](https://docs.nethe

### Supported networks

**`Mainnet`** **`Goerli`** **`Sepolia`** **`Gnosis (xDai)`** **`Energy Web`** **`Volta`**
**`Mainnet`** **`Goerli`** **`Sepolia`** **`Holesky`** **`Gnosis (xDai)`** **`Chiado`** **`Energy Web`** **`Volta`**

## Download and run

Expand Down Expand Up @@ -65,8 +65,8 @@ winget install Microsoft.VCRedist.2015+.x64
#### Install using Windows Package Manager

1. `winget install nethermind`
2. To run directly: `nethermind.runner.exe -c mainnet` \
or with the assistant: `nethermind.launcher.exe`
2. To run directly: `nethermind.exe -c mainnet` \
or with the assistant: `nethermind-launcher.exe`

### On macOS

Expand Down Expand Up @@ -106,7 +106,7 @@ Install [.NET SDK](https://dotnet.microsoft.com/en-us/download)
### Clone the repository

```sh
git clone https://github.com/nethermindeth/nethermind --recursive
git clone --recursive https://github.com/nethermindeth/nethermind.git
```

### Build and run
Expand Down
4 changes: 2 additions & 2 deletions scripts/deployment/archive-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ cd $PUB_DIR
cd linux-x64 && zip -r $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-linux-x64.zip . && cd ..
cd linux-arm64 && zip -r $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-linux-arm64.zip . && cd ..
cd win-x64 && zip -r $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-windows-x64.zip . && cd ..
cd osx-x64 && zip -r $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-macos-x64.zip . && cd ..
cd osx-arm64 && zip -r $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-macos-arm64.zip . && cd ..
cd osx-x64 && zip -r -y $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-macos-x64.zip . && cd ..
cd osx-arm64 && zip -r -y $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-macos-arm64.zip . && cd ..
cd ref && zip -r $GITHUB_WORKSPACE/$PACKAGE_DIR/$PACKAGE_PREFIX-ref-assemblies.zip . && cd ..

echo "Archiving completed"
10 changes: 6 additions & 4 deletions scripts/deployment/debian/postinst
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

arch=$(uname -m)
json=$(curl -sSL https://api.github.com/repos/NethermindEth/nethermind/releases/latest)
tag_name=$(echo $json | jq -r '.tag_name')

if [[ $arch == x86_64* ]]; then
curl -s https://api.github.com/repos/NethermindEth/nethermind/releases/latest | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux-x64 | xargs wget -O nethermind.zip -q
echo $json | jq -r '.assets[].browser_download_url | select(contains("linux-x64"))' | xargs -I % curl -sSL % -o nethermind.zip
ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.so > /dev/null 2>&1
elif [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
curl -s https://api.github.com/repos/NethermindEth/nethermind/releases/latest | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux-arm64 | xargs wget -O nethermind.zip -q
elif [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
echo $json | jq -r '.assets[].browser_download_url | select(contains("linux-arm64"))' | xargs -I % curl -sSL % -o nethermind.zip
ln -s /usr/lib/aarch64-linux-gnu/libdl.so.2 /usr/lib/aarch64-linux-gnu/libdl.so > /dev/null 2>&1
apt update > /dev/null 2>&1 && apt install libgflags-dev -y > /dev/null 2>&1
fi
Expand All @@ -17,5 +19,5 @@ mkdir -p /usr/share/nethermind
cp -r nethermind/* /usr/share/nethermind
rm -rf nethermind

wget https://raw.githubusercontent.com/NethermindEth/nethermind/master/scripts/execution.sh -O /usr/bin/nethermind
curl -sSL https://raw.githubusercontent.com/NethermindEth/nethermind/release/$tag_name/scripts/execution.sh -o /usr/bin/nethermind
chmod +x /usr/bin/nethermind
11 changes: 8 additions & 3 deletions scripts/deployment/publish-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
set -e

echo "Publishing packages to GitHub"
echo "Drafting release $GIT_TAG"

release_id=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-X GET \
Expand All @@ -14,6 +13,8 @@ release_id=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \

if [ "$release_id" == "" ]
then
echo "Drafting release $GIT_TAG"

body=$(printf \
'{"tag_name": "%s", "target_commitish": "%s", "name": "v%s", "body": "## Release notes\\n\\n", "draft": true, "prerelease": %s}' \
$GIT_TAG $GITHUB_SHA $GIT_TAG $PRERELEASE)
Expand All @@ -25,9 +26,13 @@ then
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$body" | jq -r '.id')
else
echo "Publishing release $GIT_TAG"

make_latest=$([ $PRERELEASE = 'true' ] && echo "false" || echo "true")

body=$(printf \
'{"target_commitish": "%s", "name": "v%s", "draft": false, "prerelease": %s}' \
$GITHUB_SHA $GIT_TAG $PRERELEASE)
'{"target_commitish": "%s", "name": "v%s", "draft": false, "make_latest": "%s", "prerelease": %s}' \
$GITHUB_SHA $GIT_TAG $make_latest $PRERELEASE)

curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$release_id \
-X PATCH \
Expand Down
8 changes: 4 additions & 4 deletions scripts/execution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ sudo chown -R $(whoami) /usr/share/nethermind
opts=$@
if [ ${#opts} -gt 0 ]
then
echo 'Executing Nethermind Runner'
sudo /usr/share/nethermind/Nethermind.Runner $@
echo 'Executing Nethermind'
sudo /usr/share/nethermind/nethermind $@
else
echo 'Executing Nethermind Launcher'
echo 'Executing Nethermind launcher'
cd /usr/share/nethermind
sudo /usr/share/nethermind/Nethermind.Launcher
sudo /usr/share/nethermind/nethermind-launcher
fi
Loading

0 comments on commit 02aa290

Please sign in to comment.