recon-generate 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/info.d.ts +1 -0
- package/dist/info.js +36 -0
- package/package.json +1 -1
package/dist/info.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface InfoOutput {
|
|
|
32
32
|
with_fallback: string[];
|
|
33
33
|
with_receive: string[];
|
|
34
34
|
coverage_map: Record<string, Record<string, CoverageBlock>>;
|
|
35
|
+
exclude_from_fuzzing: string[];
|
|
35
36
|
}
|
|
36
37
|
export declare const runInfo: (foundryRoot: string, contractName: string, options?: {
|
|
37
38
|
outputPath?: string;
|
package/dist/info.js
CHANGED
|
@@ -907,6 +907,39 @@ const hasReceive = (contract) => {
|
|
|
907
907
|
const allFunctions = (0, utils_1.getDefinitions)(contract, 'vFunctions', true);
|
|
908
908
|
return allFunctions.some(fn => fn.kind === solc_typed_ast_1.FunctionKind.Receive);
|
|
909
909
|
};
|
|
910
|
+
/**
|
|
911
|
+
* Check if a function contains a fuzzFromHere() call
|
|
912
|
+
*/
|
|
913
|
+
const hasFuzzFromHereCall = (fnDef) => {
|
|
914
|
+
for (const call of fnDef.getChildrenByType(solc_typed_ast_1.FunctionCall)) {
|
|
915
|
+
const expr = call.vExpression;
|
|
916
|
+
if (expr instanceof solc_typed_ast_1.MemberAccess && expr.memberName === 'fuzzFromHere') {
|
|
917
|
+
return true;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return false;
|
|
921
|
+
};
|
|
922
|
+
/**
|
|
923
|
+
* Collect public/external functions that contain vm.fuzzFromHere() calls
|
|
924
|
+
* These functions should be excluded from fuzzing
|
|
925
|
+
*/
|
|
926
|
+
const collectExcludeFromFuzzing = (contract) => {
|
|
927
|
+
const exclude = [];
|
|
928
|
+
const allFunctions = (0, utils_1.getDefinitions)(contract, 'vFunctions', true).reverse();
|
|
929
|
+
for (const fnDef of allFunctions) {
|
|
930
|
+
// Only check public/external functions
|
|
931
|
+
if (fnDef.visibility !== solc_typed_ast_1.FunctionVisibility.External && fnDef.visibility !== solc_typed_ast_1.FunctionVisibility.Public) {
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
934
|
+
if (hasFuzzFromHereCall(fnDef)) {
|
|
935
|
+
// Use function name (not signature) as per the expected output format
|
|
936
|
+
if (!exclude.includes(fnDef.name)) {
|
|
937
|
+
exclude.push(fnDef.name);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return exclude;
|
|
942
|
+
};
|
|
910
943
|
/**
|
|
911
944
|
* Load source file contents for source location info
|
|
912
945
|
*/
|
|
@@ -956,7 +989,10 @@ const runInfo = async (foundryRoot, contractName, options = {}) => {
|
|
|
956
989
|
with_fallback: [],
|
|
957
990
|
with_receive: [],
|
|
958
991
|
coverage_map: {},
|
|
992
|
+
exclude_from_fuzzing: [],
|
|
959
993
|
};
|
|
994
|
+
// Collect functions to exclude from fuzzing (from target contract)
|
|
995
|
+
output.exclude_from_fuzzing = collectExcludeFromFuzzing(targetContract);
|
|
960
996
|
// Collect info for all related contracts
|
|
961
997
|
for (const contract of relatedContracts) {
|
|
962
998
|
// Skip abstract contracts (their functions are inherited by concrete contracts)
|