Skip to content

Commit

Permalink
fix rollup checks
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtzData committed Mar 27, 2024
1 parent b549c3a commit acb028c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
14 changes: 7 additions & 7 deletions tests/e2e/pages/RollupTxnBatchesZKEvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ export class RollupTxnBatchesPageZKEvm extends HomeRollupZKEvm {
await this.actions.navigateToURL(`${this.l2URL()}batches`)
}

async validateTable(ctx: BrowserContext): Promise<void> {
await this.clickTableRowCol(4, 0, `a`)
async validateTable(ctx: BrowserContext, rowNum: number): Promise<void> {
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())
}
}
21 changes: 16 additions & 5 deletions tests/e2e/test_rpc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]) {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/functional/Rollup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
8 changes: 7 additions & 1 deletion tests/load/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit acb028c

Please sign in to comment.