@humanode-hyperlane/cli 30.0.0-humanode.1 → 1045.2.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/README.md +1 -1
- package/bundle/154.index.js +462 -0
- package/bundle/230.index.js +572 -0
- package/bundle/25.index.js +9569 -0
- package/bundle/{214.index.js → 308.index.js} +192 -88
- package/bundle/367.index.js +4 -0
- package/bundle/461.index.js +49 -0
- package/bundle/505.index.js +126369 -0
- package/bundle/529.index.js +3603 -0
- package/bundle/576.index.js +36 -0
- package/bundle/610.index.js +86 -0
- package/bundle/628.index.js +152 -0
- package/bundle/633.index.js +86 -0
- package/bundle/697.index.js +410 -0
- package/bundle/{30fb121a258f7502fa97.js → 7183ea1c1bf0a5da980d.js} +1 -1
- package/bundle/748.index.js +674 -0
- package/bundle/78.index.js +372 -0
- package/bundle/787.index.js +175 -0
- package/bundle/841.index.js +2093 -0
- package/bundle/{172.index.js → 848.index.js} +779 -915
- package/bundle/868.index.js +460 -0
- package/bundle/902.index.js +173 -0
- package/bundle/956.index.js +9901 -0
- package/bundle/aleo_wasm.wasm +0 -0
- package/bundle/aleo_wasm1.wasm +0 -0
- package/bundle/build/Release/bigint_buffer.node +0 -0
- package/bundle/index.js +2 -2
- package/bundle/worker2.js +9123 -3469
- package/bundle/worker3.js +9109 -3455
- package/examples/layerzero/layerzero-warp-route.yaml +91 -0
- package/examples/sealevel/core-config-composite-ism.yaml +21 -0
- package/examples/sealevel/igp-hook-config.yaml +13 -0
- package/examples/sealevel/warp-config-routing-message-id-multisig-ism.yaml +21 -0
- package/examples/warp-base.yaml +24 -0
- package/examples/warp-config-predicate-mainnet.yaml +14 -0
- package/examples/warp-deployed-predicate-mainnet.yaml +19 -0
- package/examples/warp-ethereum.yaml +19 -0
- package/examples/wormhole/wormhole-warp-route.yaml +46 -0
- package/package.json +35 -28
- package/bundle/100.index.js +0 -1453
- package/bundle/12.index.js +0 -91
- package/bundle/213.index.js +0 -901
- package/bundle/306.index.js +0 -1037
- package/bundle/467.index.js +0 -222
- package/bundle/485.index.js +0 -85430
- package/bundle/515.index.js +0 -5191
- package/bundle/544.index.js +0 -792
- package/bundle/617.index.js +0 -1612
- package/bundle/660.index.js +0 -223
- package/bundle/688.index.js +0 -232
- package/bundle/756.index.js +0 -8595
- package/bundle/824.index.js +0 -385
- package/bundle/95.index.js +0 -264
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
export const id = 697;
|
|
2
|
+
export const ids = [697];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 73697:
|
|
6
|
+
/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ createEvmForkManagerFactory: () => (/* binding */ createEvmForkManagerFactory)
|
|
11
|
+
/* harmony export */ });
|
|
12
|
+
/* unused harmony exports getAnvilCommand, waitForEvmRpcReady, EvmForkManager */
|
|
13
|
+
/* harmony import */ var _ethersproject_providers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(97650);
|
|
14
|
+
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(62418);
|
|
15
|
+
/* harmony import */ var execa__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30025);
|
|
16
|
+
/* harmony import */ var node_net__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77030);
|
|
17
|
+
/* harmony import */ var _humanode_hyperlane_forking_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65310);
|
|
18
|
+
/* harmony import */ var _humanode_hyperlane_sdk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(17023);
|
|
19
|
+
/* harmony import */ var _humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14918);
|
|
20
|
+
/* harmony import */ var _humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21387);
|
|
21
|
+
/* harmony import */ var _humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(26400);
|
|
22
|
+
/* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(54321);
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const LOCAL_HOST = 'http://127.0.0.1';
|
|
32
|
+
// Per-probe RPC timeout so a single hung request fails fast and the bounded
|
|
33
|
+
// readiness loop can continue.
|
|
34
|
+
const RPC_PROBE_TIMEOUT_MS = 5000;
|
|
35
|
+
class RunningEvmFork {
|
|
36
|
+
provider;
|
|
37
|
+
endpoint;
|
|
38
|
+
kill;
|
|
39
|
+
constructor(provider, endpoint, kill) {
|
|
40
|
+
this.provider = provider;
|
|
41
|
+
this.endpoint = endpoint;
|
|
42
|
+
this.kill = kill;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// The registry currently marks Arc's technicalStack as "other". Match its
|
|
46
|
+
// canonical name and known network IDs so custom metadata names also work.
|
|
47
|
+
const ARC_CHAIN_NAMES = new Set(['arc', 'arctestnet']);
|
|
48
|
+
const ARC_CHAIN_IDS = new Set(['5042', '5042002']);
|
|
49
|
+
function isArcChain(chainName, chainId) {
|
|
50
|
+
return ARC_CHAIN_NAMES.has(chainName) || ARC_CHAIN_IDS.has(String(chainId));
|
|
51
|
+
}
|
|
52
|
+
function getAnvilCommand(config) {
|
|
53
|
+
const isArc = isArcChain(config.chainName, config.chainId);
|
|
54
|
+
return {
|
|
55
|
+
binary: isArc ? 'arc-anvil' : 'anvil',
|
|
56
|
+
args: [
|
|
57
|
+
'--port',
|
|
58
|
+
String(config.port),
|
|
59
|
+
'--chain-id',
|
|
60
|
+
String(config.chainId),
|
|
61
|
+
'--fork-url',
|
|
62
|
+
config.upstreamRpcUrl,
|
|
63
|
+
// Arc derives its block gas limit from protocol configuration and rejects
|
|
64
|
+
// this flag. Keep the existing behavior for other EVM chains.
|
|
65
|
+
...(!isArc ? ['--disable-block-gas-limit'] : []),
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function defaultSpawnAnvil(config) {
|
|
70
|
+
const { binary, args } = getAnvilCommand(config);
|
|
71
|
+
return (0,execa__WEBPACK_IMPORTED_MODULE_2__/* .execa */ .Ho)(binary, args);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* execa renders the full Anvil command — including the credential-bearing
|
|
75
|
+
* `--fork-url` argument — into its error's message/command fields, and shell-
|
|
76
|
+
* quotes it, so a URL containing a quote survives an exact-string strip. We
|
|
77
|
+
* therefore surface a fixed error derived from none of execa's rendered-command
|
|
78
|
+
* fields, copying only non-command diagnostics so failures stay debuggable.
|
|
79
|
+
* Anvil has no env option for `--fork-url`, so the URL stays in argv (visible to
|
|
80
|
+
* a local-machine `ps` only); this keeps it out of every error we log or rethrow.
|
|
81
|
+
*/
|
|
82
|
+
class AnvilStartError extends Error {
|
|
83
|
+
exitCode;
|
|
84
|
+
signal;
|
|
85
|
+
signalDescription;
|
|
86
|
+
code;
|
|
87
|
+
constructor(binary, missingBinary) {
|
|
88
|
+
super(missingBinary && binary === 'arc-anvil'
|
|
89
|
+
? 'arc-anvil not found on PATH; install Arc Foundry from https://github.com/circlefin/arc-foundry'
|
|
90
|
+
: `${binary} failed to start`);
|
|
91
|
+
this.name = 'AnvilStartError';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function sanitizeAnvilError(error, config) {
|
|
95
|
+
const binary = getAnvilCommand(config).binary;
|
|
96
|
+
const missingBinary = typeof error === 'object' &&
|
|
97
|
+
error !== null &&
|
|
98
|
+
'code' in error &&
|
|
99
|
+
error.code === 'ENOENT';
|
|
100
|
+
const sanitized = new AnvilStartError(binary, missingBinary);
|
|
101
|
+
if (typeof error === 'object' && error !== null) {
|
|
102
|
+
if ('exitCode' in error)
|
|
103
|
+
sanitized.exitCode = error.exitCode;
|
|
104
|
+
if ('signal' in error)
|
|
105
|
+
sanitized.signal = error.signal;
|
|
106
|
+
if ('signalDescription' in error) {
|
|
107
|
+
sanitized.signalDescription = error.signalDescription;
|
|
108
|
+
}
|
|
109
|
+
if ('code' in error)
|
|
110
|
+
sanitized.code = error.code;
|
|
111
|
+
}
|
|
112
|
+
return sanitized;
|
|
113
|
+
}
|
|
114
|
+
async function waitForEvmRpcReady(provider, signal, chainName, chainId) {
|
|
115
|
+
await (0,_humanode_hyperlane_forking_sdk__WEBPACK_IMPORTED_MODULE_1__/* .waitUntilReady */ .bs)(() => (0,_humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_3__/* .timeout */ .wR)(provider.getNetwork(), RPC_PROBE_TIMEOUT_MS, 'anvil readiness probe timed out'), { attempts: 10, baseRetryMs: 500, signal });
|
|
116
|
+
if (isArcChain(chainName, chainId)) {
|
|
117
|
+
const nodeInfo = await (0,_humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_3__/* .timeout */ .wR)(provider.send('anvil_nodeInfo', []), RPC_PROBE_TIMEOUT_MS, 'Arc Anvil mode probe timed out');
|
|
118
|
+
(0,_humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .v)(typeof nodeInfo === 'object' &&
|
|
119
|
+
nodeInfo !== null &&
|
|
120
|
+
'network' in nodeInfo &&
|
|
121
|
+
nodeInfo.network === 'arc', 'Arc Anvil did not start in Arc mode');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const DEFAULT_START_EVM_FORK_DEPS = {
|
|
125
|
+
spawnAnvil: defaultSpawnAnvil,
|
|
126
|
+
waitForReady: waitForEvmRpcReady,
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Rejects if `port` on 127.0.0.1 is already bound. A bind-test up front closes
|
|
130
|
+
* the port-collision race: proving RPC health after spawn can otherwise pass
|
|
131
|
+
* against an unrelated node already listening on the port, before our freshly
|
|
132
|
+
* spawned anvil fails with EADDRINUSE.
|
|
133
|
+
*/
|
|
134
|
+
async function assertPortAvailable(port) {
|
|
135
|
+
await new Promise((resolve, reject) => {
|
|
136
|
+
const server = (0,node_net__WEBPACK_IMPORTED_MODULE_0__.createServer)();
|
|
137
|
+
server.once('error', (error) => {
|
|
138
|
+
const code = 'code' in error ? error.code : undefined;
|
|
139
|
+
reject(code === 'EADDRINUSE'
|
|
140
|
+
? new Error(`port ${port} is already in use`)
|
|
141
|
+
: error);
|
|
142
|
+
});
|
|
143
|
+
server.once('listening', () => {
|
|
144
|
+
server.close(() => resolve());
|
|
145
|
+
});
|
|
146
|
+
server.listen(port, '127.0.0.1');
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// A single process-level `exit` hook kills every still-running fork, rather than
|
|
150
|
+
// one listener per fork — which would trip MaxListenersExceededWarning past ten
|
|
151
|
+
// forks and retain each child's closure until process exit. A fork joins the
|
|
152
|
+
// registry on start and leaves when it is killed or its child exits.
|
|
153
|
+
const runningForkKills = new Set();
|
|
154
|
+
let forkExitHookInstalled = false;
|
|
155
|
+
function trackForkExit(killFork) {
|
|
156
|
+
runningForkKills.add(killFork);
|
|
157
|
+
if (!forkExitHookInstalled) {
|
|
158
|
+
forkExitHookInstalled = true;
|
|
159
|
+
process.once('exit', () => {
|
|
160
|
+
for (const kill of Array.from(runningForkKills)) {
|
|
161
|
+
kill();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return () => {
|
|
166
|
+
runningForkKills.delete(killFork);
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
async function startEvmFork(config, deps = DEFAULT_START_EVM_FORK_DEPS) {
|
|
170
|
+
const endpoint = `${LOCAL_HOST}:${config.port}`;
|
|
171
|
+
// Fail fast if the port is taken, before spawning, so we never treat another
|
|
172
|
+
// process's RPC as our fork.
|
|
173
|
+
await assertPortAvailable(config.port);
|
|
174
|
+
let killOnError;
|
|
175
|
+
try {
|
|
176
|
+
let anvilProcess;
|
|
177
|
+
try {
|
|
178
|
+
anvilProcess = deps.spawnAnvil(config);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
// A synchronous spawn throw (e.g. execa rejecting an argument that
|
|
182
|
+
// contains a NUL byte) can embed the credential-bearing URL in its
|
|
183
|
+
// message; sanitize it at the source so it never leaks.
|
|
184
|
+
throw sanitizeAnvilError(error, config);
|
|
185
|
+
}
|
|
186
|
+
const onProcessExit = () => {
|
|
187
|
+
void kill(false).catch((error) => (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logDebug */ .MD)(`Failed to kill anvil fork for chain ${config.chainName}`, error));
|
|
188
|
+
};
|
|
189
|
+
const kill = async (isPanicking) => {
|
|
190
|
+
untrackFork();
|
|
191
|
+
anvilProcess.kill(isPanicking ? 'SIGTERM' : 'SIGINT');
|
|
192
|
+
};
|
|
193
|
+
killOnError = kill;
|
|
194
|
+
// Kill this fork if the process exits; drop it from the registry once the
|
|
195
|
+
// child is gone (killed or exited) so a single process-level `exit` hook
|
|
196
|
+
// covers any number of forks without accumulating listeners. Registered
|
|
197
|
+
// before the readiness race so the failure path's kill can untrack it.
|
|
198
|
+
const untrackFork = trackForkExit(onProcessExit);
|
|
199
|
+
void anvilProcess.then(() => untrackFork(), () => untrackFork());
|
|
200
|
+
const provider = new _ethersproject_providers__WEBPACK_IMPORTED_MODULE_6__.JsonRpcProvider(endpoint);
|
|
201
|
+
// Abort the readiness probe the instant the race settles so no retry timer
|
|
202
|
+
// keeps polling a dead port after anvil exits before its RPC is ready.
|
|
203
|
+
const controller = new AbortController();
|
|
204
|
+
const readiness = deps.waitForReady(provider, controller.signal, config.chainName, config.chainId);
|
|
205
|
+
// Reject if anvil exits before its RPC is ready (e.g. the port is already
|
|
206
|
+
// occupied) so we never treat another process's RPC as our fork.
|
|
207
|
+
const exited = anvilProcess.then(() => {
|
|
208
|
+
throw new Error('anvil exited before its RPC was ready');
|
|
209
|
+
}, (error) => {
|
|
210
|
+
throw sanitizeAnvilError(error, config);
|
|
211
|
+
});
|
|
212
|
+
// A later exit (e.g. on kill once readiness has won) must not surface as an
|
|
213
|
+
// unhandled rejection after the race settles.
|
|
214
|
+
exited.catch(() => { });
|
|
215
|
+
try {
|
|
216
|
+
await Promise.race([readiness, exited]);
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
controller.abort();
|
|
220
|
+
}
|
|
221
|
+
return new RunningEvmFork(provider, endpoint, kill);
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
// Kill any running anvil process otherwise the process will keep running
|
|
225
|
+
// in the background.
|
|
226
|
+
if (killOnError) {
|
|
227
|
+
await killOnError(true);
|
|
228
|
+
}
|
|
229
|
+
// Both anvil-error sources are sanitized at their source (the synchronous
|
|
230
|
+
// spawn throw above and the async `exited` mapping), so no URL-bearing error
|
|
231
|
+
// reaches here; rethrow verbatim to preserve real readiness/exit messages.
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
class EvmForkManager {
|
|
236
|
+
config;
|
|
237
|
+
deps;
|
|
238
|
+
running;
|
|
239
|
+
constructor(config, deps) {
|
|
240
|
+
this.config = config;
|
|
241
|
+
this.deps = deps;
|
|
242
|
+
}
|
|
243
|
+
get requireRunning() {
|
|
244
|
+
const running = this.running;
|
|
245
|
+
(0,_humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_4__/* .assert */ .v)(running, `Fork not started for chain ${this.config.chainName}`);
|
|
246
|
+
return running;
|
|
247
|
+
}
|
|
248
|
+
async start() {
|
|
249
|
+
this.running = await startEvmFork(this.config, this.deps);
|
|
250
|
+
}
|
|
251
|
+
async applyForkConfig(config) {
|
|
252
|
+
const { provider } = this.requireRunning;
|
|
253
|
+
await handleImpersonations(provider, this.config.chainName, config.impersonateAccounts);
|
|
254
|
+
await handleTransactions(provider, this.config.chainName, config.transactions);
|
|
255
|
+
}
|
|
256
|
+
getForkedChainMetadata() {
|
|
257
|
+
return {
|
|
258
|
+
rpcUrls: [{ http: this.requireRunning.endpoint }],
|
|
259
|
+
blocks: { confirmations: 1 },
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
kill() {
|
|
263
|
+
void this.running
|
|
264
|
+
?.kill(false)
|
|
265
|
+
.catch((error) => (0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logDebug */ .MD)(`Failed to kill anvil fork for chain ${this.config.chainName}`, error));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function createEvmForkManagerFactory(multiProvider) {
|
|
269
|
+
return (ctx) => {
|
|
270
|
+
const metadata = multiProvider.getChainMetadata(ctx.chainName);
|
|
271
|
+
return new EvmForkManager({
|
|
272
|
+
chainName: metadata.name,
|
|
273
|
+
chainId: metadata.chainId,
|
|
274
|
+
upstreamRpcUrl: ctx.upstreamRpcUrl,
|
|
275
|
+
port: ctx.port,
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
async function handleImpersonations(provider, chainName, accountsToImpersonate) {
|
|
280
|
+
if (accountsToImpersonate.length === 0) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
(0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Impersonating accounts ${accountsToImpersonate} on chain ${chainName}`);
|
|
284
|
+
await Promise.all(accountsToImpersonate.map((address) => provider.send('anvil_impersonateAccount', [address])));
|
|
285
|
+
}
|
|
286
|
+
async function handleTransactions(provider, chainName, transactions) {
|
|
287
|
+
if (transactions.length === 0) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
(0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Executing transactions on chain ${chainName}`);
|
|
291
|
+
let txCounter = 0;
|
|
292
|
+
for (const transaction of transactions) {
|
|
293
|
+
const signer = provider.getSigner(transaction.from);
|
|
294
|
+
await provider.send('anvil_setBalance', [
|
|
295
|
+
transaction.from,
|
|
296
|
+
'10000000000000000000',
|
|
297
|
+
]);
|
|
298
|
+
let calldata;
|
|
299
|
+
if (transaction.data?.type === _humanode_hyperlane_sdk__WEBPACK_IMPORTED_MODULE_7__/* .TransactionDataType */ .pp.RAW_CALLDATA) {
|
|
300
|
+
calldata = transaction.data.calldata;
|
|
301
|
+
}
|
|
302
|
+
else if (transaction.data?.type === _humanode_hyperlane_sdk__WEBPACK_IMPORTED_MODULE_7__/* .TransactionDataType */ .pp.SIGNATURE) {
|
|
303
|
+
const functionInterface = new ethers__WEBPACK_IMPORTED_MODULE_8__.ethers.utils.Interface([
|
|
304
|
+
transaction.data.signature,
|
|
305
|
+
]);
|
|
306
|
+
const [functionName] = Object.keys(functionInterface.functions);
|
|
307
|
+
calldata = functionInterface.encodeFunctionData(functionName, transaction.data.args);
|
|
308
|
+
}
|
|
309
|
+
const annotation = transaction.annotation ?? `#${txCounter}`;
|
|
310
|
+
// Advance once per iteration (before any `continue`) so fallback `#n`
|
|
311
|
+
// annotations stay unique even when a tx short-circuits on a revert assert.
|
|
312
|
+
txCounter++;
|
|
313
|
+
(0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Executing transaction on chain ${chainName}: "${annotation}"`);
|
|
314
|
+
let pendingTx;
|
|
315
|
+
try {
|
|
316
|
+
pendingTx = await signer.sendTransaction({
|
|
317
|
+
to: transaction.to,
|
|
318
|
+
data: calldata,
|
|
319
|
+
value: transaction.value,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
const reason = getRevertReason(error);
|
|
324
|
+
if (reason && transaction.revertAssertion) {
|
|
325
|
+
assertRevert(transaction.revertAssertion, reason, {
|
|
326
|
+
chainName: chainName,
|
|
327
|
+
transactionAnnotation: annotation,
|
|
328
|
+
});
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
// New unhandled error
|
|
332
|
+
throw error;
|
|
333
|
+
}
|
|
334
|
+
const txReceipt = await pendingTx.wait();
|
|
335
|
+
if (txReceipt.status == 0) {
|
|
336
|
+
throw new Error(`Transaction "${annotation}" reverted on chain ${chainName}`);
|
|
337
|
+
}
|
|
338
|
+
transaction.eventAssertions.forEach((eventAssertion, idx) => assertEvent(eventAssertion, txReceipt.logs, {
|
|
339
|
+
chainName: chainName,
|
|
340
|
+
assertionIdx: idx,
|
|
341
|
+
transactionAnnotation: annotation,
|
|
342
|
+
}));
|
|
343
|
+
if (transaction.timeSkip) {
|
|
344
|
+
(0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Forwarding time by "${transaction.timeSkip}" seconds on chain ${chainName}`);
|
|
345
|
+
await provider.send('evm_increaseTime', [transaction.timeSkip]);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
(0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Successfully executed all transactions on chain ${chainName}`);
|
|
349
|
+
}
|
|
350
|
+
function getRevertReason(error) {
|
|
351
|
+
if (typeof error === 'object' &&
|
|
352
|
+
error !== null &&
|
|
353
|
+
'reason' in error &&
|
|
354
|
+
typeof error.reason === 'string') {
|
|
355
|
+
return error.reason;
|
|
356
|
+
}
|
|
357
|
+
return undefined;
|
|
358
|
+
}
|
|
359
|
+
function assertRevert(revertAssertion, reason, meta) {
|
|
360
|
+
// If contract call reverts, then there should be a reason
|
|
361
|
+
// https://github.com/ethers-io/ethers.js/blob/v5.7/packages/providers/src.ts/json-rpc-provider.ts#L79
|
|
362
|
+
if (reason !== revertAssertion.reason) {
|
|
363
|
+
throw new Error(`Expected revert: ${revertAssertion.reason} does not match ${reason}`);
|
|
364
|
+
}
|
|
365
|
+
const annotation = revertAssertion.annotation ?? revertAssertion.type;
|
|
366
|
+
(0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Successfully completed revert assertion on chain "${meta.chainName}" and transaction "${meta.transactionAnnotation}": "${annotation}"`);
|
|
367
|
+
}
|
|
368
|
+
function assertEvent(eventAssertion, rawLogs, meta) {
|
|
369
|
+
const [rawLog] = rawLogs.filter((rawLog) => eventAssertion.type === _humanode_hyperlane_sdk__WEBPACK_IMPORTED_MODULE_7__/* .EventAssertionType */ .l.RAW_TOPIC
|
|
370
|
+
? assertEventByTopic(eventAssertion, rawLog)
|
|
371
|
+
: assertEventBySignature(eventAssertion, rawLog));
|
|
372
|
+
if (!rawLog) {
|
|
373
|
+
throw new Error(`Log ${eventAssertion.type === _humanode_hyperlane_sdk__WEBPACK_IMPORTED_MODULE_7__/* .EventAssertionType */ .l.RAW_TOPIC
|
|
374
|
+
? eventAssertion.topic
|
|
375
|
+
: eventAssertion.signature} not found in transaction!`);
|
|
376
|
+
}
|
|
377
|
+
const annotation = eventAssertion.annotation ?? `#${meta.assertionIdx}`;
|
|
378
|
+
(0,_logger_js__WEBPACK_IMPORTED_MODULE_5__/* .logGray */ ._P)(`Successfully completed assertion on chain "${meta.chainName}" and transaction "${meta.transactionAnnotation}": "${annotation}"`);
|
|
379
|
+
}
|
|
380
|
+
function assertEventByTopic(eventAssertion, rawLog) {
|
|
381
|
+
return rawLog.topics[0] === eventAssertion.topic;
|
|
382
|
+
}
|
|
383
|
+
function assertEventBySignature(eventAssertion, rawLog) {
|
|
384
|
+
const eventInterface = new ethers__WEBPACK_IMPORTED_MODULE_8__.ethers.utils.Interface([eventAssertion.signature]);
|
|
385
|
+
let parsedLog;
|
|
386
|
+
// parseLog throws if the event cannot be decoded
|
|
387
|
+
try {
|
|
388
|
+
parsedLog = eventInterface.parseLog(rawLog);
|
|
389
|
+
if (!parsedLog) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
catch {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
if (!eventAssertion.args) {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
const logArgs = parsedLog.args
|
|
400
|
+
.slice(0, eventAssertion.args.length)
|
|
401
|
+
.map((arg) => String(arg));
|
|
402
|
+
return (0,_humanode_hyperlane_utils__WEBPACK_IMPORTED_MODULE_9__/* .deepEquals */ .c2)(logArgs, eventAssertion.args);
|
|
403
|
+
}
|
|
404
|
+
//# sourceMappingURL=EvmForkManager.js.map
|
|
405
|
+
__webpack_async_result__();
|
|
406
|
+
} catch(e) { __webpack_async_result__(e); } });
|
|
407
|
+
|
|
408
|
+
/***/ })
|
|
409
|
+
|
|
410
|
+
};
|
|
@@ -63,7 +63,7 @@ if (globalThis.XMLHttpRequest == null) {
|
|
|
63
63
|
// needed when writing Worker code.
|
|
64
64
|
if (globalThis.navigator == null) {
|
|
65
65
|
globalThis.navigator = {
|
|
66
|
-
hardwareConcurrency: $os.
|
|
66
|
+
hardwareConcurrency: $os.availableParallelism(),
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
if (globalThis.Worker == null) {
|