Skip to content

Commit

Permalink
Merge branch 'main' into fix-custom-resolver-namewrapper-aware-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Feb 5, 2025
2 parents 5582910 + 16c6fab commit caa9568
Show file tree
Hide file tree
Showing 52 changed files with 2,593 additions and 2,355 deletions.
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.yarn/**/* linguist-generated -diff
.yalc/**/* linguist-generated -diff
.pnp.cjs text linguist-generated -diff
.pnp.loader.mjs text linguist-generated -diff
yarn.lock text linguist-generated -diff
yalc.lock text linguist-generated -diff
*.lock text linguist-generated -diff

# Archives
Expand Down
21 changes: 1 addition & 20 deletions .github/workflows/pages-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,14 @@ name: Cloudflare Pages
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NEXT_PUBLIC_INTERCOM_ID: re9q5yti
NEXT_PUBLIC_DRPC_KEY: ${{ github.ref == 'refs/heads/main' && AnmpasF2C0JBqeAEzxVO8aTteiMlrW4R75hpDonbV6cR || '' }}
NEXT_PUBLIC_DRPC_KEY: AnmpasF2C0JBqeAEzxVO8aTteiMlrW4R75hpDonbV6cR

on: [push]
jobs:
yalc_check:
runs-on: ubuntu-latest
outputs:
can_deploy: ${{ steps.has_yalc.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Yalc
run: npm i -g yalc

- id: has_yalc
run: |
! yalc check | grep -qe .

deploy:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [yalc_check]
permissions:
contents: read
deployments: write
Expand All @@ -36,10 +21,6 @@ jobs:
- 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

- name: Install pnpm
run: corepack enable pnpm

Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: tar -cvf stateless-build.tar out

- name: Upload stateless
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: stateless-build
path: stateless-build.tar
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
run: tar -cvf stateful-build.tar out

- name: Upload stateful
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: stateful-build
path: stateful-build.tar
Expand Down Expand Up @@ -116,9 +116,10 @@ jobs:

- name: Download build
id: download
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: stateless-build
merge-multiple: true

- name: Untar files
run: tar -xvf stateless-build.tar
Expand All @@ -130,12 +131,13 @@ jobs:
run: |
PLAYWRIGHT_SHARD=${{matrix.shard}} PLAYWRIGHT_TOTAL=${{strategy.job-total}} pnpm e2e:ci -nb
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: stateless-report
name: stateless-report-${{matrix.shard}}
path: playwright-report/
retention-days: 30
overwrite: true

stateful:
name: stateful (${{matrix.shard}})
Expand Down Expand Up @@ -165,7 +167,7 @@ jobs:

- name: Download build
id: download
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: stateful-build

Expand All @@ -184,9 +186,9 @@ jobs:
# NEXT_PUBLIC_GRAPH_URI: https://api.studio.thegraph.com/query/49574/ensholesky/version/latest
SECRET_WORDS: ${{ secrets.SECRET_WORDS }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: stateful-report
name: stateful-report-${{matrix.shard}}
path: playwright-report/
retention-days: 30
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,3 @@ tsconfig.vitest-temp.json
.sentryclirc

.dev.vars

*yalc*
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.yalc
.next
node_modules
pnpm-lock.yaml
Expand Down
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,17 +469,10 @@ Cloudflare will automatically build and deploy a test site when pushed to a new

## External Package Local Development

1. Install yalc globally:
2. Link a local package:

```bash
npm i -g yalc
```

2. Run relevant update script within external repo, for example:

```bash
# Example publish script for ENSjs, be aware this may have changed.
pnpm publish:local:ensjs
pnpm link ../ensjs
```

3. Run pnpm install within this repo:
Expand All @@ -488,7 +481,6 @@ pnpm publish:local:ensjs
pnpm install
```

If updating an existing yalc installation, you can add the `--force` flag.

## Coding guidelines

Expand Down
6 changes: 3 additions & 3 deletions deploy/00_deploy_bulk_renewal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import { Interface } from '@ethersproject/abi'
import { utils } from 'ethers'
import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
Expand Down Expand Up @@ -49,15 +49,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log('Set interface implementor of eth tld for bulk renewal')
const tx2 = await resolver.setInterface(
ethers.utils.namehash('eth'),
computeInterfaceId(new Interface(bulkRenewal.abi)),
computeInterfaceId(new utils.Interface(bulkRenewal.abi)),
bulkRenewal.address,
)
await tx2.wait()

console.log('Set interface implementor of eth tld for registrar controller')
const tx3 = await resolver.setInterface(
ethers.utils.namehash('eth'),
computeInterfaceId(new Interface(controllerArtifact.abi)),
computeInterfaceId(new utils.Interface(controllerArtifact.abi)),
controller.address,
)
await tx3.wait()
Expand Down
40 changes: 36 additions & 4 deletions e2e/specs/stateless/createSubname.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ test('should allow creating a subname', async ({ page, makeName, login, makePage
})

const subnamesPage = makePageObject('SubnamesPage')
const recordsPage = makePageObject('RecordsPage')

await subnamesPage.goto(name)
await login.connect()
Expand All @@ -120,17 +121,30 @@ test('should allow creating a subname', async ({ page, makeName, login, makePage
await subnamesPage.getSubmitSubnameButton.click()
await subnamesPage.addMoreToProfileButton.click()
await page.getByTestId('profile-record-option-name').click()
await page.getByTestId('profile-record-option-description').click()
await page.getByTestId('add-profile-records-button').click()
await page
.getByTestId('profile-record-input-input-eth')
.fill('0x42D63ae25990889E35F215bC95884039Ba354115')
await page.getByTestId('profile-record-input-input-name').fill('Test Name')
await page
.getByTestId('profile-record-input-description')
.getByRole('textbox')
.fill('New profile')

await subnamesPage.getSubmitSubnameProfileButton.click()

const transactionModal = makePageObject('TransactionModal')
await transactionModal.autoComplete()

const subname = `test.${name}`
await subnamesPage.goto(subname)
await recordsPage.goto(subname)

await expect(page).toHaveURL(new RegExp(`/${subname}`), { timeout: 15000 })
await expect(recordsPage.getRecordValue('text', 'name')).toHaveText('Test Name')
await expect(recordsPage.getRecordValue('text', 'description')).toHaveText('New profile')
await expect(recordsPage.getRecordValue('address', 'eth')).toHaveText(
'0x42D63ae25990889E35F215bC95884039Ba354115',
)
})

test('should allow creating a subnames if the user is the wrapped owner', async ({
Expand All @@ -146,7 +160,7 @@ test('should allow creating a subnames if the user is the wrapped owner', async
type: 'wrapped',
})
const subnamesPage = makePageObject('SubnamesPage')

const recordsPage = makePageObject('RecordsPage')
await page.goto(`/${name}`)
await login.connect()

Expand All @@ -156,14 +170,32 @@ test('should allow creating a subnames if the user is the wrapped owner', async
await subnamesPage.getAddSubnameButton.click()
await subnamesPage.getAddSubnameInput.fill('test')
await subnamesPage.getSubmitSubnameButton.click()

await subnamesPage.addMoreToProfileButton.click()
await page.getByTestId('profile-record-option-name').click()
await page.getByTestId('profile-record-option-description').click()
await page.getByTestId('add-profile-records-button').click()
await page
.getByTestId('profile-record-input-input-eth')
.fill('0x42D63ae25990889E35F215bC95884039Ba354115')
await page.getByTestId('profile-record-input-input-name').fill('Test Name')
await page
.getByTestId('profile-record-input-description')
.getByRole('textbox')
.fill('New profile')
await subnamesPage.getSubmitSubnameProfileButton.click()

const transactionModal = makePageObject('TransactionModal')
await transactionModal.autoComplete()

const subname = `test.${name}`

await expect(page).toHaveURL(new RegExp(`/${subname}`), { timeout: 15000 })
await recordsPage.goto(subname)
await expect(recordsPage.getRecordValue('text', 'name')).toHaveText('Test Name')
await expect(recordsPage.getRecordValue('text', 'description')).toHaveText('New profile')
await expect(recordsPage.getRecordValue('address', 'eth')).toHaveText(
'0x42D63ae25990889E35F215bC95884039Ba354115',
)
})

test('should not allow adding a subname that already exists', async ({
Expand Down
73 changes: 69 additions & 4 deletions e2e/specs/stateless/extendNames.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test('should be able to extend multiple names (including names in grace preiod)
await transactionModal.autoComplete()

await expect(page.getByText('Your "Extend names" transaction was successful')).toBeVisible({
timeout: 10000,
timeout: 15000,
})
await subgraph.sync()

Expand Down Expand Up @@ -378,6 +378,10 @@ test('should be able to extend a name by a month', async ({
await test.step('should extend', async () => {
await extendNamesModal.getExtendButton.click()
const transactionModal = makePageObject('TransactionModal')

// Verify duration and new expiry display in transaction modal
await expect(page.getByText('1 month')).toBeVisible()

await transactionModal.autoComplete()

const newTimestamp = await profilePage.getExpiryTimestamp()
Expand Down Expand Up @@ -442,6 +446,10 @@ test('should be able to extend a name by a day', async ({
await test.step('should extend', async () => {
await extendNamesModal.getExtendButton.click()
const transactionModal = makePageObject('TransactionModal')

// Verify duration and new expiry display in transaction modal
await expect(page.getByText('1 day')).toBeVisible()

await transactionModal.autoComplete()

const newTimestamp = await profilePage.getExpiryTimestamp()
Expand Down Expand Up @@ -516,6 +524,10 @@ test('should be able to extend a name in grace period by a month', async ({
await test.step('should extend', async () => {
await extendNamesModal.getExtendButton.click()
const transactionModal = makePageObject('TransactionModal')

// Verify duration and new expiry display in transaction modal
await expect(page.getByText('1 month')).toBeVisible()

await transactionModal.autoComplete()

const newTimestamp = await profilePage.getExpiryTimestamp()
Expand Down Expand Up @@ -592,6 +604,10 @@ test('should be able to extend a name in grace period by 1 day', async ({
await test.step('should extend', async () => {
await extendNamesModal.getExtendButton.click()
const transactionModal = makePageObject('TransactionModal')

// Verify duration and new expiry display in transaction modal
await expect(page.getByText('1 day')).toBeVisible()

await transactionModal.autoComplete()

const newTimestamp = await profilePage.getExpiryTimestamp()
Expand All @@ -618,7 +634,7 @@ test('should be able to extend a single wrapped name using deep link', async ({
const homePage = makePageObject('HomePage')
await homePage.goto()
await login.connect()
await page.goto(`/${name}?renew`)
await page.goto(`/${name}?renew=123`)

const timestamp = await profilePage.getExpiryTimestamp()

Expand Down Expand Up @@ -664,7 +680,7 @@ test('should not be able to extend a name which is not registered', async ({
const homePage = makePageObject('HomePage')
await homePage.goto()
await login.connect()
await page.goto(`/${name}?renew`)
await page.goto(`/${name}?renew=123`)
await expect(page.getByRole('heading', { name: `Register ${name}` })).toBeVisible()
})

Expand All @@ -675,6 +691,55 @@ test('renew deep link should redirect to registration when not logged in', async
const name = 'this-name-does-not-exist.eth'
const homePage = makePageObject('HomePage')
await homePage.goto()
await page.goto(`/${name}?renew`)
await page.goto(`/${name}?renew=123`)
await expect(page.getByRole('heading', { name: `Register ${name}` })).toBeVisible()
})

test('should handle URL-based renew parameter', async ({ page, login, makeName }) => {
const name = await makeName({
label: 'legacy',
type: 'legacy',
owner: 'user',
})

await test.step('should handle large duration', async () => {
await page.goto(`/${name}?renew=315360000`) // 10 years
await login.connect()
await expect(page.getByText('10 years extension', { exact: true })).toBeVisible()
})
})

test('should handle URL-based renew for names in grace period', async ({
page,
login,
makeName,
}) => {
const name = await makeName({
label: 'legacy',
type: 'legacy',
owner: 'user',
duration: -24 * 60 * 60,
})

await test.step('should allow extend in grace period', async () => {
await page.goto(`/${name}?renew=94608000`) // 3 years
await login.connect()

await expect(page.getByText(`${name} has expired`)).toBeVisible()
await expect(page.getByText(`You do not own ${name}`)).toBeVisible()
await page.getByTestId('extend-names-confirm').click()

await expect(page.getByText('3 years extension', { exact: true })).toBeVisible()
})
})

test('should handle URL-based renew for disconnected users', async ({ page, makeName }) => {
const name = await makeName({
label: 'legacy',
type: 'legacy',
owner: 'user',
})

await page.goto(`/${name}?renew=94608000`)
await expect(page.getByText('Connect a wallet')).toBeVisible()
})
Loading

0 comments on commit caa9568

Please sign in to comment.