Skip to content

Commit 4565fc0

Browse files
committed
Merge remote-tracking branch 'origin/main' into jxom/multisig-store-ox-v0
2 parents a581fa0 + b53b001 commit 4565fc0

9 files changed

Lines changed: 235 additions & 19 deletions

File tree

.changeset/slow-zones-read.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"viem": patch
3+
---
4+
5+
Added Zone protocol addresses, ZoneFactory registry reads, and ZonePortal administration operations to Tempo exports.

.github/workflows/verify.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,17 @@ jobs:
258258
fail-fast: false
259259
max-parallel: 3
260260
matrix:
261-
hardfork: [T8, T9, T10]
261+
hardfork: [T10, Tnext]
262262
shard: [1, 2, 3]
263263
total-shards: [3]
264264
include:
265-
- hardfork: T8
266-
tempo-tag: sha-e828ab7
267-
zone-tag: sha-aae82c4
268-
- hardfork: T9
269-
# Tempo 1.12.0 (d791f43f) with pre-T10 Zones.
270-
tempo-tag: sha256:23150c7bae007afd2eeaa596c4b9f3d6950ecd0dec3e05ad44ebdbb8a6add863
271-
zone-tag: sha-aae82c4
272265
- hardfork: T10
273266
# Tempo de760926 and sender-bound Zones 196f47b7.
274267
tempo-tag: sha256:af7a8955370adc4868a3237352ceded3bd917702a14758796eab86b338b75e49
275268
zone-tag: sha256:45b4e66b0a7d5f8d9486eeb05e0842c7a223b53e9ef910ef73cd9558f4a79118
269+
- hardfork: Tnext
270+
tempo-tag: latest
271+
zone-tag: sha256:cba4ccc8724ee1b2394b1fbb0fbfc1d645b7791ba26267422b9dd90ef7dabdb7
276272

277273
steps:
278274
- name: Clone repository

src/tempo/Addresses.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ export const tip20Factory = '0x20fc000000000000000000000000000000000000'
1616
export const tip403Registry = '0x403c000000000000000000000000000000000000'
1717
export const validator = '0xcccccccc00000000000000000000000000000000'
1818
export const validatorV2 = '0xcccccccc00000000000000000000000000000001'
19+
export const zoneFactory = '0x5aF2000000000000000000000000000000000000'
20+
export const zoneMessenger = '0x5A4d000000000000000000000000000000000000'
1921
export const zoneOutbox = '0x1c00000000000000000000000000000000000002'
22+
export const zonePortalImplementation =
23+
'0x5AD1000000000000000000000000000000000000'
24+
export const zoneVerifier = '0x5a56000000000000000000000000000000000000'

src/tempo/actions/zone.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ const unredactedZoneClient = getZoneClient({
6666
transport: zoneHttp(unredactedRpcUrl),
6767
})
6868
const hardfork = import.meta.env.VITE_TEMPO_HARDFORK
69-
const legacyZoneCallback =
70-
hardfork === 'T7' || hardfork === 'T8' || hardfork === 'T9'
69+
const legacyZoneCallback = hardfork === 'T9'
7170
const parentToken = '0x20c0000000000000000000000000000000000000'
7271
const depositParameters = {
7372
amount: parseUnits('1', 6),
@@ -159,7 +158,7 @@ async function createUnconfiguredZone() {
159158
rpcUrl: 'http://127.0.0.1:0',
160159
},
161160
],
162-
gas: 20_000_000n,
161+
gas: 30_000_000n,
163162
})
164163
: await (async () => {
165164
const verifier = await readContract(mainnetClient, {
@@ -189,7 +188,7 @@ async function createUnconfiguredZone() {
189188
rpcUrl: 'http://127.0.0.1:0',
190189
},
191190
],
192-
gas: 20_000_000n,
191+
gas: 30_000_000n,
193192
})
194193
})()
195194
const receipt = await waitForTransactionReceipt(mainnetClient, { hash })

src/tempo/zones/Abis.test-d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
encodeFunctionData,
44
type Hex,
55
parseEventLogs,
6+
type ReadContractReturnType,
67
zeroAddress,
78
zeroHash,
89
} from 'viem'
@@ -50,6 +51,43 @@ test('zoneFactory supports both parameter shapes', () => {
5051
expectTypeOf(sequencer).toEqualTypeOf<Hex>()
5152
})
5253

54+
test('zoneFactory decodes zone registry entries', () => {
55+
type ZoneInfo = ReadContractReturnType<typeof Abis.zoneFactory, 'zones'>
56+
57+
expectTypeOf<ZoneInfo>().toEqualTypeOf<{
58+
accessMode: boolean
59+
admin: Address
60+
gatewayMode: boolean
61+
portal: Address
62+
rpcUrl: string
63+
sequencers: readonly Address[]
64+
threshold: number
65+
verifier: Address
66+
zoneId: number
67+
}>()
68+
})
69+
70+
test('zonePortal decodes token configuration', () => {
71+
type TokenConfig = ReadContractReturnType<
72+
typeof Abis.zonePortal,
73+
'tokenConfig'
74+
>
75+
76+
expectTypeOf<TokenConfig>().toEqualTypeOf<{
77+
depositsActive: boolean
78+
enabled: boolean
79+
}>()
80+
})
81+
82+
test('zonePortal encodes pause operations', () => {
83+
const pause = encodeFunctionData({
84+
abi: Abis.zonePortal,
85+
functionName: 'pause',
86+
})
87+
88+
expectTypeOf(pause).toEqualTypeOf<Hex>()
89+
})
90+
5391
test('zoneOutbox decodes WithdrawalRequested fallback nonces', () => {
5492
const [event] = parseEventLogs({
5593
abi: Abis.zoneOutbox,

src/tempo/zones/Abis.ts

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,43 @@ export const zoneFactory = [
9191
{ name: 'portal', type: 'address' },
9292
],
9393
},
94+
{
95+
type: 'function',
96+
name: 'owner',
97+
stateMutability: 'view',
98+
inputs: [],
99+
outputs: [{ name: '', type: 'address' }],
100+
},
101+
{
102+
type: 'function',
103+
name: 'nextZoneId',
104+
stateMutability: 'view',
105+
inputs: [],
106+
outputs: [{ name: '', type: 'uint32' }],
107+
},
108+
{
109+
type: 'function',
110+
name: 'zones',
111+
stateMutability: 'view',
112+
inputs: [{ name: 'id', type: 'uint32' }],
113+
outputs: [
114+
{
115+
name: 'info',
116+
type: 'tuple',
117+
components: [
118+
{ name: 'zoneId', type: 'uint32' },
119+
{ name: 'portal', type: 'address' },
120+
{ name: 'accessMode', type: 'bool' },
121+
{ name: 'gatewayMode', type: 'bool' },
122+
{ name: 'admin', type: 'address' },
123+
{ name: 'sequencers', type: 'address[]' },
124+
{ name: 'threshold', type: 'uint8' },
125+
{ name: 'verifier', type: 'address' },
126+
{ name: 'rpcUrl', type: 'string' },
127+
],
128+
},
129+
],
130+
},
94131
{
95132
type: 'function',
96133
name: 'verifier',
@@ -148,6 +185,130 @@ export const zonePortal = [
148185
],
149186
outputs: [{ name: '', type: 'bytes32' }],
150187
},
188+
{
189+
name: 'messenger',
190+
type: 'function',
191+
stateMutability: 'view',
192+
inputs: [],
193+
outputs: [{ name: '', type: 'address' }],
194+
},
195+
{
196+
name: 'verifier',
197+
type: 'function',
198+
stateMutability: 'view',
199+
inputs: [],
200+
outputs: [{ name: '', type: 'address' }],
201+
},
202+
{
203+
name: 'admin',
204+
type: 'function',
205+
stateMutability: 'view',
206+
inputs: [],
207+
outputs: [{ name: '', type: 'address' }],
208+
},
209+
{
210+
name: 'pendingAdmin',
211+
type: 'function',
212+
stateMutability: 'view',
213+
inputs: [],
214+
outputs: [{ name: '', type: 'address' }],
215+
},
216+
{
217+
name: 'paused',
218+
type: 'function',
219+
stateMutability: 'view',
220+
inputs: [],
221+
outputs: [{ name: '', type: 'bool' }],
222+
},
223+
{
224+
name: 'pauseExpiry',
225+
type: 'function',
226+
stateMutability: 'view',
227+
inputs: [],
228+
outputs: [{ name: '', type: 'uint64' }],
229+
},
230+
{
231+
name: 'hasRole',
232+
type: 'function',
233+
stateMutability: 'view',
234+
inputs: [
235+
{ name: 'account', type: 'address' },
236+
{ name: 'expected', type: 'uint8' },
237+
],
238+
outputs: [{ name: '', type: 'bool' }],
239+
},
240+
{
241+
name: 'abdicationEffectiveAt',
242+
type: 'function',
243+
stateMutability: 'view',
244+
inputs: [{ name: 'capability', type: 'uint8' }],
245+
outputs: [{ name: '', type: 'uint64' }],
246+
},
247+
{
248+
name: 'pause',
249+
type: 'function',
250+
stateMutability: 'nonpayable',
251+
inputs: [],
252+
outputs: [],
253+
},
254+
{
255+
name: 'sequencerSetVersion',
256+
type: 'function',
257+
stateMutability: 'view',
258+
inputs: [],
259+
outputs: [{ name: '', type: 'uint64' }],
260+
},
261+
{
262+
name: 'sequencerThreshold',
263+
type: 'function',
264+
stateMutability: 'view',
265+
inputs: [],
266+
outputs: [{ name: '', type: 'uint8' }],
267+
},
268+
{
269+
name: 'sequencerCount',
270+
type: 'function',
271+
stateMutability: 'view',
272+
inputs: [],
273+
outputs: [{ name: '', type: 'uint256' }],
274+
},
275+
{
276+
name: 'sequencerAt',
277+
type: 'function',
278+
stateMutability: 'view',
279+
inputs: [{ name: 'index', type: 'uint256' }],
280+
outputs: [{ name: '', type: 'address' }],
281+
},
282+
{
283+
name: 'enabledTokenCount',
284+
type: 'function',
285+
stateMutability: 'view',
286+
inputs: [],
287+
outputs: [{ name: '', type: 'uint256' }],
288+
},
289+
{
290+
name: 'enabledTokenAt',
291+
type: 'function',
292+
stateMutability: 'view',
293+
inputs: [{ name: 'index', type: 'uint256' }],
294+
outputs: [{ name: '', type: 'address' }],
295+
},
296+
{
297+
name: 'tokenConfig',
298+
type: 'function',
299+
stateMutability: 'view',
300+
inputs: [{ name: 'token', type: 'address' }],
301+
outputs: [
302+
{
303+
name: 'config',
304+
type: 'tuple',
305+
components: [
306+
{ name: 'enabled', type: 'bool' },
307+
{ name: 'depositsActive', type: 'bool' },
308+
],
309+
},
310+
],
311+
},
151312
{
152313
name: 'sequencerEncryptionKey',
153314
type: 'function',

src/tempo/zones/zone.test-d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { tempoModerato } from 'viem/chains'
2+
import type { Addresses as TempoAddresses } from 'viem/tempo'
23
import { Addresses, zoneModerato } from 'viem/tempo/zones'
34
import { expectTypeOf, test } from 'vitest'
45

@@ -15,3 +16,18 @@ test('exposes Zone E contracts', () => {
1516
`0x${string}` | undefined
1617
>()
1718
})
19+
20+
test('exposes Zone protocol addresses', () => {
21+
expectTypeOf<
22+
typeof TempoAddresses.zoneFactory
23+
>().toEqualTypeOf<'0x5aF2000000000000000000000000000000000000'>()
24+
expectTypeOf<
25+
typeof TempoAddresses.zoneMessenger
26+
>().toEqualTypeOf<'0x5A4d000000000000000000000000000000000000'>()
27+
expectTypeOf<
28+
typeof TempoAddresses.zonePortalImplementation
29+
>().toEqualTypeOf<'0x5AD1000000000000000000000000000000000000'>()
30+
expectTypeOf<
31+
typeof TempoAddresses.zoneVerifier
32+
>().toEqualTypeOf<'0x5a56000000000000000000000000000000000000'>()
33+
})

test/src/anvil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const anvilSepolia = defineAnvil({
3434
'VITE_ANVIL_FORK_URL_SEPOLIA',
3535
'https://rpc.sepolia.ethpandaops.io',
3636
),
37-
forkBlockNumber: 10_000_000n,
37+
forkBlockNumber: 11_532_670n,
3838
noMining: true,
3939
port: 8845,
4040
})

test/src/tempo/prool.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import { createCustomTempo } from './prool.tmp.js'
1717
export const port = 9545
1818

1919
const hardfork = import.meta.env.VITE_TEMPO_HARDFORK
20-
const legacyHardfork =
21-
hardfork === 'T7' || hardfork === 'T8' || hardfork === 'T9'
20+
const legacyHardfork = hardfork === 'T9'
2221

2322
/** Dev key used to provision and administer local Zones. */
2423
export const zoneAdminKey = legacyHardfork
@@ -204,10 +203,7 @@ async function startZone(
204203
dev: {
205204
// Native T10 genesis assigns the factory to Anvil #0. Pre-T10 provisioning uses Anvil #1.
206205
key: zoneAdminKey,
207-
...(import.meta.env.VITE_TEMPO_HARDFORK !== 'T7' &&
208-
import.meta.env.VITE_TEMPO_HARDFORK !== 'T8'
209-
? { token: pathUsd }
210-
: {}),
206+
token: pathUsd,
211207
},
212208
image,
213209
l1: {

0 commit comments

Comments
 (0)