From acb028cffeee50f603a7a257833857e668b94087 Mon Sep 17 00:00:00 2001 From: 0xtzData Date: Wed, 27 Mar 2024 13:59:07 +0100 Subject: [PATCH] fix rollup checks --- tests/e2e/pages/RollupTxnBatchesZKEvm.ts | 14 +++++++------- tests/e2e/test_rpc.mjs | 21 ++++++++++++++++----- tests/e2e/tests/functional/Rollup.test.ts | 2 +- tests/load/README.md | 8 +++++++- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/tests/e2e/pages/RollupTxnBatchesZKEvm.ts b/tests/e2e/pages/RollupTxnBatchesZKEvm.ts index 476b6a38..eceb422c 100644 --- a/tests/e2e/pages/RollupTxnBatchesZKEvm.ts +++ b/tests/e2e/pages/RollupTxnBatchesZKEvm.ts @@ -18,20 +18,20 @@ export class RollupTxnBatchesPageZKEvm extends HomeRollupZKEvm { await this.actions.navigateToURL(`${this.l2URL()}batches`) } - async validateTable(ctx: BrowserContext): Promise { - await this.clickTableRowCol(4, 0, `a`) + async validateTable(ctx: BrowserContext, rowNum: number): Promise { + await this.clickTableRowCol(rowNum, 0, `a`) expect(this.page.url()).toContain(this.l2URL()) await this.open() - await this.actions.verifyElementIsDisplayed(`table >> tr >> nth=4 >> td >> nth=1 >> text=/L1 Sequence Confirmed/`) - await this.actions.verifyElementIsDisplayed(`table >> tr >> nth=4 >> td >> nth=2 >> text=/.*go/`) - await this.clickTableRowCol(4, 3, `a`) + await this.actions.verifyElementIsDisplayed(`table >> tr >> nth=${rowNum} >> td >> nth=1 >> text=/L1 Sequence Confirmed/`) + await this.actions.verifyElementIsDisplayed(`table >> tr >> nth=${rowNum} >> td >> nth=2 >> text=/.*go/`) + await this.clickTableRowCol(rowNum, 3, `a`) expect(this.page.url()).toContain(this.l2URL()) await this.open() - await this.actions.verifyElementIsDisplayed(`table >> tr >> nth=4 >> td >> nth=4 >> text=/\\w+/`) + await this.actions.verifyElementIsDisplayed(`table >> tr >> nth=${rowNum} >> td >> nth=4 >> text=/\\w+/`) - const txPageL1 = await this.openLinkNewPage(ctx, () => this.clickTableRowCol(4, 5, `a`)) + const txPageL1 = await this.openLinkNewPage(ctx, () => this.clickTableRowCol(rowNum, 5, `a`)) expect(txPageL1.url()).toContain(this.l1URL()) } } diff --git a/tests/e2e/test_rpc.mjs b/tests/e2e/test_rpc.mjs index 1c85152d..1ef69387 100644 --- a/tests/e2e/test_rpc.mjs +++ b/tests/e2e/test_rpc.mjs @@ -115,8 +115,9 @@ async function checkEthGetLogs(addr, from, to) { const filter = { address: addr, fromBlock: from, - toBlock: to, + toBlock: to, }; + console.log(`from: ${from}, to: ${to}`) const data = await provider.getLogs(filter) console.log(chalk.yellow(`GetLogs API result: ${JSON.stringify(data)}`)) for (const field of [`blockNumber`, `blockHash`, `transactionIndex`, `removed`, `address`, `data`, `topics`, `transactionHash`, `logIndex`]) { @@ -203,12 +204,22 @@ async function findAllAddresses(bs, bn) { return addresses } -const addrs = await findAllAddresses(1, 34) -console.log(`addresses: ${JSON.stringify(addrs)}`) -for (let addr of addrs) { - await checkEthGetLogs(addr, 1, 34) + +async function scanBlocks(from, to) { + const addrs = await findAllAddresses(from, to) + console.log(`addresses: ${JSON.stringify(addrs)}`) + for (let addr of addrs) { + await checkEthGetLogs(addr, from, to) + } } +// txpool_content + +// curl -X POST -H "Content-Type: application/json" \ +// --data '{"jsonrpc":"2.0", "id":2, "method": "debug_traceBlockByHash", "params": ["0x794367b0292ff04e182ee76ce1a07caffdd533490f4c652d14dc34b40aa14079"] }' \ +// "https://rpc-testnet.cyclenetwork.io" + +// await scanBlocks(30, 31) // await checkEthBlockNumber() // const blockInfo = await checkEthGetBlockByNumberOrHash(staticBn) // await checkEthGetBlockByNumberOrHash(blockInfo.hash) diff --git a/tests/e2e/tests/functional/Rollup.test.ts b/tests/e2e/tests/functional/Rollup.test.ts index 80df296a..3d88c425 100644 --- a/tests/e2e/tests/functional/Rollup.test.ts +++ b/tests/e2e/tests/functional/Rollup.test.ts @@ -24,7 +24,7 @@ test(`@Rollup Txn batches table verification`, async ({ context, newRollupTxnBat test(`@Rollup Txn batches table verification (ZKEVM)`, async ({ context, newRollupTxnBatchesZKEvm }) => { await newRollupTxnBatchesZKEvm.open() - await newRollupTxnBatchesZKEvm.validateTable(context) + await newRollupTxnBatchesZKEvm.validateTable(context, 7) }) test(`@Rollup Output roots table verification`, async ({ context, newRollupOutputRoots }) => { diff --git a/tests/load/README.md b/tests/load/README.md index 87e7c437..f7094952 100644 --- a/tests/load/README.md +++ b/tests/load/README.md @@ -10,6 +10,12 @@ npm install Build `xk6` binary for your platform ``` xk6 build --with github.com/grafana/xk6-output-timescaledb + +or + +docker run --rm -it -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build v0.43.1 \ + --with github.com/avitalique/xk6-file@latest \ + --with github.com/grafana/xk6-output-timescaledb ``` ## Run @@ -28,7 +34,7 @@ Check the [manual](./dashboards/README.md) Feel free to use `console.debug` or `console.warn` methods, all the logs are aggregated to `Loki` , for more info visit [k6 docs](https://k6.io/docs/cloud/analyzing-results/logs/) -## Writing own tests +## Writing the tests Rules for writing tests are simple: - The test code is located in `src` folder