Skip to content

Refactor fee payment handling in fees.ts by streamlining voting contract instance creation and reordering feeJuice initialization. Update gas settings for improved fee management. #49

Refactor fee payment handling in fees.ts by streamlining voting contract instance creation and reordering feeJuice initialization. Update gas settings for improved fee management.

Refactor fee payment handling in fees.ts by streamlining voting contract instance creation and reordering feeJuice initialization. Update gas settings for improved fee management. #49

Workflow file for this run

name: Sandbox Tests
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
jobs:
sandbox-tests:
name: Sandbox Tests
runs-on: ubuntu-latest
env:
AZTEC_ENV: sandbox
VERSION: 3.0.0-devnet.2
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "yarn"
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Install Aztec CLI
run: |
curl -s https://install.aztec.network > tmp.sh
bash tmp.sh <<< yes "yes"
- name: Update path
run: echo "/home/runner/.aztec/bin" >> $GITHUB_PATH
- name: Set Aztec version and start sandbox
run: |
VERSION=${{ env.VERSION }} aztec-up
aztec start --sandbox &
- name: Wait for sandbox to be ready
run: |
echo "Waiting for sandbox to start..."
for i in {1..30}; do
if curl -s http://localhost:8080/status >/dev/null 2>&1; then
echo "✅ Sandbox is ready!"
break
fi
echo "Waiting... ($i/30)"
sleep 5
done
- name: Install project dependencies
run: yarn
- name: Compile contracts
run: script -e -c "${AZTEC_NARGO:-aztec-nargo} compile && aztec-postprocess-contract"
- name: Generate contract artifacts
run: script -e -c "aztec codegen target --outdir src/artifacts"
- name: Change ownership for nargo files
run: sudo chown -R $(whoami) ~/nargo && sudo chown -R $(whoami) ~/nargo/github.com
- name: Run JavaScript tests
run: |
script -e -c "rm -rf store/pxe"
script -e -c "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json"
- name: Run Aztec tests
run: script -e -c "aztec test"
- name: Deploy account and capture credentials
run: |
script -e -c "yarn clear-store"
TEMP_OUTPUT=$(mktemp)
if script -e -c "yarn deploy-account" > "$TEMP_OUTPUT" 2>&1; then
echo "✅ Deploy account script completed successfully"
else
echo "❌ Deploy account script failed"
cat "$TEMP_OUTPUT"
rm "$TEMP_OUTPUT"
exit 1
fi
cat "$TEMP_OUTPUT"
SECRET_KEY=$(grep -o "Secret key generated: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Secret key generated: //' || echo "")
SIGNING_KEY=$(grep -o "Signing key generated: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Signing key generated: //' || echo "")
SALT_VALUE=$(grep -o "Salt generated: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Salt generated: //' || echo "")
rm "$TEMP_OUTPUT"
if [ -n "$SECRET_KEY" ] && [ -n "$SIGNING_KEY" ] && [ -n "$SALT_VALUE" ]; then
echo "SECRET=\"$SECRET_KEY\"" >> .env
echo "SIGNING_KEY=\"$SIGNING_KEY\"" >> .env
echo "SALT=\"$SALT_VALUE\"" >> .env
echo "📋 Saved credentials to .env file"
else
echo "❌ Failed to extract SECRET, SIGNING_KEY, and/or SALT from deploy output"
exit 1
fi
- name: Deploy contract and capture address
run: |
TEMP_OUTPUT=$(mktemp)
if script -e -c "yarn deploy" > "$TEMP_OUTPUT" 2>&1; then
echo "✅ Deploy script completed successfully"
else
cat "$TEMP_OUTPUT"
rm "$TEMP_OUTPUT"
exit 1
fi
cat "$TEMP_OUTPUT"
# Extract contract address
VOTING_CONTRACT_ADDRESS=$(grep -o "Contract address: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Contract address: //' || echo "")
# Extract salt
CONTRACT_SALT=$(grep -o "Salt: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Salt: //' || echo "")
# Extract deployer
CONTRACT_DEPLOYER=$(grep -o "Deployer: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Deployer: //' || echo "")
# Extract public keys
PK_NULLIFIER=$(grep -o "Master Nullifier: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Master Nullifier: //' || echo "")
PK_INCOMING=$(grep -o "Master Incoming Viewing: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Master Incoming Viewing: //' || echo "")
PK_OUTGOING=$(grep -o "Master Outgoing Viewing: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Master Outgoing Viewing: //' || echo "")
PK_TAGGING=$(grep -o "Master Tagging: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Master Tagging: //' || echo "")
# Extract constructor args (JSON array), strip ANSI codes, and trim whitespace
CONSTRUCTOR_ARGS=$(grep "Constructor args:" "$TEMP_OUTPUT" | sed 's/.*Constructor args: //' | sed 's/\x1b\[[0-9;]*m//g' | tr -d '\n\r' | sed 's/[[:space:]]*$//' || echo "")
rm "$TEMP_OUTPUT"
# Save all data to .env
if [ -n "$VOTING_CONTRACT_ADDRESS" ]; then
echo "VOTING_CONTRACT_ADDRESS=\"$VOTING_CONTRACT_ADDRESS\"" >> .env
echo "📋 Saved contract address to .env file"
fi
if [ -n "$CONTRACT_SALT" ]; then
echo "CONTRACT_SALT=\"$CONTRACT_SALT\"" >> .env
echo "📋 Saved contract salt to .env file"
fi
if [ -n "$CONTRACT_DEPLOYER" ]; then
echo "CONTRACT_DEPLOYER=\"$CONTRACT_DEPLOYER\"" >> .env
echo "📋 Saved contract deployer to .env file"
fi
if [ -n "$PK_NULLIFIER" ]; then
echo "CONTRACT_PK_NULLIFIER=\"$PK_NULLIFIER\"" >> .env
fi
if [ -n "$PK_INCOMING" ]; then
echo "CONTRACT_PK_INCOMING=\"$PK_INCOMING\"" >> .env
fi
if [ -n "$PK_OUTGOING" ]; then
echo "CONTRACT_PK_OUTGOING=\"$PK_OUTGOING\"" >> .env
fi
if [ -n "$PK_TAGGING" ]; then
echo "CONTRACT_PK_TAGGING=\"$PK_TAGGING\"" >> .env
fi
if [ -n "$CONSTRUCTOR_ARGS" ]; then
echo "CONTRACT_CONSTRUCTOR_ARGS=\"$CONSTRUCTOR_ARGS\"" >> .env
echo "📋 Saved constructor args to .env file"
fi
- name: Run sandbox scripts
run: |
script -e -c "yarn fees"
script -e -c "yarn multiple-wallet"
script -e -c "yarn profile"
script -e -c "yarn interaction-existing-contract"