recon-generate 0.0.16 → 0.0.17

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
@@ -23,6 +23,7 @@ interface InfoOutput {
23
23
  assert: Record<string, Record<string, AssertInfo[]>>;
24
24
  constant_functions: Record<string, string[]>;
25
25
  constants_used: Record<string, Record<string, ConstantValue[][]>>;
26
+ inheritances: Record<string, string[]>;
26
27
  functions_relations: Record<string, Record<string, {
27
28
  impacts: string[];
28
29
  is_impacted_by: string[];
package/dist/info.js CHANGED
@@ -261,6 +261,33 @@ const collectRelatedContracts = (targetContract, allContracts) => {
261
261
  }
262
262
  return visited;
263
263
  };
264
+ /**
265
+ * Recursively collect all inherited contracts for a given contract
266
+ * Uses a visited set to avoid infinite loops
267
+ */
268
+ const collectAllInheritances = (contract, visited = new Set()) => {
269
+ const inheritedNames = [];
270
+ // Get direct base contracts
271
+ const directBases = contract.vLinearizedBaseContracts.filter(base => base.id !== contract.id);
272
+ for (const base of directBases) {
273
+ // Skip if already visited (avoid infinite loops)
274
+ if (visited.has(base.id))
275
+ continue;
276
+ visited.add(base.id);
277
+ // Add this base contract
278
+ if (!inheritedNames.includes(base.name)) {
279
+ inheritedNames.push(base.name);
280
+ }
281
+ // Recursively collect inheritances from this base
282
+ const baseInheritances = collectAllInheritances(base, visited);
283
+ for (const name of baseInheritances) {
284
+ if (!inheritedNames.includes(name)) {
285
+ inheritedNames.push(name);
286
+ }
287
+ }
288
+ }
289
+ return inheritedNames;
290
+ };
264
291
  const collectPayableFunctions = (contract) => {
265
292
  const payable = [];
266
293
  const allFunctions = (0, utils_1.getDefinitions)(contract, 'vFunctions', true).reverse();
@@ -914,6 +941,7 @@ const runInfo = async (foundryRoot, contractName, options = {}) => {
914
941
  assert: {},
915
942
  constant_functions: {},
916
943
  constants_used: {},
944
+ inheritances: {},
917
945
  functions_relations: {},
918
946
  with_fallback: [],
919
947
  with_receive: [],
@@ -965,6 +993,11 @@ const runInfo = async (foundryRoot, contractName, options = {}) => {
965
993
  if (hasReceive(contract)) {
966
994
  output.with_receive.push(contract.name);
967
995
  }
996
+ // Inheritances (all base contracts recursively, excluding self)
997
+ const inheritedContracts = collectAllInheritances(contract);
998
+ if (inheritedContracts.length > 0) {
999
+ output.inheritances[contract.name] = inheritedContracts;
1000
+ }
968
1001
  }
969
1002
  const jsonOutput = JSON.stringify(output, null, 2);
970
1003
  // Cleanup Z3 context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recon-generate",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "CLI to scaffold Recon fuzzing suite inside Foundry projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {