Skip to content

Commit 9f963f3

Browse files
committed
add firedancer conformance to ci
1 parent 8fdf608 commit 9f963f3

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,31 @@ jobs:
140140
echo "CU usage has changed. Please run `cargo bench` and commit the new results.";
141141
exit 1;
142142
fi
143+
144+
fd_conformance:
145+
name: Builtin-BPF Conformance Test
146+
runs-on: ubuntu-latest
147+
needs: build_programs
148+
steps:
149+
- name: Git Checkout
150+
uses: actions/checkout@v4
151+
152+
- name: Setup Environment
153+
uses: ./.github/actions/setup
154+
with:
155+
cargo-cache-key: cargo-program-conformance
156+
cargo-cache-fallback-key: cargo-programs
157+
solana: true
158+
159+
- name: Restore Program Builds
160+
uses: actions/cache/restore@v4
161+
with:
162+
path: ./**/*.so
163+
key: ${{ runner.os }}-builds-${{ github.sha }}
164+
165+
- name: Builtin-BPF Conformance Test
166+
shell: bash
167+
run: pnpm zx ./scripts/ci/fd-conformance.mjs
143168

144169
## SKIP: IDL is hand-cranked here for now.
145170
##

scripts/ci/fd-conformance.mjs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env zx
2+
3+
// Firedancer conformance testing of the Core BPF Config program against its
4+
// original builtin implementation.
5+
//
6+
// Note: This script can only be run on Ubuntu.
7+
8+
import 'zx/globals';
9+
import fs from 'node:fs';
10+
import { workingDirectory } from '../utils.mjs';
11+
12+
// Clone the conformance harness.
13+
const harnessPath = path.join(workingDirectory, 'solana-conformance');
14+
await $`git clone -b core-bpf https://github.com/buffalojoec/solana-conformance.git`;
15+
16+
// Clone the test vectors.
17+
const testVectorsPath = path.join(harnessPath, 'impl', 'test-vectors');
18+
await $`git clone https://github.com/firedancer-io/test-vectors.git ${testVectorsPath}`;
19+
20+
// Clone the SolFuzz-Agave harness.
21+
const solFuzzAgavePath = path.join(harnessPath, 'impl', 'agave-v2.1.0');
22+
await $`git clone -b agave-v2.1.0 http://github.com/firedancer-io/solfuzz-agave.git ${solFuzzAgavePath}`;
23+
24+
// Move into the conformance harness.
25+
cd(harnessPath);
26+
27+
// Build the environment.
28+
await $`bash install_ubuntu_lite.sh`;
29+
30+
// // Build the Agave target with the builtin version.
31+
// await $`make -j -C impl lib/libsolfuzz_agave_v2.0.so`;
32+
// const builtinTargetPath = path.join(
33+
// harnessPath,
34+
// 'impl',
35+
// 'lib',
36+
// 'libsolfuzz_agave_v2.0.so',
37+
// );
38+
39+
// // Build the Agave target with the BPF version.
40+
// await $`PROGRAM="config" make -j -C impl lib/libsolfuzz_agave_v2.0_core_bpf.so`;
41+
// const bpfTargetPath = path.join(
42+
// harnessPath,
43+
// 'impl',
44+
// 'lib',
45+
// 'libsolfuzz_agave_core_bpf_config.so',
46+
// );
47+
48+
// // Run the tests.
49+
// const fixturesPath = path.join(
50+
// harnessPath,
51+
// 'test-vectors',
52+
// 'instr',
53+
// 'fixtures',
54+
// 'config',
55+
// );
56+
// await $`solana-test-suite run-tests -i ${fixturesPath} -s ${builtinTargetPath} -t ${bpfTargetPath}`;
57+
58+
// // Find the results files.
59+
// function findResultFile(dirPath) {
60+
// const files = fs.readdir(dirPath);
61+
// const resultFile = files.find(file => file.endsWith('.txt'));
62+
// if (!resultFile) throw new Error(`No result file found in ${dirPath}`);
63+
// return path.join(dirPath, resultFile);
64+
// }
65+
66+
// const builtinResultsPath = findResultFile(path.join(
67+
// harnessPath,
68+
// 'test_results',
69+
// 'libsolfuzz_agave_v2.0',
70+
// ));
71+
72+
// const bpfResultsPath = findResultFile(path.join(
73+
// harnessPath,
74+
// 'test_results',
75+
// 'libsolfuzz_agave_core_bpf_config',
76+
// ));
77+
78+
// // Assert conformance.
79+
// const [builtinResults, bpfResults] = await Promise.all([
80+
// fs.readFile(builtinResultsPath, 'utf-8'),
81+
// fs.readFile(bpfResultsPath, 'utf-8'),
82+
// ]);
83+
84+
// if (builtinResults !== bpfResults) {
85+
// throw new Error(`Error: mismatches detected.`);
86+
// } else {
87+
// console.log('All tests passed.');
88+
// }

0 commit comments

Comments
 (0)