Skip to content

feat: add updated fuzzer from tact-check repository #2340

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

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e4c01a3
feat: added fuzzer code with some issues
Mell0r Mar 7, 2025
86568f9
fix: receiver.ts rewritten, many small bugfixes
Mell0r Mar 9, 2025
f49d0c9
fix: many linter fixes, all files codestyle switched to 4 spaces
Mell0r Mar 9, 2025
debcb8d
style: prettier fixes
Mell0r Mar 9, 2025
20daeef
fix: added non empty src info, but it is not working still
Mell0r Mar 11, 2025
8e21cff
fix: replaced simplified-string with string, added non-empty locInfo,…
Mell0r Mar 16, 2025
de9ebca
fix: added stdlib to compilation
Mell0r Mar 29, 2025
159d6bd
fix: added evalComptimeExpressions in the precompile replica
Mell0r Mar 29, 2025
608af66
fix: added constant definitions to trait generation
Mell0r Mar 29, 2025
0418907
fix: there is not possible to generate two equal entities of differen…
Mell0r Mar 30, 2025
8a09691
refactor: separated named and unnamed entities in scope to provide nu…
Mell0r Mar 30, 2025
7af6135
refactor: various small linter and cspell fixes
Mell0r Mar 30, 2025
63c3803
Merge branch 'main' into fuzzer-insertion
Mell0r Mar 30, 2025
c41a314
style: import type
Mell0r Mar 30, 2025
1a11374
feat: added correct wildcard formatting
Mell0r Mar 31, 2025
a37ca2c
refactor: adressed couple of todos and formatted files
Mell0r Mar 31, 2025
8e36352
style: done suggested change to prettifying imports from ast
Mell0r Mar 31, 2025
e6a55a9
Merge branch 'main' into fuzzer-insertion
jeshecdom Apr 3, 2025
6eb5e6f
tests: Added expression stats script.
jeshecdom Apr 4, 2025
ac21810
tests: added column titles in counts file.
jeshecdom Apr 4, 2025
fa12962
tests: build functions for contracts.
jeshecdom Apr 8, 2025
fbc54f6
feat: wip: added expression equality testing with stubs for now
Mell0r Apr 8, 2025
1c517ce
test: expression generator.
jeshecdom Apr 9, 2025
c90ad42
Merge branch 'fuzzer-insertion' into expression-fuzzing
Mell0r Apr 10, 2025
972f182
feat: simple test using the expression generator implemented
Mell0r Apr 10, 2025
6611366
fix: types in util functions specified more clearly, removed any cast
Mell0r Apr 10, 2025
34fd4e8
tests: Added logarithmic counts.
jeshecdom Apr 11, 2025
7959b7e
fix: error formatted correctly now, fixed interpreter context specifi…
Mell0r Apr 11, 2025
b4394e9
fix: shift operator checks in range [0..256]
jeshecdom Apr 11, 2025
abd7d3e
tests: Added indexed getters to ProxyContract.
jeshecdom Apr 11, 2025
bf285c8
fix: checkProperty error printing
Mell0r Apr 11, 2025
e145dc1
feat: merge with parent branch
Mell0r Apr 11, 2025
53d4eca
fix: added export from expression generation, swapped expects in test
Mell0r Apr 11, 2025
81431a0
fix: initializeGenerator function must receive the AstFactory object
jeshecdom Apr 11, 2025
c891808
fix: nullable bindings is now generated differently, no longer can ge…
Mell0r Apr 11, 2025
a15c9c9
refactor: moved test logic to separate file
Mell0r Apr 11, 2025
5e513db
refactor: fully port generator to fast-check.
jeshecdom Apr 12, 2025
54f210f
fix: add cell_hash, slice_hash, string_hash missing functions in mini…
jeshecdom Apr 12, 2025
7abb57b
feat: added interpratation and compilation failing tests saving to th…
Mell0r Apr 12, 2025
32b4420
Merge branch 'fuzzer-insertion' into expression-fuzzing
Mell0r Apr 12, 2025
ff735d2
wip: feat: merge with parent branch
Mell0r Apr 12, 2025
d9353f4
fix: removed partial sums from counting.
jeshecdom Apr 12, 2025
2a12aff
refactor: updated some wrong comments
jeshecdom Apr 12, 2025
24ee6a4
tests: partial functionality: testing configurable terminals and non-…
jeshecdom Apr 15, 2025
381529d
Merge branch 'main' into fuzzer-insertion
jeshecdom Apr 15, 2025
87f1ee3
tests: Finished configurable terminals and non-terminals. Also, finis…
jeshecdom Apr 16, 2025
39e4379
fix: Added nullChecks: true flag, which was causing the discrepancies…
jeshecdom Apr 17, 2025
e0904ef
tests: Integrate expression generator with rest of fuzzer.
jeshecdom Apr 23, 2025
8680a29
small fixes.
jeshecdom Apr 23, 2025
6d2c069
tests: make imported fuzzer top-down.
jeshecdom Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@
"src/test/exit-codes/contracts/compute-phase-errors.tact",
"src/test/e2e-slow/map-property-tests/map-properties-key-value-types.ts",
"src/test/e2e-slow/map-property-tests/build",
"src/test/fuzzer/src/minimal-fc-stdlib/stdlib.fc",
"/docs",
"src/benchmarks/contracts/func/notcoin/stdlib-custom.fc",
"src/benchmarks/contracts/func/notcoin/gas.fc",
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
"gen:contracts:test:map": "ts-node ./src/test/e2e-slow/map-property-tests/generate.ts",
"gen:contracts:all": "yarn gen:contracts:fast && yarn gen:contracts:test:map",
"gen": "yarn gen:grammar && yarn gen:stdlib && yarn gen:func-js && yarn gen:contracts:all",
"fuzz:expressions:stats": "ts-node src/test/fuzzer/test/expression-stats.ts",
"clean": "rm -fr dist",
"cleanall": "rm -fr dist node_modules",
"copy:stdlib": "ts-node src/stdlib/copy.build.ts",
2 changes: 2 additions & 0 deletions spell/cspell-list.txt
Original file line number Diff line number Diff line change
@@ -119,6 +119,7 @@ mintable
misparse
misparsed
mktemp
mult
multiformats
nanoton
nanotons
@@ -143,6 +144,7 @@ pinst
POSIX
postpack
prando
preorder
quadtree
quadtrees
RANDU
66 changes: 66 additions & 0 deletions src/func/funcCompile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ILogger } from "@/context/logger";
import { execSync } from "child_process";

// Wasm Imports
// eslint-disable-next-line @typescript-eslint/no-require-imports
@@ -60,6 +61,71 @@ export async function funcCompile(args: {
entries: string[];
sources: { path: string; content: string }[];
logger: ILogger;
}): Promise<FuncCompilationResult> {
const USE_NATIVE = process.env.USE_NATIVE === "true";
if (USE_NATIVE) {
return funcCompileNative(args);
}
return funcCompileWasm(args);
}

export function funcCompileNative(args: {
entries: string[];
sources: { path: string; content: string }[];
logger: ILogger;
}): FuncCompilationResult {
const FC_STDLIB_PATH = process.env.FC_STDLIB_PATH;
if (typeof FC_STDLIB_PATH === "undefined") {
throw new Error("FC_STDLIB_PATH is not set");
}
const FIFT_LIBS_PATH = process.env.FIFT_LIBS_PATH;
if (typeof FIFT_LIBS_PATH === "undefined") {
throw new Error("FIFT_LIBS_PATH is not set");
}
const FUNC_FIFT_COMPILER_PATH = process.env.FUNC_FIFT_COMPILER_PATH;
if (typeof FUNC_FIFT_COMPILER_PATH === "undefined") {
throw new Error("FUNC_FIFT_COMPILER_PATH is not set");
}

const files: string[] = args.entries;
const configStr = JSON.stringify({
sources: files.map((f) => f.replace("@stdlib/", FC_STDLIB_PATH)),
optLevel: 2,
fiftPath: FIFT_LIBS_PATH,
});

const retJson = execSync(
[FUNC_FIFT_COMPILER_PATH, `'${configStr}'`].join(" "),
);

const result = JSON.parse(retJson.toString()) as CompileResult;

switch (result.status) {
case "error": {
return {
ok: false,
log: "",
fift: null,
output: null,
};
}
case "ok": {
return {
ok: true,
log: "",
fift: cutFirstLine(result.fiftCode.replaceAll("\\n", "\n")),
output: Buffer.from(result.codeBoc, "base64"),
};
}
}

throw Error("Unexpected compiler response");
}

export async function funcCompileWasm(args: {
entries: string[];
sources: { path: string; content: string }[];
logger: ILogger;
}): Promise<FuncCompilationResult> {
// Parameters
const files: string[] = args.entries;
Loading