From 9b8694d0e41e357a55115f686a9866deab3ea9ff Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Thu, 5 Sep 2024 09:51:07 +0300 Subject: [PATCH 1/5] Bump `reth` Docker image to 1.0.6 --- docker-compose-cpu-runner.yml | 2 +- docker-compose-gpu-runner-cuda-12-0.yml | 2 +- docker-compose-gpu-runner.yml | 2 +- docker-compose.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose-cpu-runner.yml b/docker-compose-cpu-runner.yml index 08d01390d770..beb54f3ade98 100644 --- a/docker-compose-cpu-runner.yml +++ b/docker-compose-cpu-runner.yml @@ -2,7 +2,7 @@ version: '3.2' services: reth: restart: always - image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2" + image: "ghcr.io/paradigmxyz/reth:v1.0.6" volumes: - type: bind source: ./volumes/reth/data diff --git a/docker-compose-gpu-runner-cuda-12-0.yml b/docker-compose-gpu-runner-cuda-12-0.yml index 92a7b0b00887..35a0faeb9620 100644 --- a/docker-compose-gpu-runner-cuda-12-0.yml +++ b/docker-compose-gpu-runner-cuda-12-0.yml @@ -2,7 +2,7 @@ version: '3.2' services: reth: restart: always - image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2" + image: "ghcr.io/paradigmxyz/reth:v1.0.6" volumes: - type: bind source: ./volumes/reth/data diff --git a/docker-compose-gpu-runner.yml b/docker-compose-gpu-runner.yml index bbd61715842d..f95ae0d5f544 100644 --- a/docker-compose-gpu-runner.yml +++ b/docker-compose-gpu-runner.yml @@ -2,7 +2,7 @@ version: '3.2' services: reth: restart: always - image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2" + image: "ghcr.io/paradigmxyz/reth:v1.0.6" volumes: - type: bind source: ./volumes/reth/data diff --git a/docker-compose.yml b/docker-compose.yml index 7751c99d68a7..1e3a273ec9a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.2' services: reth: restart: always - image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2" + image: "ghcr.io/paradigmxyz/reth:v1.0.6" ports: - 127.0.0.1:8545:8545 volumes: From d0b5f7fe9fb39aa049096c7356242758dd628764 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Thu, 5 Sep 2024 09:52:28 +0300 Subject: [PATCH 2/5] Enable extended tracing for HTTP server --- core/bin/zksync_server/src/node_builder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index 36ee7d990cf9..e2a0c5846b5d 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -364,6 +364,7 @@ impl MainNodeBuilder { subscriptions_limit: Some(rpc_config.subscriptions_limit()), batch_request_size_limit: Some(rpc_config.max_batch_request_size()), response_body_size_limit: Some(rpc_config.max_response_body_size()), + with_extended_tracing: rpc_config.extended_api_tracing, ..Default::default() }; self.node.add_layer(Web3ServerLayer::http( From 95dc84965a209aa5746e04e587009cf5816b5e8f Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Thu, 5 Sep 2024 14:16:15 +0300 Subject: [PATCH 3/5] Fix missing / unnecessary `await`s --- .../ts-integration/tests/api/web3.test.ts | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/core/tests/ts-integration/tests/api/web3.test.ts b/core/tests/ts-integration/tests/api/web3.test.ts index b20e9d1e37d3..251f2ee85964 100644 --- a/core/tests/ts-integration/tests/api/web3.test.ts +++ b/core/tests/ts-integration/tests/api/web3.test.ts @@ -202,7 +202,7 @@ describe('web3 API compatibility tests', () => { test('Should test web3 response extensions', async () => { if (testMaster.isFastMode()) { - // This test requires a new L1 batch to be created, which may be very time consuming on stage. + // This test requires a new L1 batch to be created, which may be very time-consuming on stage. return; } @@ -333,7 +333,7 @@ describe('web3 API compatibility tests', () => { // Pubsub notifier is not reactive + tests are being run in parallel, so we can't expect that the next block // would be expected one. Instead, we just want to receive an event with the particular block number. - wsProvider.on('block', (block) => { + await wsProvider.on('block', (block) => { if (block >= currentBlock) { newBlock = block; } @@ -355,7 +355,6 @@ describe('web3 API compatibility tests', () => { // ...though the gap should not be *too* big. expect(newBlock).toBeLessThan(currentBlock + 100); await tx.wait(); // To not leave a hanging promise. - wsProvider.removeAllListeners(); await wsProvider.destroy(); }); @@ -368,7 +367,7 @@ describe('web3 API compatibility tests', () => { let newTxHash: string | null = null; // We can't use `once` as there may be other pending txs sent together with our one. - wsProvider.on('pending', async (txHash) => { + await wsProvider.on('pending', async (txHash) => { const tx = await alice.provider.getTransaction(txHash); // We're waiting for the exact transaction to appear. if (!tx || tx.to != uniqueRecipient) { @@ -392,7 +391,6 @@ describe('web3 API compatibility tests', () => { expect(newTxHash as string).toEqual(tx.hash); await tx.wait(); // To not leave a hanging promise. - wsProvider.removeAllListeners(); await wsProvider.destroy(); }); @@ -404,7 +402,7 @@ describe('web3 API compatibility tests', () => { // We're sending a few transfers from the wallet, so we'll use a new account to make event unique. let uniqueRecipient = testMaster.newEmptyAccount().address; - // Setup a filter for an ERC20 transfer. + // Set up a filter for an ERC20 transfer. const erc20TransferTopic = ethers.id('Transfer(address,address,uint256)'); let filter = { address: l2Token, @@ -414,15 +412,15 @@ describe('web3 API compatibility tests', () => { ethers.zeroPadValue(uniqueRecipient, 32) // Recipient ] }; - wsProvider.once(filter, (event) => { + await wsProvider.once(filter, (event) => { newEvent = event; }); - // Setup a filter that should not match anything. + // Set up a filter that should not match anything. let incorrectFilter = { address: alice.address }; - wsProvider.once(incorrectFilter, (_) => { + await wsProvider.once(incorrectFilter, (_) => { expect(null).fail('Found log for incorrect filter'); }); @@ -439,7 +437,6 @@ describe('web3 API compatibility tests', () => { expect((newEvent as any).transactionHash).toEqual(tx.hash); await tx.wait(); // To not leave a hanging promise. - wsProvider.removeAllListeners(); await wsProvider.destroy(); }); @@ -608,7 +605,7 @@ describe('web3 API compatibility tests', () => { // Pubsub notify is not reactive and may be laggy, so we want to increase the chances // for test to pass. So we try to sleep a few iterations until we receive expected amount - // of events. If we won't receive them, we continue and the test will fail anyway. + // of events. If we don't receive them, we continue and the test will fail anyway. const expectedTrivialEventsCount = 2; const expectedSimpleEventsCount = 2; const expectedIndexedEventsCount = 1; @@ -697,12 +694,11 @@ describe('web3 API compatibility tests', () => { // There are around `0.5 * maxLogsLimit` logs in [tx1Receipt.blockNumber, tx1Receipt.blockNumber] range, // so query with such filter should succeed. - await expect( - alice.provider.getLogs({ - fromBlock: tx1Receipt.blockNumber, - toBlock: tx1Receipt.blockNumber - }) - ).resolves; + const logs = await alice.provider.getLogs({ + fromBlock: tx1Receipt.blockNumber, + toBlock: tx1Receipt.blockNumber + }); + expect(logs.length).toBeGreaterThanOrEqual(maxLogsLimit / 2); // There are at least `1.5 * maxLogsLimit` logs in [tx1Receipt.blockNumber, tx3Receipt.blockNumber] range, // so query with such filter should fail. @@ -716,7 +712,7 @@ describe('web3 API compatibility tests', () => { test('Should throw error for estimate gas for account with balance < tx.value', async () => { let poorBob = testMaster.newEmptyAccount(); - expect( + await expect( poorBob.estimateGas({ value: 1, to: alice.address }) ).toBeRejected(/*'insufficient balance for transfer'*/); }); @@ -860,7 +856,7 @@ describe('web3 API compatibility tests', () => { const getLogsByHash = (await alice.provider.getLogs({ blockHash: latestBlock.hash || undefined })).map((x) => { return new zksync.types.Log({ ...x, l1BatchNumber: 0 }, alice.provider); // Set bogus value. }); - await expect(getLogsByNumber).toEqual(getLogsByHash); + expect(getLogsByNumber).toEqual(getLogsByHash); // Check that incorrect queries are rejected. await expect( @@ -1030,7 +1026,7 @@ describe('web3 API compatibility tests', () => { const incrementFunctionData = contract2.interface.encodeFunctionData('increment', [1]); // Assert that the estimation fails because the increment function is not present in contract1 - expect( + await expect( alice.provider.estimateGas({ to: contract1Address.toString(), data: incrementFunctionData From c2f78445826e6e20bdfed2222343809a91c61199 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Thu, 5 Sep 2024 14:29:06 +0300 Subject: [PATCH 4/5] Add logs for upgrade test --- core/tests/upgrade-test/tests/upgrade.test.ts | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/core/tests/upgrade-test/tests/upgrade.test.ts b/core/tests/upgrade-test/tests/upgrade.test.ts index ffa28e4f1099..0f70e751b844 100644 --- a/core/tests/upgrade-test/tests/upgrade.test.ts +++ b/core/tests/upgrade-test/tests/upgrade.test.ts @@ -280,9 +280,11 @@ describe('Upgrade test', function () { ); executeOperation = chainUpgradeCalldata; + console.log('Sending scheduleTransparentOperation'); await sendGovernanceOperation(stmUpgradeData.scheduleTransparentOperation); + console.log('Sending executeOperation'); await sendGovernanceOperation(stmUpgradeData.executeOperation); - + console.log('Sending chain admin operation'); await sendChainAdminOperation(setTimestampCalldata); // Wait for server to process L1 event. @@ -371,23 +373,25 @@ describe('Upgrade test', function () { }); async function sendGovernanceOperation(data: string) { - await ( - await ecosystemGovWallet.sendTransaction({ - to: await governanceContract.getAddress(), - data: data, - type: 0 - }) - ).wait(); + const transaction = await ecosystemGovWallet.sendTransaction({ + to: await governanceContract.getAddress(), + data: data, + type: 0 + }); + console.log(`Sent governance operation, tx_hash=${transaction.hash}, nonce=${transaction.nonce}`); + await transaction.wait(); + console.log(`Governance operation succeeded, tx_hash=${transaction.hash}`); } async function sendChainAdminOperation(data: string) { - await ( - await adminGovWallet.sendTransaction({ - to: await chainAdminContract.getAddress(), - data: data, - type: 0 - }) - ).wait(); + const transaction = await adminGovWallet.sendTransaction({ + to: await chainAdminContract.getAddress(), + data: data, + type: 0 + }); + console.log(`Sent chain admin operation, tx_hash=${transaction.hash}, nonce=${transaction.nonce}`); + await transaction.wait(); + console.log(`Chain admin operation succeeded, tx_hash=${transaction.hash}`); } }); From 1f28c385d5a2bdd0e2edc9f22a77b1c1e8a5c88e Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Thu, 5 Sep 2024 15:25:11 +0300 Subject: [PATCH 5/5] Remove fundamentally error-prone test --- .../ts-integration/tests/api/web3.test.ts | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/core/tests/ts-integration/tests/api/web3.test.ts b/core/tests/ts-integration/tests/api/web3.test.ts index 251f2ee85964..79789e744471 100644 --- a/core/tests/ts-integration/tests/api/web3.test.ts +++ b/core/tests/ts-integration/tests/api/web3.test.ts @@ -678,38 +678,6 @@ describe('web3 API compatibility tests', () => { ).resolves.toHaveProperty('result', expect.stringMatching(HEX_VALUE_REGEX)); }); - test('Should check API returns error when there are too many logs in eth_getLogs', async () => { - const contract = await deployContract(alice, contracts.events, []); - const maxLogsLimit = testMaster.environment().maxLogsLimit; - - // Send 3 transactions that emit `maxLogsLimit / 2` events. - const tx1 = await contract.emitManyEvents(maxLogsLimit / 2); - const tx1Receipt = await tx1.wait(); - - const tx2 = await contract.emitManyEvents(maxLogsLimit / 2); - await tx2.wait(); - - const tx3 = await contract.emitManyEvents(maxLogsLimit / 2); - const tx3Receipt = await tx3.wait(); - - // There are around `0.5 * maxLogsLimit` logs in [tx1Receipt.blockNumber, tx1Receipt.blockNumber] range, - // so query with such filter should succeed. - const logs = await alice.provider.getLogs({ - fromBlock: tx1Receipt.blockNumber, - toBlock: tx1Receipt.blockNumber - }); - expect(logs.length).toBeGreaterThanOrEqual(maxLogsLimit / 2); - - // There are at least `1.5 * maxLogsLimit` logs in [tx1Receipt.blockNumber, tx3Receipt.blockNumber] range, - // so query with such filter should fail. - await expect( - alice.provider.getLogs({ - fromBlock: tx1Receipt.blockNumber, - toBlock: tx3Receipt.blockNumber - }) - ).rejects.toThrow(`Query returned more than ${maxLogsLimit} results.`); - }); - test('Should throw error for estimate gas for account with balance < tx.value', async () => { let poorBob = testMaster.newEmptyAccount(); await expect(