recon-generate 0.0.25 → 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 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
@@ -142,6 +142,11 @@ const typeStringToSolidityType = (typeString, value) => {
142
142
  if (typeString.startsWith('literal_string')) {
143
143
  return 'string';
144
144
  }
145
+ // Handle contract/interface types - these are addresses at runtime
146
+ // e.g., "contract IFoo", "contract Foo", "interface IBar"
147
+ if (typeString.startsWith('contract ') || typeString.startsWith('interface ')) {
148
+ return 'address';
149
+ }
145
150
  // Handle basic types
146
151
  const basicTypes = [
147
152
  'bool', 'address', 'bytes', 'string',
@@ -902,6 +907,39 @@ const hasReceive = (contract) => {
902
907
  const allFunctions = (0, utils_1.getDefinitions)(contract, 'vFunctions', true);
903
908
  return allFunctions.some(fn => fn.kind === solc_typed_ast_1.FunctionKind.Receive);
904
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
+ };
905
943
  /**
906
944
  * Load source file contents for source location info
907
945
  */
@@ -951,7 +989,10 @@ const runInfo = async (foundryRoot, contractName, options = {}) => {
951
989
  with_fallback: [],
952
990
  with_receive: [],
953
991
  coverage_map: {},
992
+ exclude_from_fuzzing: [],
954
993
  };
994
+ // Collect functions to exclude from fuzzing (from target contract)
995
+ output.exclude_from_fuzzing = collectExcludeFromFuzzing(targetContract);
955
996
  // Collect info for all related contracts
956
997
  for (const contract of relatedContracts) {
957
998
  // Skip abstract contracts (their functions are inherited by concrete contracts)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recon-generate",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "CLI to scaffold Recon fuzzing suite inside Foundry projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {