Skip to content

Commit

Permalink
Merge pull request ensdomains#603 from ensdomains/viem-test
Browse files Browse the repository at this point in the history
  • Loading branch information
TateB authored Mar 14, 2024
2 parents ea18938 + fc8d36e commit d4fb64c
Show file tree
Hide file tree
Showing 730 changed files with 36,844 additions and 30,221 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ NETWORK=mainnet
ARCHIVE_URL=https://storage.googleapis.com/ens-manager-build-data

TRANSACTION_WAIT_TIME=5000
STABLE_MODE=500
STABLE_MODE=500
BATCH_GATEWAY_URLS='["https://ccip-v2.ens.xyz/"]'
27 changes: 16 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,31 @@
"prettier",
"plugin:prettier/recommended"
],
"plugins": ["testing-library", "@typescript-eslint", "prettier", "jest"],
"plugins": ["testing-library", "@typescript-eslint", "prettier", "vitest"],
"parser": "@typescript-eslint/parser",
"overrides": [
{
"files": ["src/**/*.test.[jt]sx?"],
"env": { "jest/globals": true },
"globals": {
"context": "readonly"
},
"plugins": ["jest"],
"extends": ["plugin:jest/recommended"],
"rules": {
"jest/expect-expect": "off"
"plugins": ["vitest"],
"extends": ["plugin:vitest/recommended"]
},
{
"files": ["functions/**/*"],
"parserOptions": {
"project": "./functions/tsconfig.json"
}
}
],
"parserOptions": {
"project": "./tsconfig.json"
},
"ignorePatterns": ["next.config.js", "jest.config.js", "deploy/**/*", "src/**/*.test.tsx", "src/**/*.test.ts"],
"ignorePatterns": [
"next.config.js",
"deploy/**/*",
"src/**/*.test.tsx",
"src/**/*.test.ts",
"playwright/**/*.ts"
],
"rules": {
"react/react-in-jsx-scope": "off",
"react/jsx-props-no-spreading": "off",
Expand All @@ -51,7 +56,7 @@
{
"selector": "*[value=/\\b(0x)?[a-f0-9]{64}\\b/i]",
"message": "No private keys allowed"
}
}
],
"prettier/prettier": "error",
"import/prefer-default-export": "off",
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/pages-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Misc. Deps
run: sudo apt-get install -y libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++

- name: Check Yalc
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' }}
run: if [ ${{ needs.yalc_check.outputs.can_deploy }} != true ]; then exit 1; else exit 0; fi

- uses: pnpm/[email protected]
with:
version: 7.8.0
version: 8.11.0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
Expand All @@ -70,6 +73,7 @@ jobs:
projectName: ens-app-v3
directory: out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: '3'

- name: Submit sitemap
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@ jobs:

- uses: pnpm/[email protected]
with:
version: 7.8.0
version: 8.11.0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- run: pnpm install --frozen-lockfile

- name: Get contract addresses
run: 'parallel --lb --halt now,success=1,fail=1 ::: \
"pnpm tenv start -ng -ns -nb" \
"pnpm wait-on ./.env.local"'

- run: pnpm test:coverage

build-stateless:
Expand All @@ -32,12 +37,12 @@ jobs:

- uses: pnpm/[email protected]
with:
version: 7.8.0
version: 8.11.0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
Expand Down Expand Up @@ -66,12 +71,12 @@ jobs:

- uses: pnpm/[email protected]
with:
version: 7.8.0
version: 8.11.0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
Expand All @@ -95,18 +100,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
steps:
- uses: actions/checkout@v3

- uses: pnpm/[email protected]
with:
version: 7.8.0
version: 8.11.0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
Expand All @@ -127,7 +132,7 @@ jobs:

- name: Run tests
run: |
PLAYWRIGHT_SHARD=${{matrix.shard}} PLAYWRIGHT_TOTAL=${{strategy.job-total}} pnpm e2e:ci -nb
PLAYWRIGHT_SHARD=${{matrix.shard}} PLAYWRIGHT_TOTAL=${{strategy.job-total}} pnpm e2e:ci -nb
- uses: actions/upload-artifact@v3
if: always()
Expand All @@ -151,12 +156,12 @@ jobs:

- uses: pnpm/[email protected]
with:
version: 7.8.0
version: 8.11.0

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
Expand All @@ -179,7 +184,7 @@ jobs:
run: |
parallel --lb --halt now,success=1,fail=1 ::: \
"pnpm wrangle" \
"pnpm wait-on http://localhost:8788 && npx playwright test --shard=${{matrix.shard}}/${{strategy.job-total}} --project=stateful"
"pnpm wait-on http://127.0.0.1:8788 && npx playwright test --shard=${{matrix.shard}}/${{strategy.job-total}} --project=stateful"
env:
NEXT_PUBLIC_GRAPH_URI: https://api.thegraph.com/subgraphs/name/tateb/enssubdomaincount
SECRET_WORDS: ${{ secrets.SECRET_WORDS }}
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ tsconfig.tsbuildinfo
!.yarn/sdks
!.yarn/versions

# wrangler
.wrangler/

# jest coverage
/coverage

Expand All @@ -64,8 +67,11 @@ tsconfig.tsbuildinfo
# hardhat
/cache
/artifacts
/typings-custom/generated

# Sentry
.sentryclirc

.dev.vars
.dev.vars

*yalc*
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint && git add package.json
# pnpm lint && git add package.json
16 changes: 12 additions & 4 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"importOrder": ["@app/test-utils", "<THIRD_PARTY_MODULES>", "^@ensdomains/(.*)$", "^@app/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"]
"importOrder": [
"@app/test-utils",
"",
"<THIRD_PARTY_MODULES>",
"",
"^@ensdomains/(.*)$",
"",
"^@app/(.*)$",
"",
"^[./]"
],
"plugins": ["@ianvs/prettier-plugin-sort-imports"]
}
8 changes: 5 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"**/.yarn": true,
"**/.pnp.*": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
Expand All @@ -13,9 +13,11 @@
"stylelint.configFile": ".stylelintrc.json",
"stylelint.validate": ["css", "typescriptreact"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.prettierPath": "node_modules/prettier/index.js",
"prettier.prettierPath": "./node_modules/prettier/index.cjs",
"prettier.configPath": "./.prettierrc.json",
"[svg]": {
"editor.defaultFormatter": "jock.svg"
},
"jest.jestCommandLine": "pnpm run test"
"jest.jestCommandLine": "pnpm run test",
"cSpell.words": ["ensjs"]
}
1 change: 0 additions & 1 deletion __mocks__/fileMock.js

This file was deleted.

5 changes: 0 additions & 5 deletions __mocks__/rainbowkitMock.js

This file was deleted.

4 changes: 0 additions & 4 deletions __mocks__/styleMock.js

This file was deleted.

15 changes: 0 additions & 15 deletions __mocks__/svgMock.tsx

This file was deleted.

Binary file modified archive.tar.lz4
Binary file not shown.
17 changes: 0 additions & 17 deletions custom-test-env.js

This file was deleted.

7 changes: 3 additions & 4 deletions deploy/00_deploy_bulk_renewal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { Interface } from '@ethersproject/abi'
import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'

import { namehash } from '@ensdomains/ensjs/utils/normalise'
import { namehash } from 'viem'

const { makeInterfaceId } = require('@openzeppelin/test-helpers')

function computeInterfaceId(iface: Interface) {
function computeInterfaceId(iface: any): any {
return makeInterfaceId.ERC165(
Object.values(iface.functions).map((frag) => frag.format('sighash')),
Object.values(iface.functions).map((frag: any) => frag.format('sighash')),
)
}

Expand Down
2 changes: 1 addition & 1 deletion deploy/00_get_registration_gas_values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'

import { namehash } from '@ensdomains/ensjs/utils/normalise'
import { namehash } from 'viem'

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (!hre.network.tags.generate) {
Expand Down
3 changes: 1 addition & 2 deletions deploy/00_legacy_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'

import { labelhash } from '@ensdomains/ensjs/utils/labels'
import { namehash } from '@ensdomains/ensjs/utils/normalise'
import { namehash, labelhash } from 'viem'

const ZERO_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000'

Expand Down
2 changes: 1 addition & 1 deletion deploy/00_migrate_legacy_records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'

import { namehash } from '@ensdomains/ensjs/utils/normalise'
import { namehash } from 'viem'

const names = [
{
Expand Down
2 changes: 1 addition & 1 deletion deploy/00_register_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'

import { namehash } from '@ensdomains/ensjs/utils/normalise'
import { namehash } from 'viem'

const names = [
{
Expand Down
Loading

0 comments on commit d4fb64c

Please sign in to comment.