@openzeppelin/upgrades-core 1.9.2 → 1.12.0
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/LICENSE +22 -0
- package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.json +80 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +113 -0
- package/artifacts/AdminUpgradeabilityProxy.json +2 -2
- package/artifacts/contracts/proxy/AdminUpgradeabilityProxy.sol/AdminUpgradeabilityProxy.json +2 -2
- package/dist/beacon.d.ts +8 -0
- package/dist/beacon.d.ts.map +1 -0
- package/dist/beacon.js +25 -0
- package/dist/beacon.js.map +1 -0
- package/dist/deployment.d.ts +14 -3
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +20 -13
- package/dist/deployment.js.map +1 -1
- package/dist/deployment.test.js +23 -0
- package/dist/deployment.test.js.map +1 -1
- package/dist/eip-1967-type.d.ts +4 -0
- package/dist/eip-1967-type.d.ts.map +1 -0
- package/dist/eip-1967-type.js +37 -0
- package/dist/eip-1967-type.js.map +1 -0
- package/dist/eip-1967.d.ts +5 -0
- package/dist/eip-1967.d.ts.map +1 -1
- package/dist/eip-1967.js +19 -12
- package/dist/eip-1967.js.map +1 -1
- package/dist/impl-address.d.ts +19 -0
- package/dist/impl-address.d.ts.map +1 -0
- package/dist/impl-address.js +67 -0
- package/dist/impl-address.js.map +1 -0
- package/dist/impl-store.d.ts +3 -2
- package/dist/impl-store.d.ts.map +1 -1
- package/dist/impl-store.js +21 -10
- package/dist/impl-store.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +11 -1
- package/dist/provider.js.map +1 -1
- package/dist/proxy-kind.d.ts +12 -0
- package/dist/proxy-kind.d.ts.map +1 -0
- package/dist/proxy-kind.js +50 -0
- package/dist/proxy-kind.js.map +1 -0
- package/dist/standalone.d.ts +19 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +24 -0
- package/dist/standalone.js.map +1 -0
- package/dist/standalone.test.d.ts +2 -0
- package/dist/standalone.test.d.ts.map +1 -0
- package/dist/standalone.test.js +33 -0
- package/dist/standalone.test.js.map +1 -0
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +11 -5
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/report.d.ts +3 -2
- package/dist/storage/report.d.ts.map +1 -1
- package/dist/storage/report.js +9 -3
- package/dist/storage/report.js.map +1 -1
- package/dist/usage-error.d.ts +21 -0
- package/dist/usage-error.d.ts.map +1 -0
- package/dist/usage-error.js +51 -0
- package/dist/usage-error.js.map +1 -0
- package/dist/utils/address.d.ts +8 -0
- package/dist/utils/address.d.ts.map +1 -0
- package/dist/utils/address.js +20 -0
- package/dist/utils/address.js.map +1 -0
- package/dist/utils/make-non-enumerable.d.ts +1 -1
- package/dist/utils/make-non-enumerable.d.ts.map +1 -1
- package/dist/utils/make-non-enumerable.js.map +1 -1
- package/dist/validate/error.d.ts.map +1 -1
- package/dist/validate/error.js +2 -65
- package/dist/validate/error.js.map +1 -1
- package/dist/validate/index.d.ts +2 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +4 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/overrides.js +1 -1
- package/dist/validate/overrides.js.map +1 -1
- package/dist/validate/query.d.ts +3 -1
- package/dist/validate/query.d.ts.map +1 -1
- package/dist/validate/query.js +23 -7
- package/dist/validate/query.js.map +1 -1
- package/dist/validate/report.d.ts +8 -0
- package/dist/validate/report.d.ts.map +1 -0
- package/dist/validate/report.js +79 -0
- package/dist/validate/report.js.map +1 -0
- package/dist/version.d.ts +3 -3
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +12 -6
- package/dist/version.js.map +1 -1
- package/package.json +8 -5
- package/src/beacon.ts +20 -0
- package/src/deployment.test.ts +25 -0
- package/src/deployment.ts +43 -13
- package/src/eip-1967-type.ts +35 -0
- package/src/eip-1967.ts +16 -12
- package/src/impl-address.ts +76 -0
- package/src/impl-store.ts +23 -7
- package/src/index.ts +18 -1
- package/src/manifest.ts +1 -1
- package/src/provider.ts +16 -0
- package/src/proxy-kind.ts +59 -0
- package/src/standalone.test.ts +40 -0
- package/src/standalone.ts +41 -0
- package/src/storage/index.ts +14 -4
- package/src/storage/report.ts +10 -5
- package/src/usage-error.ts +68 -0
- package/src/utils/address.ts +16 -0
- package/src/utils/make-non-enumerable.ts +1 -1
- package/src/validate/error.ts +5 -67
- package/src/validate/index.ts +2 -0
- package/src/validate/overrides.ts +1 -1
- package/src/validate/query.ts +24 -6
- package/src/validate/report.ts +78 -0
- package/src/version.ts +14 -6
- package/CHANGELOG.md +0 -114
- package/dist/set-proxy-kind.d.ts +0 -5
- package/dist/set-proxy-kind.d.ts.map +0 -1
- package/dist/set-proxy-kind.js +0 -25
- package/dist/set-proxy-kind.js.map +0 -1
- package/src/set-proxy-kind.ts +0 -27
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpgradeableContract = void 0;
|
|
4
|
+
const src_decoder_1 = require("./src-decoder");
|
|
5
|
+
const validate_1 = require("./validate");
|
|
6
|
+
const storage_1 = require("./storage");
|
|
7
|
+
class UpgradeableContract {
|
|
8
|
+
constructor(name, solcInput, solcOutput, opts = {}) {
|
|
9
|
+
this.name = name;
|
|
10
|
+
const decodeSrc = (0, src_decoder_1.solcInputOutputDecoder)(solcInput, solcOutput);
|
|
11
|
+
const validation = (0, validate_1.validate)(solcOutput, decodeSrc);
|
|
12
|
+
this.version = (0, validate_1.getContractVersion)(validation, name);
|
|
13
|
+
this.errors = (0, validate_1.getErrors)(validation, this.version, opts);
|
|
14
|
+
this.layout = (0, validate_1.getStorageLayout)(validation, this.version);
|
|
15
|
+
}
|
|
16
|
+
getErrorReport() {
|
|
17
|
+
return new validate_1.UpgradeableContractErrorReport(this.errors);
|
|
18
|
+
}
|
|
19
|
+
getStorageUpgradeReport(newVersion, opts = {}) {
|
|
20
|
+
return (0, storage_1.getStorageUpgradeReport)(this.layout, newVersion.layout, (0, validate_1.withValidationDefaults)(opts));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.UpgradeableContract = UpgradeableContract;
|
|
24
|
+
//# sourceMappingURL=standalone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":";;;AACA,+CAAuD;AACvD,yCAQoB;AACpB,uCAAmE;AASnE,MAAa,mBAAmB;IAK9B,YAAqB,IAAY,EAAE,SAAoB,EAAE,UAAsB,EAAE,OAA0B,EAAE;QAAxF,SAAI,GAAJ,IAAI,CAAQ;QAC/B,MAAM,SAAS,GAAG,IAAA,oCAAsB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,IAAA,mBAAQ,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAA,6BAAkB,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,IAAA,oBAAS,EAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,IAAA,2BAAgB,EAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,yCAA8B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,uBAAuB,CAAC,UAA+B,EAAE,OAA0B,EAAE;QACnF,OAAO,IAAA,iCAAuB,EAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,IAAA,iCAAsB,EAAC,IAAI,CAAC,CAAC,CAAC;IAC/F,CAAC;CACF;AApBD,kDAoBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.test.d.ts","sourceRoot":"","sources":["../src/standalone.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ava_1 = __importDefault(require("ava"));
|
|
7
|
+
const hardhat_1 = require("hardhat");
|
|
8
|
+
const standalone_1 = require("./standalone");
|
|
9
|
+
const test = ava_1.default;
|
|
10
|
+
test.before(async (t) => {
|
|
11
|
+
const buildInfo = await hardhat_1.artifacts.getBuildInfo('contracts/test/Standalone.sol:StandaloneV1');
|
|
12
|
+
if (buildInfo === undefined) {
|
|
13
|
+
throw new Error('Build info not found');
|
|
14
|
+
}
|
|
15
|
+
t.context.solcInput = buildInfo.input;
|
|
16
|
+
t.context.solcOutput = buildInfo.output;
|
|
17
|
+
});
|
|
18
|
+
test('reports unsafe operation', t => {
|
|
19
|
+
const impl = new standalone_1.UpgradeableContract('StandaloneV1', t.context.solcInput, t.context.solcOutput);
|
|
20
|
+
const report = impl.getErrorReport();
|
|
21
|
+
t.false(report.ok);
|
|
22
|
+
t.true(report.errors[0].kind === 'delegatecall');
|
|
23
|
+
});
|
|
24
|
+
test('reports storage upgrade errors', t => {
|
|
25
|
+
const v1 = new standalone_1.UpgradeableContract('StandaloneV1', t.context.solcInput, t.context.solcOutput);
|
|
26
|
+
const v2Good = new standalone_1.UpgradeableContract('StandaloneV2Good', t.context.solcInput, t.context.solcOutput);
|
|
27
|
+
const goodReport = v1.getStorageUpgradeReport(v2Good);
|
|
28
|
+
t.true(goodReport.ok);
|
|
29
|
+
const v2Bad = new standalone_1.UpgradeableContract('StandaloneV2Bad', t.context.solcInput, t.context.solcOutput);
|
|
30
|
+
const badReport = v1.getStorageUpgradeReport(v2Bad);
|
|
31
|
+
t.false(badReport.ok);
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=standalone.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.test.js","sourceRoot":"","sources":["../src/standalone.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAA2C;AAC3C,qCAAoC;AAGpC,6CAAmD;AAOnD,MAAM,IAAI,GAAG,aAA+B,CAAC;AAE7C,IAAI,CAAC,MAAM,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;IACpB,MAAM,SAAS,GAAG,MAAM,mBAAS,CAAC,YAAY,CAAC,4CAA4C,CAAC,CAAC;IAC7F,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IACD,CAAC,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC;IACtC,CAAC,CAAC,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,CAAC,CAAC,EAAE;IACnC,MAAM,IAAI,GAAG,IAAI,gCAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IACrC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gCAAgC,EAAE,CAAC,CAAC,EAAE;IACzC,MAAM,EAAE,GAAG,IAAI,gCAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9F,MAAM,MAAM,GAAG,IAAI,gCAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtG,MAAM,UAAU,GAAG,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAEtB,MAAM,KAAK,GAAG,IAAI,gCAAmB,CAAC,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACpG,MAAM,SAAS,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export * from './compat';
|
|
2
|
+
import { UpgradesError } from '../error';
|
|
2
3
|
import { StorageLayout } from './layout';
|
|
3
4
|
import { StorageOperation, StorageItem } from './compare';
|
|
5
|
+
import { LayoutCompatibilityReport } from './report';
|
|
4
6
|
import { ValidationOptions } from '../validate/overrides';
|
|
5
7
|
export declare function assertStorageUpgradeSafe(original: StorageLayout, updated: StorageLayout, unsafeAllowCustomTypes: boolean): void;
|
|
6
8
|
export declare function assertStorageUpgradeSafe(original: StorageLayout, updated: StorageLayout, opts: Required<ValidationOptions>): void;
|
|
9
|
+
export declare function getStorageUpgradeReport(original: StorageLayout, updated: StorageLayout, opts: Required<ValidationOptions>): LayoutCompatibilityReport;
|
|
10
|
+
export declare class StorageUpgradeErrors extends UpgradesError {
|
|
11
|
+
readonly report: LayoutCompatibilityReport;
|
|
12
|
+
constructor(report: LayoutCompatibilityReport);
|
|
13
|
+
}
|
|
7
14
|
export declare function getStorageUpgradeErrors(original: StorageLayout, updated: StorageLayout, opts?: ValidationOptions): StorageOperation<StorageItem>[];
|
|
8
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAqB,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAA2B,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAA0B,MAAM,uBAAuB,CAAC;AAGlF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,aAAa,EACtB,sBAAsB,EAAE,OAAO,GAC9B,IAAI,CAAC;AAER,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAChC,IAAI,CAAC;AAmBR,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAChC,yBAAyB,CAgB3B;AAED,qBAAa,oBAAqB,SAAQ,aAAa;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB;gBAAjC,MAAM,EAAE,yBAAyB;CAGvD;AAGD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,aAAa,EACtB,IAAI,GAAE,iBAAsB,GAC3B,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAWjC"}
|
package/dist/storage/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.getStorageUpgradeErrors = exports.assertStorageUpgradeSafe = void 0;
|
|
13
|
+
exports.getStorageUpgradeErrors = exports.StorageUpgradeErrors = exports.getStorageUpgradeReport = exports.assertStorageUpgradeSafe = void 0;
|
|
14
14
|
__exportStar(require("./compat"), exports);
|
|
15
15
|
const error_1 = require("../error");
|
|
16
16
|
const layout_1 = require("./layout");
|
|
@@ -22,6 +22,13 @@ function assertStorageUpgradeSafe(original, updated, opts = false) {
|
|
|
22
22
|
const unsafeAllowCustomTypes = opts;
|
|
23
23
|
opts = (0, overrides_1.withValidationDefaults)({ unsafeAllowCustomTypes });
|
|
24
24
|
}
|
|
25
|
+
const report = getStorageUpgradeReport(original, updated, opts);
|
|
26
|
+
if (!report.pass) {
|
|
27
|
+
throw new StorageUpgradeErrors(report);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.assertStorageUpgradeSafe = assertStorageUpgradeSafe;
|
|
31
|
+
function getStorageUpgradeReport(original, updated, opts) {
|
|
25
32
|
const originalDetailed = (0, layout_1.getDetailedLayout)(original);
|
|
26
33
|
const updatedDetailed = (0, layout_1.getDetailedLayout)(updated);
|
|
27
34
|
const comparator = new compare_1.StorageLayoutComparator(opts.unsafeAllowCustomTypes, opts.unsafeAllowRenames);
|
|
@@ -35,17 +42,16 @@ function assertStorageUpgradeSafe(original, updated, opts = false) {
|
|
|
35
42
|
else if (opts.unsafeAllowCustomTypes) {
|
|
36
43
|
(0, log_1.logNote)(`\`unsafeAllowCustomTypes\` is no longer necessary. Structs are enums are automatically checked.\n`);
|
|
37
44
|
}
|
|
38
|
-
|
|
39
|
-
throw new StorageUpgradeErrors(report);
|
|
40
|
-
}
|
|
45
|
+
return report;
|
|
41
46
|
}
|
|
42
|
-
exports.
|
|
47
|
+
exports.getStorageUpgradeReport = getStorageUpgradeReport;
|
|
43
48
|
class StorageUpgradeErrors extends error_1.UpgradesError {
|
|
44
49
|
constructor(report) {
|
|
45
50
|
super(`New storage layout is incompatible`, () => report.explain());
|
|
46
51
|
this.report = report;
|
|
47
52
|
}
|
|
48
53
|
}
|
|
54
|
+
exports.StorageUpgradeErrors = StorageUpgradeErrors;
|
|
49
55
|
// Kept for backwards compatibility and to avoid rewriting tests
|
|
50
56
|
function getStorageUpgradeErrors(original, updated, opts = {}) {
|
|
51
57
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAyB;AAEzB,oCAAyC;AACzC,qCAA4D;AAC5D,uCAAmF;AAEnF,qDAAkF;AAClF,sCAAmD;AAcnD,SAAgB,wBAAwB,CACtC,QAAuB,EACvB,OAAsB,EACtB,OAA8C,KAAK;IAEnD,IAAI,OAAO,IAAI,KAAK,SAAS,EAAE;QAC7B,MAAM,sBAAsB,GA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CAAC;AACZ,CAAC;AAfD,0DAeC"}
|
package/dist/storage/report.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { StorageOperation, StorageItem } from './compare';
|
|
2
2
|
export declare class LayoutCompatibilityReport {
|
|
3
3
|
readonly ops: StorageOperation<StorageItem>[];
|
|
4
|
-
readonly pass: boolean;
|
|
5
4
|
constructor(ops: StorageOperation<StorageItem>[]);
|
|
6
|
-
|
|
5
|
+
get ok(): boolean;
|
|
6
|
+
get pass(): boolean;
|
|
7
|
+
explain(color?: boolean): string;
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=report.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/storage/report.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAA2C,MAAM,WAAW,CAAC;AAKxG,qBAAa,yBAAyB;
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/storage/report.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAA2C,MAAM,WAAW,CAAC;AAKxG,qBAAa,yBAAyB;IACxB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC,WAAW,CAAC,EAAE;gBAApC,GAAG,EAAE,gBAAgB,CAAC,WAAW,CAAC,EAAE;IAEzD,IAAI,EAAE,IAAI,OAAO,CAEhB;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,OAAO,CAAC,KAAK,UAAO,GAAG,MAAM;CAa9B"}
|
package/dist/storage/report.js
CHANGED
|
@@ -11,13 +11,19 @@ const assert_1 = require("../utils/assert");
|
|
|
11
11
|
class LayoutCompatibilityReport {
|
|
12
12
|
constructor(ops) {
|
|
13
13
|
this.ops = ops;
|
|
14
|
-
this.pass = ops.length === 0;
|
|
15
14
|
}
|
|
16
|
-
|
|
15
|
+
get ok() {
|
|
16
|
+
return this.pass;
|
|
17
|
+
}
|
|
18
|
+
get pass() {
|
|
19
|
+
return this.ops.length === 0;
|
|
20
|
+
}
|
|
21
|
+
explain(color = true) {
|
|
22
|
+
const chalk = new chalk_1.default.Instance({ level: color && chalk_1.default.supportsColor ? chalk_1.default.supportsColor.level : 0 });
|
|
17
23
|
const res = [];
|
|
18
24
|
for (const op of this.ops) {
|
|
19
25
|
const src = 'updated' in op ? op.updated.src : op.original.contract;
|
|
20
|
-
res.push(
|
|
26
|
+
res.push(chalk.bold(src) + ':' + (0, indent_1.indent)(explainStorageOperation(op, { kind: 'layout', allowAppend: true }), 2, 1));
|
|
21
27
|
}
|
|
22
28
|
return res.join('\n\n');
|
|
23
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/storage/report.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/storage/report.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA2B;AAK3B,8CAAwD;AACxD,4CAAyC;AACzC,4CAAyC;AAEzC,MAAa,yBAAyB;IACpC,YAAqB,GAAoC;QAApC,QAAG,GAAH,GAAG,CAAiC;IAAG,CAAC;IAE7D,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,CAAC,KAAK,GAAG,IAAI;QAClB,MAAM,KAAK,GAAG,IAAI,eAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,IAAI,eAAM,CAAC,aAAa,CAAC,CAAC,CAAC,eAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC7G,MAAM,GAAG,GAAG,EAAE,CAAC;QAEf,KAAK,MAAM,EAAE,IAAI,IAA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,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;IAExC,IAAI,aAAa,KAAK,YAAY,EAAE;QAClC,OAAO,MAAM,YAAY,EAAE,CAAC;KAC7B;SAAM;QACL,OAAO,QAAQ,aAAa,OAAO,YAAY,EAAE,CAAC;KACnD;AACH,CAAC;AAED,SAAS,KAAK,CAAC,QAA2B;IACxC,OAAO,GAAG,GAAG,QAAQ,CAAC,KAAK,GAAG,GAAG,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EthereumProvider, UpgradesError } from '.';
|
|
2
|
+
export declare class BeaconProxyUnsupportedError extends UpgradesError {
|
|
3
|
+
constructor();
|
|
4
|
+
}
|
|
5
|
+
export declare class DeployBeaconProxyKindError extends UpgradesError {
|
|
6
|
+
constructor(kind: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class DeployBeaconProxyUnsupportedError extends UpgradesError {
|
|
9
|
+
constructor(beaconAddress: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class DeployBeaconProxyImplUnknownError extends UpgradesError {
|
|
12
|
+
constructor(implAddress: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class LoadProxyUnsupportedError extends UpgradesError {
|
|
15
|
+
constructor(proxyAddress: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class PrepareUpgradeUnsupportedError extends UpgradesError {
|
|
18
|
+
constructor(proxyOrBeaconAddress: string);
|
|
19
|
+
}
|
|
20
|
+
export declare function assertNotProxy(provider: EthereumProvider, address: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=usage-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-error.d.ts","sourceRoot":"","sources":["../src/usage-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA6D,aAAa,EAAE,MAAM,GAAG,CAAC;AAE/G,qBAAa,2BAA4B,SAAQ,aAAa;;CAO7D;AAED,qBAAa,0BAA2B,SAAQ,aAAa;gBAC/C,IAAI,EAAE,MAAM;CAMzB;AAED,qBAAa,iCAAkC,SAAQ,aAAa;gBACtD,aAAa,EAAE,MAAM;CAGlC;AAED,qBAAa,iCAAkC,SAAQ,aAAa;gBACtD,WAAW,EAAE,MAAM;CAMhC;AAED,qBAAa,yBAA0B,SAAQ,aAAa;gBAC9C,YAAY,EAAE,MAAM;CAMjC;AAED,qBAAa,8BAA+B,SAAQ,aAAa;gBACnD,oBAAoB,EAAE,MAAM;CAMzC;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,iBAc/E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertNotProxy = exports.PrepareUpgradeUnsupportedError = exports.LoadProxyUnsupportedError = exports.DeployBeaconProxyImplUnknownError = exports.DeployBeaconProxyUnsupportedError = exports.DeployBeaconProxyKindError = exports.BeaconProxyUnsupportedError = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class BeaconProxyUnsupportedError extends _1.UpgradesError {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('Beacon proxies are not supported with the current function.', () => 'Use deployBeacon(), deployBeaconProxy(), or upgradeBeacon() instead.');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.BeaconProxyUnsupportedError = BeaconProxyUnsupportedError;
|
|
11
|
+
class DeployBeaconProxyKindError extends _1.UpgradesError {
|
|
12
|
+
constructor(kind) {
|
|
13
|
+
super(`Unsupported proxy kind '${kind}'`, () => `deployBeaconProxy() is only supported with proxy kind undefined or 'beacon'`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.DeployBeaconProxyKindError = DeployBeaconProxyKindError;
|
|
17
|
+
class DeployBeaconProxyUnsupportedError extends _1.UpgradesError {
|
|
18
|
+
constructor(beaconAddress) {
|
|
19
|
+
super(`Contract at ${beaconAddress} doesn't look like a beacon`, () => 'Deploy a beacon using deployBeacon().');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.DeployBeaconProxyUnsupportedError = DeployBeaconProxyUnsupportedError;
|
|
23
|
+
class DeployBeaconProxyImplUnknownError extends _1.UpgradesError {
|
|
24
|
+
constructor(implAddress) {
|
|
25
|
+
super(`Beacon's current implementation at ${implAddress} is unknown`, () => `Call deployBeaconProxy() with the implementation option providing the beacon's current implementation.`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.DeployBeaconProxyImplUnknownError = DeployBeaconProxyImplUnknownError;
|
|
29
|
+
class LoadProxyUnsupportedError extends _1.UpgradesError {
|
|
30
|
+
constructor(proxyAddress) {
|
|
31
|
+
super(`Contract at ${proxyAddress} doesn't look like a supported proxy`, () => 'Only transparent, UUPS, or beacon proxies can be loaded with the loadProxy() function.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.LoadProxyUnsupportedError = LoadProxyUnsupportedError;
|
|
35
|
+
class PrepareUpgradeUnsupportedError extends _1.UpgradesError {
|
|
36
|
+
constructor(proxyOrBeaconAddress) {
|
|
37
|
+
super(`Contract at address ${proxyOrBeaconAddress} doesn't look like a supported proxy or beacon`, () => `Only transparent, UUPS, or beacon proxies or beacons can be used with the prepareUpgrade() function.`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.PrepareUpgradeUnsupportedError = PrepareUpgradeUnsupportedError;
|
|
41
|
+
async function assertNotProxy(provider, address) {
|
|
42
|
+
if (await (0, _1.isTransparentOrUUPSProxy)(provider, address)) {
|
|
43
|
+
throw new _1.UpgradesError('Address is a transparent or UUPS proxy which cannot be upgraded using upgradeBeacon().', () => 'Use upgradeProxy() instead.');
|
|
44
|
+
}
|
|
45
|
+
else if (await (0, _1.isBeaconProxy)(provider, address)) {
|
|
46
|
+
const beaconAddress = await (0, _1.getBeaconAddress)(provider, address);
|
|
47
|
+
throw new _1.UpgradesError('Address is a beacon proxy which cannot be upgraded directly.', () => `upgradeBeacon() must be called with a beacon address, not a beacon proxy address. Call upgradeBeacon() on the beacon address ${beaconAddress} instead.`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.assertNotProxy = assertNotProxy;
|
|
51
|
+
//# sourceMappingURL=usage-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage-error.js","sourceRoot":"","sources":["../src/usage-error.ts"],"names":[],"mappings":";;;AAAA,wBAA+G;AAE/G,MAAa,2BAA4B,SAAQ,gBAAa;IAC5D;QACE,KAAK,CACH,6DAA6D,EAC7D,GAAG,EAAE,CAAC,sEAAsE,CAC7E,CAAC;IACJ,CAAC;CACF;AAPD,kEAOC;AAED,MAAa,0BAA2B,SAAQ,gBAAa;IAC3D,YAAY,IAAY;QACtB,KAAK,CACH,2BAA2B,IAAI,GAAG,EAClC,GAAG,EAAE,CAAC,6EAA6E,CACpF,CAAC;IACJ,CAAC;CACF;AAPD,gEAOC;AAED,MAAa,iCAAkC,SAAQ,gBAAa;IAClE,YAAY,aAAqB;QAC/B,KAAK,CAAC,eAAe,aAAa,6BAA6B,EAAE,GAAG,EAAE,CAAC,uCAAuC,CAAC,CAAC;IAClH,CAAC;CACF;AAJD,8EAIC;AAED,MAAa,iCAAkC,SAAQ,gBAAa;IAClE,YAAY,WAAmB;QAC7B,KAAK,CACH,sCAAsC,WAAW,aAAa,EAC9D,GAAG,EAAE,CAAC,wGAAwG,CAC/G,CAAC;IACJ,CAAC;CACF;AAPD,8EAOC;AAED,MAAa,yBAA0B,SAAQ,gBAAa;IAC1D,YAAY,YAAoB;QAC9B,KAAK,CACH,eAAe,YAAY,sCAAsC,EACjE,GAAG,EAAE,CAAC,wFAAwF,CAC/F,CAAC;IACJ,CAAC;CACF;AAPD,8DAOC;AAED,MAAa,8BAA+B,SAAQ,gBAAa;IAC/D,YAAY,oBAA4B;QACtC,KAAK,CACH,uBAAuB,oBAAoB,gDAAgD,EAC3F,GAAG,EAAE,CAAC,sGAAsG,CAC7G,CAAC;IACJ,CAAC;CACF;AAPD,wEAOC;AAEM,KAAK,UAAU,cAAc,CAAC,QAA0B,EAAE,OAAe;IAC9E,IAAI,MAAM,IAAA,2BAAwB,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;QACrD,MAAM,IAAI,gBAAa,CACrB,wFAAwF,EACxF,GAAG,EAAE,CAAC,6BAA6B,CACpC,CAAC;KACH;SAAM,IAAI,MAAM,IAAA,gBAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;QACjD,MAAM,aAAa,GAAG,MAAM,IAAA,mBAAgB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChE,MAAM,IAAI,gBAAa,CACrB,8DAA8D,EAC9D,GAAG,EAAE,CACH,gIAAgI,aAAa,WAAW,CAC3J,CAAC;KACH;AACH,CAAC;AAdD,wCAcC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses an address from a hex string which may come from storage or a returned address via eth_call.
|
|
3
|
+
*
|
|
4
|
+
* @param addressString The address hex string.
|
|
5
|
+
* @returns The parsed checksum address, or undefined if the input string is not an address.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseAddress(addressString: string): string | undefined;
|
|
8
|
+
//# sourceMappingURL=address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/utils/address.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOtE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseAddress = void 0;
|
|
4
|
+
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
5
|
+
/**
|
|
6
|
+
* Parses an address from a hex string which may come from storage or a returned address via eth_call.
|
|
7
|
+
*
|
|
8
|
+
* @param addressString The address hex string.
|
|
9
|
+
* @returns The parsed checksum address, or undefined if the input string is not an address.
|
|
10
|
+
*/
|
|
11
|
+
function parseAddress(addressString) {
|
|
12
|
+
const buf = Buffer.from(addressString.replace(/^0x/, ''), 'hex');
|
|
13
|
+
if (!buf.slice(0, 12).equals(Buffer.alloc(12, 0))) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const address = '0x' + buf.toString('hex', 12, 32); // grab the last 20 bytes
|
|
17
|
+
return (0, ethereumjs_util_1.toChecksumAddress)(address);
|
|
18
|
+
}
|
|
19
|
+
exports.parseAddress = parseAddress;
|
|
20
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/utils/address.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAEpD;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,aAAqB;IAChD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACjE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;QACjD,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,yBAAyB;IAC7E,OAAO,IAAA,mCAAiB,EAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAPD,oCAOC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function makeNonEnumerable<O
|
|
1
|
+
export declare function makeNonEnumerable<O>(obj: O, key: keyof O): void;
|
|
2
2
|
//# sourceMappingURL=make-non-enumerable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-non-enumerable.d.ts","sourceRoot":"","sources":["../../src/utils/make-non-enumerable.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"make-non-enumerable.d.ts","sourceRoot":"","sources":["../../src/utils/make-non-enumerable.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,CAE/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-non-enumerable.js","sourceRoot":"","sources":["../../src/utils/make-non-enumerable.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"make-non-enumerable.js","sourceRoot":"","sources":["../../src/utils/make-non-enumerable.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAAI,GAAM,EAAE,GAAY;IACvD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AACzD,CAAC;AAFD,8CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/validate/error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/validate/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,qBAAa,gBAAiB,SAAQ,aAAa;IACf,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE;gBAAxD,YAAY,EAAE,MAAM,EAAW,MAAM,EAAE,eAAe,EAAE;CAKrE"}
|
package/dist/validate/error.js
CHANGED
|
@@ -1,76 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ValidationErrors = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
4
|
const error_1 = require("../error");
|
|
5
|
+
const report_1 = require("./report");
|
|
9
6
|
class ValidationErrors extends error_1.UpgradesError {
|
|
10
7
|
constructor(contractName, errors) {
|
|
11
|
-
super(`Contract \`${contractName}\` is not upgrade safe`, () =>
|
|
12
|
-
return errors.map(describeError).join('\n\n');
|
|
13
|
-
});
|
|
8
|
+
super(`Contract \`${contractName}\` is not upgrade safe`, () => new report_1.UpgradeableContractErrorReport(errors).explain());
|
|
14
9
|
this.errors = errors;
|
|
15
10
|
}
|
|
16
11
|
}
|
|
17
12
|
exports.ValidationErrors = ValidationErrors;
|
|
18
|
-
const errorInfo = {
|
|
19
|
-
constructor: {
|
|
20
|
-
msg: e => `Contract \`${e.contract}\` has a constructor`,
|
|
21
|
-
hint: () => 'Define an initializer instead',
|
|
22
|
-
link: 'https://zpl.in/upgrades/error-001',
|
|
23
|
-
},
|
|
24
|
-
delegatecall: {
|
|
25
|
-
msg: () => `Use of delegatecall is not allowed`,
|
|
26
|
-
link: 'https://zpl.in/upgrades/error-002',
|
|
27
|
-
},
|
|
28
|
-
selfdestruct: {
|
|
29
|
-
msg: () => `Use of selfdestruct is not allowed`,
|
|
30
|
-
link: 'https://zpl.in/upgrades/error-003',
|
|
31
|
-
},
|
|
32
|
-
'state-variable-assignment': {
|
|
33
|
-
msg: e => `Variable \`${e.name}\` is assigned an initial value`,
|
|
34
|
-
hint: () => 'Move the assignment to the initializer',
|
|
35
|
-
link: 'https://zpl.in/upgrades/error-004',
|
|
36
|
-
},
|
|
37
|
-
'state-variable-immutable': {
|
|
38
|
-
msg: e => `Variable \`${e.name}\` is immutable`,
|
|
39
|
-
hint: () => `Use a constant or mutable variable instead`,
|
|
40
|
-
link: 'https://zpl.in/upgrades/error-005',
|
|
41
|
-
},
|
|
42
|
-
'external-library-linking': {
|
|
43
|
-
msg: e => `Linking external libraries like \`${e.name}\` is not yet supported`,
|
|
44
|
-
hint: () => `Use libraries with internal functions only, or skip this check with the \`unsafeAllowLinkedLibraries\` flag \n` +
|
|
45
|
-
` if you have manually checked that the libraries are upgrade safe`,
|
|
46
|
-
link: 'https://zpl.in/upgrades/error-006',
|
|
47
|
-
},
|
|
48
|
-
'struct-definition': {
|
|
49
|
-
msg: e => `Structs like \`${e.name}\` are supported in the latest version of the plugin`,
|
|
50
|
-
hint: () => `Update your dependency and run again`,
|
|
51
|
-
},
|
|
52
|
-
'enum-definition': {
|
|
53
|
-
msg: e => `Enums like \`${e.name}\` are supported in the latest version of the plugin`,
|
|
54
|
-
hint: () => `Update your dependency and run again`,
|
|
55
|
-
},
|
|
56
|
-
'missing-public-upgradeto': {
|
|
57
|
-
msg: () => `Implementation is missing a public \`upgradeTo(address)\` function`,
|
|
58
|
-
hint: () => `Inherit UUPSUpgradeable to include this function in your contract\n` +
|
|
59
|
-
` @openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol`,
|
|
60
|
-
link: 'https://zpl.in/upgrades/error-008',
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
function describeError(e) {
|
|
64
|
-
var _a;
|
|
65
|
-
const info = errorInfo[e.kind];
|
|
66
|
-
const log = [chalk_1.default.bold(e.src) + ': ' + info.msg(e)];
|
|
67
|
-
const hint = (_a = info.hint) === null || _a === void 0 ? void 0 : _a.call(info, e);
|
|
68
|
-
if (hint) {
|
|
69
|
-
log.push(hint);
|
|
70
|
-
}
|
|
71
|
-
if (info.link) {
|
|
72
|
-
log.push(chalk_1.default.dim(info.link));
|
|
73
|
-
}
|
|
74
|
-
return log.join('\n ');
|
|
75
|
-
}
|
|
76
13
|
//# sourceMappingURL=error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/validate/error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/validate/error.ts"],"names":[],"mappings":";;;AACA,oCAAyC;AACzC,qCAA0D;AAE1D,MAAa,gBAAiB,SAAQ,qBAAa;IACjD,YAAY,YAAoB,EAAW,MAAyB;QAClE,KAAK,CAAC,cAAc,YAAY,wBAAwB,EAAE,GAAG,EAAE,CAC7D,IAAI,uCAA8B,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CACrD,CAAC;QAHuC,WAAM,GAAN,MAAM,CAAmB;IAIpE,CAAC;CACF;AAND,4CAMC"}
|
package/dist/validate/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { ValidationOptions, withValidationDefaults } from './overrides';
|
|
|
3
3
|
export { ValidationErrors } from './error';
|
|
4
4
|
export { RunValidation, ValidationLog, Validation, ValidationResult } from './compat';
|
|
5
5
|
export { ValidationData, ValidationDataCurrent, isCurrentValidationData, concatRunData } from './data';
|
|
6
|
-
export { getContractVersion, getContractNameAndRunValidation, getStorageLayout, assertUpgradeSafe, getUnlinkedBytecode, getErrors, isUpgradeSafe, } from './query';
|
|
6
|
+
export { getContractVersion, getContractNameAndRunValidation, getStorageLayout, assertUpgradeSafe, getUnlinkedBytecode, getErrors, isUpgradeSafe, inferProxyKind, } from './query';
|
|
7
|
+
export { UpgradeableContractErrorReport } from './report';
|
|
7
8
|
export { silenceWarnings } from '../utils/log';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvG,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvG,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/validate/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.silenceWarnings = exports.isUpgradeSafe = exports.getErrors = exports.getUnlinkedBytecode = exports.assertUpgradeSafe = exports.getStorageLayout = exports.getContractNameAndRunValidation = exports.getContractVersion = exports.concatRunData = exports.isCurrentValidationData = exports.ValidationErrors = exports.withValidationDefaults = exports.validate = void 0;
|
|
3
|
+
exports.silenceWarnings = exports.UpgradeableContractErrorReport = exports.inferProxyKind = exports.isUpgradeSafe = exports.getErrors = exports.getUnlinkedBytecode = exports.assertUpgradeSafe = exports.getStorageLayout = exports.getContractNameAndRunValidation = exports.getContractVersion = exports.concatRunData = exports.isCurrentValidationData = exports.ValidationErrors = exports.withValidationDefaults = exports.validate = void 0;
|
|
4
4
|
var run_1 = require("./run");
|
|
5
5
|
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return run_1.validate; } });
|
|
6
6
|
var overrides_1 = require("./overrides");
|
|
@@ -18,6 +18,9 @@ Object.defineProperty(exports, "assertUpgradeSafe", { enumerable: true, get: fun
|
|
|
18
18
|
Object.defineProperty(exports, "getUnlinkedBytecode", { enumerable: true, get: function () { return query_1.getUnlinkedBytecode; } });
|
|
19
19
|
Object.defineProperty(exports, "getErrors", { enumerable: true, get: function () { return query_1.getErrors; } });
|
|
20
20
|
Object.defineProperty(exports, "isUpgradeSafe", { enumerable: true, get: function () { return query_1.isUpgradeSafe; } });
|
|
21
|
+
Object.defineProperty(exports, "inferProxyKind", { enumerable: true, get: function () { return query_1.inferProxyKind; } });
|
|
22
|
+
var report_1 = require("./report");
|
|
23
|
+
Object.defineProperty(exports, "UpgradeableContractErrorReport", { enumerable: true, get: function () { return report_1.UpgradeableContractErrorReport; } });
|
|
21
24
|
// Backwards compatibility
|
|
22
25
|
var log_1 = require("../utils/log");
|
|
23
26
|
Object.defineProperty(exports, "silenceWarnings", { enumerable: true, get: function () { return log_1.silenceWarnings; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":";;;AAAA,6BAAwE;AAA/D,+FAAA,QAAQ,OAAA;AACjB,yCAAwE;AAA5C,mHAAA,sBAAsB,OAAA;AAClD,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA;AAEzB,+BAAuG;AAAvD,+GAAA,uBAAuB,OAAA;AAAE,qGAAA,aAAa,OAAA;AACtF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":";;;AAAA,6BAAwE;AAA/D,+FAAA,QAAQ,OAAA;AACjB,yCAAwE;AAA5C,mHAAA,sBAAsB,OAAA;AAClD,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA;AAEzB,+BAAuG;AAAvD,+GAAA,uBAAuB,OAAA;AAAE,qGAAA,aAAa,OAAA;AACtF,iCASiB;AARf,2GAAA,kBAAkB,OAAA;AAClB,wHAAA,+BAA+B,OAAA;AAC/B,yGAAA,gBAAgB,OAAA;AAChB,0GAAA,iBAAiB,OAAA;AACjB,4GAAA,mBAAmB,OAAA;AACnB,kGAAA,SAAS,OAAA;AACT,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AAEhB,mCAA0D;AAAjD,wHAAA,8BAA8B,OAAA;AAEvC,0BAA0B;AAC1B,oCAA+C;AAAtC,sGAAA,eAAe,OAAA"}
|
|
@@ -50,7 +50,7 @@ function withValidationDefaults(opts) {
|
|
|
50
50
|
exports.withValidationDefaults = withValidationDefaults;
|
|
51
51
|
function processExceptions(contractName, errors, opts) {
|
|
52
52
|
const { unsafeAllow } = withValidationDefaults(opts);
|
|
53
|
-
if (opts.kind === 'transparent') {
|
|
53
|
+
if (opts.kind === 'transparent' || opts.kind === 'beacon') {
|
|
54
54
|
errors = errors.filter(error => error.kind !== 'missing-public-upgradeto');
|
|
55
55
|
}
|
|
56
56
|
for (const [errorType, errorDescription] of Object.entries(exports.ValidationErrorUnsafeMessages)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/validate/overrides.ts"],"names":[],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eAAe,GAAG,eAAe,IAAI,WAAW,CAAC;gBACjD,OAAO,CAAC,WAAW,CAAC;YACtB,CAAC,CAAC,CAAC;YAEH,IAAI,eAAe,IAAI,gBAAgB,EAAE;gBACvC,IAAA,gBAAU,EAAC,oCAAoC,YAAY,EAAE,EAAE,gBAAgB,CAAC,CAAC;aAClF;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA5BD,8CA4BC"}
|
package/dist/validate/query.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ValidationRunData, ValidationError } from './run';
|
|
|
3
3
|
import { StorageLayout } from '../storage/layout';
|
|
4
4
|
import { ValidationOptions } from './overrides';
|
|
5
5
|
import { ValidationData } from './data';
|
|
6
|
+
import { ProxyDeployment } from '../manifest';
|
|
6
7
|
export declare function assertUpgradeSafe(data: ValidationData, version: Version, opts: ValidationOptions): void;
|
|
7
8
|
export declare function getContractVersion(runData: ValidationRunData, contractName: string): Version;
|
|
8
9
|
export declare function getContractNameAndRunValidation(data: ValidationData, version: Version): [string, ValidationRunData];
|
|
@@ -10,6 +11,7 @@ export declare function getStorageLayout(data: ValidationData, version: Version)
|
|
|
10
11
|
export declare function unfoldStorageLayout(runData: ValidationRunData, contractName: string): StorageLayout;
|
|
11
12
|
export declare function findVersionWithoutMetadataMatches(data: ValidationData, versionWithoutMetadata: string): Generator<[string, ValidationRunData]>;
|
|
12
13
|
export declare function getUnlinkedBytecode(data: ValidationData, bytecode: string): string;
|
|
13
|
-
export declare function getErrors(data: ValidationData, version: Version): ValidationError[];
|
|
14
|
+
export declare function getErrors(data: ValidationData, version: Version, opts?: ValidationOptions): ValidationError[];
|
|
14
15
|
export declare function isUpgradeSafe(data: ValidationData, version: Version): boolean;
|
|
16
|
+
export declare function inferProxyKind(data: ValidationData, version: Version): ProxyDeployment['kind'];
|
|
15
17
|
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources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