Skip to content

Commit ab26dba

Browse files
committed
debug: probe shared Zone runtime code and verifier (temporary)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012MNnMpdcBXcSaA3UK3ACbs
1 parent c8df0f3 commit ab26dba

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

‎src/tempo/actions/zone.test.ts‎

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,92 @@ async function debugZoneWithdrawal(parameters: {
293293
} as never),
294294
)
295295

296+
// Shared Zone runtime code installed on L1.
297+
for (const [name, address] of [
298+
['factory', '0x5aF2000000000000000000000000000000000000'],
299+
['messenger', '0x5A4D000000000000000000000000000000000000'],
300+
['portalImpl', '0x5AD1000000000000000000000000000000000000'],
301+
['verifier', '0x5A56000000000000000000000000000000000000'],
302+
['portalProxy', portalAddress],
303+
['signatureVerifier', Addresses.signatureVerifier],
304+
] as const)
305+
await safe(`code.${name}`, async () => {
306+
const code = (await mainnetClient.request({
307+
method: 'eth_getCode',
308+
params: [address, 'latest'],
309+
})) as Hex
310+
return `${(code.length - 2) / 2} bytes, keccak ${keccak256(code)}, head ${code.slice(0, 26)}`
311+
})
312+
313+
// Direct call of the shared verifier with the arguments the portal would pass.
314+
const verifierAbi = [
315+
{
316+
name: 'verify',
317+
type: 'function',
318+
stateMutability: 'pure',
319+
inputs: [
320+
{ type: 'uint32' },
321+
{ type: 'uint64' },
322+
{ type: 'uint64' },
323+
{ type: 'bytes32' },
324+
{ type: 'uint64' },
325+
{
326+
type: 'tuple',
327+
components: [{ type: 'bytes32' }, { type: 'bytes32' }],
328+
},
329+
{
330+
type: 'tuple',
331+
components: [
332+
{ type: 'bytes32' },
333+
{ type: 'bytes32' },
334+
{ type: 'uint64' },
335+
{ type: 'uint64' },
336+
],
337+
},
338+
{ type: 'bytes32' },
339+
{ type: 'bytes' },
340+
{ type: 'bytes' },
341+
],
342+
outputs: [{ type: 'bool' }],
343+
},
344+
] as const
345+
await safe('verifier.verify(direct)', async () => {
346+
try {
347+
return await mainnetClient.request({
348+
method: 'eth_call',
349+
params: [
350+
{
351+
from: portalAddress,
352+
to: '0x5A56000000000000000000000000000000000000',
353+
data: encodeFunctionData({
354+
abi: verifierAbi,
355+
functionName: 'verify',
356+
args: [
357+
1,
358+
BigInt(latest) - 5n,
359+
BigInt(latest) - 5n,
360+
keccak256('0x03'),
361+
1n,
362+
{ 0: zeroHash, 1: keccak256('0x01') } as never,
363+
{ 0: zeroHash, 1: zeroHash, 2: 0n, 3: 0n } as never,
364+
keccak256('0x02'),
365+
'0x',
366+
'0x',
367+
],
368+
}),
369+
},
370+
'latest',
371+
],
372+
} as never)
373+
} catch (error) {
374+
const e = error as Error & { cause?: unknown }
375+
return {
376+
error: e.message.split('\n')[0],
377+
cause: JSON.stringify(e.cause)?.slice(0, 300),
378+
}
379+
}
380+
})
381+
296382
// Signature verifier precompile with a Zone-style 65-byte (v = 27/28) signature.
297383
const probeHash = keccak256('0xdead')
298384
const probeSignature = await account.sign({ hash: probeHash })

0 commit comments

Comments
 (0)