Browse Source

Update dependency p-limit to v6 (#5104)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: cairo <cairoeth@protonmail.com>
renovate[bot] 11 months ago
parent
commit
3da7a869aa
3 changed files with 126 additions and 29 deletions
  1. 26 18
      certora/run.js
  2. 99 10
      package-lock.json
  3. 1 1
      package.json

+ 26 - 18
certora/run.js

@@ -7,11 +7,16 @@
 //    node certora/run.js AccessControl
 //    node certora/run.js AccessControlHarness:AccessControl
 
-const proc = require('child_process');
-const { PassThrough } = require('stream');
-const events = require('events');
-
-const argv = require('yargs')
+import { spawn } from 'child_process';
+import { PassThrough } from 'stream';
+import { once } from 'events';
+import path from 'path';
+import yargs from 'yargs';
+import { hideBin } from 'yargs/helpers';
+import pLimit from 'p-limit';
+import fs from 'fs/promises';
+
+const argv = yargs(hideBin(process.argv))
   .env('')
   .options({
     all: {
@@ -21,7 +26,7 @@ const argv = require('yargs')
     spec: {
       alias: 's',
       type: 'string',
-      default: __dirname + '/specs.json',
+      default: path.resolve(import.meta.dirname, 'specs.json'),
     },
     parallel: {
       alias: 'p',
@@ -38,18 +43,20 @@ const argv = require('yargs')
       type: 'array',
       default: [],
     },
-  }).argv;
+  })
+  .parse();
 
 function match(entry, request) {
   const [reqSpec, reqContract] = request.split(':').reverse();
   return entry.spec == reqSpec && (!reqContract || entry.contract == reqContract);
 }
 
-const specs = require(argv.spec).filter(s => argv.all || argv._.some(r => match(s, r)));
-const limit = require('p-limit')(argv.parallel);
+const specs = JSON.parse(fs.readFileSync(argv.spec, 'utf8')).filter(s => argv.all || argv._.some(r => match(s, r)));
+
+const limit = pLimit(argv.parallel);
 
 if (argv._.length == 0 && !argv.all) {
-  console.error(`Warning: No specs requested. Did you forgot to toggle '--all'?`);
+  console.error(`Warning: No specs requested. Did you forget to toggle '--all'?`);
 }
 
 for (const r of argv._) {
@@ -64,12 +71,13 @@ if (process.exitCode) {
 }
 
 for (const { spec, contract, files, options = [] } of specs) {
-  limit(
-    runCertora,
-    spec,
-    contract,
-    files,
-    [...options, ...argv.options].flatMap(opt => opt.split(' ')),
+  limit(() =>
+    runCertora(
+      spec,
+      contract,
+      files,
+      [...options, ...argv.options].flatMap(opt => opt.split(' ')),
+    ),
   );
 }
 
@@ -79,7 +87,7 @@ async function runCertora(spec, contract, files, options = []) {
   if (argv.verbose) {
     console.log('Running:', args.join(' '));
   }
-  const child = proc.spawn('certoraRun', args);
+  const child = spawn('certoraRun', args);
 
   const stream = new PassThrough();
   const output = collect(stream);
@@ -103,7 +111,7 @@ async function runCertora(spec, contract, files, options = []) {
   });
 
   // wait for process end
-  const [code, signal] = await events.once(child, 'exit');
+  const [code, signal] = await once(child, 'exit');
 
   // error
   if (code || signal) {

+ 99 - 10
package-lock.json

@@ -34,7 +34,7 @@
         "hardhat-ignore-warnings": "^0.2.11",
         "lodash.startcase": "^4.4.0",
         "micromatch": "^4.0.2",
-        "p-limit": "^3.1.0",
+        "p-limit": "^6.0.0",
         "prettier": "^3.0.0",
         "prettier-plugin-solidity": "^1.1.0",
         "rimraf": "^6.0.0",
@@ -4618,6 +4618,22 @@
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
+    "node_modules/eslint/node_modules/p-limit": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+      "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "yocto-queue": "^0.1.0"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/eslint/node_modules/p-locate": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
@@ -4647,6 +4663,19 @@
         "node": ">=8"
       }
     },
+    "node_modules/eslint/node_modules/yocto-queue": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+      "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/espree": {
       "version": "10.2.0",
       "resolved": "https://registry.npmjs.org/espree/-/espree-10.2.0.tgz",
@@ -7683,6 +7712,22 @@
       "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
       "dev": true
     },
+    "node_modules/mocha/node_modules/p-limit": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+      "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "yocto-queue": "^0.1.0"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/mocha/node_modules/p-locate": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
@@ -7754,6 +7799,19 @@
         "node": ">=10"
       }
     },
+    "node_modules/mocha/node_modules/yocto-queue": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+      "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/ms": {
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -8045,15 +8103,16 @@
       }
     },
     "node_modules/p-limit": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
-      "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.0.0.tgz",
+      "integrity": "sha512-Dx+NzOuILWwjJE9OYtEKuQRy0i3c5QVAmDsVrvvRSgyNnPuB27D2DyEjl6QTNyeePaAHjaPk+ya0yA0Frld8RA==",
       "dev": true,
+      "license": "MIT",
       "dependencies": {
-        "yocto-queue": "^0.1.0"
+        "yocto-queue": "^1.1.1"
       },
       "engines": {
-        "node": ">=10"
+        "node": ">=18"
       },
       "funding": {
         "url": "https://github.com/sponsors/sindresorhus"
@@ -8337,6 +8396,22 @@
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
+    "node_modules/preferred-pm/node_modules/p-limit": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+      "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "yocto-queue": "^0.1.0"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/preferred-pm/node_modules/p-locate": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
@@ -8352,6 +8427,19 @@
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
+    "node_modules/preferred-pm/node_modules/yocto-queue": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+      "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/prelude-ls": {
       "version": "1.2.1",
       "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -11399,12 +11487,13 @@
       }
     },
     "node_modules/yocto-queue": {
-      "version": "0.1.0",
-      "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
-      "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz",
+      "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==",
       "dev": true,
+      "license": "MIT",
       "engines": {
-        "node": ">=10"
+        "node": ">=12.20"
       },
       "funding": {
         "url": "https://github.com/sponsors/sindresorhus"

+ 1 - 1
package.json

@@ -76,7 +76,7 @@
     "hardhat-ignore-warnings": "^0.2.11",
     "lodash.startcase": "^4.4.0",
     "micromatch": "^4.0.2",
-    "p-limit": "^3.1.0",
+    "p-limit": "^6.0.0",
     "prettier": "^3.0.0",
     "prettier-plugin-solidity": "^1.1.0",
     "rimraf": "^6.0.0",