-
Notifications
You must be signed in to change notification settings - Fork 10
52 lines (45 loc) · 1.49 KB
/
check_bootnodes_enrs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Check Bootnodes ENRs
on:
pull_request:
branches:
- main
jobs:
check_enrs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Python
run: |
sudo apt-get update
sudo apt-get install python3
- name: Check bootnodes ENRs have no padding
run: |
for FILE in $(find . -type f \( -name 'bootnodes.yaml' -o -name 'bootstrap_nodes.txt' \)); do
echo "Checking paddings in file: $FILE"
while read -r LINE; do
if [[ "$LINE" =~ enr: ]]; then
BASE64_STRING=${LINE#enr:}
if [[ "$BASE64_STRING" =~ = ]]; then
echo "ENR in $FILE contains padding: $LINE"
exit 1
fi
fi
done < "$FILE"
done
- name: Decode Base64
run: |
for FILE in $(find . -type f \( -name 'bootnodes.yaml' -o -name 'bootstrap_nodes.txt' \)); do
echo "Test decoding in file: $FILE"
while read -r LINE; do
if [[ "$LINE" =~ enr: ]]; then
BASE64_STRING=${LINE#enr:}
DECODED_STRING=$(echo "$BASE64_STRING" | base64 -d 2>/dev/null)
if [ $? -eq 0 ]; then
echo "Succesfully decoded base64: $LINE"
else
echo "ENR could not be decoded: $LINE"
fi
fi
done < "$FILE"
done