@openzeppelin/upgrades-core 1.17.0 → 1.19.1
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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/levenshtein.d.ts +4 -1
- package/dist/levenshtein.d.ts.map +1 -1
- package/dist/levenshtein.js +1 -1
- package/dist/levenshtein.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +2 -0
- package/dist/provider.js.map +1 -1
- package/dist/storage/compare.d.ts +21 -3
- package/dist/storage/compare.d.ts.map +1 -1
- package/dist/storage/compare.js +80 -17
- package/dist/storage/compare.js.map +1 -1
- package/dist/storage/gap.d.ts +18 -0
- package/dist/storage/gap.d.ts.map +1 -0
- package/dist/storage/gap.js +29 -0
- package/dist/storage/gap.js.map +1 -0
- package/dist/storage/report-gap.test.d.ts +2 -0
- package/dist/storage/report-gap.test.d.ts.map +1 -0
- package/dist/storage/report-gap.test.js +106 -0
- package/dist/storage/report-gap.test.js.map +1 -0
- package/dist/storage/report-rename-retype.test.js +24 -0
- package/dist/storage/report-rename-retype.test.js.map +1 -1
- package/dist/storage/report.d.ts +1 -1
- package/dist/storage/report.d.ts.map +1 -1
- package/dist/storage/report.js +59 -10
- package/dist/storage/report.js.map +1 -1
- package/dist/storage.test.js +421 -2
- package/dist/storage.test.js.map +1 -1
- package/dist/usage-error.d.ts +9 -0
- package/dist/usage-error.d.ts.map +1 -1
- package/dist/usage-error.js +16 -1
- package/dist/usage-error.js.map +1 -1
- package/dist/validate/data.js +25 -5
- package/dist/validate/data.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/overrides.d.ts +34 -3
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +2 -0
- package/src/levenshtein.ts +4 -2
- package/src/provider.ts +2 -0
- package/src/storage/compare.ts +88 -18
- package/src/storage/gap.ts +26 -0
- package/src/storage/report-gap.test.ts +119 -0
- package/src/storage/report-gap.test.ts.md +59 -0
- package/src/storage/report-gap.test.ts.snap +0 -0
- package/src/storage/report-rename-retype.test.ts +27 -0
- package/src/storage/report-rename-retype.test.ts.md +7 -0
- package/src/storage/report-rename-retype.test.ts.snap +0 -0
- package/src/storage/report.test.ts.md +1 -4
- package/src/storage/report.test.ts.snap +0 -0
- package/src/storage/report.ts +83 -12
- package/src/storage.test.ts +466 -2
- package/src/storage.test.ts.snap +0 -0
- package/src/usage-error.ts +22 -0
- package/src/validate/data.ts +1 -1
- package/src/validate/index.ts +1 -1
- package/src/validate/overrides.ts +39 -3
package/src/usage-error.ts
CHANGED
|
@@ -51,6 +51,9 @@ export class PrepareUpgradeUnsupportedError extends UpgradesError {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated No longer used since forceImport() supports importing any contract.
|
|
56
|
+
*/
|
|
54
57
|
export class ForceImportUnsupportedError extends UpgradesError {
|
|
55
58
|
constructor(proxyOrBeaconAddress: string) {
|
|
56
59
|
super(
|
|
@@ -60,6 +63,25 @@ export class ForceImportUnsupportedError extends UpgradesError {
|
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
|
|
66
|
+
export class NoContractImportError extends UpgradesError {
|
|
67
|
+
constructor(address: string) {
|
|
68
|
+
super(
|
|
69
|
+
`No contract at address ${address}`,
|
|
70
|
+
() => `The address could not be imported because no contract was found at the address.`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class ValidateUpdateRequiresKindError extends UpgradesError {
|
|
76
|
+
constructor() {
|
|
77
|
+
super(
|
|
78
|
+
'The `kind` option must be provided',
|
|
79
|
+
() =>
|
|
80
|
+
'When validating an upgrade from an implementation address, pass in the `kind` option for the kind of proxy that you are using.',
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
63
85
|
export async function assertNotProxy(provider: EthereumProvider, address: string) {
|
|
64
86
|
if (await isTransparentOrUUPSProxy(provider, address)) {
|
|
65
87
|
throw new UpgradesError(
|
package/src/validate/data.ts
CHANGED
package/src/validate/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { validate, ValidationRunData, ContractValidation } from './run';
|
|
2
|
-
export { ValidationOptions, withValidationDefaults } from './overrides';
|
|
2
|
+
export { ProxyKindOption, StandaloneValidationOptions, 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';
|
|
@@ -5,13 +5,49 @@ import { logWarning } from '../utils/log';
|
|
|
5
5
|
// Backwards compatibility
|
|
6
6
|
export { silenceWarnings } from '../utils/log';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Option for the kind of proxy that will be used.
|
|
10
|
+
*/
|
|
11
|
+
export interface ProxyKindOption {
|
|
12
|
+
/**
|
|
13
|
+
* The kind of proxy to deploy, upgrade or import, or the kind of proxy that the implementation will be used with. Defaults to `"transparent"`.
|
|
14
|
+
*/
|
|
15
|
+
kind?: ProxyDeployment['kind'];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Validation options in a standalone context (without storage layout comparisons with a previous implementation).
|
|
20
|
+
*/
|
|
21
|
+
export interface StandaloneValidationOptions extends ProxyKindOption {
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Equivalent to including "struct-definition" and "enum-definition" in unsafeAllow. No longer necessary.
|
|
24
|
+
*/
|
|
9
25
|
unsafeAllowCustomTypes?: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Equivalent to including `"external-library-linking"` in {@link unsafeAllow}.
|
|
29
|
+
*/
|
|
10
30
|
unsafeAllowLinkedLibraries?: boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Selectively disable one or more validation errors.
|
|
34
|
+
*/
|
|
35
|
+
unsafeAllow?: ValidationError['kind'][];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Validation options in the context of an upgrade (with storage layout comparisions with a previous implementation).
|
|
40
|
+
*/
|
|
41
|
+
export interface ValidationOptions extends StandaloneValidationOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Configure storage layout check to allow variable renaming.
|
|
44
|
+
*/
|
|
11
45
|
unsafeAllowRenames?: boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Upgrades the proxy or beacon without first checking for storage layout compatibility errors. This is a dangerous option meant to be used as a last resort.
|
|
49
|
+
*/
|
|
12
50
|
unsafeSkipStorageCheck?: boolean;
|
|
13
|
-
unsafeAllow?: ValidationError['kind'][];
|
|
14
|
-
kind?: ProxyDeployment['kind'];
|
|
15
51
|
}
|
|
16
52
|
|
|
17
53
|
export const ValidationErrorUnsafeMessages: Record<ValidationError['kind'], string[]> = {
|