Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e): test viem.js and ethers.js clients #860

Merged
merged 38 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8449660
Setup docker
sebastijankuzner Feb 11, 2025
59fdc72
Install dependencies
sebastijankuzner Feb 11, 2025
fcfbba4
Local client
sebastijankuzner Feb 11, 2025
3e12a31
Web3 client
sebastijankuzner Feb 11, 2025
d62f33e
Ethers client
sebastijankuzner Feb 11, 2025
9853c2e
ViemClient
sebastijankuzner Feb 11, 2025
c6c8c66
Rename tests
sebastijankuzner Feb 11, 2025
13b278b
Get block
sebastijankuzner Feb 11, 2025
c8c4634
Extract compare blocks
sebastijankuzner Feb 11, 2025
cb1e3ae
Set tagOrNumber
sebastijankuzner Feb 11, 2025
9f26e1b
Compare genesis block
sebastijankuzner Feb 11, 2025
57e020c
Remove web3
sebastijankuzner Feb 11, 2025
45c7158
GetTransaction
sebastijankuzner Feb 11, 2025
b6a8be6
Extend transaction resource
sebastijankuzner Feb 11, 2025
7d49a27
Compare transactions
sebastijankuzner Feb 11, 2025
e08959c
Test getTransactionByBlockNumberAndIndex
sebastijankuzner Feb 12, 2025
51eb37c
Merge branch 'develop' into test/e2e/clients
sebastijankuzner Feb 12, 2025
ae76f1d
Get balance
sebastijankuzner Feb 12, 2025
058f836
Get nonce
sebastijankuzner Feb 12, 2025
8bced30
Get code
sebastijankuzner Feb 12, 2025
ed09ec2
Get chainId
sebastijankuzner Feb 12, 2025
9b1bb7e
Return filled logBloom
sebastijankuzner Feb 12, 2025
58f19dc
Get receipt
sebastijankuzner Feb 12, 2025
28580c2
Get storageAt
sebastijankuzner Feb 12, 2025
db8cc12
Remove unused deps
sebastijankuzner Feb 12, 2025
7c21f46
Call
sebastijankuzner Feb 12, 2025
bb66b7f
Merge branch 'develop' into test/e2e/clients
sebastijankuzner Feb 13, 2025
81ddb4f
Resolve private key
sebastijankuzner Feb 13, 2025
9586ffd
Merge branch 'develop' into test/e2e/clients
sebastijankuzner Feb 13, 2025
8e1b73f
Prepare serialized transaction
sebastijankuzner Feb 13, 2025
c36922e
Send and check tx
sebastijankuzner Feb 13, 2025
68df412
Add workflow
sebastijankuzner Feb 13, 2025
4ee46ba
Open on location and log
sebastijankuzner Feb 14, 2025
3b3a683
Rename test
sebastijankuzner Feb 14, 2025
b603211
Increase timeout
sebastijankuzner Feb 14, 2025
abc45a0
Run tests from correct location
sebastijankuzner Feb 14, 2025
2e2afdb
Use correct node version
sebastijankuzner Feb 14, 2025
83778de
Cleanup
sebastijankuzner Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ jobs:
- name: Test api-http
run: cd packages/api-http && pnpm run test:integration

e2e:
e2e-consensus:
name: "E2E Consensus"
needs:
- build
concurrency:
Expand Down Expand Up @@ -362,3 +363,62 @@ jobs:
- name: Show logs - node4
if: always()
run: docker logs consensus-node4-1

e2e-clients:
name: "E2E Clients"
needs:
- build
concurrency:
cancel-in-progress: true
group: ${{ github.head_ref }}-e2e-${{ matrix.name }}
runs-on: ubuntu-latest

timeout-minutes: 10

strategy:
matrix:
node-version: [20.x]
name: ["clients"]

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
version: latest
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pnpm modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Cache lerna
uses: actions/cache@v4
with:
key: lerna-${{ runner.os }}
path: ./.cache
restore-keys: lerna-${{ runner.os }}-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build

- name: Docker Up
run: cd tests/e2e/clients && docker compose up -d
- name: Delay
run: sleep 20
- name: Running checks for ${{ matrix.name }}
run: cd tests/e2e/clients && pnpm run test
- name: Show logs
if: always()
run: docker logs mainsail
2 changes: 1 addition & 1 deletion packages/api-evm/source/resources/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class BlockResource {
transactionsRoot: `0x${blockData.stateHash}`,
stateRoot: `0x${blockData.stateHash}`,
receiptsRoot: `0x${blockData.stateHash}`,
miner: blockData.generatorAddress,
miner: blockData.generatorAddress.toLowerCase(),
difficulty: "0x0",
totalDifficulty: "0x0",
baseFeePerGas: "0x0",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-evm/source/resources/receipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ReceiptResource {
gasUsed: `0x${receipt.gasUsed.toString(16)}`,
contractAddress: receipt.deployedContractAddress,
logs: receipt.logs,
logsBloom: "", // TODO: Implement logs bloom
logsBloom: `0x${"0".repeat(128)}`, // TODO: Implement logs bloom
type: "0x2",
status: receipt.success ? "0x1" : "0x0",
};
Expand Down
4 changes: 4 additions & 0 deletions packages/api-evm/source/resources/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ export class TransactionResource {
return {
blockHash: `0x${transaction.blockId}`,
blockNumber: `0x${transaction.blockHeight?.toString(16)}`,
chainId: `0x${transaction.network.toString(16)}`,
from: transaction.senderAddress,
gas: `0x${transaction.gasLimit.toString(16)}`,
gasPrice: `0x${transaction.gasPrice.toString(16)}`,
hash: `0x${transaction.id}`,
input: `0x${transaction.data}`,
maxPriorityFeePerGas: `0x0`,
maxFeePerGas: `0x${transaction.gasPrice.toString(16)}`,
nonce: `0x${transaction.nonce.toString(16)}`,
// eslint-disable-next-line unicorn/no-null
to: transaction.recipientAddress || null,
transactionIndex: `0x${transaction.sequence?.toString(16)}`,
value: `0x${transaction.value.toString(16)}`,
type: `0x2`,
v: `0x${transaction.v}`,
r: `0x${transaction.r}`,
s: `0x${transaction.s}`,
Expand Down
Loading
Loading