@hyperlane-xyz/sdk 1.4.1 → 1.4.3-beta0
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/consts/agentStartBlocks.d.ts +3 -0
- package/dist/consts/agentStartBlocks.d.ts.map +1 -0
- package/dist/consts/agentStartBlocks.js +28 -0
- package/dist/consts/agentStartBlocks.js.map +1 -0
- package/dist/consts/bytecode.js +1 -1
- package/dist/consts/bytecode.js.map +1 -1
- package/dist/consts/chainMetadata.js +3 -3
- package/dist/consts/chains.d.ts +1 -1
- package/dist/consts/chains.d.ts.map +1 -1
- package/dist/consts/chains.js +2 -2
- package/dist/consts/chains.js.map +1 -1
- package/dist/consts/environments/index.d.ts +40 -2
- package/dist/consts/environments/index.d.ts.map +1 -1
- package/dist/consts/environments/index.js.map +1 -1
- package/dist/consts/environments/mainnet.json +27 -9
- package/dist/consts/environments/testnet.json +36 -18
- package/dist/contracts.d.ts +5 -5
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +12 -23
- package/dist/contracts.js.map +1 -1
- package/dist/core/CoreDeployer.hardhat-test.js +33 -42
- package/dist/core/CoreDeployer.hardhat-test.js.map +1 -1
- package/dist/core/HyperlaneCore.d.ts +1 -1
- package/dist/core/HyperlaneCore.d.ts.map +1 -1
- package/dist/core/HyperlaneCore.js +12 -25
- package/dist/core/HyperlaneCore.js.map +1 -1
- package/dist/core/HyperlaneCore.test.js +4 -13
- package/dist/core/HyperlaneCore.test.js.map +1 -1
- package/dist/core/HyperlaneCoreChecker.d.ts +0 -1
- package/dist/core/HyperlaneCoreChecker.d.ts.map +1 -1
- package/dist/core/HyperlaneCoreChecker.js +79 -137
- package/dist/core/HyperlaneCoreChecker.js.map +1 -1
- package/dist/core/HyperlaneCoreDeployer.d.ts +1 -2
- package/dist/core/HyperlaneCoreDeployer.d.ts.map +1 -1
- package/dist/core/HyperlaneCoreDeployer.js +45 -71
- package/dist/core/HyperlaneCoreDeployer.js.map +1 -1
- package/dist/core/TestCoreApp.js +35 -45
- package/dist/core/TestCoreApp.js.map +1 -1
- package/dist/core/TestCoreDeployer.js +14 -27
- package/dist/core/TestCoreDeployer.js.map +1 -1
- package/dist/core/contracts.d.ts +1 -1
- package/dist/core/contracts.d.ts.map +1 -1
- package/dist/core/events.d.ts +1 -1
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/testHyperlaneDeploy.hardhat-test.js +23 -32
- package/dist/core/testHyperlaneDeploy.hardhat-test.js.map +1 -1
- package/dist/core/types.d.ts +4 -4
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +2 -3
- package/dist/core/types.js.map +1 -1
- package/dist/deploy/HyperlaneAppChecker.d.ts +3 -1
- package/dist/deploy/HyperlaneAppChecker.d.ts.map +1 -1
- package/dist/deploy/HyperlaneAppChecker.js +105 -83
- package/dist/deploy/HyperlaneAppChecker.js.map +1 -1
- package/dist/deploy/HyperlaneDeployer.d.ts +5 -1
- package/dist/deploy/HyperlaneDeployer.d.ts.map +1 -1
- package/dist/deploy/HyperlaneDeployer.js +179 -183
- package/dist/deploy/HyperlaneDeployer.js.map +1 -1
- package/dist/deploy/proxy.d.ts +9 -0
- package/dist/deploy/proxy.d.ts.map +1 -1
- package/dist/deploy/proxy.js +11 -26
- package/dist/deploy/proxy.js.map +1 -1
- package/dist/deploy/types.d.ts +18 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js +3 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/deploy/verify/ContractVerifier.js +122 -131
- package/dist/deploy/verify/ContractVerifier.js.map +1 -1
- package/dist/deploy/verify/types.d.ts +3 -3
- package/dist/deploy/verify/types.d.ts.map +1 -1
- package/dist/gas/HyperlaneIgpChecker.d.ts +0 -4
- package/dist/gas/HyperlaneIgpChecker.d.ts.map +1 -1
- package/dist/gas/HyperlaneIgpChecker.js +101 -121
- package/dist/gas/HyperlaneIgpChecker.js.map +1 -1
- package/dist/gas/HyperlaneIgpDeployer.d.ts.map +1 -1
- package/dist/gas/HyperlaneIgpDeployer.js +74 -77
- package/dist/gas/HyperlaneIgpDeployer.js.map +1 -1
- package/dist/gas/contracts.d.ts +4 -3
- package/dist/gas/contracts.d.ts.map +1 -1
- package/dist/gas/contracts.js +2 -1
- package/dist/gas/contracts.js.map +1 -1
- package/dist/gas/token-prices.d.ts +5 -5
- package/dist/gas/token-prices.d.ts.map +1 -1
- package/dist/gas/token-prices.js +37 -54
- package/dist/gas/token-prices.js.map +1 -1
- package/dist/gas/token-prices.test.js +11 -20
- package/dist/gas/token-prices.test.js.map +1 -1
- package/dist/gas/types.d.ts +5 -2
- package/dist/gas/types.d.ts.map +1 -1
- package/dist/gas/types.js +2 -2
- package/dist/gas/types.js.map +1 -1
- package/dist/hook/HyperlaneHookDeployer.js +69 -88
- package/dist/hook/HyperlaneHookDeployer.js.map +1 -1
- package/dist/hook/contracts.d.ts +4 -4
- package/dist/hook/contracts.d.ts.map +1 -1
- package/dist/hook/contracts.js +5 -1
- package/dist/hook/contracts.js.map +1 -1
- package/dist/hook/types.d.ts +3 -3
- package/dist/hook/types.d.ts.map +1 -1
- package/dist/hook/types.js +1 -1
- package/dist/hook/types.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/ism/HyperlaneIsmFactory.d.ts +1 -1
- package/dist/ism/HyperlaneIsmFactory.d.ts.map +1 -1
- package/dist/ism/HyperlaneIsmFactory.hardhat-test.js +14 -23
- package/dist/ism/HyperlaneIsmFactory.hardhat-test.js.map +1 -1
- package/dist/ism/HyperlaneIsmFactory.js +215 -198
- package/dist/ism/HyperlaneIsmFactory.js.map +1 -1
- package/dist/ism/HyperlaneIsmFactoryDeployer.js +18 -34
- package/dist/ism/HyperlaneIsmFactoryDeployer.js.map +1 -1
- package/dist/ism/contracts.d.ts +1 -1
- package/dist/ism/contracts.d.ts.map +1 -1
- package/dist/ism/types.d.ts +5 -5
- package/dist/ism/types.d.ts.map +1 -1
- package/dist/ism/types.js +1 -1
- package/dist/ism/types.js.map +1 -1
- package/dist/metadata/agentConfig.d.ts +9 -4
- package/dist/metadata/agentConfig.d.ts.map +1 -1
- package/dist/metadata/agentConfig.js +26 -8
- package/dist/metadata/agentConfig.js.map +1 -1
- package/dist/metadata/agentConfig.test.d.ts +2 -0
- package/dist/metadata/agentConfig.test.d.ts.map +1 -0
- package/dist/metadata/agentConfig.test.js +33 -0
- package/dist/metadata/agentConfig.test.js.map +1 -0
- package/dist/metadata/chainMetadata.test.js +27 -9
- package/dist/metadata/chainMetadata.test.js.map +1 -1
- package/dist/metadata/chainMetadataTypes.d.ts +3 -3
- package/dist/metadata/chainMetadataTypes.d.ts.map +1 -1
- package/dist/metadata/chainMetadataTypes.js +3 -4
- package/dist/metadata/chainMetadataTypes.js.map +1 -1
- package/dist/metadata/deploymentArtifacts.d.ts +2 -2
- package/dist/metadata/deploymentArtifacts.d.ts.map +1 -1
- package/dist/middleware/account/InterchainAccountChecker.js +4 -1
- package/dist/middleware/account/InterchainAccountChecker.js.map +1 -1
- package/dist/middleware/account/InterchainAccountDeployer.d.ts +12 -6
- package/dist/middleware/account/InterchainAccountDeployer.d.ts.map +1 -1
- package/dist/middleware/account/InterchainAccountDeployer.js +34 -63
- package/dist/middleware/account/InterchainAccountDeployer.js.map +1 -1
- package/dist/middleware/account/accounts.hardhat-test.js +21 -30
- package/dist/middleware/account/accounts.hardhat-test.js.map +1 -1
- package/dist/middleware/account/contracts.d.ts +4 -3
- package/dist/middleware/account/contracts.d.ts.map +1 -1
- package/dist/middleware/account/contracts.js +2 -1
- package/dist/middleware/account/contracts.js.map +1 -1
- package/dist/middleware/liquidity-layer/LiquidityLayerApp.js +129 -151
- package/dist/middleware/liquidity-layer/LiquidityLayerApp.js.map +1 -1
- package/dist/middleware/liquidity-layer/LiquidityLayerRouterDeployer.d.ts +2 -2
- package/dist/middleware/liquidity-layer/LiquidityLayerRouterDeployer.d.ts.map +1 -1
- package/dist/middleware/liquidity-layer/LiquidityLayerRouterDeployer.js +85 -107
- package/dist/middleware/liquidity-layer/LiquidityLayerRouterDeployer.js.map +1 -1
- package/dist/middleware/liquidity-layer/contracts.d.ts +4 -3
- package/dist/middleware/liquidity-layer/contracts.d.ts.map +1 -1
- package/dist/middleware/liquidity-layer/contracts.js +2 -1
- package/dist/middleware/liquidity-layer/contracts.js.map +1 -1
- package/dist/middleware/liquidity-layer/liquidity-layer.hardhat-test.js +41 -46
- package/dist/middleware/liquidity-layer/liquidity-layer.hardhat-test.js.map +1 -1
- package/dist/middleware/query/InterchainQueryDeployer.d.ts +1 -1
- package/dist/middleware/query/InterchainQueryDeployer.d.ts.map +1 -1
- package/dist/middleware/query/InterchainQueryDeployer.js +13 -24
- package/dist/middleware/query/InterchainQueryDeployer.js.map +1 -1
- package/dist/middleware/query/contracts.d.ts +4 -3
- package/dist/middleware/query/contracts.d.ts.map +1 -1
- package/dist/middleware/query/contracts.js +2 -1
- package/dist/middleware/query/contracts.js.map +1 -1
- package/dist/middleware/query/queries.hardhat-test.js +23 -32
- package/dist/middleware/query/queries.hardhat-test.js.map +1 -1
- package/dist/providers/MultiProvider.d.ts +2 -2
- package/dist/providers/MultiProvider.d.ts.map +1 -1
- package/dist/providers/MultiProvider.js +63 -84
- package/dist/providers/MultiProvider.js.map +1 -1
- package/dist/providers/RetryProvider.d.ts +1 -1
- package/dist/providers/RetryProvider.d.ts.map +1 -1
- package/dist/providers/RetryProvider.js +2 -16
- package/dist/providers/RetryProvider.js.map +1 -1
- package/dist/router/GasRouterDeployer.js +18 -32
- package/dist/router/GasRouterDeployer.js.map +1 -1
- package/dist/router/HyperlaneRouterChecker.d.ts +0 -1
- package/dist/router/HyperlaneRouterChecker.d.ts.map +1 -1
- package/dist/router/HyperlaneRouterChecker.js +37 -51
- package/dist/router/HyperlaneRouterChecker.js.map +1 -1
- package/dist/router/HyperlaneRouterDeployer.d.ts.map +1 -1
- package/dist/router/HyperlaneRouterDeployer.js +89 -107
- package/dist/router/HyperlaneRouterDeployer.js.map +1 -1
- package/dist/router/ProxiedRouterChecker.d.ts +3 -2
- package/dist/router/ProxiedRouterChecker.d.ts.map +1 -1
- package/dist/router/ProxiedRouterChecker.js +15 -17
- package/dist/router/ProxiedRouterChecker.js.map +1 -1
- package/dist/router/ProxiedRouterDeployer.d.ts +2 -2
- package/dist/router/ProxiedRouterDeployer.d.ts.map +1 -1
- package/dist/router/ProxiedRouterDeployer.js +27 -28
- package/dist/router/ProxiedRouterDeployer.js.map +1 -1
- package/dist/router/RouterApps.d.ts.map +1 -1
- package/dist/router/RouterApps.js +4 -15
- package/dist/router/RouterApps.js.map +1 -1
- package/dist/router/types.d.ts +14 -9
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/types.js +7 -2
- package/dist/router/types.js.map +1 -1
- package/dist/test/testUtils.d.ts.map +1 -1
- package/dist/test/testUtils.js +21 -24
- package/dist/test/testUtils.js.map +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/MultiGeneric.js +2 -4
- package/dist/utils/MultiGeneric.js.map +1 -1
- package/dist/utils/fetch.js +8 -16
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/number.js +2 -2
- package/dist/utils/number.js.map +1 -1
- package/dist/utils/objects.d.ts +2 -2
- package/dist/utils/objects.d.ts.map +1 -1
- package/dist/utils/wagmi.js +1 -2
- package/dist/utils/wagmi.js.map +1 -1
- package/package.json +9 -8
package/dist/deploy/types.js
CHANGED
|
@@ -7,5 +7,7 @@ var ViolationType;
|
|
|
7
7
|
ViolationType["NotDeployed"] = "NotDeployed";
|
|
8
8
|
ViolationType["BytecodeMismatch"] = "BytecodeMismatch";
|
|
9
9
|
ViolationType["ProxyAdmin"] = "ProxyAdmin";
|
|
10
|
-
|
|
10
|
+
ViolationType["TimelockController"] = "TimelockController";
|
|
11
|
+
ViolationType["AccessControl"] = "AccessControl";
|
|
12
|
+
})(ViolationType || (exports.ViolationType = ViolationType = {}));
|
|
11
13
|
//# sourceMappingURL=types.js.map
|
package/dist/deploy/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/deploy/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/deploy/types.ts"],"names":[],"mappings":";;;AAkBA,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,4CAA2B,CAAA;IAC3B,sDAAqC,CAAA;IACrC,0CAAyB,CAAA;IACzB,0DAAyC,CAAA;IACzC,gDAA+B,CAAA;AACjC,CAAC,EAPW,aAAa,6BAAb,aAAa,QAOxB"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -47,139 +38,139 @@ class ContractVerifier extends MultiGeneric_1.MultiGeneric {
|
|
|
47
38
|
verify(targets = this.chains()) {
|
|
48
39
|
return Promise.allSettled(targets.map((chain) => this.verifyChain(chain, this.get(chain))));
|
|
49
40
|
}
|
|
50
|
-
verifyChain(chain, inputs) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
});
|
|
41
|
+
async verifyChain(chain, inputs) {
|
|
42
|
+
this.logger(`Verifying ${chain}...`);
|
|
43
|
+
for (const input of inputs) {
|
|
44
|
+
await this.verifyContract(chain, input);
|
|
45
|
+
}
|
|
57
46
|
}
|
|
58
|
-
submitForm(chain, action, options) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
response = yield (0, cross_fetch_1.default)(apiUrl, {
|
|
71
|
-
method: 'POST',
|
|
72
|
-
headers: {
|
|
73
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
74
|
-
},
|
|
75
|
-
body: params,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
let result;
|
|
79
|
-
let responseText;
|
|
80
|
-
try {
|
|
81
|
-
responseText = yield response.text();
|
|
82
|
-
result = JSON.parse(responseText);
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
this.logger(`Failed to parse response from ${responseText}`, e);
|
|
86
|
-
}
|
|
87
|
-
if (result.message === 'NOTOK') {
|
|
88
|
-
switch (result.result) {
|
|
89
|
-
case ExplorerApiErrors.VERIFICATION_PENDING:
|
|
90
|
-
yield utils_1.utils.sleep(5000); // wait 5 seconds
|
|
91
|
-
return this.submitForm(chain, action, options);
|
|
92
|
-
case ExplorerApiErrors.ALREADY_VERIFIED:
|
|
93
|
-
case ExplorerApiErrors.ALREADY_VERIFIED_ALT:
|
|
94
|
-
return;
|
|
95
|
-
case ExplorerApiErrors.PROXY_FAILED:
|
|
96
|
-
this.logger(`Proxy verification failed, try manually?`);
|
|
97
|
-
return;
|
|
98
|
-
default:
|
|
99
|
-
this.logger(`Verification failed for some unknown reason on ${chain}`, result);
|
|
100
|
-
throw new Error(`Verification failed: ${result.result}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return result.result;
|
|
47
|
+
async submitForm(chain, action, options) {
|
|
48
|
+
const apiUrl = new URL(this.multiProvider.getExplorerApiUrl(chain));
|
|
49
|
+
const isGetRequest = action === ExplorerApiActions.CHECK_STATUS ||
|
|
50
|
+
action === ExplorerApiActions.CHECK_PROXY_STATUS ||
|
|
51
|
+
action === ExplorerApiActions.GETSOURCECODE;
|
|
52
|
+
const params = new URLSearchParams({
|
|
53
|
+
apikey: this.apiKeys[chain],
|
|
54
|
+
module: 'contract',
|
|
55
|
+
action,
|
|
56
|
+
...options,
|
|
104
57
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
58
|
+
let response;
|
|
59
|
+
if (isGetRequest) {
|
|
60
|
+
response = await (0, cross_fetch_1.default)(`${apiUrl}?${params}`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
response = await (0, cross_fetch_1.default)(apiUrl, {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
headers: {
|
|
66
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
67
|
+
},
|
|
68
|
+
body: params,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
let result;
|
|
72
|
+
let responseText;
|
|
73
|
+
try {
|
|
74
|
+
responseText = await response.text();
|
|
75
|
+
result = JSON.parse(responseText);
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
this.logger(`Failed to parse response from ${responseText}`, e);
|
|
79
|
+
}
|
|
80
|
+
if (result.message === 'NOTOK') {
|
|
81
|
+
switch (result.result) {
|
|
82
|
+
case ExplorerApiErrors.VERIFICATION_PENDING:
|
|
83
|
+
await utils_1.utils.sleep(5000); // wait 5 seconds
|
|
84
|
+
return this.submitForm(chain, action, options);
|
|
85
|
+
case ExplorerApiErrors.ALREADY_VERIFIED:
|
|
86
|
+
case ExplorerApiErrors.ALREADY_VERIFIED_ALT:
|
|
87
|
+
return;
|
|
88
|
+
case ExplorerApiErrors.PROXY_FAILED:
|
|
89
|
+
this.logger(`Proxy verification failed, try manually?`);
|
|
90
|
+
return;
|
|
91
|
+
default:
|
|
92
|
+
this.logger(`Verification failed for some unknown reason on ${chain}`, result);
|
|
93
|
+
throw new Error(`Verification failed: ${result.result}`);
|
|
115
94
|
}
|
|
116
|
-
}
|
|
95
|
+
}
|
|
96
|
+
return result.result;
|
|
117
97
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
98
|
+
async isAlreadyVerified(chain, input) {
|
|
99
|
+
try {
|
|
100
|
+
const result = await this.submitForm(chain, ExplorerApiActions.GETSOURCECODE, {
|
|
101
|
+
...this.compilerOptions,
|
|
102
|
+
address: input.address,
|
|
103
|
+
});
|
|
104
|
+
return result[0].SourceCode !== '';
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
this.logger(`Error checking if contract is already verified: ${error}`);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async verifyProxy(chain, input) {
|
|
112
|
+
if (input.isProxy) {
|
|
113
|
+
try {
|
|
114
|
+
const proxyGuid = await this.submitForm(chain, ExplorerApiActions.MARK_PROXY, {
|
|
115
|
+
address: input.address,
|
|
116
|
+
});
|
|
117
|
+
const addressUrl = await this.multiProvider.tryGetExplorerAddressUrl(chain, input.address);
|
|
118
|
+
// poll for verified proxy status
|
|
119
|
+
if (proxyGuid) {
|
|
120
|
+
await this.submitForm(chain, ExplorerApiActions.CHECK_PROXY_STATUS, {
|
|
121
|
+
guid: proxyGuid,
|
|
124
122
|
});
|
|
125
|
-
|
|
126
|
-
// poll for verified proxy status
|
|
127
|
-
if (proxyGuid) {
|
|
128
|
-
yield this.submitForm(chain, ExplorerApiActions.CHECK_PROXY_STATUS, {
|
|
129
|
-
guid: proxyGuid,
|
|
130
|
-
});
|
|
131
|
-
this.logger(`Successfully verified proxy ${addressUrl}#readProxyContract`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
console.error(`Verification of proxy at ${input.address} failed on ${chain}`);
|
|
136
|
-
throw error;
|
|
123
|
+
this.logger(`Successfully verified proxy ${addressUrl}#readProxyContract`);
|
|
137
124
|
}
|
|
138
125
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var _a;
|
|
143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
this.logger(`Verifying ${input.name} implementation at ${input.address} on ${chain}`);
|
|
145
|
-
const data = Object.assign({ sourceCode: this.flattenedSource, contractname: input.name, contractaddress: input.address,
|
|
146
|
-
// TYPO IS ENFORCED BY API
|
|
147
|
-
constructorArguements: utils_1.utils.strip0x((_a = input.constructorArguments) !== null && _a !== void 0 ? _a : '') }, this.compilerOptions);
|
|
148
|
-
const guid = yield this.submitForm(chain, ExplorerApiActions.VERIFY_IMPLEMENTATION, data);
|
|
149
|
-
const addressUrl = yield this.multiProvider.tryGetExplorerAddressUrl(chain, input.address);
|
|
150
|
-
// poll for verified status
|
|
151
|
-
if (guid) {
|
|
152
|
-
try {
|
|
153
|
-
yield this.submitForm(chain, ExplorerApiActions.CHECK_STATUS, { guid });
|
|
154
|
-
this.logger(`Successfully verified ${addressUrl}#code`);
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
console.error(`Verifying implementation at ${input.address} failed on ${chain}`);
|
|
158
|
-
throw error;
|
|
159
|
-
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
console.error(`Verification of proxy at ${input.address} failed on ${chain}`);
|
|
128
|
+
throw error;
|
|
160
129
|
}
|
|
161
|
-
}
|
|
130
|
+
}
|
|
162
131
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
132
|
+
async verifyImplementation(chain, input) {
|
|
133
|
+
this.logger(`Verifying ${input.name} implementation at ${input.address} on ${chain}`);
|
|
134
|
+
const data = {
|
|
135
|
+
sourceCode: this.flattenedSource,
|
|
136
|
+
contractname: input.name,
|
|
137
|
+
contractaddress: input.address,
|
|
138
|
+
// TYPO IS ENFORCED BY API
|
|
139
|
+
constructorArguements: utils_1.utils.strip0x(input.constructorArguments ?? ''),
|
|
140
|
+
...this.compilerOptions,
|
|
141
|
+
};
|
|
142
|
+
const guid = await this.submitForm(chain, ExplorerApiActions.VERIFY_IMPLEMENTATION, data);
|
|
143
|
+
const addressUrl = await this.multiProvider.tryGetExplorerAddressUrl(chain, input.address);
|
|
144
|
+
// poll for verified status
|
|
145
|
+
if (guid) {
|
|
146
|
+
try {
|
|
147
|
+
await this.submitForm(chain, ExplorerApiActions.CHECK_STATUS, { guid });
|
|
148
|
+
this.logger(`Successfully verified ${addressUrl}#code`);
|
|
177
149
|
}
|
|
178
|
-
|
|
179
|
-
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error(`Verifying implementation at ${input.address} failed on ${chain}`);
|
|
152
|
+
throw error;
|
|
180
153
|
}
|
|
181
|
-
|
|
182
|
-
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async verifyContract(chain, input) {
|
|
157
|
+
if (input.address === ethers_1.ethers.constants.AddressZero) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (Array.isArray(input.constructorArguments)) {
|
|
161
|
+
this.logger('Constructor arguments in legacy format, skipping');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (await this.isAlreadyVerified(chain, input)) {
|
|
165
|
+
this.logger(`Contract ${input.name} already verified on ${chain}`);
|
|
166
|
+
// There is a rate limit of 5 requests per second
|
|
167
|
+
await (0, utils_2.sleep)(200);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
await this.verifyImplementation(chain, input);
|
|
172
|
+
}
|
|
173
|
+
await this.verifyProxy(chain, input);
|
|
183
174
|
}
|
|
184
175
|
}
|
|
185
176
|
exports.ContractVerifier = ContractVerifier;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractVerifier.js","sourceRoot":"","sources":["../../../src/deploy/verify/ContractVerifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContractVerifier.js","sourceRoot":"","sources":["../../../src/deploy/verify/ContractVerifier.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAChC,iCAAwC;AACxC,mCAAgC;AAEhC,gDAA6C;AAC7C,+DAA4D;AAI5D,2DAAwD;AAQxD,IAAK,kBAMJ;AAND,WAAK,kBAAkB;IACrB,qDAA+B,CAAA;IAC/B,gEAA0C,CAAA;IAC1C,wDAAkC,CAAA;IAClC,wDAAkC,CAAA;IAClC,mEAA6C,CAAA;AAC/C,CAAC,EANI,kBAAkB,KAAlB,kBAAkB,QAMtB;AAED,IAAK,iBAKJ;AALD,WAAK,iBAAiB;IACpB,+EAA0D,CAAA;IAC1D,8DAAyC,CAAA;IACzC,8DAAyC,CAAA;IACzC,mIAA8G,CAAA;AAChH,CAAC,EALI,iBAAiB,KAAjB,iBAAiB,QAKrB;AAED,MAAa,gBAAiB,SAAQ,2BAA+B;IAGnE,YACE,kBAA+C,EAC5B,aAA4B,EAC5B,OAAyB,EACzB,eAAuB,EAAE,kDAAkD;IAC3E,eAAgC;QAEnD,KAAK,CAAC,kBAAkB,CAAC,CAAC;QALP,kBAAa,GAAb,aAAa,CAAe;QAC5B,YAAO,GAAP,OAAO,CAAkB;QACzB,oBAAe,GAAf,eAAe,CAAQ;QACvB,oBAAe,GAAf,eAAe,CAAiB;QAGnD,IAAI,CAAC,MAAM,GAAG,IAAA,aAAK,EAAC,4BAA4B,CAAC,C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ACnE,iDAAiD;YACjD,MAAM,IAAA,aAAK,EAAC,GAAG,CAAC,CAAC;YACjB,OAAO;SACR;aAAM;YACL,MAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SAC/C;QACD,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AArND,4CAqNC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ContractVerificationInput = {
|
|
2
2
|
name: string;
|
|
3
3
|
address: string;
|
|
4
4
|
constructorArguments?: string;
|
|
5
5
|
isProxy?: boolean;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type VerificationInput = ContractVerificationInput[];
|
|
8
|
+
export type CompilerOptions = {
|
|
9
9
|
codeformat: 'solidity-single-file' | 'solidity-standard-json-input';
|
|
10
10
|
compilerversion: string;
|
|
11
11
|
optimizationUsed: '0' | '1';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/deploy/verify/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/deploy/verify/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,EAAE,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,sBAAsB,GAAG,8BAA8B,CAAC;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,GAAG,GAAG,GAAG,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Ownable } from '@hyperlane-xyz/core';
|
|
2
1
|
import { types } from '@hyperlane-xyz/utils';
|
|
3
2
|
import { HyperlaneAppChecker } from '../deploy/HyperlaneAppChecker';
|
|
4
3
|
import { ChainName } from '../types';
|
|
@@ -10,9 +9,6 @@ export declare class HyperlaneIgpChecker extends HyperlaneAppChecker<HyperlaneIg
|
|
|
10
9
|
checkBytecodes(chain: ChainName): Promise<void>;
|
|
11
10
|
checkOverheadInterchainGasPaymaster(local: ChainName): Promise<void>;
|
|
12
11
|
checkInterchainGasPaymaster(local: ChainName): Promise<void>;
|
|
13
|
-
ownables(chain: ChainName): Promise<{
|
|
14
|
-
[key: string]: Ownable;
|
|
15
|
-
}>;
|
|
16
12
|
getGasOracleAddress(local: ChainName, remote: ChainName): types.Address;
|
|
17
13
|
}
|
|
18
14
|
//# sourceMappingURL=HyperlaneIgpChecker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperlaneIgpChecker.d.ts","sourceRoot":"","sources":["../../src/gas/HyperlaneIgpChecker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"HyperlaneIgpChecker.d.ts","sourceRoot":"","sources":["../../src/gas/HyperlaneIgpChecker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAS,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAML,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,qBAAa,mBAAoB,SAAQ,mBAAmB,CAC1D,YAAY,EACZ,iBAAiB,CAClB;IACO,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3C,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrD,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC/C,mCAAmC,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCpE,2BAA2B,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAiDlE,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,CAAC,OAAO;CAgBxE"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.HyperlaneIgpChecker = void 0;
|
|
13
4
|
const ethers_1 = require("ethers");
|
|
@@ -15,129 +6,118 @@ const utils_1 = require("@hyperlane-xyz/utils");
|
|
|
15
6
|
const bytecode_1 = require("../consts/bytecode");
|
|
16
7
|
const HyperlaneAppChecker_1 = require("../deploy/HyperlaneAppChecker");
|
|
17
8
|
const proxy_1 = require("../deploy/proxy");
|
|
18
|
-
const objects_1 = require("../utils/objects");
|
|
19
9
|
const types_1 = require("./types");
|
|
20
10
|
class HyperlaneIgpChecker extends HyperlaneAppChecker_1.HyperlaneAppChecker {
|
|
21
|
-
checkChain(chain) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
async checkChain(chain) {
|
|
12
|
+
await this.checkDomainOwnership(chain);
|
|
13
|
+
await this.checkProxiedContracts(chain);
|
|
14
|
+
await this.checkBytecodes(chain);
|
|
15
|
+
await this.checkOverheadInterchainGasPaymaster(chain);
|
|
16
|
+
await this.checkInterchainGasPaymaster(chain);
|
|
17
|
+
const config = this.configMap[chain];
|
|
18
|
+
if (config.upgrade) {
|
|
19
|
+
await this.checkUpgrade(chain, config.upgrade);
|
|
20
|
+
}
|
|
29
21
|
}
|
|
30
|
-
checkDomainOwnership(chain) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
async checkDomainOwnership(chain) {
|
|
23
|
+
const config = this.configMap[chain];
|
|
24
|
+
const ownableOverrides = {
|
|
25
|
+
storageGasOracle: config.oracleKey,
|
|
26
|
+
};
|
|
27
|
+
if (config.upgrade) {
|
|
28
|
+
const timelockController = this.app.getAddresses(chain).timelockController;
|
|
29
|
+
ownableOverrides['proxyAdmin'] = timelockController;
|
|
30
|
+
}
|
|
31
|
+
await super.checkOwnership(chain, config.owner, ownableOverrides);
|
|
37
32
|
}
|
|
38
|
-
checkBytecodes(chain) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.slice(2), ''));
|
|
52
|
-
});
|
|
33
|
+
async checkBytecodes(chain) {
|
|
34
|
+
const contracts = this.app.getContracts(chain);
|
|
35
|
+
await this.checkBytecode(chain, 'InterchainGasPaymaster proxy', contracts.interchainGasPaymaster.address, [bytecode_1.BytecodeHash.TRANSPARENT_PROXY_BYTECODE_HASH]);
|
|
36
|
+
const implementation = await (0, proxy_1.proxyImplementation)(this.multiProvider.getProvider(chain), contracts.interchainGasPaymaster.address);
|
|
37
|
+
await this.checkBytecode(chain, 'InterchainGasPaymaster implementation', implementation, [
|
|
38
|
+
bytecode_1.BytecodeHash.INTERCHAIN_GAS_PAYMASTER_BYTECODE_HASH,
|
|
39
|
+
bytecode_1.BytecodeHash.OWNER_INITIALIZABLE_INTERCHAIN_GAS_PAYMASTER_BYTECODE_HASH,
|
|
40
|
+
]);
|
|
41
|
+
await this.checkBytecode(chain, 'OverheadIGP', contracts.defaultIsmInterchainGasPaymaster.address, [bytecode_1.BytecodeHash.OVERHEAD_IGP_BYTECODE_HASH], (bytecode) =>
|
|
42
|
+
// Remove the address of the wrapped IGP from the bytecode
|
|
43
|
+
bytecode.replaceAll(ethers_1.utils.defaultAbiCoder
|
|
44
|
+
.encode(['address'], [contracts.interchainGasPaymaster.address])
|
|
45
|
+
.slice(2), ''));
|
|
53
46
|
}
|
|
54
|
-
checkOverheadInterchainGasPaymaster(local) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
ethers_1.BigNumber.from(expectedOverhead);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (Object.keys(overheadViolation.actual).length > 0) {
|
|
83
|
-
this.addViolation(overheadViolation);
|
|
47
|
+
async checkOverheadInterchainGasPaymaster(local) {
|
|
48
|
+
const coreContracts = this.app.getContracts(local);
|
|
49
|
+
const defaultIsmIgp = coreContracts.defaultIsmInterchainGasPaymaster;
|
|
50
|
+
// Construct the violation, updating the actual & expected
|
|
51
|
+
// objects as violations are found.
|
|
52
|
+
// A single violation is used so that only a single `setDestinationGasOverheads`
|
|
53
|
+
// call is generated to set multiple gas overheads.
|
|
54
|
+
const overheadViolation = {
|
|
55
|
+
type: 'InterchainGasPaymaster',
|
|
56
|
+
subType: types_1.IgpViolationType.Overhead,
|
|
57
|
+
contract: defaultIsmIgp,
|
|
58
|
+
chain: local,
|
|
59
|
+
actual: {},
|
|
60
|
+
expected: {},
|
|
61
|
+
};
|
|
62
|
+
const remotes = this.app.remoteChains(local);
|
|
63
|
+
for (const remote of remotes) {
|
|
64
|
+
const expectedOverhead = this.configMap[local].overhead[remote];
|
|
65
|
+
const remoteId = this.multiProvider.getDomainId(remote);
|
|
66
|
+
const existingOverhead = await defaultIsmIgp.destinationGasOverhead(remoteId);
|
|
67
|
+
if (!existingOverhead.eq(expectedOverhead)) {
|
|
68
|
+
const remoteChain = remote;
|
|
69
|
+
overheadViolation.actual[remoteChain] = existingOverhead;
|
|
70
|
+
overheadViolation.expected[remoteChain] =
|
|
71
|
+
ethers_1.BigNumber.from(expectedOverhead);
|
|
84
72
|
}
|
|
85
|
-
}
|
|
73
|
+
}
|
|
74
|
+
if (Object.keys(overheadViolation.actual).length > 0) {
|
|
75
|
+
this.addViolation(overheadViolation);
|
|
76
|
+
}
|
|
86
77
|
}
|
|
87
|
-
checkInterchainGasPaymaster(local) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
async checkInterchainGasPaymaster(local) {
|
|
79
|
+
const coreContracts = this.app.getContracts(local);
|
|
80
|
+
const igp = coreContracts.interchainGasPaymaster;
|
|
81
|
+
// Construct the violation, updating the actual & expected
|
|
82
|
+
// objects as violations are found.
|
|
83
|
+
// A single violation is used so that only a single `setGasOracles`
|
|
84
|
+
// call is generated to set multiple gas oracles.
|
|
85
|
+
const gasOraclesViolation = {
|
|
86
|
+
type: 'InterchainGasPaymaster',
|
|
87
|
+
subType: types_1.IgpViolationType.GasOracles,
|
|
88
|
+
contract: igp,
|
|
89
|
+
chain: local,
|
|
90
|
+
actual: {},
|
|
91
|
+
expected: {},
|
|
92
|
+
};
|
|
93
|
+
const remotes = this.app.remoteChains(local);
|
|
94
|
+
for (const remote of remotes) {
|
|
95
|
+
const remoteId = this.multiProvider.getDomainId(remote);
|
|
96
|
+
const actualGasOracle = await igp.gasOracles(remoteId);
|
|
97
|
+
const expectedGasOracle = this.getGasOracleAddress(local, remote);
|
|
98
|
+
if (!utils_1.utils.eqAddress(actualGasOracle, expectedGasOracle)) {
|
|
99
|
+
const remoteChain = remote;
|
|
100
|
+
gasOraclesViolation.actual[remoteChain] = actualGasOracle;
|
|
101
|
+
gasOraclesViolation.expected[remoteChain] = expectedGasOracle;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Add the violation only if it's been populated with gas oracle inconsistencies
|
|
105
|
+
if (Object.keys(gasOraclesViolation.actual).length > 0) {
|
|
106
|
+
this.addViolation(gasOraclesViolation);
|
|
107
|
+
}
|
|
108
|
+
const actualBeneficiary = await igp.beneficiary();
|
|
109
|
+
const expectedBeneficiary = this.configMap[local].beneficiary;
|
|
110
|
+
if (!utils_1.utils.eqAddress(actualBeneficiary, expectedBeneficiary)) {
|
|
111
|
+
const violation = {
|
|
96
112
|
type: 'InterchainGasPaymaster',
|
|
97
|
-
subType: types_1.IgpViolationType.
|
|
113
|
+
subType: types_1.IgpViolationType.Beneficiary,
|
|
98
114
|
contract: igp,
|
|
99
115
|
chain: local,
|
|
100
|
-
actual:
|
|
101
|
-
expected:
|
|
116
|
+
actual: actualBeneficiary,
|
|
117
|
+
expected: expectedBeneficiary,
|
|
102
118
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const remoteId = this.multiProvider.getDomainId(remote);
|
|
106
|
-
const actualGasOracle = yield igp.gasOracles(remoteId);
|
|
107
|
-
const expectedGasOracle = this.getGasOracleAddress(local, remote);
|
|
108
|
-
if (!utils_1.utils.eqAddress(actualGasOracle, expectedGasOracle)) {
|
|
109
|
-
const remoteChain = remote;
|
|
110
|
-
gasOraclesViolation.actual[remoteChain] = actualGasOracle;
|
|
111
|
-
gasOraclesViolation.expected[remoteChain] = expectedGasOracle;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
// Add the violation only if it's been populated with gas oracle inconsistencies
|
|
115
|
-
if (Object.keys(gasOraclesViolation.actual).length > 0) {
|
|
116
|
-
this.addViolation(gasOraclesViolation);
|
|
117
|
-
}
|
|
118
|
-
const actualBeneficiary = yield igp.beneficiary();
|
|
119
|
-
const expectedBeneficiary = this.configMap[local].beneficiary;
|
|
120
|
-
if (!utils_1.utils.eqAddress(actualBeneficiary, expectedBeneficiary)) {
|
|
121
|
-
const violation = {
|
|
122
|
-
type: 'InterchainGasPaymaster',
|
|
123
|
-
subType: types_1.IgpViolationType.Beneficiary,
|
|
124
|
-
contract: igp,
|
|
125
|
-
chain: local,
|
|
126
|
-
actual: actualBeneficiary,
|
|
127
|
-
expected: expectedBeneficiary,
|
|
128
|
-
};
|
|
129
|
-
this.addViolation(violation);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
// The owner of storageGasOracle is not expected to match the configured owner
|
|
134
|
-
ownables(chain) {
|
|
135
|
-
const _super = Object.create(null, {
|
|
136
|
-
ownables: { get: () => super.ownables }
|
|
137
|
-
});
|
|
138
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
-
return (0, objects_1.objFilter)(yield _super.ownables.call(this, chain), (name, contract) => name !== 'storageGasOracle');
|
|
140
|
-
});
|
|
119
|
+
this.addViolation(violation);
|
|
120
|
+
}
|
|
141
121
|
}
|
|
142
122
|
getGasOracleAddress(local, remote) {
|
|
143
123
|
const config = this.configMap[local];
|