@openzeppelin/upgrades-core 1.24.1 → 1.26.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/artifacts/build-info.json +21465 -0
- package/dist/deployment.d.ts +28 -4
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +106 -25
- package/dist/deployment.js.map +1 -1
- package/dist/deployment.test.js +116 -0
- package/dist/deployment.test.js.map +1 -1
- package/dist/impl-store.d.ts +27 -2
- package/dist/impl-store.d.ts.map +1 -1
- package/dist/impl-store.js +39 -8
- package/dist/impl-store.js.map +1 -1
- package/dist/impl-store.test.js +30 -0
- package/dist/impl-store.test.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +3 -3
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +1 -1
- package/dist/manifest.js.map +1 -1
- package/dist/manifest.test.js +1 -0
- package/dist/manifest.test.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +4 -0
- package/dist/provider.js.map +1 -1
- package/dist/usage-error.d.ts +6 -0
- package/dist/usage-error.d.ts.map +1 -1
- package/dist/usage-error.js +10 -1
- package/dist/usage-error.js.map +1 -1
- package/dist/validate/error.d.ts +3 -0
- package/dist/validate/error.d.ts.map +1 -1
- package/dist/validate/error.js +7 -1
- package/dist/validate/error.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 +2 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/query.js +1 -1
- package/dist/validate/query.js.map +1 -1
- package/package.json +3 -2
- package/src/deployment.test.ts +182 -1
- package/src/deployment.ts +134 -26
- package/src/impl-store.test.ts +52 -1
- package/src/impl-store.ts +69 -11
- package/src/index.ts +1 -0
- package/src/manifest.test.ts +1 -0
- package/src/manifest.ts +11 -8
- package/src/provider.ts +4 -0
- package/src/usage-error.ts +13 -0
- package/src/validate/error.ts +6 -0
- package/src/validate/index.ts +1 -1
- package/src/validate/query.ts +2 -2
package/src/manifest.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { EthereumProvider, getChainId, getHardhatMetadata, networkNames } from '
|
|
|
5
5
|
import lockfile from 'proper-lockfile';
|
|
6
6
|
import { compare as compareVersions } from 'compare-versions';
|
|
7
7
|
|
|
8
|
-
import type { Deployment } from './deployment';
|
|
8
|
+
import type { Deployment, RemoteDeploymentId } from './deployment';
|
|
9
9
|
import type { StorageLayout } from './storage';
|
|
10
10
|
import { pick } from './utils/pick';
|
|
11
11
|
import { mapValues } from './utils/map-values';
|
|
@@ -18,9 +18,9 @@ const currentManifestVersion = '3.2';
|
|
|
18
18
|
export interface ManifestData {
|
|
19
19
|
manifestVersion: string;
|
|
20
20
|
impls: {
|
|
21
|
-
[version in string]?: ImplDeployment;
|
|
21
|
+
[version in string]?: ImplDeployment & RemoteDeploymentId;
|
|
22
22
|
};
|
|
23
|
-
proxies: ProxyDeployment[];
|
|
23
|
+
proxies: (ProxyDeployment & RemoteDeploymentId)[];
|
|
24
24
|
admin?: Deployment;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -318,11 +318,14 @@ export function normalizeManifestData(input: ManifestData): ManifestData {
|
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
function normalizeDeployment<D extends Deployment>(input: D): Deployment;
|
|
322
|
-
function normalizeDeployment<D extends Deployment, K extends keyof D>(
|
|
323
|
-
|
|
321
|
+
function normalizeDeployment<D extends Deployment & RemoteDeploymentId>(input: D): Deployment & RemoteDeploymentId;
|
|
322
|
+
function normalizeDeployment<D extends Deployment & RemoteDeploymentId, K extends keyof D>(
|
|
323
|
+
input: D,
|
|
324
|
+
include: K[],
|
|
325
|
+
): Deployment & RemoteDeploymentId & Pick<D, K>;
|
|
326
|
+
function normalizeDeployment<D extends Deployment & RemoteDeploymentId, K extends keyof D>(
|
|
324
327
|
input: D,
|
|
325
328
|
include: K[] = [],
|
|
326
|
-
): Deployment & Pick<D, K> {
|
|
327
|
-
return pick(input, ['address', 'txHash', ...include]);
|
|
329
|
+
): Deployment & RemoteDeploymentId & Pick<D, K> {
|
|
330
|
+
return pick(input, ['address', 'txHash', 'remoteDeploymentId', ...include]);
|
|
328
331
|
}
|
package/src/provider.ts
CHANGED
|
@@ -127,10 +127,14 @@ export const networkNames: { [chainId in number]?: string } = Object.freeze({
|
|
|
127
127
|
137: 'polygon',
|
|
128
128
|
420: 'optimism-goerli',
|
|
129
129
|
80001: 'polygon-mumbai',
|
|
130
|
+
42161: 'arbitrum-one',
|
|
131
|
+
42170: 'arbitrum-nova',
|
|
132
|
+
421613: 'arbitrum-goerli',
|
|
130
133
|
43113: 'avalanche-fuji',
|
|
131
134
|
43114: 'avalanche',
|
|
132
135
|
42220: 'celo',
|
|
133
136
|
44787: 'celo-alfajores',
|
|
137
|
+
11155111: 'sepolia',
|
|
134
138
|
});
|
|
135
139
|
|
|
136
140
|
export async function isDevelopmentNetwork(provider: EthereumProvider): Promise<boolean> {
|
package/src/usage-error.ts
CHANGED
|
@@ -42,6 +42,9 @@ export class LoadProxyUnsupportedError extends UpgradesError {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated No longer used since prepareUpgrade() supports using an implementation contract as the reference address.
|
|
47
|
+
*/
|
|
45
48
|
export class PrepareUpgradeUnsupportedError extends UpgradesError {
|
|
46
49
|
constructor(proxyOrBeaconAddress: string) {
|
|
47
50
|
super(
|
|
@@ -82,6 +85,16 @@ export class ValidateUpdateRequiresKindError extends UpgradesError {
|
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
|
|
88
|
+
export class PrepareUpgradeRequiresKindError extends UpgradesError {
|
|
89
|
+
constructor() {
|
|
90
|
+
super(
|
|
91
|
+
'The `kind` option must be provided',
|
|
92
|
+
() =>
|
|
93
|
+
'When preparing an upgrade from an implementation address, pass in the `kind` option for the kind of proxy that you are using.',
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
export async function assertNotProxy(provider: EthereumProvider, address: string) {
|
|
86
99
|
if (await isTransparentOrUUPSProxy(provider, address)) {
|
|
87
100
|
throw new UpgradesError(
|
package/src/validate/error.ts
CHANGED
|
@@ -9,3 +9,9 @@ export class ValidationErrors extends UpgradesError {
|
|
|
9
9
|
);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
export class ContractSourceNotFoundError extends UpgradesError {
|
|
14
|
+
constructor() {
|
|
15
|
+
super('The requested contract was not found. Make sure the source code is available for compilation');
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/validate/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { validate, ValidationRunData, ContractValidation } from './run';
|
|
2
2
|
export { ProxyKindOption, StandaloneValidationOptions, ValidationOptions, withValidationDefaults } from './overrides';
|
|
3
|
-
export { ValidationErrors } from './error';
|
|
3
|
+
export { ValidationErrors, ContractSourceNotFoundError } from './error';
|
|
4
4
|
export { RunValidation, ValidationLog, Validation, ValidationResult } from './compat';
|
|
5
5
|
export { ValidationData, ValidationDataCurrent, isCurrentValidationData, concatRunData } from './data';
|
|
6
6
|
export {
|
package/src/validate/query.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ValidationRunData, ValidationError, isOpcodeError } from './run';
|
|
|
3
3
|
import { StorageLayout } from '../storage/layout';
|
|
4
4
|
import { unlinkBytecode } from '../link-refs';
|
|
5
5
|
import { ValidationOptions, processExceptions } from './overrides';
|
|
6
|
-
import { ValidationErrors } from './error';
|
|
6
|
+
import { ContractSourceNotFoundError, ValidationErrors } from './error';
|
|
7
7
|
import { ValidationData, normalizeValidationData } from './data';
|
|
8
8
|
import { ProxyDeployment } from '../manifest';
|
|
9
9
|
|
|
@@ -72,7 +72,7 @@ export function getContractNameAndRunValidation(data: ValidationData, version: V
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (fullContractName === undefined || runValidation === undefined) {
|
|
75
|
-
throw new
|
|
75
|
+
throw new ContractSourceNotFoundError();
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
return [fullContractName, runValidation];
|