Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flood comparision tool #6337

Merged
merged 205 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
363e653
Use better processing timer for logging (#5843)
benaadams Jun 21, 2023
10be6f6
Don't use DarkGray (#5849)
benaadams Jun 21, 2023
0e4300a
Bump to 1.20.0-rc
kamilchodola Jun 22, 2023
d16ab35
Update DotNetty feed
rubo Jun 29, 2023
a9e742c
Update DotNetty package
rubo Jul 4, 2023
78e5ec6
minor fixes
marcindsobczak Jun 20, 2023
a293ae9
Update version to 1.20.0
kamilchodola Jul 14, 2023
0e3b7cb
Bump to 1.20.1
kamilchodola Jul 17, 2023
4ea37b2
Add workflow to compare rpcs
Jul 20, 2023
0a06493
Trigger workflow?
piwonskp Aug 8, 2023
c80d9f3
Fix run-a-single-node-from-branch.yml
piwonskp Aug 8, 2023
9c127cc
Update branch name
piwonskp Aug 9, 2023
b8d275c
Wait for the node to sync
Aug 9, 2023
06937bd
Add a separate job to wait for node sync
Aug 15, 2023
0877822
Fix missing checkout
Aug 15, 2023
352bf64
Use validator mode and set Pruning to None
Aug 17, 2023
4a833a7
Increase timeout of wait to sync to 10 hours
Aug 18, 2023
6c85ab9
Change step timeout as well
Aug 18, 2023
8377d34
Wait 5.5h before running `wait_for_node_to_sync`
Aug 21, 2023
c8a360b
Fix needs
piwonskp Aug 22, 2023
13d9a28
Wait another 5.5h
Aug 23, 2023
476a16d
Fix indentation
piwonskp Aug 24, 2023
21bab0c
Remove sleep2
Aug 25, 2023
3278641
Remove debug info
Aug 25, 2023
53f3717
Change approach to multi nodes
kamilchodola Nov 28, 2023
863d9e8
Fix desc
kamilchodola Nov 28, 2023
15c83ae
Fix branch name for trigger
kamilchodola Nov 28, 2023
d4e1c7e
Merge branch 'rpc-comparision-1.23.0' of https://github.com/Nethermin…
kamilchodola Nov 28, 2023
ba1f35a
Add logs
kamilchodola Nov 28, 2023
9025c58
Add hardcoded value
kamilchodola Nov 28, 2023
889de1f
Fix matrix
kamilchodola Nov 28, 2023
5b5c76e
Change matrix approach
kamilchodola Nov 28, 2023
102b4c5
Fix json creation
kamilchodola Nov 28, 2023
803ff36
Fix path
kamilchodola Nov 28, 2023
75d4eae
Select branch
kamilchodola Nov 28, 2023
3103037
Absolut path
kamilchodola Nov 28, 2023
cc6a6f6
revert path
kamilchodola Nov 28, 2023
b3a51fd
static path
kamilchodola Nov 28, 2023
33a1c7d
Remove ref
kamilchodola Nov 28, 2023
bd71f87
bump checkout
kamilchodola Nov 28, 2023
074a6e9
add logs
kamilchodola Nov 28, 2023
c1a7fe7
Add fethc depth
kamilchodola Nov 28, 2023
024770c
change debug log
kamilchodola Nov 28, 2023
eaf6f60
More logs
kamilchodola Nov 28, 2023
8c2cf2f
Change logs
kamilchodola Nov 28, 2023
d4986fe
Change back to old version of run0single-node
kamilchodola Nov 28, 2023
dfce406
revert changes
kamilchodola Nov 28, 2023
0797b08
Change job
kamilchodola Nov 28, 2023
8eca9d1
Add matrix to path
kamilchodola Nov 28, 2023
723bf80
Adjust ref
kamilchodola Nov 28, 2023
bf37e3d
fix allowed_ips
kamilchodola Nov 28, 2023
7c99e16
missing needs
kamilchodola Nov 28, 2023
c20781b
Fix trigger job
kamilchodola Nov 28, 2023
4911983
Use better processing timer for logging (#5843)
benaadams Jun 21, 2023
54c8ccb
Don't use DarkGray (#5849)
benaadams Jun 21, 2023
f69ff70
Bump to 1.20.0-rc
kamilchodola Jun 22, 2023
71f964f
Update DotNetty feed
rubo Jun 29, 2023
3228792
Update DotNetty package
rubo Jul 4, 2023
c409761
minor fixes
marcindsobczak Jun 20, 2023
e96d1c8
Update version to 1.20.0
kamilchodola Jul 14, 2023
b7d39a4
Bump to 1.20.1
kamilchodola Jul 17, 2023
c137daf
Add workflow to compare rpcs
Jul 20, 2023
631aee3
Trigger workflow?
piwonskp Aug 8, 2023
a6576b1
Fix run-a-single-node-from-branch.yml
piwonskp Aug 8, 2023
ffc0c53
Update branch name
piwonskp Aug 9, 2023
e4d6f92
Wait for the node to sync
Aug 9, 2023
488df0a
Add a separate job to wait for node sync
Aug 15, 2023
e2057f8
Fix missing checkout
Aug 15, 2023
507ecd7
Use validator mode and set Pruning to None
Aug 17, 2023
84222b7
Increase timeout of wait to sync to 10 hours
Aug 18, 2023
70e5963
Change step timeout as well
Aug 18, 2023
4d996bf
Wait 5.5h before running `wait_for_node_to_sync`
Aug 21, 2023
4ca6c94
Fix needs
piwonskp Aug 22, 2023
37f2aa4
Wait another 5.5h
Aug 23, 2023
4dece62
Fix indentation
piwonskp Aug 24, 2023
538bf3e
Remove sleep2
Aug 25, 2023
b1595c1
Remove debug info
Aug 25, 2023
6a25987
Change approach to multi nodes
kamilchodola Nov 28, 2023
f2c0ea5
Fix branch name for trigger
kamilchodola Nov 28, 2023
8f7bbe9
Fix desc
kamilchodola Nov 28, 2023
9cb1f6d
Add logs
kamilchodola Nov 28, 2023
52d173c
Add hardcoded value
kamilchodola Nov 28, 2023
11065a4
Fix matrix
kamilchodola Nov 28, 2023
92fa043
Change matrix approach
kamilchodola Nov 28, 2023
a8b7da3
Fix json creation
kamilchodola Nov 28, 2023
8b7a5d2
Fix path
kamilchodola Nov 28, 2023
a9ec148
Select branch
kamilchodola Nov 28, 2023
48bb8a6
Absolut path
kamilchodola Nov 28, 2023
83cf2c4
revert path
kamilchodola Nov 28, 2023
6ec1812
static path
kamilchodola Nov 28, 2023
dfc7efc
Remove ref
kamilchodola Nov 28, 2023
cc6dbaf
bump checkout
kamilchodola Nov 28, 2023
1dc34ee
add logs
kamilchodola Nov 28, 2023
3d18635
Add fethc depth
kamilchodola Nov 28, 2023
82c383a
change debug log
kamilchodola Nov 28, 2023
f2b9e73
More logs
kamilchodola Nov 28, 2023
79cc8d2
Change logs
kamilchodola Nov 28, 2023
5411ac6
Change back to old version of run0single-node
kamilchodola Nov 28, 2023
0325b48
revert changes
kamilchodola Nov 28, 2023
90ae1af
Change job
kamilchodola Nov 28, 2023
c805dde
Add matrix to path
kamilchodola Nov 28, 2023
36a9394
Adjust ref
kamilchodola Nov 28, 2023
d66e343
fix allowed_ips
kamilchodola Nov 28, 2023
c4b5a2b
missing needs
kamilchodola Nov 28, 2023
c045d47
Fix trigger job
kamilchodola Nov 28, 2023
c29e0c2
Merge branch 'rpc-comparision-1.23.0' of https://github.com/Nethermin…
kamilchodola Nov 28, 2023
b19cced
Revert bad rebase changes
kamilchodola Nov 28, 2023
98d219e
Fixed workflow for testing
kamilchodola Nov 28, 2023
c88998e
Fix needs
kamilchodola Nov 28, 2023
3f5b171
Fix outputs
kamilchodola Nov 28, 2023
161768d
add missing $
kamilchodola Nov 28, 2023
6732fd7
Add more logs
kamilchodola Nov 29, 2023
352b646
Change rpc_urls
kamilchodola Nov 29, 2023
124f2ac
Change approach of node creation
kamilchodola Nov 29, 2023
deeb0de
Comment out
kamilchodola Nov 29, 2023
b9594ff
Fix needs
kamilchodola Nov 29, 2023
2479cd4
Change a way of applying artifacts and rpc_urls
kamilchodola Nov 29, 2023
165e8be
Adjust needs
kamilchodola Nov 29, 2023
ed216a9
Adjust
kamilchodola Nov 29, 2023
e9ad1a0
Add missing variables
kamilchodola Nov 29, 2023
60719cf
Fix invalid file read
kamilchodola Nov 29, 2023
2febe0f
Fix temp infura value
kamilchodola Nov 29, 2023
f365556
Fix to much '
kamilchodola Nov 29, 2023
4d109d2
Fix artifact save
kamilchodola Nov 29, 2023
9240dd5
Fix branches fetching
kamilchodola Nov 29, 2023
8126cfb
Temp remove needs
kamilchodola Nov 29, 2023
fcebf0f
Switch to first job needs
kamilchodola Nov 29, 2023
cfa3c67
Fix list fill
kamilchodola Nov 29, 2023
2a75265
Invalid path
kamilchodola Nov 29, 2023
52da7af
Add verbose logging
kamilchodola Nov 29, 2023
f225eb4
Adjust
kamilchodola Nov 29, 2023
09d6323
add missing repo
kamilchodola Nov 29, 2023
30848e9
Rollback run_id
kamilchodola Nov 29, 2023
43b43f6
Fix needs
kamilchodola Nov 29, 2023
d113bb4
Trigger
kamilchodola Nov 29, 2023
fb16952
Fix needs
kamilchodola Nov 29, 2023
97fa930
Change apprioach of downloading artifacts
kamilchodola Nov 30, 2023
023d4a8
Add more params to artifact download
kamilchodola Nov 30, 2023
0ac2dd1
Download all from current run
kamilchodola Nov 30, 2023
fe3eb41
Change the runid
kamilchodola Nov 30, 2023
1cf5023
Add search
kamilchodola Nov 30, 2023
e63c877
Fix typo
kamilchodola Nov 30, 2023
7baf5a3
Change way of downlaoding artifacts
kamilchodola Nov 30, 2023
b9742cd
Test a different run-id
kamilchodola Dec 1, 2023
5b53e8f
Change approach
kamilchodola Dec 1, 2023
1536cdb
Add mising custom id
kamilchodola Dec 1, 2023
3241a34
Change approach to only 1 branch compare
kamilchodola Dec 1, 2023
6dd7c29
Fix
kamilchodola Dec 1, 2023
01ad1b4
Fix2
kamilchodola Dec 1, 2023
8fc7714
add if commented
kamilchodola Dec 1, 2023
07a807e
Fetch only most recent run for selected ref
kamilchodola Dec 1, 2023
b510ab8
Change name of job
kamilchodola Dec 1, 2023
d3c81a7
Fix a ref_name displayed
kamilchodola Dec 1, 2023
adb199c
Fix ref name
kamilchodola Dec 1, 2023
f770410
Cleanup
kamilchodola Dec 4, 2023
7110600
Fix typo
kamilchodola Dec 4, 2023
afc0e0b
Clean refs
kamilchodola Dec 4, 2023
bc2e998
Change artifacts download path
kamilchodola Dec 4, 2023
294a5d0
Change action temporarily
kamilchodola Dec 4, 2023
38a1249
Add path param
kamilchodola Dec 4, 2023
49c795b
Switch to david action type
kamilchodola Dec 4, 2023
c8fd4a1
Trigger new nodes
kamilchodola Dec 4, 2023
d639b3d
Rollback needs
kamilchodola Dec 4, 2023
943bfb2
Fix if check for docker build creation
kamilchodola Dec 4, 2023
3840637
Rolback to classic artifacts downoad
kamilchodola Dec 4, 2023
b914ac9
Add better docker image check
kamilchodola Dec 4, 2023
eb5a81c
Add missing if condition
kamilchodola Dec 4, 2023
7a24bd9
Fix paths and add temp sepolia
kamilchodola Dec 4, 2023
44c86aa
Change delimiter
kamilchodola Dec 4, 2023
1803f06
Adjust waiting for node
kamilchodola Dec 4, 2023
09f6dba
Fix wrong output
kamilchodola Dec 4, 2023
0a67a58
Mock and test
kamilchodola Dec 4, 2023
2f7bc95
Fix issue
kamilchodola Dec 4, 2023
73b5f54
Fix issue2
kamilchodola Dec 4, 2023
e4fbe66
Fix issue
kamilchodola Dec 4, 2023
fe2373d
Remove deps
kamilchodola Dec 4, 2023
fe9b95b
Fix invalid "
kamilchodola Dec 4, 2023
5979880
Revert comments back
kamilchodola Dec 4, 2023
e340e67
Test on existing infra
kamilchodola Dec 4, 2023
14f1515
Fix bad replace
kamilchodola Dec 4, 2023
2e253ce
Change aproach of running
kamilchodola Dec 4, 2023
0c4e9d1
Fix failure
kamilchodola Dec 4, 2023
371c906
Add a better order of artifacts on a rpc_list
kamilchodola Dec 5, 2023
8e5f93f
Adjust
kamilchodola Dec 5, 2023
5102b13
Fix
kamilchodola Dec 5, 2023
124607e
Rollback to env
kamilchodola Dec 5, 2023
1597f1e
Adjust flood script
kamilchodola Dec 5, 2023
ae552ae
Fix rpc_urls creation
kamilchodola Dec 5, 2023
115c745
Hardcode urls for test
kamilchodola Dec 5, 2023
288db72
Comment out needs
kamilchodola Dec 5, 2023
359fdf1
Add missing equality tests
kamilchodola Dec 5, 2023
f06f051
Change to kch flood fork
kamilchodola Dec 5, 2023
665bed5
Rollback to official flood
kamilchodola Dec 5, 2023
e796222
Generate new nodes
kamilchodola Dec 5, 2023
1bf351d
Add misiing extension
kamilchodola Dec 5, 2023
05d48e6
adjist script and add logs
kamilchodola Dec 5, 2023
747684a
Fix typo
kamilchodola Dec 5, 2023
99f714d
Test
kamilchodola Dec 5, 2023
4db31b8
Change approach slightly
kamilchodola Dec 5, 2023
f3bcb11
One mroe adjustment
kamilchodola Dec 5, 2023
c3d8290
Adjust to mainnet and add missing envs
kamilchodola Dec 5, 2023
331ffa8
Bump timeout to something higher to fit tests
kamilchodola Dec 5, 2023
c8bdf04
Clean Up
kamilchodola Dec 5, 2023
c70e31b
Add missing changes
kamilchodola Dec 6, 2023
38808f5
merge master
kamilchodola Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
261 changes: 261 additions & 0 deletions .github/workflows/rpc-comparison.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
name: '[JSON-RPC] Compare Nethermind between clients and versions'

on:
workflow_dispatch:
inputs:
allowed_ips:
type: string
description: "A comma-separated list of ips allowed to connect to the node"
default: ''
required: false
branch_to_compare:
type: string
description: "A space-separated list of branches. If empty, then selected branch will be used. If multiple specified, those will be compared to themselves."
default: ""
required: false
compare_with:
type: string
description: "A space-separated list of additional comparers. If empty, then nothing else will be added to comparision. Possible options: 'INFURA_ENDPOINT', 'NETHERMIND_ARCHIVE_ENDPOINT'"
default: ""
required: false

jobs:
create_main_node:
name: Create node from current branch
uses: ./.github/workflows/run-a-single-node-from-branch.yml
secrets: inherit
with:
additional_options: '{"timeout":"12", "default_dockerfile":"Dockerfile", "default_dockerfile_build_type":"release", "ssh_keys":"", "allowed_ips":"${{ inputs.allowed_ips }}"}'
non_validator_mode: false
additional_nethermind_flags: Pruning.Mode=None JsonRpc.EnabledModules=[Eth,Subscribe,Trace,TxPool,Web3,Personal,Proof,Net,Parity,Health,Rpc,Debug,Admin]
nethermind_repo_ref: ${{ github.ref }}
custom_run_id: ${{ github.run_id }}

create_compare_node:
name: Create node from branch to compare
uses: ./.github/workflows/run-a-single-node-from-branch.yml
if: inputs.branch_to_compare != ''
secrets: inherit
with:
additional_options: '{"timeout":"12", "default_dockerfile":"Dockerfile", "default_dockerfile_build_type":"release", "ssh_keys":"", "allowed_ips":"${{ inputs.allowed_ips }}"}'
non_validator_mode: false
additional_nethermind_flags: Pruning.Mode=None JsonRpc.EnabledModules=[Eth,Subscribe,Trace,TxPool,Web3,Personal,Proof,Net,Parity,Health,Rpc,Debug,Admin]
nethermind_repo_ref: ${{ inputs.branch_to_compare }}
custom_run_id: ${{ github.run_id }}

aggregate_rpcs:
name: Collect all RPC Urls and pass it further
runs-on: ubuntu-latest
needs: [create_main_node, create_compare_node]
outputs:
rpc_urls: ${{ steps.process_artifacts.outputs.rpc_urls }}
steps:

- name: Prepare clean main ref
id: prepare_main_ref
run: |
REF_NAME=${{ github.ref }}
CLEAN_REF=$(echo "${REF_NAME/refs\/heads\//}" | sed 's/[^a-zA-Z0-9._-]/-/g')
echo "CLEAN_MAIN_REF=$CLEAN_REF" >> $GITHUB_ENV

- name: Prepare clean compare ref
id: prepare_compare_ref
if: inputs.branch_to_compare != ''
run: |
REF_NAME=${{ inputs.nethermind_repo_ref }}
CLEAN_REF=$(echo "${REF_NAME/refs\/heads\//}" | sed 's/[^a-zA-Z0-9._-]/-/g')
echo "CLEAN_COMPARE_REF=$CLEAN_REF" >> $GITHUB_ENV

- name: Download RPC Artifact for current branch
uses: actions/download-artifact@v3
with:
name: rpc-url___${{ env.CLEAN_MAIN_REF }}___${{ github.run_id }}
path: artifacts

- name: Download RPC Artifact for branch to compare
if: inputs.branch_to_compare != ''
uses: actions/download-artifact@v3
with:
name: rpc-url___${{ env.CLEAN_COMPARE_REF }}___${{ github.run_id }}
path: artifacts

- name: Process Artifacts Content
id: process_artifacts
run: |
rpc_urls=""
main_branch_file="rpc_url%${{ env.CLEAN_MAIN_REF }}%${{ github.run_id }}.txt"
compare_branch_file="rpc_url%${{ env.CLEAN_COMPARE_REF }}%${{ github.run_id }}"

ls artifacts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a leftover from testing?

# Check and add the main branch file
if [ -f "artifacts/$main_branch_file" ]; then
url_content=$(cat "artifacts/$main_branch_file")
echo $url_content
rpc_urls+="${{ env.CLEAN_MAIN_REF }}::$url_content,"
fi

# Check and add the compare branch file
if [ -f "artifacts/$compare_branch_file" ]; then
url_content=$(cat "artifacts/$compare_branch_file")
echo $url_content
rpc_urls+="${{ env.CLEAN_COMPARE_REF }}::$url_content,"
fi

rpc_urls=${rpc_urls%,}
echo $rpc_urls
echo "rpc_urls=$rpc_urls" >> $GITHUB_OUTPUT

wait_for_node_to_sync:
name: Wait for the nodes to sync
runs-on: ubuntu-latest
needs: [aggregate_rpcs]
timeout-minutes: 600
steps:
- uses: actions/checkout@v3
- name: Install WireGuard
run: |
sudo apt update
sudo apt install -y wireguard resolvconf
sudo mkdir -p /etc/wireguard
envsubst < scripts/wireguard.conf.template > wg0.conf
sudo wg-quick up ./wg0.conf
env:
WIREGUARD_PRIVKEY: '${{ secrets.WIREGUARD_PRIVKEY }}'
WIREGUARD_ADDRESS: '${{ secrets.WIREGUARD_ADDRESS }}'
WIREGUARD_DNS: '${{ secrets.WIREGUARD_DNS }}'
WIREGUARD_PUBKEY: '${{ secrets.WIREGUARD_PUBKEY }}'
WIREGUARD_PRESHAREDKEY: '${{ secrets.WIREGUARD_PRESHAREDKEY }}'
WIREGUARD_ALLOWED_IPS: '${{ secrets.WIREGUARD_ALLOWED_IPS }}'
WIREGUARD_SERVER_IP: '${{ secrets.WIREGUARD_SERVER_IP }}'
WIREGUARD_SERVER_PORT: '${{ secrets.WIREGUARD_SERVER_PORT }}'

- name: Wait for the nodes to sync
timeout-minutes: 600
run: |
# Assuming rpc_urls_str is a comma-separated string of URLs
rpc_urls_str="${{ needs.aggregate_rpcs.outputs.rpc_urls }}"
IFS=',' read -r -a rpc_urls_array <<< "$rpc_urls_str"

# Loop through the array and strip the branch prefix
processed_rpc_urls=()
for url_entry in "${rpc_urls_array[@]}"; do
processed_url="${url_entry#*::}" # Remove everything up to and including "::"
processed_rpc_urls+=("$processed_url")
done

sync_complete_flag=0

check_sync() {
rpc_url=$1
while curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' "$rpc_url" | jq -e '.result'; do
echo "Still waiting for node to be synced at RPC: $rpc_url."
sleep 60
done
echo "Node at $rpc_url synced."
sync_complete_flag=$((sync_complete_flag+1))
}

# Just an RPC warmup - to make sure no faulty info reached a check
sleep 60

# Iterate over the processed array of URLs
for url in "${processed_rpc_urls[@]}"; do
check_sync "$url"
done


compare:
name: Compare JSON-RPC responses between clients and versions
runs-on: ubuntu-latest
needs: [wait_for_node_to_sync, aggregate_rpcs]
steps:
- uses: actions/checkout@v3
- name: Install flood
run: pip install git+https://github.com/piwonskp/flood.git

- name: Install WireGuard
run: |
sudo apt update
sudo apt install -y wireguard resolvconf
sudo mkdir -p /etc/wireguard
envsubst < scripts/wireguard.conf.template > wg0.conf
sudo wg-quick up ./wg0.conf
env:
WIREGUARD_PRIVKEY: '${{ secrets.WIREGUARD_PRIVKEY }}'
WIREGUARD_ADDRESS: '${{ secrets.WIREGUARD_ADDRESS }}'
WIREGUARD_DNS: '${{ secrets.WIREGUARD_DNS }}'
WIREGUARD_PUBKEY: '${{ secrets.WIREGUARD_PUBKEY }}'
WIREGUARD_PRESHAREDKEY: '${{ secrets.WIREGUARD_PRESHAREDKEY }}'
WIREGUARD_ALLOWED_IPS: '${{ secrets.WIREGUARD_ALLOWED_IPS }}'
WIREGUARD_SERVER_IP: '${{ secrets.WIREGUARD_SERVER_IP }}'
WIREGUARD_SERVER_PORT: '${{ secrets.WIREGUARD_SERVER_PORT }}'

- name: Prepare Comparison Flags
id: prep_comparison
env:
INFURA_ENDPOINT: '${{ secrets.INFURA_ENDPOINT }}'
NETHERMIND_ARCHIVE_ENDPOINT: '${{ secrets.NETHERMIND_ARCHIVE_ENDPOINT }}'
run: |
others_str="${{ github.event.inputs.compare_with }}"
rpc_urls_str="${{ needs.aggregate_rpcs.outputs.rpc_urls }}"

IFS=',' read -r -a rpc_urls_array <<< "$rpc_urls_str"
unset IFS
IFS=' ' read -r -a others_str_array <<< "$others_str"
unset IFS

# Construct nethermind_urls_str as an array
nethermind_urls_str=()
for url_entry in "${rpc_urls_array[@]}"; do
branch="${url_entry%%::*}" # Extract the branch part
url="${url_entry#*::}" # Extract the URL part
nethermind_urls_str+=("nethermind_$branch=$url")
done

# Construct others_prepared_str as an array
others_prepared_str=()
for other in "${others_str_array[@]}"; do
if [[ "$other" == "INFURA_ENDPOINT" ]]; then
others_prepared_str+=("$other=${INFURA_ENDPOINT}")
elif [[ "$other" == "NETHERMIND_ARCHIVE_ENDPOINT" ]]; then
others_prepared_str+=("$other=${NETHERMIND_ARCHIVE_ENDPOINT}")
fi
done

# Flag for comparing to other branch
if [ ${#nethermind_urls_str[@]} -gt 1 ]; then
echo "compare_to_other_branch=true" >> $GITHUB_ENV
echo "compare_to_other_branch_params=${nethermind_urls_str[0]} ${nethermind_urls_str[1]}" >> $GITHUB_ENV
else
echo "compare_to_other_branch=false" >> $GITHUB_ENV
fi

# Flags for comparing to INFURA and ARCHIVE endpoints
compare_to_infura=false
compare_to_archive=false
for (( j = 0; j < ${#others_prepared_str[@]}; j++ )); do
if [[ "${others_prepared_str[j]}" == "INFURA_ENDPOINT=${INFURA_ENDPOINT}" ]]; then
compare_to_infura=true
echo "compare_to_infura_params=${nethermind_urls_str[0]} ${others_prepared_str[j]}" >> $GITHUB_ENV
elif [[ "${others_prepared_str[j]}" == "NETHERMIND_ARCHIVE_ENDPOINT=${NETHERMIND_ARCHIVE_ENDPOINT}" ]]; then
compare_to_archive=true
echo "compare_to_archive_params=${nethermind_urls_str[0]} ${others_prepared_str[j]}" >> $GITHUB_ENV
fi
done
echo "compare_to_infura=$compare_to_infura" >> $GITHUB_ENV
echo "compare_to_archive=$compare_to_archive" >> $GITHUB_ENV

- name: Compare to Other Branch
if: env.compare_to_other_branch == 'true'
run: |
flood all ${compare_to_other_branch_params} --equality

- name: Compare to INFURA Endpoint
if: env.compare_to_infura == 'true'
run: |
flood all ${compare_to_infura_params} --equality

- name: Compare to Nethermind Archive Endpoint
if: env.compare_to_archive == 'true'
run: |
flood all ${compare_to_archive_params} --equality
Loading