Skip to content

Commit 3da7a86

Browse files
renovate[bot]Amxxcairoeth
authored
Update dependency p-limit to v6 (#5104)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Hadrien Croubois <[email protected]> Co-authored-by: cairo <[email protected]>
1 parent f962373 commit 3da7a86

File tree

3 files changed

+126
-29
lines changed

3 files changed

+126
-29
lines changed

certora/run.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77
// node certora/run.js AccessControl
88
// node certora/run.js AccessControlHarness:AccessControl
99

10-
const proc = require('child_process');
11-
const { PassThrough } = require('stream');
12-
const events = require('events');
13-
14-
const argv = require('yargs')
10+
import { spawn } from 'child_process';
11+
import { PassThrough } from 'stream';
12+
import { once } from 'events';
13+
import path from 'path';
14+
import yargs from 'yargs';
15+
import { hideBin } from 'yargs/helpers';
16+
import pLimit from 'p-limit';
17+
import fs from 'fs/promises';
18+
19+
const argv = yargs(hideBin(process.argv))
1520
.env('')
1621
.options({
1722
all: {
@@ -21,7 +26,7 @@ const argv = require('yargs')
2126
spec: {
2227
alias: 's',
2328
type: 'string',
24-
default: __dirname + '/specs.json',
29+
default: path.resolve(import.meta.dirname, 'specs.json'),
2530
},
2631
parallel: {
2732
alias: 'p',
@@ -38,18 +43,20 @@ const argv = require('yargs')
3843
type: 'array',
3944
default: [],
4045
},
41-
}).argv;
46+
})
47+
.parse();
4248

4349
function match(entry, request) {
4450
const [reqSpec, reqContract] = request.split(':').reverse();
4551
return entry.spec == reqSpec && (!reqContract || entry.contract == reqContract);
4652
}
4753

48-
const specs = require(argv.spec).filter(s => argv.all || argv._.some(r => match(s, r)));
49-
const limit = require('p-limit')(argv.parallel);
54+
const specs = JSON.parse(fs.readFileSync(argv.spec, 'utf8')).filter(s => argv.all || argv._.some(r => match(s, r)));
55+
56+
const limit = pLimit(argv.parallel);
5057

5158
if (argv._.length == 0 && !argv.all) {
52-
console.error(`Warning: No specs requested. Did you forgot to toggle '--all'?`);
59+
console.error(`Warning: No specs requested. Did you forget to toggle '--all'?`);
5360
}
5461

5562
for (const r of argv._) {
@@ -64,12 +71,13 @@ if (process.exitCode) {
6471
}
6572

6673
for (const { spec, contract, files, options = [] } of specs) {
67-
limit(
68-
runCertora,
69-
spec,
70-
contract,
71-
files,
72-
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
74+
limit(() =>
75+
runCertora(
76+
spec,
77+
contract,
78+
files,
79+
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
80+
),
7381
);
7482
}
7583

@@ -79,7 +87,7 @@ async function runCertora(spec, contract, files, options = []) {
7987
if (argv.verbose) {
8088
console.log('Running:', args.join(' '));
8189
}
82-
const child = proc.spawn('certoraRun', args);
90+
const child = spawn('certoraRun', args);
8391

8492
const stream = new PassThrough();
8593
const output = collect(stream);
@@ -103,7 +111,7 @@ async function runCertora(spec, contract, files, options = []) {
103111
});
104112

105113
// wait for process end
106-
const [code, signal] = await events.once(child, 'exit');
114+
const [code, signal] = await once(child, 'exit');
107115

108116
// error
109117
if (code || signal) {

package-lock.json

Lines changed: 99 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"hardhat-ignore-warnings": "^0.2.11",
7777
"lodash.startcase": "^4.4.0",
7878
"micromatch": "^4.0.2",
79-
"p-limit": "^3.1.0",
79+
"p-limit": "^6.0.0",
8080
"prettier": "^3.0.0",
8181
"prettier-plugin-solidity": "^1.1.0",
8282
"rimraf": "^6.0.0",

0 commit comments

Comments
 (0)