Skip to content

Commit e6055af

Browse files
committed
Addressed PR feedback
1 parent 46fad70 commit e6055af

3 files changed

Lines changed: 42 additions & 24 deletions

File tree

scripts/edit/vc/nimbus/export_asdb.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ if docker compose ps --format '{{.Status}}' vc-nimbus 2>/dev/null | grep -qi run
8585
exit 1
8686
fi
8787

88-
# Create output directory if it doesn't exist
88+
# Make paths absolute for docker bind mount
89+
if [[ "$OUTPUT_FILE" != /* ]]; then
90+
OUTPUT_FILE="$(pwd)/$OUTPUT_FILE"
91+
fi
8992
OUTPUT_DIR=$(dirname "$OUTPUT_FILE")
90-
mkdir -p "$OUTPUT_DIR"
9193

92-
# Make OUTPUT_DIR absolute for docker bind mount
93-
if [[ "$OUTPUT_DIR" != /* ]]; then
94-
OUTPUT_DIR="$(pwd)/$OUTPUT_DIR"
95-
fi
94+
# Create output directory if it doesn't exist
95+
mkdir -p "$OUTPUT_DIR"
9696

9797
echo "Exporting slashing protection data using vc-nimbus container..."
9898

@@ -108,9 +108,15 @@ if ! docker compose run --rm -T \
108108
exit 1
109109
fi
110110

111+
# Fix file ownership (docker creates it as root)
112+
EXPORTED_FILE="$OUTPUT_DIR/slashing-protection.json"
113+
if [ -f "$EXPORTED_FILE" ]; then
114+
sudo chown "$(id -u):$(id -g)" "$EXPORTED_FILE"
115+
fi
116+
111117
# Move file to expected output path if not already there
112-
if [ -f "$OUTPUT_DIR/slashing-protection.json" ] && [ "$OUTPUT_FILE" != "$OUTPUT_DIR/slashing-protection.json" ]; then
113-
mv "$OUTPUT_DIR/slashing-protection.json" "$OUTPUT_FILE"
118+
if [ "$EXPORTED_FILE" != "$OUTPUT_FILE" ]; then
119+
mv "$EXPORTED_FILE" "$OUTPUT_FILE"
114120
fi
115121

116122
# Validate the exported JSON

scripts/edit/vc/prysm/export_asdb.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ if docker compose ps --format '{{.Status}}' vc-prysm 2>/dev/null | grep -qi runn
8585
exit 1
8686
fi
8787

88-
# Create output directory if it doesn't exist
88+
# Make paths absolute for docker bind mount
89+
if [[ "$OUTPUT_FILE" != /* ]]; then
90+
OUTPUT_FILE="$(pwd)/$OUTPUT_FILE"
91+
fi
8992
OUTPUT_DIR=$(dirname "$OUTPUT_FILE")
90-
mkdir -p "$OUTPUT_DIR"
9193

92-
# Make OUTPUT_DIR absolute for docker bind mount
93-
if [[ "$OUTPUT_DIR" != /* ]]; then
94-
OUTPUT_DIR="$(pwd)/$OUTPUT_DIR"
95-
fi
94+
# Create output directory if it doesn't exist
95+
mkdir -p "$OUTPUT_DIR"
9696

9797
echo "Exporting slashing protection data using vc-prysm container..."
9898

@@ -111,10 +111,16 @@ if ! docker compose run --rm -T \
111111
exit 1
112112
fi
113113

114+
# Fix file ownership (docker creates it as root)
114115
# Prysm creates a file named slashing_protection.json in the export directory
116+
EXPORTED_FILE="$OUTPUT_DIR/slashing_protection.json"
117+
if [ -f "$EXPORTED_FILE" ]; then
118+
sudo chown "$(id -u):$(id -g)" "$EXPORTED_FILE"
119+
fi
120+
115121
# Rename it to match our expected output file name
116-
if [ -f "$OUTPUT_DIR/slashing_protection.json" ]; then
117-
mv "$OUTPUT_DIR/slashing_protection.json" "$OUTPUT_FILE"
122+
if [ -f "$EXPORTED_FILE" ]; then
123+
mv "$EXPORTED_FILE" "$OUTPUT_FILE"
118124
fi
119125

120126
# Validate the exported JSON

scripts/edit/vc/teku/export_asdb.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ if docker compose ps --format '{{.Status}}' vc-teku 2>/dev/null | grep -qi runni
8585
exit 1
8686
fi
8787

88-
# Create output directory if it doesn't exist
88+
# Make paths absolute for docker bind mount
89+
if [[ "$OUTPUT_FILE" != /* ]]; then
90+
OUTPUT_FILE="$(pwd)/$OUTPUT_FILE"
91+
fi
8992
OUTPUT_DIR=$(dirname "$OUTPUT_FILE")
90-
mkdir -p "$OUTPUT_DIR"
9193

92-
# Make OUTPUT_DIR absolute for docker bind mount
93-
if [[ "$OUTPUT_DIR" != /* ]]; then
94-
OUTPUT_DIR="$(pwd)/$OUTPUT_DIR"
95-
fi
94+
# Create output directory if it doesn't exist
95+
mkdir -p "$OUTPUT_DIR"
9696

9797
echo "Exporting slashing protection data using vc-teku container..."
9898

@@ -109,9 +109,15 @@ if ! docker compose run --rm -T \
109109
exit 1
110110
fi
111111

112+
# Fix file ownership (docker creates it as root)
113+
EXPORTED_FILE="$OUTPUT_DIR/slashing-protection.json"
114+
if [ -f "$EXPORTED_FILE" ]; then
115+
sudo chown "$(id -u):$(id -g)" "$EXPORTED_FILE"
116+
fi
117+
112118
# Move file to expected output path if not already there
113-
if [ -f "$OUTPUT_DIR/slashing-protection.json" ] && [ "$OUTPUT_FILE" != "$OUTPUT_DIR/slashing-protection.json" ]; then
114-
mv "$OUTPUT_DIR/slashing-protection.json" "$OUTPUT_FILE"
119+
if [ "$EXPORTED_FILE" != "$OUTPUT_FILE" ]; then
120+
mv "$EXPORTED_FILE" "$OUTPUT_FILE"
115121
fi
116122

117123
# Validate the exported JSON

0 commit comments

Comments
 (0)