Skip to content

Commit ee0dce7

Browse files
committed
implement mollusk conformance testing
1 parent 7e0b15e commit ee0dce7

File tree

7 files changed

+37
-94
lines changed

7 files changed

+37
-94
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ jobs:
141141
exit 1;
142142
fi
143143
144-
fd_conformance:
145-
name: Builtin-BPF Conformance Test
144+
conformance:
145+
name: Conformance Test
146146
runs-on: ubuntu-latest
147147
needs: build_programs
148148
steps:
@@ -160,16 +160,17 @@ jobs:
160160
run: |
161161
sudo apt-get update
162162
sudo apt-get install -y libudev-dev pkg-config
163+
cargo install mollusk-svm-cli
163164
164165
- name: Restore Program Builds
165166
uses: actions/cache/restore@v4
166167
with:
167168
path: ./**/*.so
168169
key: ${{ runner.os }}-builds-${{ github.sha }}
169170

170-
- name: Builtin-BPF Conformance Test
171+
- name: Conformance Test
171172
shell: bash
172-
run: pnpm zx ./scripts/ci/fd-conformance.mjs
173+
run: pnpm zx ./scripts/ci/conformance.mjs
173174

174175
## SKIP: IDL is hand-cranked here for now.
175176
##

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
**/*.rs.bk
77
node_modules
88
test-ledger
9+
base.so
910
dist
1011
solana-conformance

Cargo.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[workspace]
22
resolver = "2"
33
members = ["clients/rust", "program"]
4-
# Required for CI
5-
exclude = ["solana-conformance/impl/solfuzz-agave"]
64

75
[workspace.package]
86
authors = ["Anza Technology Maintainers <[email protected]>"]

program/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ solana-program = { workspace = true }
2424
thiserror = { workspace = true }
2525

2626
[dev-dependencies]
27-
mollusk-svm = { workspace = true, features = ["fuzz-fd"] }
27+
mollusk-svm = { workspace = true, features = ["fuzz"] }
2828
mollusk-svm-bencher = { workspace = true }
2929
solana-sdk = { workspace = true }
3030

scripts/ci/conformance.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env zx
2+
3+
// Mollusk conformance testing of this Core BPF Config program against the
4+
// version running on mainnet-beta.
5+
6+
import 'zx/globals';
7+
import { getProgramId, getProgramSharedObjectPath, workingDirectory } from '../utils.mjs';
8+
9+
const programId = getProgramId('program');
10+
const programBinaryPath = getProgramSharedObjectPath('program');
11+
const baseBinaryPath = path.join(workingDirectory, 'base.so');
12+
const molluskFixturesPath = path.join(workingDirectory, 'program', 'fuzz', 'blob');
13+
14+
// Clone the program from mainnet-beta.
15+
await $`solana program dump -um ${programId} ${baseBinaryPath}`;
16+
17+
// Test this program against the cloned program for conformance with Mollusk.
18+
let output = await $`mollusk run-test \
19+
--proto firedancer \
20+
${baseBinaryPath} ${programBinaryPath} \
21+
${molluskFixturesPath} ${programId}`;
22+
23+
// The last line of output should exactly match the following:
24+
// [DONE][TEST RESULT]: 0 failures
25+
if (!output.stdout.includes("[DONE][TEST RESULT]: 0 failures")) {
26+
throw new Error(`Error: mismatches detected.`);
27+
}

scripts/ci/fd-conformance.mjs

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)