recon-generate 0.0.36 → 0.0.38

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/index.js CHANGED
@@ -43,6 +43,7 @@ const coverage_1 = require("./coverage");
43
43
  const pathsGenerator_1 = require("./pathsGenerator");
44
44
  const info_1 = require("./info");
45
45
  const utils_1 = require("./utils");
46
+ const fs = __importStar(require("fs"));
46
47
  const link_1 = require("./link");
47
48
  const link2_1 = require("./link2");
48
49
  const sourcemap_1 = require("./sourcemap");
@@ -133,7 +134,8 @@ async function main() {
133
134
  .option('--list', 'List available contracts/functions (after filters) and exit')
134
135
  .option('--force', 'Replace existing generated suite output (under --output). Does not rebuild .recon/out.')
135
136
  .option('--force-build', 'Delete .recon/out to force a fresh forge build before generating')
136
- .option('--foundry-config <path>', 'Path to foundry.toml (defaults to ./foundry.toml)');
137
+ .option('--foundry-config <path>', 'Path to foundry.toml (defaults to ./foundry.toml)')
138
+ .option('--scaffold <path>', 'Path to contracts-to-scaffold.json (Scout V2 output)');
137
139
  program
138
140
  .command('coverage')
139
141
  .description('Generate recon-coverage.json from a Crytic tester contract without scaffolding tests')
@@ -354,6 +356,29 @@ async function main() {
354
356
  const foundryConfigPath = (0, utils_1.getFoundryConfigPath)(workspaceRoot, opts.foundryConfig);
355
357
  const foundryRoot = path.dirname(foundryConfigPath);
356
358
  const forgeConfig = await (0, utils_1.getFoundryConfig)(foundryRoot);
359
+ // Scout V2: load contracts-to-scaffold.json and merge into include/mock filters
360
+ if (opts.scaffold) {
361
+ const scaffoldPath = path.isAbsolute(opts.scaffold)
362
+ ? opts.scaffold
363
+ : path.resolve(workspaceRoot, opts.scaffold);
364
+ try {
365
+ const scaffoldData = JSON.parse(fs.readFileSync(scaffoldPath, 'utf-8'));
366
+ const sourceContracts = scaffoldData.source_contracts || [];
367
+ const mockedContracts = scaffoldData.mocked_contracts || [];
368
+ if (sourceContracts.length) {
369
+ const existing = opts.include || '';
370
+ opts.include = [existing, sourceContracts.join(',')].filter(Boolean).join(',');
371
+ }
372
+ if (mockedContracts.length) {
373
+ const existing = opts.mock || '';
374
+ opts.mock = [existing, mockedContracts.join(',')].filter(Boolean).join(',');
375
+ }
376
+ console.log(`Scout V2: loaded ${sourceContracts.length} source + ${mockedContracts.length} mock contracts from ${opts.scaffold}`);
377
+ }
378
+ catch (err) {
379
+ console.error(`Scout V2: failed to load scaffold file ${opts.scaffold}: ${err.message}`);
380
+ }
381
+ }
357
382
  const includeFilter = parseFilter(opts.include);
358
383
  const excludeFilter = parseFilter(opts.exclude);
359
384
  const adminFilter = parseFilter(opts.admin);
@@ -33,7 +33,7 @@ abstract contract Setup is BaseSetup, ActorManager, AssetManager, Utils {
33
33
  address[] {{instanceName this.name}}_s;
34
34
  {{/if}}
35
35
  {{/each}}
36
-
36
+
37
37
  /// === Setup === ///
38
38
  /// This contains all calls to be performed in the tester constructor, both for Echidna and Foundry
39
39
  function setup() internal virtual override {
@@ -57,15 +57,17 @@ abstract contract Setup is BaseSetup, ActorManager, AssetManager, Utils {
57
57
 
58
58
  /// === MODIFIERS === ///
59
59
  /// Prank admin and actor
60
-
60
+
61
61
  modifier asAdmin {
62
- vm.prank(address(this));
62
+ vm.startPrank(address(this));
63
63
  _;
64
+ vm.stopPrank();
64
65
  }
65
66
 
66
67
  modifier asActor {
67
- vm.prank(address(_getActor()));
68
+ vm.startPrank(address(_getActor()));
68
69
  _;
70
+ vm.stopPrank();
69
71
  }
70
72
  }
71
73
  `, { noEscape: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recon-generate",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "CLI to scaffold Recon fuzzing suite inside Foundry projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {