Skip to content

Commit f702d6c

Browse files
committed
add conformance recipe
1 parent 6ac8e06 commit f702d6c

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

.github/workflows/main.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,36 @@ jobs:
178178
echo "CU usage has changed. Please run `cargo bench` and commit the new results.";
179179
exit 1;
180180
fi
181+
182+
conformance:
183+
name: Conformance Test
184+
runs-on: ubuntu-latest
185+
needs: build_program
186+
steps:
187+
- name: Git Checkout
188+
uses: actions/checkout@v4
189+
190+
- name: Setup Environment
191+
uses: ./.github/actions/setup
192+
with:
193+
cargo-cache-key: cargo-program-conformance
194+
cargo-cache-fallback-key: cargo-program
195+
solana: true
196+
197+
- name: Install System Dependencies
198+
run: |
199+
sudo apt-get update
200+
sudo apt-get install -y libudev-dev pkg-config
201+
command -v mollusk >/dev/null 2>&1 || cargo install mollusk-svm-cli
202+
203+
- name: Restore Program Builds
204+
uses: actions/cache/restore@v4
205+
with:
206+
path: ./**/*.so
207+
key: ${{ runner.os }}-builds-${{ github.sha }}
208+
209+
- name: Conformance Test
210+
run: make conformance
181211

182212
generate_clients:
183213
name: Check Client Generation

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ build-program:
3535
bench-program-compute-units:
3636
cargo bench --manifest-path program/Cargo.toml
3737

38+
conformance:
39+
./scripts/conformance.sh
40+
3841
format-js:
3942
cd ./clients/js && pnpm install && pnpm format
4043

scripts/conformance.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# Mollusk conformance testing of this Core BPF Config program against the
4+
# version running on mainnet-beta.
5+
6+
set -euo pipefail
7+
8+
WORKDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
9+
10+
PROGRAM_ID="Config1111111111111111111111111111111111111"
11+
PROGRAM_BINARY_PATH="$WORKDIR/target/deploy/solana_config_program.so"
12+
BASE_BINARY_PATH="$WORKDIR/program/fuzz/program-mb-3-17-2025.so"
13+
MOLLUSK_FIXTURES_PATH="$WORKDIR/program/fuzz/blob"
14+
15+
# Test this program against the cloned program for conformance with Mollusk.
16+
OUTPUT=$(mollusk run-test \
17+
--proto firedancer --ignore-compute-units \
18+
"$BASE_BINARY_PATH" "$PROGRAM_BINARY_PATH" \
19+
"$MOLLUSK_FIXTURES_PATH" "$PROGRAM_ID")
20+
21+
# The last line of output should exactly match the following:
22+
# [DONE][TEST RESULT]: 0 failures
23+
if ! grep -q "\[DONE\]\[TEST RESULT\]: 0 failures" <<< "$OUTPUT"; then
24+
echo "Error: mismatches detected."
25+
exit 1
26+
fi
27+
28+
echo "$OUTPUT"
29+
echo "Conformance test passed."

0 commit comments

Comments
 (0)