fix: remove enr padding #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 for padding | |
run: | | |
contains_padding=false | |
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 "Error: ENR in $FILE contains padding: $LINE" | |
contains_padding=true | |
fi | |
fi | |
done < "$FILE" | |
done | |
if [ "$contains_padding" = true ]; then | |
echo "Error: Bootnodes ENR strings in the following files contain padding:" | |
find . -type f \( -name 'bootnodes.yaml' -o -name 'bootstrap_nodes.txt' \) -exec grep -l enr {} + | |
exit 1 | |
fi | |
- name: Decode Base64 | |
run: | | |
contains_decoding_issue=false | |
for FILE in $(find . -type f \( -name 'bootnodes.yaml' -o -name 'bootstrap_nodes.txt' \)); do | |
echo "Testing 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 "Error: ENR could not be decoded in $FILE: $LINE" | |
contains_decoding_issue=true | |
fi | |
fi | |
done < "$FILE" | |
done | |
if [ "$contains_decoding_issue" = true ]; then | |
echo "Error: Bootnodes ENR strings in the following files contain decoding issues:" | |
find . -type f \( -name 'bootnodes.yaml' -o -name 'bootstrap_nodes.txt' \) -exec grep -l enr {} + | |
exit 1 | |
fi |