Skip to content

Commit

Permalink
Merge pull request #191 from Consensys/fix/denv-command
Browse files Browse the repository at this point in the history
fix: linea-ens-contracts denv command + readme
  • Loading branch information
Julink-eth authored Jul 26, 2024
2 parents 92bda1c + 0bccb91 commit 6a696ac
Show file tree
Hide file tree
Showing 13 changed files with 223 additions and 42 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@ contract TestL1 is EVMFetchTarget {

## Requirements

- NodeJs v18.x.
- pnpm v9.x
- yarn for the linea-ens-contracts package only
- [Node.js](https://nodejs.org/en/download/package-manager) v18.x.
- [pnpm](https://pnpm.io/installation) v9.x
- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install)
- [Docker](https://docs.docker.com/engine/install/)
- [docker-compose](https://docs.docker.com/compose/install/)

## Installation
See [Install](./packages/linea-ens-app/README.md#install) in the linea-ens-app README.

## Packages

Expand Down
1 change: 0 additions & 1 deletion package.json

This file was deleted.

190 changes: 178 additions & 12 deletions packages/linea-ens-app/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Linea ENS App

Friendly forked from ENS V3 app: https://github.com/ensdomains/ens-app-v3
This documentation provides instructions on how to set up, deploy, and run the Linea ENS App locally.

Friendly forked from ENS V3 app: [https://github.com/ensdomains/ens-app-v3](https://github.com/ensdomains/ens-app-v3).

## Usage

### Requirements

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

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

### Install

In the `linea-ens` root folder, run:

```bash
pnpm i
```

### Quick start on localhost

In a first terminal run:
#### 1. Run background services and deploy smart contracts

In a first terminal, run:

```bash
cd packages/linea-ens-app
Expand All @@ -21,28 +33,93 @@ pnpm i
pnpm denv
```

In a second terminal run:
Once successfully started, you should see `TheGraph` logs:

```bash
graph-node_1 | Jul 11 10:39:41.725 INFO Done processing trigger, gas_used: 197859281, data_source: ENSRegistry, handler: handleNewResolver, total_ms: 2, transaction: 0x807b…2c88, address: 0x5fbd…0aa3, signature: NewResolver(indexed bytes32,address), sgd: 1, subgraph_id: QmUqJV5Z..., component: SubgraphInstanceManager
graph-node_1 | Jul 11 10:39:41.729 INFO Applying 7 entity operation(s), block_hash: 0xb51c59cdbc..., block_number: 79, sgd: 1, subgraph_id: QmUqJV5Z..., component: SubgraphInstanceManager
```

#### 2. Deploy ENS Subgraph

In a second terminal, run:

```bash
cd packages/linea-ens-subgraph
yarn setup
```

In a third terminal run:
Once successfully started, you should see:

```bash
Build completed: QmRmG8bPjg3oy62b...
Deployed to http://127.0.0.1:8000/subgraphs/name/graphprotocol/ens/graphql
```

#### 3. Start Web3Signer

In a third terminal, run:

```bash
cd services/web3signer/
cp ./keyFiles/examples/signer.yaml ./keyFiles/signer.yaml
make dev-docker
```

Once successfully started, you should see:

```bash
Web3Signer has started with TLS disabled, and ready to handle signing requests on 0.0.0.0:9000
```

#### 4. Start PoH Signer API

In a fourth terminal, run:

```bash
cd packages/poh-signer-api
cp .env.example .env
pnpm i
make dev
```

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

Once successfully started, you should see:

```bash
Poh Signer Api v1.0.0 development started on port: 4000
```

#### 5. Start ENS frontend

In a fifth terminal, run:

```bash
cd packages/linea-ens-app
pnpm dev:glocal
```

- Then browse http://localhost:3000/
- Import one of the hardhat test accounts in your metamask (eg: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80)
- Add the local test network to your metamask with this info:
- Localhost 8545
- http://127.0.0.1:8545
- 1337
- ETH
- You can start testing the app
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`)
- Add the local test network to your MetaMask with these info:

- 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`.
- 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).
- You can start testing the app and register a domain.

### Running Dev env

Expand Down Expand Up @@ -114,3 +191,92 @@ pnpm buildandstart:glocal
The structure of the `pages` folder is mimicked inside `components`. Components specific to a page can be found in the 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:

```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.

```bash
pnpm --version
9.4.0
```

```bash
yarn --version
1.22.22
```

```bash
docker-compose --version
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:
```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.

To do so follow these steps in the root folder:
1. `corepack disable`
2. `npm install -g pnpm`
3. `npm install -g yarn`

### EACCES: permission denied, unlink

If you encounter this error:

```bash
[Error: EACCES: permission denied, unlink '/home/rapha/studio/linea/ens/linea-ens/packages/linea-ens-app/data/ipfs/api'] {
errno: -13,
code: 'EACCES',
syscall: 'unlink',
path: '/home/rapha/studio/linea/ens/linea-ens/packages/linea-ens-app/data/ipfs/api'
}
```

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:

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

2. Comment `if` statement on L.30, like:

```
// if (!pohResponse.poh) {
// throw new Error('address not POH');
// }
```

But you cannot use an address twice, you have to change address for each new registration.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ethers } from 'hardhat'
// @ts-ignore
import packet from 'dns-packet'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-ignore
import packet from 'dns-packet'
import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-ignore
import packet from 'dns-packet'
import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-ignore
import namehash from 'eth-ens-namehash'
import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
Expand Down
1 change: 1 addition & 0 deletions packages/linea-ens-contracts/tasks/seed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs'

import * as envfile from 'envfile'
// @ts-ignore
import n from 'eth-ens-namehash'
import { task } from 'hardhat/config'

Expand Down
9 changes: 8 additions & 1 deletion packages/linea-ens-contracts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3799,13 +3799,20 @@ dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"

dns-packet@^5.0.4, dns-packet@^5.2.1, dns-packet@^5.3.0:
dns-packet@^5.0.4, dns-packet@^5.2.1:
version "5.4.0"
resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-5.4.0.tgz#1f88477cf9f27e78a213fb6d118ae38e759a879b"
integrity sha512-EgqGeaBB8hLiHLZtp/IbaDQTL8pZ0+IvwzSHA6d7VyMDM+B9hgddEMa9xjK5oYnw0ci0JQ6g2XCD7/f6cafU6g==
dependencies:
"@leichtgewicht/ip-codec" "^2.0.1"

dns-packet@^5.3.0:
version "5.6.1"
resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-5.6.1.tgz#ae888ad425a9d1478a0674256ab866de1012cf2f"
integrity sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==
dependencies:
"@leichtgewicht/ip-codec" "^2.0.1"

doctrine@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
Expand Down
Loading

0 comments on commit 6a696ac

Please sign in to comment.