Skip to content

Commit 44ac729

Browse files
committed
chore: resolve conflicts
2 parents 610b68a + 933b48b commit 44ac729

File tree

5 files changed

+47
-6
lines changed

5 files changed

+47
-6
lines changed

.github/workflows/ci-test.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ jobs:
6464
version: v1.5.1
6565

6666
- name: Run ZKsync OS (L1-L2)
67-
uses: dutterbutter/zksync-server-action@e0401b155b1fa0f4f3629d569db3ae7094383729 # main
67+
uses: dutterbutter/zksync-server-action@54ebddef27a0bd7ef30246f94add1c9091ae23be # v0.2.0
6868
with:
69-
version: v0.14.2
69+
version: v0.15.1
70+
protocol_version: v30.2
7071

7172
- name: Compile test contracts
7273
working-directory: tests/contracts
@@ -192,9 +193,10 @@ jobs:
192193
version: v1.5.1
193194

194195
- name: Run ZKsync OS (L1-L2)
195-
uses: dutterbutter/zksync-server-action@e0401b155b1fa0f4f3629d569db3ae7094383729 # main
196+
uses: dutterbutter/zksync-server-action@54ebddef27a0bd7ef30246f94add1c9091ae23be # v0.2.0
196197
with:
197-
version: v0.14.2
198+
version: v0.15.1
199+
protocol_version: v30.2
198200

199201
- name: Setup Bun
200202
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2

src/adapters/ethers/e2e/helpers.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import { expect } from 'bun:test';
2020
// TODO: make this shared across resources
2121
const L1_RPC_URL = 'http://127.0.0.1:8545';
2222
const L2_RPC_URL = 'http://127.0.0.1:3050';
23-
const PRIVATE_KEY = '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6';
23+
const PRIVATE_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';
24+
const L2_RICH_PRIVATE_KEY = '0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110';
2425
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
2526

2627
export const DEPLOYER_PRIVATE_KEY =
@@ -37,6 +38,18 @@ export function createTestClientAndSdk() {
3738
return { client, sdk };
3839
}
3940

41+
// Ensure the test signer has enough ETH on L2 for withdrawal tests.
42+
export async function ensureL2Balance(client: any, minBalance: bigint): Promise<void> {
43+
const me = (await client.signer.getAddress()) as Address;
44+
const current = (await client.l2.getBalance(me)) as bigint;
45+
if (current >= minBalance) return;
46+
47+
const topUp = minBalance - current + 1_000_000_000_000_000n; // +0.001 ETH buffer for gas
48+
const funder = new Wallet(L2_RICH_PRIVATE_KEY, client.l2);
49+
const tx = await funder.sendTransaction({ to: me, value: topUp });
50+
await tx.wait();
51+
}
52+
4053
/** Create deployer wallets bound to current providers (same PK on both chains). */
4154
export function makeDeployers(l1: JsonRpcProvider, l2: JsonRpcProvider) {
4255
const baseL1 = new Wallet(DEPLOYER_PRIVATE_KEY, l1);

src/adapters/ethers/e2e/withdrawals.eth.e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { Address, Hex } from '../../../core/types/primitives.ts';
1010
import { ETH_ADDRESS } from '../../../core/constants.ts';
1111
import {
1212
createTestClientAndSdk,
13+
ensureL2Balance,
1314
waitUntilReadyToFinalize,
1415
verifyWithdrawalBalancesAfterFinalize,
1516
waitForL2InclusionWithdraw,
@@ -29,6 +30,7 @@ describe('withdrawals.e2e (ethers): ETH withdrawal', () => {
2930
beforeAll(async () => {
3031
({ client, sdk } = createTestClientAndSdk());
3132
me = (await client.signer.getAddress()) as Address;
33+
await ensureL2Balance(client, WITHDRAW_WEI);
3234

3335
// Ensure L2 has funds to withdraw
3436
const l2Bal = await client.l2.getBalance(me);

src/adapters/viem/e2e/helpers.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import { createViemSdk } from '../sdk.ts';
2727
// TODO: refactor with shared mocks
2828
const L1_RPC = 'http://127.0.0.1:8545';
2929
const L2_RPC = 'http://127.0.0.1:3050';
30-
const PRIVATE_KEY = '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6';
30+
const PRIVATE_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';
31+
const L2_RICH_PRIVATE_KEY = '0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110';
3132
const DEPLOYER_PRIVATE_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';
3233
const L1_CHAIN: Chain | undefined = undefined;
3334
const L2_CHAIN: Chain | undefined = undefined;
@@ -66,6 +67,27 @@ export function createTestClientAndSdk() {
6667
return { client, sdk };
6768
}
6869

70+
// Ensure the test signer has enough ETH on L2 for withdrawal tests.
71+
export async function ensureL2Balance(client: any, minBalance: bigint): Promise<void> {
72+
const me = client.account.address as Address;
73+
const current = (await client.l2.getBalance({ address: me })) as bigint;
74+
if (current >= minBalance) return;
75+
76+
const topUp = minBalance - current + 1_000_000_000_000_000n; // +0.001 ETH buffer for gas
77+
const funderAccount = privateKeyToAccount(L2_RICH_PRIVATE_KEY);
78+
const l2Funder = createWalletClient<Transport, Chain, Account>({
79+
account: funderAccount,
80+
transport: http(L2_RPC),
81+
...(L2_CHAIN ? { chain: L2_CHAIN } : {}),
82+
});
83+
const hash = await l2Funder.sendTransaction({
84+
account: funderAccount,
85+
to: me,
86+
value: topUp,
87+
});
88+
await client.l2.waitForTransactionReceipt({ hash });
89+
}
90+
6991
export function makeDeployers() {
7092
const deployerAccount = privateKeyToAccount(DEPLOYER_PRIVATE_KEY);
7193

src/adapters/viem/e2e/withdrawals.eth.e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { Address, Hex } from '../../../core/types/primitives.ts';
1010
import { ETH_ADDRESS } from '../../../core/constants.ts';
1111
import {
1212
createTestClientAndSdk,
13+
ensureL2Balance,
1314
waitForL2InclusionWithdraw,
1415
waitUntilReadyToFinalize,
1516
verifyWithdrawalBalancesAfterFinalize,
@@ -28,6 +29,7 @@ describe('withdrawals.e2e (viem): ETH withdrawal', () => {
2829
beforeAll(async () => {
2930
({ client, sdk } = createTestClientAndSdk());
3031
me = client.account.address as Address;
32+
await ensureL2Balance(client, WITHDRAW_WEI);
3133

3234
// Ensure L2 has funds to withdraw
3335
const l2Bal = await client.l2.getBalance({ address: me });

0 commit comments

Comments
 (0)