Skip to content

Commit

Permalink
fix(integration): remove container.json check
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMustermann2 committed Nov 21, 2024
1 parent d855bab commit 391affc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
9 changes: 4 additions & 5 deletions script/integration/deposit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ for var in "${vars[@]}"; do
fi
done

# Fetch the validator details and save them to container.json
if ! curl -s -X GET "$INTEGRATION_BEACON_CHAIN_ENDPOINT/eth/v1/beacon/genesis" -H "accept: application/json" | jq . >"$SCRIPT_DIR/genesis.json"; then
echo "Error: Failed to fetch genesis data from the beacon chain"
exit 1
Expand Down Expand Up @@ -57,13 +56,13 @@ fi
deposit_address=$(jq -r .data.DEPOSIT_CONTRACT_ADDRESS "$SCRIPT_DIR/genesis.json")
slots_per_epoch=$(jq -r .data.SLOTS_PER_EPOCH "$SCRIPT_DIR/spec.json")
if ! [[ "$slots_per_epoch" =~ ^[0-9]+$ ]]; then
echo "Error: Invalid slots per epoch"
exit 1
echo "Error: Invalid slots per epoch"
exit 1
fi
seconds_per_slot=$(jq -r .data.SECONDS_PER_SLOT "$SCRIPT_DIR/spec.json")
if ! [[ "$seconds_per_slot" =~ ^[0-9]+$ ]]; then
echo "Error: Invalid seconds per slot"
exit 1
echo "Error: Invalid seconds per slot"
exit 1
fi

# Make the variables available to the forge script
Expand Down
24 changes: 9 additions & 15 deletions script/integration/prove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,8 @@ done

# Check for the files to exist
if [ ! -f "$SCRIPT_DIR/spec.json" ]; then
echo "Error: spec.json not found in $SCRIPT_DIR"
exit 1
fi

# Check for the files to exist
if [ ! -f "$SCRIPT_DIR/container.json" ]; then
echo "Error: container.json not found in $SCRIPT_DIR"
exit 1
echo "Error: spec.json not found in $SCRIPT_DIR"
exit 1
fi

# Fetch the validator details and save them to container.json
Expand Down Expand Up @@ -67,23 +61,23 @@ slot=$((slots_per_epoch * epoch))

# Now derive the proof using the proof generation binary, which must already be running configured to the localnet
response=$(curl -s -w "%{http_code}" -X POST -H "Content-Type: application/json" \
-d "{\"slot\": $slot, \"validator_index\": $validator_index}" \
$INTEGRATION_PROVE_ENDPOINT/v1/validator-proof)
-d "{\"slot\": $slot, \"validator_index\": $validator_index}" \
$INTEGRATION_PROVE_ENDPOINT/v1/validator-proof)

http_code=${response: -3}
body=${response:0:${#response}-3}

if [ "$http_code" != "200" ]; then
echo "Error: Failed to generate proof. HTTP code: $http_code"
echo "Response: $body"
exit 1
echo "Error: Failed to generate proof. HTTP code: $http_code"
echo "Response: $body"
exit 1
fi

echo "$body" | jq . >"$SCRIPT_DIR/proof.json"

if [ ! -s "$SCRIPT_DIR/proof.json" ]; then
echo "Error: Generated proof is empty"
exit 1
echo "Error: Generated proof is empty"
exit 1
fi

export INTEGRATION_NST_DEPOSITOR=$INTEGRATION_NST_DEPOSITOR
Expand Down

0 comments on commit 391affc

Please sign in to comment.