Skip to content

Commit

Permalink
feat: use hardhat in v3 tests, kapi image
Browse files Browse the repository at this point in the history
  • Loading branch information
Amuhar committed Oct 24, 2024
1 parent 9232ceb commit 926a294
Show file tree
Hide file tree
Showing 31 changed files with 18,930 additions and 2,577 deletions.
10 changes: 10 additions & 0 deletions Dockerfile.hardhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:18.14.2

WORKDIR /app

COPY hardhat.config.ts ./hardhat.config.ts

RUN npm install -g hardhat


CMD ["npx", "hardhat", "node"]
65 changes: 65 additions & 0 deletions docker-compose.e2e-v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
version: '3.7'

services:
e2e_pgdb:
container_name: e2e_pgdb
image: postgres:14-alpine
restart: unless-stopped
environment:
- POSTGRES_DB=node_operator_keys_service_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
expose:
- "5432:5432"
ports:
- "5433:5432"
volumes:
- ./.volumes/pgdata-17000/:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

hardhat_node:
container_name: hardhat_node
build:
context: .
dockerfile: Dockerfile.hardhat.yml
ports:
- "8545:8545"
environment:
- FORK_URL=${FORK_URL}
- FORK_BLOCK=${FORK_BLOCK}
- WALLET_PRIVATE_KEY=${WALLET_PRIVATE_KEY}
volumes:
- .:/app
healthcheck:
test: ["CMD-SHELL", "curl -s http://127.0.0.1:8545 >/dev/null || exit 1"]
interval: 10s
retries: 10

e2e_keys_api:
container_name: e2e_keys_api
image: lidofinance/lido-keys-api:staging
command: ["yarn", "start:dev"]
platform: linux/amd64
environment:
- NODE_ENV=production
- DB_NAME=node_operator_keys_service_db
- DB_PORT=5432
- DB_HOST=e2e_pgdb
- DB_USER=postgres
- DB_PASSWORD=postgres
- PROVIDERS_URLS=http://hardhat_node:8545
- VALIDATOR_REGISTRY_ENABLE=false
- CHAIN_ID=17000
- CL_API_URLS=""
depends_on:
e2e_pgdb:
condition: service_healthy
ports:
- "3000:3000"

links:
- e2e_pgdb
33 changes: 33 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { HardhatUserConfig } from 'hardhat/config';
import * as dotenv from 'dotenv';
dotenv.config();
// for v3 version
export const FORK_BLOCK = 2038357;

// TODO: add check that RPC_URL is for holesky
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const RPC_URL = process.env.FORK_URL!;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const secretKey = process.env.WALLET_PRIVATE_KEY!;

const config: HardhatUserConfig = {
networks: {
hardhat: {
forking: {
url: RPC_URL,
// use latest
blockNumber: FORK_BLOCK,
},
chainId: 17000,
accounts: [
{
privateKey: secretKey,
balance: (BigInt(1e18) * BigInt(100)).toString(),
},
],
},
},
solidity: '0.8.4',
};

export default config;
Loading

0 comments on commit 926a294

Please sign in to comment.