diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index cf27f4aa..3586b7d2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -238,7 +238,7 @@ jobs: - name: Set nitro contracts image run: | - echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts:v3.2.0-2f747c7" >> "$GITHUB_ENV" + echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts-anvil:v3.2.0-2f747c7" >> "$GITHUB_ENV" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -281,7 +281,7 @@ jobs: - name: Set token bridge contracts image run: | - echo "TOKEN_BRIDGE_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-token-bridge-contracts:v1.2.2" >> "$GITHUB_ENV" + echo "TOKEN_BRIDGE_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-token-bridge-contracts-anvil:v1.2.5-5975d8f73608" >> "$GITHUB_ENV" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -307,7 +307,7 @@ jobs: uses: docker/build-push-action@v6 with: context: ./token-bridge-contracts - file: ./token-bridge-contracts/Dockerfile + file: ./token-bridge-contracts/Dockerfile.anvil push: true tags: | ${{ env.TOKEN_BRIDGE_CONTRACTS_GHCR_IMAGE }} @@ -327,8 +327,8 @@ jobs: - name: Set nitro contracts image run: | - echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts:v3.2.0-2f747c7" >> "$GITHUB_ENV" - echo "TOKEN_BRIDGE_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-token-bridge-contracts:v1.2.2" >> "$GITHUB_ENV" + echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts-anvil:v3.2.0-2f747c7" >> "$GITHUB_ENV" + echo "TOKEN_BRIDGE_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-token-bridge-contracts-anvil:v1.2.5-5975d8f73608" >> "$GITHUB_ENV" - name: Log in to GHCR uses: docker/login-action@v3 diff --git a/nitro-contracts/Dockerfile b/nitro-contracts/Dockerfile index eaa45522..418f7983 100644 --- a/nitro-contracts/Dockerfile +++ b/nitro-contracts/Dockerfile @@ -2,9 +2,6 @@ FROM ghcr.io/foundry-rs/foundry:v1.3.1 AS foundry FROM node:20-bullseye-slim AS builder -ARG NITRO_CONTRACTS_REPO_URL=https://github.com/OffchainLabs/nitro-contracts.git -ARG NITRO_CONTRACTS_GIT_COMMIT=2f747c722d98d5fd662bfda08cd86aa534b22be2 - COPY --from=foundry /usr/local/bin/forge /usr/local/bin/forge RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* @@ -12,8 +9,8 @@ RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* WORKDIR /workspace RUN git init . \ - && git remote add origin "${NITRO_CONTRACTS_REPO_URL}" \ - && git fetch --depth 1 origin "${NITRO_CONTRACTS_GIT_COMMIT}" \ + && git remote add origin https://github.com/OffchainLabs/nitro-contracts.git \ + && git fetch --depth 1 origin 2f747c722d98d5fd662bfda08cd86aa534b22be2 \ && git checkout --detach FETCH_HEAD \ && git submodule update --init --recursive --depth 1 diff --git a/src/contracts/IERC20Inbox.ts b/src/contracts/ERC20Inbox.ts similarity index 100% rename from src/contracts/IERC20Inbox.ts rename to src/contracts/ERC20Inbox.ts diff --git a/src/contracts/Inbox.ts b/src/contracts/Inbox.ts new file mode 100644 index 00000000..49351a15 --- /dev/null +++ b/src/contracts/Inbox.ts @@ -0,0 +1,28 @@ +export const inboxABI = [ + { + stateMutability: 'view', + type: 'function', + inputs: [ + { name: 'dataLength', type: 'uint256' }, + { name: 'baseFee', type: 'uint256' }, + ], + name: 'calculateRetryableSubmissionFee', + outputs: [{ type: 'uint256' }], + }, + { + stateMutability: 'payable', + type: 'function', + inputs: [ + { name: 'to', type: 'address' }, + { name: 'l2CallValue', type: 'uint256' }, + { name: 'maxSubmissionCost', type: 'uint256' }, + { name: 'excessFeeRefundAddress', type: 'address' }, + { name: 'callValueRefundAddress', type: 'address' }, + { name: 'gasLimit', type: 'uint256' }, + { name: 'maxFeePerGas', type: 'uint256' }, + { name: 'data', type: 'bytes' }, + ], + name: 'createRetryableTicketNoRefundAliasRewrite', + outputs: [{ type: 'uint256' }], + }, +] as const; diff --git a/src/createTokenBridge.integration.test.ts b/src/createTokenBridge.integration.test.ts index 6e7e6849..cd1e9956 100644 --- a/src/createTokenBridge.integration.test.ts +++ b/src/createTokenBridge.integration.test.ts @@ -22,6 +22,7 @@ import { scaleFrom18DecimalsToNativeTokenDecimals } from './utils/decimals'; import { getWethAddress } from './utils/getWethAddress'; import { isAnvilTestMode, getAnvilTestStack } from './integrationTestHelpers/injectedMode'; import { Address } from 'viem'; +import { testConstants } from './integrationTestHelpers/constants'; const env = isAnvilTestMode() ? getAnvilTestStack() : undefined; @@ -54,16 +55,19 @@ if (env) { const l1Client = createPublicClient({ chain: env ? env.l1.chain : nitroTestnodeL1, transport: env ? http(env.l1.rpcUrl) : http(nitroTestnodeL1.rpcUrls.default.http[0]), + ...(env ? { pollingInterval: testConstants.POLLING_INTERVAL } : {}), }); const l2Client = createPublicClient({ chain: env ? env.l2.chain : nitroTestnodeL2, transport: env ? http(env.l2.rpcUrl) : http(nitroTestnodeL2.rpcUrls.default.http[0]), + ...(env ? { pollingInterval: testConstants.POLLING_INTERVAL } : {}), }); const l3Client = createPublicClient({ chain: env ? env.l3.chain : nitroTestnodeL3, transport: env ? http(env.l3.rpcUrl) : http(nitroTestnodeL3.rpcUrls.default.http[0]), + ...(env ? { pollingInterval: testConstants.POLLING_INTERVAL } : {}), }); function checkTokenBridgeContracts(tokenBridgeContracts: TokenBridgeContracts) { diff --git a/src/ethers-compat/publicClientToProvider.ts b/src/ethers-compat/publicClientToProvider.ts index a0b1cc2d..a95a3bfe 100644 --- a/src/ethers-compat/publicClientToProvider.ts +++ b/src/ethers-compat/publicClientToProvider.ts @@ -20,5 +20,8 @@ export function publicClientToProvider( const transportUrl = publicClient.transport.url as string | undefined; const url = transportUrl ?? chain.rpcUrls.default.http[0]; - return new providers.StaticJsonRpcProvider(url, network); + const provider = new providers.StaticJsonRpcProvider(url, network); + provider.pollingInterval = publicClient.pollingInterval; + + return provider; } diff --git a/src/integrationTestHelpers/anvilHarness.ts b/src/integrationTestHelpers/anvilHarness.ts index c5336454..c8f0cd6b 100644 --- a/src/integrationTestHelpers/anvilHarness.ts +++ b/src/integrationTestHelpers/anvilHarness.ts @@ -272,11 +272,13 @@ export function hydrateAnvilTestStack(env: InjectedAnvilTestStack): AnvilTestSta publicClient: createPublicClient({ chain: l2Chain, transport: http(env.l2.rpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, }), walletClient: createWalletClient({ chain: l2Chain, transport: http(env.l2.rpcUrl), account: blockAdvancerAccount, + pollingInterval: testConstants.POLLING_INTERVAL, }), account: blockAdvancerAccount, }), @@ -316,15 +318,15 @@ export async function setupAnvilTestStack(): Promise { dockerNetworkName = `chain-sdk-int-test-net-${Date.now()}`; createDockerNetwork(dockerNetworkName); - const l2ChainId = testConstants.DEFAULT_L2_CHAIN_ID; + const l2ChainId = testConstants.L2_CHAIN_ID; const l3ChainId = l2ChainId + 1; - const l1RpcPort = testConstants.DEFAULT_L1_RPC_PORT; - const l2RpcPort = testConstants.DEFAULT_L2_RPC_PORT; - const l3RpcPort = testConstants.DEFAULT_L3_RPC_PORT; - const anvilImage = testConstants.DEFAULT_ANVIL_IMAGE; - const nitroImage = testConstants.DEFAULT_NITRO_IMAGE; - const sepoliaBeaconRpc = testConstants.DEFAULT_SEPOLIA_BEACON_RPC; - const anvilForkUrl = testConstants.DEFAULT_SEPOLIA_RPC; + const l1RpcPort = testConstants.L1_RPC_PORT; + const l2RpcPort = testConstants.L2_RPC_PORT; + const l3RpcPort = testConstants.L3_RPC_PORT; + const anvilImage = testConstants.ANVIL_IMAGE; + const nitroImage = testConstants.NITRO_IMAGE; + const sepoliaBeaconRpc = testConstants.SEPOLIA_BEACON_RPC; + const anvilForkUrl = testConstants.SEPOLIA_RPC; const rollupCreatorVersion: RollupCreatorSupportedVersion = 'v3.2'; const rollupTimingParams: CustomTimingParams = { confirmPeriodBlocks: 150n, @@ -353,7 +355,7 @@ export async function setupAnvilTestStack(): Promise { }); l1RpcCachingProxy = await startRpcCachingProxy(anvilForkUrl, cacheFilePath, { - forkBlockNumber: testConstants.DEFAULT_SEPOLIA_FORK_BLOCK_NUMBER, + forkBlockNumber: testConstants.SEPOLIA_FORK_BLOCK_NUMBER, }); const l1RpcUrlWithCaching = l1RpcCachingProxy.proxyUrl; @@ -374,7 +376,7 @@ export async function setupAnvilTestStack(): Promise { l1RpcPort, anvilImage, anvilForkUrl: l1RpcUrlWithCaching, - anvilForkBlockNumber: testConstants.DEFAULT_SEPOLIA_FORK_BLOCK_NUMBER, + anvilForkBlockNumber: testConstants.SEPOLIA_FORK_BLOCK_NUMBER, chainId: sepolia.id, }); @@ -389,6 +391,7 @@ export async function setupAnvilTestStack(): Promise { const l1Client = createPublicClient({ chain: l1Chain, transport: http(l1RpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, }); registerChainForRpcUrl({ rpcUrl: l1RpcUrl, chain: l1Chain }); @@ -462,7 +465,7 @@ export async function setupAnvilTestStack(): Promise { validatorPrivateKey: validatorAccount.privateKey, stakeToken: l2RollupConfig.stakeToken, parentChainId: sepolia.id, - parentChainRpcUrl: `http://${l1ContainerName}:8545`, + parentChainRpcUrl: `http://${l1ContainerName}:${l1RpcPort}`, parentChainBeaconRpcUrl: sepoliaBeaconRpc, }); @@ -535,12 +538,14 @@ export async function setupAnvilTestStack(): Promise { let l2Client: PublicClient = createPublicClient({ chain: l2BootstrapChain, transport: http(l2RpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, }); const l2WalletClient = createWalletClient({ chain: l2BootstrapChain, transport: http(l2RpcUrl), account: harnessDeployer, + pollingInterval: testConstants.POLLING_INTERVAL, }); const l2BlockAdvancer = createBlockAdvancer({ @@ -549,6 +554,7 @@ export async function setupAnvilTestStack(): Promise { chain: l2BootstrapChain, transport: http(l2RpcUrl), account: l2BlockAdvancerAccount, + pollingInterval: testConstants.POLLING_INTERVAL, }), account: l2BlockAdvancerAccount, }); @@ -566,6 +572,8 @@ export async function setupAnvilTestStack(): Promise { console.log('L2 create2 factory is ready\n'); const l2Provider = new ethers.providers.JsonRpcProvider(l2RpcUrl); + l2Provider.pollingInterval = testConstants.POLLING_INTERVAL; + const l2Signer = new ethers.Wallet(harnessDeployer.privateKey, l2Provider); console.log('Deploying L2 custom gas token...'); @@ -635,6 +643,7 @@ export async function setupAnvilTestStack(): Promise { l2Client = createPublicClient({ chain: l2Chain, transport: http(l2RpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, }); console.log('Deploying L3 rollup contracts on L2...'); @@ -679,7 +688,7 @@ export async function setupAnvilTestStack(): Promise { stakeToken: l3RollupConfig.stakeToken, parentChainId: l2ChainId as ParentChainId, parentChainIsArbitrum: true, - parentChainRpcUrl: `http://${l2ContainerName}:8449`, + parentChainRpcUrl: `http://${l2ContainerName}:${l2RpcPort}`, }); if ( @@ -737,11 +746,13 @@ export async function setupAnvilTestStack(): Promise { const l3Client = createPublicClient({ chain: l3Chain, transport: http(l3RpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, }); const l3WalletClient = createWalletClient({ chain: l3Chain, transport: http(l3RpcUrl), account: harnessDeployer, + pollingInterval: testConstants.POLLING_INTERVAL, }); await ( @@ -814,6 +825,7 @@ export async function setupAnvilTestStack(): Promise { chain: l2Chain, transport: http(l2RpcUrl), account: l2BlockAdvancerAccount, + pollingInterval: testConstants.POLLING_INTERVAL, }); const l3BlockAdvancer = createBlockAdvancer({ @@ -822,6 +834,7 @@ export async function setupAnvilTestStack(): Promise { chain: l3Chain, transport: http(l3RpcUrl), account: l3BlockAdvancerAccount, + pollingInterval: testConstants.POLLING_INTERVAL, }), account: l3BlockAdvancerAccount, }); diff --git a/src/integrationTestHelpers/anvilHarnessHelpers.ts b/src/integrationTestHelpers/anvilHarnessHelpers.ts index 5f9d0a33..cc538c01 100644 --- a/src/integrationTestHelpers/anvilHarnessHelpers.ts +++ b/src/integrationTestHelpers/anvilHarnessHelpers.ts @@ -16,7 +16,8 @@ import { ethers } from 'ethers'; import { arbOwnerABI, arbOwnerAddress } from '../contracts/ArbOwner'; import { erc20ABI } from '../contracts/ERC20'; -import { erc20InboxABI } from '../contracts/IERC20Inbox'; +import { inboxABI } from '../contracts/Inbox'; +import { erc20InboxABI } from '../contracts/ERC20Inbox'; import { tokenBridgeCreatorAddress } from '../contracts/TokenBridgeCreator'; import { testConstants } from './constants'; import { @@ -92,7 +93,7 @@ async function getRequiredRetryableFunding( const retryableSubmissionFee = await l1Client.readContract({ address: inbox, - abi: testConstants.inboxFundingAbi, + abi: inboxABI, functionName: 'calculateRetryableSubmissionFee', args: [0n, l1BaseFeePerGas], }); @@ -197,13 +198,25 @@ export async function fundL2Deployer(params: { inbox: Address; }) { const { l1RpcUrl, l2RpcUrl, l2Chain, deployer, inbox } = params; - const l1Client = createPublicClient({ chain: sepolia, transport: http(l1RpcUrl) }); + + const l1Client = createPublicClient({ + chain: sepolia, + transport: http(l1RpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, + }); + const l1WalletClient = createWalletClient({ chain: sepolia, transport: http(l1RpcUrl), account: deployer, + pollingInterval: testConstants.POLLING_INTERVAL, + }); + + const l2Client = createPublicClient({ + chain: l2Chain, + transport: http(l2RpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, }); - const l2Client = createPublicClient({ chain: l2Chain, transport: http(l2RpcUrl) }); const fundAmount = parseEther('1000'); const retryableGasLimit = BigInt(100_000); @@ -225,7 +238,7 @@ export async function fundL2Deployer(params: { to: inbox, value: fundAmount + maxSubmissionCost + retryableGasLimit * l2MaxFeePerGas, data: encodeFunctionData({ - abi: testConstants.inboxFundingAbi, + abi: inboxABI, functionName: 'createRetryableTicketNoRefundAliasRewrite', args: [ deployer.address, @@ -250,7 +263,7 @@ export async function fundL2Deployer(params: { return currentBalance; } - await sleep(1000); + await sleep(100); } throw new Error( @@ -309,8 +322,7 @@ export async function bridgeNativeTokenToOrbitChain(params: { if (updatedBalance >= targetBalance) { return updatedBalance; } - - await sleep(1000); + await sleep(100); } const finalBalance = await childPublicClient.getBalance({ address: depositor.address }); @@ -359,7 +371,10 @@ export async function setBalanceOnL1(params: { address: Address; balance: bigint; }) { - const publicClient = createPublicClient({ transport: http(params.rpcUrl) }); + const publicClient = createPublicClient({ + transport: http(params.rpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, + }); await publicClient.request({ method: 'anvil_setBalance' as never, params: [params.address, `0x${params.balance.toString(16)}`] as never, @@ -367,7 +382,10 @@ export async function setBalanceOnL1(params: { } export async function refreshForkTime(params: { rpcUrl: string }) { - const publicClient = createPublicClient({ transport: http(params.rpcUrl) }); + const publicClient = createPublicClient({ + transport: http(params.rpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, + }); const now = Math.floor(Date.now() / 1000); await publicClient.request({ @@ -428,7 +446,7 @@ export function startBlockAdvancing(blockAdvancer: BlockAdvancer): void { // ignore and keep advancing blocks } - await sleep(1000); + await sleep(100); } } finally { if (blockAdvancingStates.get(blockAdvancer) === state) { @@ -498,7 +516,11 @@ export async function deployTokenBridgeCreator( (chain.contracts.tokenBridgeCreator as ChainContract).address = address; } else { const chainId = - chain?.id ?? (await createPublicClient({ transport: http(params.rpcUrl) }).getChainId()); + chain?.id ?? + (await createPublicClient({ + transport: http(params.rpcUrl), + pollingInterval: testConstants.POLLING_INTERVAL, + }).getChainId()); (tokenBridgeCreatorAddress as Record)[chainId] = address; } diff --git a/src/integrationTestHelpers/constants.ts b/src/integrationTestHelpers/constants.ts index 9ac8aa0b..a961adf2 100644 --- a/src/integrationTestHelpers/constants.ts +++ b/src/integrationTestHelpers/constants.ts @@ -1,35 +1,31 @@ -import { Address, parseAbi } from 'viem'; +import { Address } from 'viem'; import { ethers } from 'ethers'; export const testConstants = { - DEFAULT_ANVIL_IMAGE: 'ghcr.io/foundry-rs/foundry:v1.3.1', - DEFAULT_NITRO_IMAGE: 'offchainlabs/nitro-node:v3.9.5-66e42c4', - DEFAULT_NITRO_CONTRACTS_IMAGE: 'ghcr.io/offchainlabs/chain-sdk-nitro-contracts:v3.2.0-2f747c7', + ANVIL_IMAGE: 'ghcr.io/foundry-rs/foundry:v1.3.1', + NITRO_IMAGE: 'offchainlabs/nitro-node:v3.9.5-66e42c4', + DEFAULT_NITRO_CONTRACTS_IMAGE: + 'ghcr.io/offchainlabs/chain-sdk-nitro-contracts-anvil:v3.2.0-2f747c7', DEFAULT_TOKEN_BRIDGE_CONTRACTS_IMAGE: - 'ghcr.io/offchainlabs/chain-sdk-token-bridge-contracts:v1.2.5', + 'ghcr.io/offchainlabs/chain-sdk-token-bridge-contracts-anvil:v1.2.5-5975d8f73608', DEPLOYER_PRIVATE_KEY: '0x490d84b7602e4b470af4f86a3ad095607a8bb5a4fa8ba148f41fcfd236b4fdf5' as Address, - DEFAULT_L2_CHAIN_ID: 421_337, - DEFAULT_L3_CHAIN_ID: 421_338, - DEFAULT_L1_RPC_PORT: 9645, - DEFAULT_L2_RPC_PORT: 8747, - DEFAULT_L3_RPC_PORT: 8749, - DEFAULT_SEPOLIA_FORK_BLOCK_NUMBER: 10_490_000, - DEFAULT_SOURCE_DEPLOYER_PRIVATE_KEY: - '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', - DEFAULT_SEPOLIA_RPC: 'https://sepolia.gateway.tenderly.co', - DEFAULT_SEPOLIA_BEACON_RPC: 'https://ethereum-sepolia-beacon-api.publicnode.com', + L2_CHAIN_ID: 421_337, + L3_CHAIN_ID: 421_338, + L1_RPC_PORT: 9545, + L2_RPC_PORT: 9546, + L3_RPC_PORT: 9547, + SEPOLIA_FORK_BLOCK_NUMBER: 10_490_000, + SEPOLIA_RPC: 'https://sepolia.gateway.tenderly.co', + SEPOLIA_BEACON_RPC: 'https://ethereum-sepolia-beacon-api.publicnode.com', CREATE2_FACTORY: '0x4e59b44847b379578588920cA78FbF26c0B4956C', CREATE2_DEPLOYER: '0x3fab184622dc19b6109349b94811493bf2a45362', CREATE2_DEPLOYER_TX: '0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222', - inboxFundingAbi: parseAbi([ - 'function calculateRetryableSubmissionFee(uint256 dataLength, uint256 baseFee) view returns (uint256)', - 'function createRetryableTicketNoRefundAliasRewrite(address to,uint256 l2CallValue,uint256 maxSubmissionCost,address excessFeeRefundAddress,address callValueRefundAddress,uint256 gasLimit,uint256 maxFeePerGas,bytes data) payable returns (uint256)', - ]), LOW_L2_FEE_OVERRIDES: { maxFeePerGas: ethers.utils.parseUnits('0.1', 'gwei'), maxPriorityFeePerGas: ethers.BigNumber.from(0), }, NITRO_DEPLOY_POLLING_INTERVAL_MS: 100, + POLLING_INTERVAL: 100, }; diff --git a/src/integrationTestHelpers/dockerHelpers.ts b/src/integrationTestHelpers/dockerHelpers.ts index c4234e35..d74702ea 100644 --- a/src/integrationTestHelpers/dockerHelpers.ts +++ b/src/integrationTestHelpers/dockerHelpers.ts @@ -60,7 +60,7 @@ export function getTokenBridgeContractsImage(): string { return image; } catch { const tokenBridgeContractsDir = join(process.cwd(), 'token-bridge-contracts'); - const dockerfilePath = join(tokenBridgeContractsDir, 'Dockerfile'); + const dockerfilePath = join(tokenBridgeContractsDir, 'Dockerfile.anvil'); docker(['build', '-f', dockerfilePath, '-t', image, tokenBridgeContractsDir]); return image; @@ -131,6 +131,10 @@ export function getTokenBridgeCreatorDockerArgs( `BASECHAIN_WETH=${params.wethAddress}`, '-e', `GAS_LIMIT_FOR_L2_FACTORY_DEPLOYMENT=10000000`, + '-e', + `POLLING_INTERVAL=${testConstants.POLLING_INTERVAL}`, + '-e', + 'DISABLE_CONTRACT_VERIFICATION=true', tokenBridgeContractsImage, 'deploy:token-bridge-creator', ]; @@ -316,18 +320,18 @@ export function startL1AnvilContainer(params: { '--entrypoint', 'anvil', '-p', - `${params.l1RpcPort}:8545`, + `${params.l1RpcPort}:${params.l1RpcPort}`, params.anvilImage, '--fork-url', params.anvilForkUrl, '--fork-block-number', - String(params.anvilForkBlockNumber), + `${params.anvilForkBlockNumber}`, '--host', '0.0.0.0', '--port', - '8545', + `${params.l1RpcPort}`, '--chain-id', - String(params.chainId), + `${params.chainId}`, '--block-base-fee-per-gas', '0', ]); @@ -350,7 +354,7 @@ export function startNitroContainer(params: { '--network', params.networkName, '-p', - `${params.rpcPort}:8449`, + `${params.rpcPort}:${params.rpcPort}`, '-v', `${params.runtimeDir}:/runtime`, params.nitroImage, @@ -373,11 +377,11 @@ export function startNitroContainer(params: { '--http.addr', '0.0.0.0', '--http.port', - '8449', + `${params.rpcPort}`, '--ws.addr', '0.0.0.0', '--ws.port', - '8548', + `${params.rpcPort + 1000}`, '--validation.wasm.enable-wasmroots-check=false', ]); } diff --git a/token-bridge-contracts/Dockerfile.anvil b/token-bridge-contracts/Dockerfile.anvil new file mode 100644 index 00000000..1bb593b7 --- /dev/null +++ b/token-bridge-contracts/Dockerfile.anvil @@ -0,0 +1,12 @@ +FROM node:20-bullseye-slim +RUN apt-get update && \ + apt-get install -y git python3 build-essential && \ + rm -rf /var/lib/apt/lists/* +WORKDIR /workspace +RUN git init . \ + && git remote add origin https://github.com/OffchainLabs/token-bridge-contracts.git \ + && git fetch --depth 1 origin 5975d8f7360816341be7f94fd333ef240f4aec23 \ + && git checkout --detach FETCH_HEAD +RUN yarn install --frozen-lockfile +RUN yarn build +ENTRYPOINT ["yarn"]