Skip to content

Commit

Permalink
chore: Fix typos and code formatting (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
alainncls authored Feb 12, 2025
1 parent 19484c5 commit 3a4f02f
Show file tree
Hide file tree
Showing 8 changed files with 2,767 additions and 2,728 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ See [Install](./packages/linea-ens-app/README.md#install) in the linea-ens-app R

### linea-ens-resolver

The linea-ens-resolver contract intented to be deployed on L1 that is built on top
The linea-ens-resolver contract intended to be deployed on L1 that is built on top
of [linea-state-verifier](./packages/linea-state-verifier) and verifies Linea ENS data (domain names, metadata etc).

More documentation available in [linea-ens-resolver/README.md](./packages/linea-ens-resolver/README.md)

### linea-ens-contracts

The linea-ens-contracts contracts intented to be deployed on L2 (Linea) stores and returns the data necessary to resolve
The linea-ens-contracts contracts intended to be deployed on L2 (Linea) stores and returns the data necessary to resolve
a domain name and more data related to ENS.

More documentation available in [linea-ens-contracts/README.md](./packages/linea-ens-contracts/README.md)
Expand Down
52 changes: 35 additions & 17 deletions packages/linea-ens-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Friendly forked from ENS V3 app: [https://github.com/ensdomains/ens-app-v3](http

### Requirements

Install `Node.js`, `pnpm`, `Yarn` and `docker-compose`.
Install `Node.js`, `pnpm`, `Yarn` and `docker-compose`.

See [Requirements](../../README.md#requirements).

Expand Down Expand Up @@ -83,7 +83,8 @@ pnpm i
make dev
```

Make sure `VERIFIER_CONTRACT_ADDRESS` matches the `PohVerifier` contract address in `./packages/linea-ens-app/.env.local`.
Make sure `VERIFIER_CONTRACT_ADDRESS` matches the `PohVerifier` contract address in
`./packages/linea-ens-app/.env.local`.

Once successfully started, you should see:

Expand All @@ -100,25 +101,28 @@ cd packages/linea-ens-app
pnpm dev:glocal
```

You'll need an account with POH to fully use the local env, if you don't, you can get it [here] (https://poh.linea.build/).
You'll need an account with POH to fully use the local env, if you don't, you can get
it [here] (https://poh.linea.build/).

- Then browse http://localhost:3000/.
- Import one of the hardhat test accounts in your MetaMask to have funds (eg, private key: `ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`, for address: `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`)
- Import one of the hardhat test accounts in your MetaMask to have funds (eg, private key:
`ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`, for address:
`0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`)
- Add the local test network to your MetaMask with these info:

- Click on `Add a network manually`
- Add this config:
- Click on `Add a network manually`
- Add this config:

| Setting | Value |
| --------------- | --------------------- |
| --------------- | --------------------- |
| Network name | Localhost 8545 |
| New RPC URL | http://127.0.0.1:8545 |
| Chain ID | 1337 |
| Currency symbol | ETH |

- Save and Swith to `Localhost 8455`.
- Save and Switch to `Localhost 8455`.
- Transfer 1 ETH from the test account above (eg: `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`), to your POH account
- If you don't have an address with PoH, see [Common Errors](#common-errors).
- If you don't have an address with PoH, see [Common Errors](#common-errors).
- You can start testing the app and register a domain.

### Running Dev env
Expand All @@ -143,7 +147,8 @@ Currently the tests written by ENS are not working in this repo because they sti

#### **If you need to deploy a new subgraph**

You shouldn't deploy the subgraph on top of the existing dataset, instead you should create a clean dataset (explained below).
You shouldn't deploy the subgraph on top of the existing dataset, instead you should create a clean dataset (explained
below).

1. Start the test environment

Expand All @@ -153,7 +158,8 @@ pnpm denv --save

2. Deploy the subgraph

After the deploy scripts have run, you can deploy the subgraph. Assuming you are in the [linea-ens-subgraph](https://github.com/Consensys/linea-enstree/main/packages/linea-ens-subgraph) repo, you can use:
After the deploy scripts have run, you can deploy the subgraph. Assuming you are in
the [linea-ens-subgraph](https://github.com/Consensys/linea-enstree/main/packages/linea-ens-subgraph) repo, you can use:

```bash
yarn setup
Expand Down Expand Up @@ -188,21 +194,25 @@ pnpm buildandstart:glocal

## Architecture

The structure of the `pages` folder is mimicked inside `components`. Components specific to a page can be found in the `components` folder, in the folder corresponding to that page.
The structure of the `pages` folder is mimicked inside `components`. Components specific to a page can be found in the
`components` folder, in the folder corresponding to that page.

Components that are used in multiple places will be found in the top level of the `components` folder.

## Common Errors

### Node.js version and other requirements

Most installation errors are due to `Node.js`, `pnpm`, `yarn` or `docker-compose` versions. Verify the [requirements](../../README.md#requirements) if you encounter an error. To verify, you can execute:
Most installation errors are due to `Node.js`, `pnpm`, `yarn` or `docker-compose` versions. Verify
the [requirements](../../README.md#requirements) if you encounter an error. To verify, you can execute:

```bash
node --version
v18.20.4
```
Node Version Manager (nvm) can be used to manage multiple versions of Node.js if you find you are not in the correct version of Node.

Node Version Manager (nvm) can be used to manage multiple versions of Node.js if you find you are not in the correct
version of Node.

```bash
pnpm --version
Expand All @@ -220,32 +230,40 @@ docker-compose version 1.29.2, build 5becea4c
```

### Canvas issues

It is possible the Canvas libraries are not installed correctly or missing.
To install/reinstall: First install pkg-config:
To install/reinstall: First install pkg-config:

```bash
brew install pkg-config
```

Then install dependencies for canvas

```bash
brew install cairo pango libpng jpeg giflib librsvg
```

After installing the dependencies, set the PKG_CONFIG_PATH environment variable:

```bash
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:/opt/homebrew/share/pkgconfig:$PKG_CONFIG_PATH"
```

Finally clear npm cache and node_modules:

```bash
npm cache clean --force
rm -rf node_modules
```

### Package Manager errors:
If you encounter a Package Manager error this stems from a Yarn compatibility issue. To resolve this we need to disable Yarn that has been bundled in with the latest versions of Node.js and install Yarn separately.

If you encounter a Package Manager error this stems from a Yarn compatibility issue. To resolve this we need to disable
Yarn that has been bundled in with the latest versions of Node.js and install Yarn separately.

To do so follow these steps in the root folder:

1. `corepack disable`
2. `npm install -g pnpm`
3. `npm install -g yarn`
Expand All @@ -267,7 +285,7 @@ To fix it, you can safely remove `data` in `./packages/linea-ens-app/data`.

### Linea PoH Status: INVALID

If your address doesn't have a PoH, for testing purpose you can temporally deactivate the PoH verification:
If your address doesn't have a PoH, for testing purpose you can temporarily deactivate the PoH verification:

1. Edit `linea-ens/packages/poh-signer-api/src/modules/poh/poh.service.ts`.

Expand Down
70 changes: 35 additions & 35 deletions packages/linea-ens-app/deploy/01_get_contract_addresses.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
/* eslint-disable import/no-extraneous-dependencies */
import { existsSync } from 'fs'
import { mkdir, readFile, writeFile } from 'fs/promises'
import { resolve } from 'path'
import { existsSync } from 'fs';
import { mkdir, readFile, writeFile } from 'fs/promises';
import { resolve } from 'path';

import { ethers, utils } from 'ethers'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import YAML from 'yaml'
import { ethers, utils } from 'ethers';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import YAML from 'yaml';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) {
if (!process.env.BASE_DOMAIN) {
throw 'BASE_DOMAIN env needs to be intialized'
throw 'BASE_DOMAIN env needs to be initialized';
}

const allDeployments = await hre.deployments.all()
const allDeployments = await hre.deployments.all();
const deploymentAddressArray = Object.keys(allDeployments).map((dkey) => [
dkey,
allDeployments[dkey].address,
])
const deploymentAddressMap = Object.fromEntries(deploymentAddressArray)
]);
const deploymentAddressMap = Object.fromEntries(deploymentAddressArray);

await writeFile(
resolve(__dirname, '../.env.local'),
`NEXT_PUBLIC_DEPLOYMENT_ADDRESSES='${JSON.stringify(deploymentAddressMap)}'`,
)
);
if (!existsSync(resolve(__dirname, '../typings-custom/generated'))) {
await mkdir(resolve(__dirname, '../typings-custom/generated'))
await mkdir(resolve(__dirname, '../typings-custom/generated'));
}
await writeFile(
resolve(__dirname, '../typings-custom/generated/local-contracts-generated.d.ts'),
Expand All @@ -37,8 +37,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
}
}
`,
)
console.log('Wrote contract addresses to .env.local')
);
console.log('Wrote contract addresses to .env.local');

const deploymentsSubgraphNames = {
ENSRegistry: deploymentAddressMap['ENSRegistry'],
Expand All @@ -48,40 +48,40 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
EthRegistrarControllerOld: deploymentAddressMap['LegacyETHRegistrarController'],
ETHRegistrarController: deploymentAddressMap['ETHRegistrarController'],
NameWrapper: deploymentAddressMap['NameWrapper'],
}
};

const subgraphYamlPath = resolve(__dirname, '../../linea-ens-subgraph/subgraph.yaml')
const subgraphYamlFile = await readFile(subgraphYamlPath, 'utf8')
const subgraphYamlPath = resolve(__dirname, '../../linea-ens-subgraph/subgraph.yaml');
const subgraphYamlFile = await readFile(subgraphYamlPath, 'utf8');

const subgraphYaml = YAML.parse(subgraphYamlFile)
const dataSources = subgraphYaml.dataSources
const subgraphYaml = YAML.parse(subgraphYamlFile);
const dataSources = subgraphYaml.dataSources;

dataSources.map((dataSource) => {
dataSource.source.address = deploymentsSubgraphNames[dataSource.name]
})
dataSource.source.address = deploymentsSubgraphNames[dataSource.name];
});

await writeFile(subgraphYamlPath, YAML.stringify(subgraphYaml))
await writeFile(subgraphYamlPath, YAML.stringify(subgraphYaml));

console.log(
'Updated subgraph.yaml in packages/linea-ens-subgraph with the local deployment addresses',
)
);

const subgraphEnvPath = resolve(__dirname, '../../linea-ens-subgraph/src/env.ts')
const subgraphEnvPath = resolve(__dirname, '../../linea-ens-subgraph/src/env.ts');

const baseDomain = `${process.env.BASE_DOMAIN}.eth`
const labelHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(process.env.BASE_DOMAIN))
const baseDomain = `${process.env.BASE_DOMAIN}.eth`;
const labelHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(process.env.BASE_DOMAIN));
const envSrc =
`export const BASE_DOMAIN = "${baseDomain}";\n` +
`export const BASE_NODE = "${utils.namehash(baseDomain)}";\n` +
`export const BASE_LABEL = "${process.env.BASE_DOMAIN}";\n` +
`export const BASE_LABEL_HASH = "${labelHash}";\n`
`export const BASE_LABEL_HASH = "${labelHash}";\n`;

await writeFile(subgraphEnvPath, envSrc)
await writeFile(subgraphEnvPath, envSrc);

console.log('Updated env.ts in packages/linea-ens-subgraph with the env base domain')
}
console.log('Updated env.ts in packages/linea-ens-subgraph with the env base domain');
};

func.runAtTheEnd = true
func.tags = ['get-contract-addresses']
func.runAtTheEnd = true;
func.tags = ['get-contract-addresses'];

export default func
export default func;
2 changes: 1 addition & 1 deletion packages/linea-ens-app/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
14 changes: 7 additions & 7 deletions packages/linea-ens-app/patches/@[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ index 66fad67c218a34a923d3674683c3a79c51c8555b..f048f6bc8bdc99af229eca208a38d6db
const log = require('debug')('synpress:metamask');
const playwright = require('./playwright');
+const sleep = require('util').promisify(setTimeout);

const {
onboardingWelcomePageElements,
@@ -74,6 +75,7 @@ const metamask = {
Expand Down Expand Up @@ -388,16 +388,16 @@ index 66fad67c218a34a923d3674683c3a79c51c8555b..f048f6bc8bdc99af229eca208a38d6db
@@ -1145,6 +1179,7 @@ const metamask = {
return true;
},
async confirmPermisionToApproveAll() {
+ log(`Running confirmPermisionToApproveAll()`);
async confirmPermissionToApproveAll() {
+ log(`Running confirmPermissionToApproveAll()`);
const notificationPage = await playwright.switchToMetamaskNotification();
await playwright.waitAndClick(
notificationPageElements.allowToSpendButton,
@@ -1158,6 +1193,7 @@ const metamask = {
return true;
},
async rejectPermisionToApproveAll() {
+ log(`Running rejectPermisionToApproveAll()`);
async rejectPermissionToApproveAll() {
+ log(`Running rejectPermissionToApproveAll()`);
const notificationPage = await playwright.switchToMetamaskNotification();
await playwright.waitAndClick(
notificationPageElements.allowToSpendButton,
Expand Down Expand Up @@ -698,7 +698,7 @@ index d7daab5bf8883389ccbecb18e53c050d1eef6d13..3ad8b6d1342f99ca4d33d4dd74433595
--- a/synpress.js
+++ b/synpress.js
@@ -6,7 +6,6 @@ const { version } = require('./package.json');

if (process.env.DEBUG && process.env.DEBUG.includes('synpress')) {
log('DEBUG mode is enabled');
- process.env.PWDEBUG = 1;
Expand All @@ -716,4 +716,4 @@ index d7daab5bf8883389ccbecb18e53c050d1eef6d13..3ad8b6d1342f99ca4d33d4dd74433595
+ )
.option(
'-r, --record',
'[dashboard] record video of tests running after setting up your project to record',
'[dashboard] record video of tests running after setting up your project to record',
Loading

0 comments on commit 3a4f02f

Please sign in to comment.