diff --git a/src/createRollupPrepareDeploymentParamsConfig.unit.test.ts b/src/createRollupPrepareDeploymentParamsConfig.unit.test.ts index cc8081fc..7b88d045 100644 --- a/src/createRollupPrepareDeploymentParamsConfig.unit.test.ts +++ b/src/createRollupPrepareDeploymentParamsConfig.unit.test.ts @@ -1,5 +1,5 @@ import { it, expect } from 'vitest'; -import { createPublicClient, http } from 'viem'; +import { Address, createPublicClient, http } from 'viem'; import { arbitrumOne, arbitrumSepolia } from './chains'; import { prepareChainConfig } from './prepareChainConfig'; @@ -8,6 +8,32 @@ import { createRollupPrepareDeploymentParamsConfig } from './createRollupPrepare const chainId = 69_420n; const vitalik: `0x${string}` = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'; +function getOverrides({ owner, chainId }: { owner: Address; chainId: bigint }) { + return { + owner, + chainId, + chainConfig: prepareChainConfig({ + chainId: Number(chainId), + arbitrum: { + InitialChainOwner: owner, + InitialArbOSVersion: 30, + DataAvailabilityCommittee: true, + }, + }), + confirmPeriodBlocks: 4200n, + extraChallengeTimeBlocks: 5n, + loserStakeEscrow: '0x0000000000000000000000000000000000000001', + sequencerInboxMaxTimeVariation: { + delayBlocks: 200n, + delaySeconds: 5n, + futureBlocks: 100n, + futureSeconds: 1n, + }, + stakeToken: '0x0000000000000000000000000000000000000002', + wasmModuleRoot: '0xWasmModuleRoot', + } as const; +} + it('creates config for a chain on top of arbitrum one with defaults', () => { const arbitrumOneClient = createPublicClient({ chain: arbitrumOne, @@ -29,29 +55,10 @@ it('creates config for a chain on top of arbitrum one with overrides', () => { }); expect( - createRollupPrepareDeploymentParamsConfig(arbitrumOneClient, { - owner: vitalik, - chainId, - chainConfig: prepareChainConfig({ - chainId: 69_420, - arbitrum: { - InitialChainOwner: vitalik, - InitialArbOSVersion: 30, - DataAvailabilityCommittee: true, - }, - }), - confirmPeriodBlocks: 4200n, - extraChallengeTimeBlocks: 5n, - loserStakeEscrow: '0x0000000000000000000000000000000000000001', - sequencerInboxMaxTimeVariation: { - delayBlocks: 200n, - delaySeconds: 5n, - futureBlocks: 100n, - futureSeconds: 1n, - }, - stakeToken: '0x0000000000000000000000000000000000000002', - wasmModuleRoot: '0xWasmModuleRoot', - }), + createRollupPrepareDeploymentParamsConfig( + arbitrumOneClient, + getOverrides({ owner: vitalik, chainId }), + ), ).toMatchSnapshot(); }); @@ -76,28 +83,9 @@ it('creates config for a chain on top of arbitrum sepolia with overrides', () => }); expect( - createRollupPrepareDeploymentParamsConfig(arbitrumSepoliaClient, { - owner: vitalik, - chainId, - chainConfig: prepareChainConfig({ - chainId: 69_420, - arbitrum: { - InitialChainOwner: vitalik, - InitialArbOSVersion: 30, - DataAvailabilityCommittee: true, - }, - }), - confirmPeriodBlocks: 4200n, - extraChallengeTimeBlocks: 5n, - loserStakeEscrow: '0x0000000000000000000000000000000000000001', - sequencerInboxMaxTimeVariation: { - delayBlocks: 200n, - delaySeconds: 5n, - futureBlocks: 100n, - futureSeconds: 1n, - }, - stakeToken: '0x0000000000000000000000000000000000000002', - wasmModuleRoot: '0xWasmModuleRoot', - }), + createRollupPrepareDeploymentParamsConfig( + arbitrumSepoliaClient, + getOverrides({ owner: vitalik, chainId }), + ), ).toMatchSnapshot(); });