Skip to content

Commit 0d07a80

Browse files
authored
Merge branch 'main' into feat-nitro-config-v3.6.0
2 parents 8f6b8bf + 624089d commit 0d07a80

13 files changed

+191
-80
lines changed

audit-ci.jsonc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@
7272
// https://github.com/cryptocoinjs/secp256k1-node/commit/dc37f41f2abfe87853b54bcd7d1b556db41b0c64#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R35
7373
// from: @arbitrum/token-bridge-contracts > @openzeppelin/upgrades-core > ethereumjs-util > ethereum-cryptography
7474
"GHSA-584q-6j8j-r5pm",
75-
// https://github.com/advisories/GHSA-fc9h-whq2-v747
76-
// Valid ECDSA signatures erroneously rejected in Elliptic
77-
// from: @arbitrum/token-bridge-contracts > @openzeppelin/upgrades-core > ethereumjs-util > ethereum-cryptography > secp256k1
78-
// from: ethers > @ethersproject/signing-key
79-
"GHSA-fc9h-whq2-v747",
8075
// https://github.com/advisories/GHSA-3xgq-45jj-v275
8176
// cross-spawn command injection vulnerability
8277
// Only used during development via audit-ci, nyc, and patch-package
@@ -101,12 +96,16 @@
10196
// https://github.com/advisories/GHSA-xcj6-pq6g-qj4x
10297
// the vite dev server (when exposed to the network with --host) can return contents of arbitrary files
10398
//
99+
// https://github.com/advisories/GHSA-859w-5945-r5v3
100+
// the vite dev server (when exposed to the network with --host) can return contents of arbitrary files
101+
//
104102
// vite is only used with vitest for running tests, and without exposing the dev server to the network
105103
//
106104
// from: vitest>vite
107105
// from: vitest>vite-node>vite
108106
"GHSA-4r4m-qw57-chr8",
109107
"GHSA-356w-63v5-8wf4",
110-
"GHSA-xcj6-pq6g-qj4x"
108+
"GHSA-xcj6-pq6g-qj4x",
109+
"GHSA-859w-5945-r5v3"
111110
]
112111
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"**/@wagmi/cli/viem/ws": "8.17.1",
3636
"**/@ethersproject/providers/ws": "7.5.10",
3737
"**/elliptic": "6.6.1",
38-
"**/nanoid": "3.3.8"
38+
"**/nanoid": "3.3.8",
39+
"**/base-x": "3.0.11"
3940
}
4041
}

src/contracts/Rollup/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// export the latest version
2-
export * from './v2.1';
2+
export * from './v3.1';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// export the latest version
2-
export * from './v2.1';
2+
export * from './v3.1';

src/decorators/rollupAdminLogicPublicActions.integration.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const client = createPublicClient({
1919
}),
2020
);
2121

22-
it.skip('successfully set validators', async () => {
22+
it('successfully set validators', async () => {
2323
const randomAccounts = [
2424
privateKeyToAccount(generatePrivateKey()).address,
2525
privateKeyToAccount(generatePrivateKey()).address,
@@ -31,7 +31,10 @@ it.skip('successfully set validators', async () => {
3131
rollup: l3Rollup,
3232
},
3333
);
34-
expect(initialValidators).toHaveLength(10);
34+
// By default, chains from nitro testnode has 11 validators
35+
// https://github.com/OffchainLabs/nitro-testnode/blob/de8cf4edec0d12e5ef1b7623e54e35ddb579ff0b/test-node.bash#L634
36+
// https://github.com/OffchainLabs/nitro-contracts/blob/47a9c034bc082256d498f8031fab1a37c37a123c/scripts/rollupCreation.ts#L250-L257
37+
expect(initialValidators).toHaveLength(11);
3538
expect(isAccurateInitially).toBeTruthy();
3639

3740
const tx = await client.rollupAdminLogicPrepareTransactionRequest({

src/getBatchPosters.integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function setBatchPoster(batchPoster: Address, state: boolean) {
3838
}
3939

4040
// Tests can be enabled once we run one node per integration test
41-
describe.skip('successfully get batch posters', () => {
41+
describe('successfully get batch posters', () => {
4242
it('when disabling the same batch posters multiple time', async () => {
4343
const randomAccount = privateKeyToAccount(generatePrivateKey()).address;
4444

src/getBatchPosters.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
getFunctionSelector,
1010
} from 'viem';
1111

12+
import { rollupCreatorABI as rollupCreatorV3Dot1ABI } from './contracts/RollupCreator';
1213
import { rollupCreatorABI as rollupCreatorV2Dot1ABI } from './contracts/RollupCreator/v2.1';
1314
import { rollupCreatorABI as rollupCreatorV1Dot1ABI } from './contracts/RollupCreator/v1.1';
1415
import { sequencerInboxABI } from './contracts/SequencerInbox';
@@ -18,6 +19,9 @@ import { gnosisSafeL2ABI } from './contracts/GnosisSafeL2';
1819
import { createRollupFetchTransactionHash } from './createRollupFetchTransactionHash';
1920
import { getLogsWithBatching } from './utils/getLogsWithBatching';
2021

22+
const createRollupV3Dot1ABI = getAbiItem({ abi: rollupCreatorV3Dot1ABI, name: 'createRollup' });
23+
const createRollupV3Dot1FunctionSelector = getFunctionSelector(createRollupV3Dot1ABI);
24+
2125
const createRollupV2Dot1ABI = getAbiItem({ abi: rollupCreatorV2Dot1ABI, name: 'createRollup' });
2226
const createRollupV2Dot1FunctionSelector = getFunctionSelector(createRollupV2Dot1ABI);
2327

@@ -40,6 +44,7 @@ const ownerFunctionCalledEventAbi = getAbiItem({
4044

4145
function getBatchPostersFromFunctionData<
4246
TAbi extends
47+
| (typeof createRollupV3Dot1ABI)[]
4348
| (typeof createRollupV2Dot1ABI)[]
4449
| (typeof createRollupV1Dot1ABI)[]
4550
| (typeof setIsBatchPosterABI)[],
@@ -148,6 +153,14 @@ export async function getBatchPosters<TChain extends Chain>(
148153
const txSelectedFunction = tx.input.slice(0, 10);
149154

150155
switch (txSelectedFunction) {
156+
case createRollupV3Dot1FunctionSelector: {
157+
const [{ batchPosters }] = getBatchPostersFromFunctionData({
158+
abi: [createRollupV3Dot1ABI],
159+
data: tx.input,
160+
});
161+
162+
return new Set([...acc, ...batchPosters]);
163+
}
151164
case createRollupV2Dot1FunctionSelector: {
152165
const [{ batchPosters }] = getBatchPostersFromFunctionData({
153166
abi: [createRollupV2Dot1ABI],

src/getBatchPosters.unit.test.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
encodeFunctionData,
88
http,
99
} from 'viem';
10-
import { arbitrum, arbitrumSepolia } from 'viem/chains';
10+
import { arbitrum, arbitrumSepolia, sepolia } from 'viem/chains';
1111
import { it, expect, vi, describe } from 'vitest';
1212

1313
import { gnosisSafeL2ABI } from './contracts/GnosisSafeL2';
@@ -26,6 +26,11 @@ const arbitrumSepoliaClient = createPublicClient({
2626
transport: http(),
2727
});
2828

29+
const sepoliaClient = createPublicClient({
30+
chain: sepolia,
31+
transport: http('https://sepolia.gateway.tenderly.co'),
32+
});
33+
2934
function mockLog(transactionHash: string) {
3035
return {
3136
address: '0x193e2887031c148ab54f5e856ea51ae521661200',
@@ -186,6 +191,16 @@ it('getBatchPosters returns batch posters for a chain created with RollupCreator
186191
expect(isAccurate).toBeTruthy();
187192
});
188193

194+
// https://sepolia.etherscan.io/tx/0xd79a80b7300df1bcb14e2e3ea83521d1ae37e5f171a787fb0f5377ea7f5003ad
195+
it('getBatchPosters returns batch posters for a chain created with RollupCreator v3.1', async () => {
196+
const { isAccurate, batchPosters } = await getBatchPosters(sepoliaClient, {
197+
rollup: '0x5D65e18b873dD978EeE4704BC6033436aA253936',
198+
sequencerInbox: '0x3fB778EC3e6126aF1d956A7812Eb0a28B9d25017',
199+
});
200+
expect(batchPosters).toEqual(['0x05c82FC99a41e417Ea6ED14e1D3f3b01BBFfba5A']);
201+
expect(isAccurate).toBeTruthy();
202+
});
203+
189204
describe('createRollupFunctionSelector', () => {
190205
it('getBatchPosters returns all batch posters with isAccurate flag set to true', async () => {
191206
const mockTransport = () =>
@@ -489,7 +504,7 @@ describe('safeL2FunctionSelector', () => {
489504
});
490505

491506
describe('Detect batch posters added or removed multiple times', () => {
492-
it('when disabling the same batch poster multiple time', async () => {
507+
it('when disabling the same batch poster multiple times', async () => {
493508
const batchPoster = '0xC0b97e2998edB3Bf5c6369e7f7eFfb49c36fA962';
494509
const mockTransport = () =>
495510
createTransport({
@@ -527,7 +542,7 @@ describe('Detect batch posters added or removed multiple times', () => {
527542
expect(batchPosters).toEqual([]);
528543
expect(isAccurate).toBeTruthy();
529544
});
530-
it('when enabling the same batch posters multiple time', async () => {
545+
it('when enabling the same batch posters multiple times', async () => {
531546
const batchPoster = '0xC0b97e2998edB3Bf5c6369e7f7eFfb49c36fA962';
532547
const mockTransport = () =>
533548
createTransport({

src/getValidators.integration.test.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ async function setValidator(validator: Address, state: boolean) {
3838
}
3939

4040
// Tests can be enabled once we run one node per integration test
41-
describe.skip('successfully get validators', () => {
42-
it('when disabling the same validator multiple time', async () => {
41+
describe('successfully get validators', () => {
42+
it('when disabling the same validator multiple times', async () => {
4343
const randomAccount = privateKeyToAccount(generatePrivateKey()).address;
4444

4545
const { isAccurate: isAccurateInitially, validators: initialValidators } = await getValidators(
@@ -48,8 +48,11 @@ describe.skip('successfully get validators', () => {
4848
rollup: l3Rollup,
4949
},
5050
);
51-
// By default, chains from nitro testnode has 10 validators
52-
expect(initialValidators).toHaveLength(10);
51+
52+
// By default, chains from nitro testnode has 11 validators
53+
// https://github.com/OffchainLabs/nitro-testnode/blob/de8cf4edec0d12e5ef1b7623e54e35ddb579ff0b/test-node.bash#L634
54+
// https://github.com/OffchainLabs/nitro-contracts/blob/47a9c034bc082256d498f8031fab1a37c37a123c/scripts/rollupCreation.ts#L250-L257
55+
expect(initialValidators).toHaveLength(11);
5356
expect(isAccurateInitially).toBeTruthy();
5457

5558
await setValidator(randomAccount, false);
@@ -79,7 +82,7 @@ describe.skip('successfully get validators', () => {
7982
expect(isAccurateFinal).toBeTruthy();
8083
});
8184

82-
it('when enabling the same validators multiple time', async () => {
85+
it('when enabling the same validators multiple times', async () => {
8386
const randomAccount = privateKeyToAccount(generatePrivateKey()).address;
8487

8588
const { isAccurate: isAccurateInitially, validators: initialValidators } = await getValidators(
@@ -88,8 +91,10 @@ describe.skip('successfully get validators', () => {
8891
rollup: l3Rollup,
8992
},
9093
);
91-
// By default, chains from nitro testnode has 10 validators
92-
expect(initialValidators).toHaveLength(10);
94+
// By default, chains from nitro testnode has 11 validators
95+
// https://github.com/OffchainLabs/nitro-testnode/blob/de8cf4edec0d12e5ef1b7623e54e35ddb579ff0b/test-node.bash#L634
96+
// https://github.com/OffchainLabs/nitro-contracts/blob/47a9c034bc082256d498f8031fab1a37c37a123c/scripts/rollupCreation.ts#L250-L257
97+
expect(initialValidators).toHaveLength(11);
9398
expect(isAccurateInitially).toBeTruthy();
9499

95100
await setValidator(randomAccount, true);
@@ -113,7 +118,10 @@ describe.skip('successfully get validators', () => {
113118
client,
114119
{ rollup: l3Rollup },
115120
);
116-
expect(initialValidators).toHaveLength(10);
121+
// By default, chains from nitro testnode has 11 validators
122+
// https://github.com/OffchainLabs/nitro-testnode/blob/de8cf4edec0d12e5ef1b7623e54e35ddb579ff0b/test-node.bash#L634
123+
// https://github.com/OffchainLabs/nitro-contracts/blob/47a9c034bc082256d498f8031fab1a37c37a123c/scripts/rollupCreation.ts#L250-L257
124+
expect(initialValidators).toHaveLength(11);
117125
expect(isAccurateInitially).toBeTruthy();
118126

119127
const firstValidator = initialValidators[0];
@@ -129,7 +137,10 @@ describe.skip('successfully get validators', () => {
129137
client,
130138
{ rollup: l3Rollup },
131139
);
132-
expect(initialValidators).toHaveLength(10);
140+
// By default, chains from nitro testnode has 11 validators
141+
// https://github.com/OffchainLabs/nitro-testnode/blob/de8cf4edec0d12e5ef1b7623e54e35ddb579ff0b/test-node.bash#L634
142+
// https://github.com/OffchainLabs/nitro-contracts/blob/47a9c034bc082256d498f8031fab1a37c37a123c/scripts/rollupCreation.ts#L250-L257
143+
expect(initialValidators).toHaveLength(11);
133144
expect(isAccurateInitially).toBeTruthy();
134145

135146
const lastValidator = initialValidators[initialValidators.length - 1];

0 commit comments

Comments
 (0)