-
Notifications
You must be signed in to change notification settings - Fork 7
[DRAFT]: add firedancer conformance to ci #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+134
−0
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ | |
| node_modules | ||
| test-ledger | ||
| dist | ||
| solana-conformance | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/usr/bin/env zx | ||
|
|
||
| // Firedancer conformance testing of the Core BPF Config program against its | ||
| // original builtin implementation. | ||
| // | ||
| // Note: This script can only be run on Ubuntu. | ||
|
|
||
| import 'zx/globals'; | ||
| import { getProgramId, getProgramSharedObjectPath, workingDirectory } from '../utils.mjs'; | ||
|
|
||
| // Clone the conformance harness. | ||
| const harnessPath = path.join(workingDirectory, 'solana-conformance'); | ||
| await $`git clone https://github.com/firedancer-io/solana-conformance.git`; | ||
|
|
||
| // Clone the test vectors. | ||
| const testVectorsPath = path.join(harnessPath, 'impl', 'test-vectors'); | ||
| await $`git clone https://github.com/firedancer-io/test-vectors.git ${testVectorsPath}`; | ||
|
|
||
| // Remove the fixtures we want to skip. | ||
| const fixturesPath = path.join(testVectorsPath, 'instr', 'fixtures', 'config'); | ||
| const skipFixtures = [ | ||
| // These fixtures provide executable config accounts, which we know is a | ||
| // case that can't manifest under the Solana protocol. | ||
| '04a0b782cb1f4b1be044313331edda9dfb4696d6.fix', | ||
| 'c7ec10c03d5faadcebd32dc5b9a4086abef892ca_3157979.fix', | ||
| '68e8dbf0f31de69a2bd1d2c0fe9af3ba676301d6_3157979.fix', | ||
| 'f84b5ad44f7a253ebc8056d06396694370a7fa4c_3157979.fix', | ||
| '8bbe900444c675cfc3fbf0f80ae2eb061e536a09.fix', | ||
| ]; | ||
| for (const fixture of skipFixtures) { | ||
| await $`rm -f ${path.join(fixturesPath, fixture)}`; | ||
| } | ||
|
|
||
| // Clone the SolFuzz-Agave harness. | ||
| const solFuzzAgavePath = path.join(harnessPath, 'impl', 'solfuzz-agave'); | ||
| await $`git clone -b agave-v2.1.0 http://github.com/firedancer-io/solfuzz-agave.git ${solFuzzAgavePath}`; | ||
|
|
||
| // Fetch protobuf files. | ||
| await $`make -j -C ${solFuzzAgavePath} fetch_proto` | ||
|
|
||
| // Move into the conformance harness. | ||
| cd(harnessPath); | ||
|
|
||
| // Build the environment. | ||
| await $`bash install_ubuntu_lite.sh`; | ||
|
|
||
| const solFuzzAgaveManifestPath = path.join(solFuzzAgavePath, 'Cargo.toml'); | ||
| const solFuzzAgaveTargetPath = path.join( | ||
| solFuzzAgavePath, | ||
| 'target', | ||
| 'x86_64-unknown-linux-gnu', | ||
| 'release', | ||
| 'libsolfuzz_agave.so', | ||
| ); | ||
|
|
||
| const testTargetsDir = path.join(harnessPath, 'impl', 'lib'); | ||
| await $`mkdir -p ${testTargetsDir}`; | ||
|
|
||
| // Build the Agave target with the builtin version. | ||
| const testTargetPathBuiltin = path.join(testTargetsDir, 'builtin.so'); | ||
| await $`cargo build --manifest-path ${solFuzzAgaveManifestPath} \ | ||
| --lib --release --target x86_64-unknown-linux-gnu`; | ||
| await $`mv ${solFuzzAgaveTargetPath} ${testTargetPathBuiltin}`; | ||
|
|
||
| // Build the Agave target with the BPF version. | ||
| const testTargetPathCoreBpf = path.join(testTargetsDir, 'core_bpf.so'); | ||
| await $`CORE_BPF_PROGRAM_ID=${getProgramId('program')} \ | ||
| CORE_BPF_TARGET=${getProgramSharedObjectPath('program')} \ | ||
| FORCE_RECOMPILE=true \ | ||
| cargo build --manifest-path ${solFuzzAgaveManifestPath} \ | ||
| --lib --release --target x86_64-unknown-linux-gnu --features core-bpf`; | ||
| await $`mv ${solFuzzAgaveTargetPath} ${testTargetPathCoreBpf}`; | ||
|
|
||
| // Run the tests. | ||
| await $`source test_suite_env/bin/activate && \ | ||
| solana-test-suite run-tests \ | ||
| -i ${fixturesPath} -s ${testTargetPathBuiltin} -t ${testTargetPathCoreBpf}`; | ||
|
|
||
| // Assert conformance. | ||
| // There should be no fixtures in the `failed_protobufs` directory. | ||
| if (fs.readdirSync('test_results/failed_protobufs').length > 0) { | ||
| throw new Error(`Error: mismatches detected.`); | ||
| } else { | ||
| console.log('All tests passed.'); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.