Commit ef12bdef by Hadrien Croubois

missing dependency + lint

parent 1738bc79
...@@ -31,5 +31,6 @@ jobs: ...@@ -31,5 +31,6 @@ jobs:
FORCE_COLOR: 1 FORCE_COLOR: 1
ENABLE_GAS_REPORT: true ENABLE_GAS_REPORT: true
- run: npm run test:inheritance - run: npm run test:inheritance
- run: npm run layout:test
- name: Print gas report - name: Print gas report
run: cat gas-report.txt run: cat gas-report.txt
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"@nomiclabs/hardhat-web3": "^2.0.0", "@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/docs-utils": "^0.1.0", "@openzeppelin/docs-utils": "^0.1.0",
"@openzeppelin/test-helpers": "^0.5.13", "@openzeppelin/test-helpers": "^0.5.13",
"@openzeppelin/upgrades-core": "^1.13.1",
"chai": "^4.2.0", "chai": "^4.2.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
...@@ -1817,6 +1818,65 @@ ...@@ -1817,6 +1818,65 @@
"semver": "bin/semver" "semver": "bin/semver"
} }
}, },
"node_modules/@openzeppelin/upgrades-core": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/@openzeppelin/upgrades-core/-/upgrades-core-1.13.1.tgz",
"integrity": "sha512-xqrNQ65BG0pW8Tb8RVI73gHf3mBuuMuduiKQ8PxpFnmMq/CAuwVNbkPRAif7q1USVkXsIdrMKGki1eaZX1xh8g==",
"dev": true,
"dependencies": {
"bn.js": "^5.1.2",
"cbor": "^8.0.0",
"chalk": "^4.1.0",
"compare-versions": "^4.0.0",
"debug": "^4.1.1",
"ethereumjs-util": "^7.0.3",
"proper-lockfile": "^4.1.1",
"solidity-ast": "^0.4.15"
}
},
"node_modules/@openzeppelin/upgrades-core/node_modules/bn.js": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz",
"integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==",
"dev": true
},
"node_modules/@openzeppelin/upgrades-core/node_modules/cbor": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz",
"integrity": "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==",
"dev": true,
"dependencies": {
"nofilter": "^3.1.0"
},
"engines": {
"node": ">=12.19"
}
},
"node_modules/@openzeppelin/upgrades-core/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@openzeppelin/upgrades-core/node_modules/nofilter": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz",
"integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==",
"dev": true,
"engines": {
"node": ">=12.19"
}
},
"node_modules/@sentry/core": { "node_modules/@sentry/core": {
"version": "5.30.0", "version": "5.30.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz",
...@@ -5619,6 +5679,12 @@ ...@@ -5619,6 +5679,12 @@
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true "dev": true
}, },
"node_modules/compare-versions": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-4.1.3.tgz",
"integrity": "sha512-WQfnbDcrYnGr55UwbxKiQKASnTtNnaAWVi8jZyy8NTpVAXWACSne8lMD1iaIo9AiU6mnuLvSVshCzewVuWxHUg==",
"dev": true
},
"node_modules/component-emitter": { "node_modules/component-emitter": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
...@@ -13171,6 +13237,17 @@ ...@@ -13171,6 +13237,17 @@
"asap": "~2.0.6" "asap": "~2.0.6"
} }
}, },
"node_modules/proper-lockfile": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz",
"integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==",
"dev": true,
"dependencies": {
"graceful-fs": "^4.2.4",
"retry": "^0.12.0",
"signal-exit": "^3.0.2"
}
},
"node_modules/proxy-addr": { "node_modules/proxy-addr": {
"version": "2.0.7", "version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
...@@ -13768,6 +13845,15 @@ ...@@ -13768,6 +13845,15 @@
"node": ">=0.12" "node": ">=0.12"
} }
}, },
"node_modules/retry": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
"integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",
"dev": true,
"engines": {
"node": ">= 4"
}
},
"node_modules/reusify": { "node_modules/reusify": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
...@@ -19312,6 +19398,55 @@ ...@@ -19312,6 +19398,55 @@
} }
} }
}, },
"@openzeppelin/upgrades-core": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/@openzeppelin/upgrades-core/-/upgrades-core-1.13.1.tgz",
"integrity": "sha512-xqrNQ65BG0pW8Tb8RVI73gHf3mBuuMuduiKQ8PxpFnmMq/CAuwVNbkPRAif7q1USVkXsIdrMKGki1eaZX1xh8g==",
"dev": true,
"requires": {
"bn.js": "^5.1.2",
"cbor": "^8.0.0",
"chalk": "^4.1.0",
"compare-versions": "^4.0.0",
"debug": "^4.1.1",
"ethereumjs-util": "^7.0.3",
"proper-lockfile": "^4.1.1",
"solidity-ast": "^0.4.15"
},
"dependencies": {
"bn.js": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz",
"integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==",
"dev": true
},
"cbor": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz",
"integrity": "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==",
"dev": true,
"requires": {
"nofilter": "^3.1.0"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"nofilter": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz",
"integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==",
"dev": true
}
}
},
"@sentry/core": { "@sentry/core": {
"version": "5.30.0", "version": "5.30.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz",
...@@ -22530,6 +22665,12 @@ ...@@ -22530,6 +22665,12 @@
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true "dev": true
}, },
"compare-versions": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-4.1.3.tgz",
"integrity": "sha512-WQfnbDcrYnGr55UwbxKiQKASnTtNnaAWVi8jZyy8NTpVAXWACSne8lMD1iaIo9AiU6mnuLvSVshCzewVuWxHUg==",
"dev": true
},
"component-emitter": { "component-emitter": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
...@@ -28611,6 +28752,17 @@ ...@@ -28611,6 +28752,17 @@
"asap": "~2.0.6" "asap": "~2.0.6"
} }
}, },
"proper-lockfile": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz",
"integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.4",
"retry": "^0.12.0",
"signal-exit": "^3.0.2"
}
},
"proxy-addr": { "proxy-addr": {
"version": "2.0.7", "version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
...@@ -29069,6 +29221,12 @@ ...@@ -29069,6 +29221,12 @@
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
"dev": true "dev": true
}, },
"retry": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
"integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",
"dev": true
},
"reusify": { "reusify": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
"@nomiclabs/hardhat-web3": "^2.0.0", "@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/docs-utils": "^0.1.0", "@openzeppelin/docs-utils": "^0.1.0",
"@openzeppelin/test-helpers": "^0.5.13", "@openzeppelin/test-helpers": "^0.5.13",
"@openzeppelin/upgrades-core": "^1.13.1",
"chai": "^4.2.0", "chai": "^4.2.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
......
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const { findAll } = require('solidity-ast/utils'); const { findAll } = require('solidity-ast/utils');
const { astDereferencer } = require('@openzeppelin/upgrades-core/dist/ast-dereferencer');
const { solcInputOutputDecoder } = require('@openzeppelin/upgrades-core/dist/src-decoder');
const { extractStorageLayout } = require('@openzeppelin/upgrades-core/dist/storage/extract');
const { StorageLayoutComparator } = require('@openzeppelin/upgrades-core/dist/storage/compare');
const { LayoutCompatibilityReport } = require('@openzeppelin/upgrades-core/dist/storage/report');
const {
astDereferencer,
} = require('@openzeppelin/upgrades-core/dist/ast-dereferencer');
const { build, check, _: artifacts } = require('yargs').argv; const {
solcInputOutputDecoder,
extractStorageLayout,
StorageLayoutComparator,
LayoutCompatibilityReport,
} = require('@openzeppelin/upgrades-core');
const { build, check, _: artifacts } = require('yargs').argv;
// build layout for current version of the code // build layout for current version of the code
const layout = {} const layout = {};
for (const artifact of artifacts) { for (const artifact of artifacts) {
const { input, output } = require(path.resolve(__dirname, '../..', artifact)); const { input, output } = require(path.resolve(__dirname, '../..', artifact));
const decoder = solcInputOutputDecoder(input, output); const decoder = solcInputOutputDecoder(input, output);
const deref = astDereferencer(output); const deref = astDereferencer(output);
for (const src in output.contracts) { for (const src in output.contracts) {
if (src.startsWith('contracts/mocks/')) { if (src.startsWith('contracts/mocks/')) {
continue; continue;
} }
for (const contractDef of findAll('ContractDefinition', output.sources[src].ast)) {
layout[contractDef.name] = extractStorageLayout( for (const contractDef of findAll('ContractDefinition', output.sources[src].ast)) {
contractDef, if ([ 'interface', 'library' ].includes(contractDef.contractKind)) {
decoder, continue;
deref, }
output.contracts[src][contractDef.name].storageLayout
).storage; layout[contractDef.name] = extractStorageLayout(
} contractDef,
decoder,
deref,
output.contracts[src][contractDef.name].storageLayout,
).storage;
} }
}
} }
// if the --check option is set, check compatibility of the current layout against the cache // if the --check option is set, check compatibility of the current layout against the cache
if (check) { if (check) {
const cache = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../..', check))); const cache = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../..', check)));
for (id in cache) { for (const id in cache) {
const comparator = new StorageLayoutComparator(); const comparator = new StorageLayoutComparator();
const report = new LayoutCompatibilityReport(comparator.layoutLevenshtein(cache[id], layout[id], { allowAppend: false })); const report = new LayoutCompatibilityReport(comparator.layoutLevenshtein(
cache[id],
layout[id],
{ allowAppend: false },
));
if (!report.ok) { if (!report.ok) {
console.log(`Storage incompatibility in ${id}`); console.log(`Storage incompatibility in ${id}`);
console.log(report.explain()); console.log(report.explain());
process.exitCode = 1; process.exitCode = 1;
}
} }
}
} }
// if the --build option is set, write the layout results // if the --build option is set, write the layout results
if (build) { if (build) {
fs.writeFileSync(path.resolve(__dirname, '../..', build), JSON.stringify(layout)); fs.writeFileSync(path.resolve(__dirname, '../..', build), JSON.stringify(layout));
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment