graphprotocol / contracts

Contracts repository for The Graph protocol

Home Page:https://thegraph.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hh console setting env vars `GRAPH_CONFIG` and `ADDRESS_BOOK`

tmigone opened this issue · comments

Instantiating GRE fails with:

tomi@ceres:/U/t/g/th/contracts/p/contracts (main) ✗ DEBUG=hardhat:gre:* hh console --network arbitrum-sepolia
No need to generate any newer typings.
Welcome to Node.js v18.18.2.
Type ".help" for more information.
> g=graph()
  hardhat:gre:debug *** Initializing Graph Runtime Environment (GRE) *** +0ms
  hardhat:gre:debug Main network: arbitrum-sepolia +1ms
  hardhat:gre:debug == Features +1ms
  hardhat:gre:debug Tx logging: enabled +0ms
  hardhat:gre:debug Secure accounts: enabled +0ms
  hardhat:gre:debug Forking: disabled +0ms
  hardhat:gre:debug == Getting chain ids +0ms
  hardhat:gre:debug Hardhat chain id: 421614 +0ms
  hardhat:gre:debug Secondary chain id: 11155111 +0ms
  hardhat:gre:debug L1 chain id: 11155111 - Is HHL1: false +0ms
  hardhat:gre:debug L2 chain id: 421614 - Is HHL2: true +1ms
  hardhat:gre:debug == Getting providers +0ms
  hardhat:gre:debug Provider url for L1(sepolia): https://sepolia.infura.io/v3/b736bc4a497048d5b497b1c713458e55 +0ms
  hardhat:gre:debug Creating provider for L1(sepolia) +1ms
  hardhat:gre:debug Provider url for L2(arbitrum-sepolia): https://sepolia-rollup.arbitrum.io/rpcblock +177ms
  hardhat:gre:debug Creating provider for L2(arbitrum-sepolia) +0ms
  hardhat:gre:debug == Getting address book path +0ms
  hardhat:gre:debug Graph base dir: /Users/tomi/git/thegraph/contracts/packages/contracts +0ms
  hardhat:gre:debug 1) opts.addressBook: undefined +0ms
  hardhat:gre:debug 2) hre.network.config.addressBook: undefined +0ms
  hardhat:gre:debug 3) hre.config.graph.addressBook:  +0ms
  hardhat:gre:debug Address book path found: /Users/tomi/git/thegraph/contracts/packages/contracts +0ms
  hardhat:gre:debug == Getting graph config paths +0ms
  hardhat:gre:debug Graph base dir: /Users/tomi/git/thegraph/contracts/packages/contracts +0ms
  hardhat:gre:debug > L1 graph config +0ms
  hardhat:gre:debug 1) opts.l1GraphConfig: undefined +0ms
  hardhat:gre:debug 2) opts.graphConfig: undefined +0ms
  hardhat:gre:debug 3) l1Network.graphConfig: config/graph.sepolia.yml +0ms
  hardhat:gre:debug 4) hre.config.graph.l1GraphConfig: config/graph.mainnet.yml +0ms
  hardhat:gre:debug > L2 graph config +0ms
  hardhat:gre:debug 1) opts.l2GraphConfig: undefined +0ms
  hardhat:gre:debug 2) opts.graphConfig: undefined +0ms
  hardhat:gre:debug 3) l2Network.graphConfig: config/graph.arbitrum-sepolia.yml +0ms
  hardhat:gre:debug 4) hre.config.graph.l2GraphConfig: config/graph.arbitrum-one.yml +0ms
  hardhat:gre:debug L1 graph config path: /Users/tomi/git/thegraph/contracts/packages/contracts/config/graph.sepolia.yml +0ms
  hardhat:gre:debug L2 graph config path: /Users/tomi/git/thegraph/contracts/packages/contracts/config/graph.arbitrum-sepolia.yml +0ms
  hardhat:gre:debug GRE initialized successfully! +1ms
  hardhat:gre:debug Main network: L2 +0ms
  hardhat:gre:debug Secondary network: L1 +0ms
Uncaught:
Error [ERR_INTERNAL_ASSERTION]: Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:751:3)
    at tryReadSync (node:fs:451:20)
    at Object.readFileSync (node:fs:497:19)
    at new AddressBook (/Users/tomi/git/thegraph/contracts/packages/sdk/src/deployments/lib/address-book.ts:46:38)
    at new GraphNetworkAddressBook (/Users/tomi/git/thegraph/contracts/packages/sdk/src/deployments/network/deployment/address-book.ts:7:1)
    at /Users/tomi/git/thegraph/contracts/packages/sdk/src/gre/gre.ts:202:35
    at getRealTarget (/Users/tomi/git/thegraph/contracts/packages/sdk/node_modules/hardhat/src/internal/util/lazy.ts:112:22)
    at Proxy.[nodejs.util.inspect.custom] (/Users/tomi/git/thegraph/contracts/packages/sdk/node_modules/hardhat/src/internal/util/lazy.ts:47:28)
    at formatValue (node:internal/util/inspect:805:19)
    at formatProperty (node:internal/util/inspect:1926:11)
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

    at TTY.callbackTrampoline (node:internal/async_hooks:130:17)
    at TTY.onStreamRead (node:internal/stream_base_commons:190:23)
    at ReadStream.Readable.push (node:internal/streams/readable:245:10)
    at readableAddChunk (node:internal/streams/readable:308:9)
    at addChunk (node:internal/streams/readable:335:12)
    at ReadStream.emit (node:domain:489:12)
    at ReadStream.emit (node:events:517:28)
    at ReadStream.onData (node:internal/readline/emitKeypressEvents:64:36)
    at emitKeys.next (<anonymous>)
    at emitKeys (node:internal/readline/utils:357:14)
    at ReadStream.emit (node:domain:489:12)
    at ReadStream.emit (node:events:517:28)
    at ReadStream.onkeypress (node:internal/readline/interface:271:20)
    at REPLServer.self._ttyWrite (node:repl:994:9)
    at REPLServer.[_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1272:22)
    at REPLServer.[_line] [as _line] (node:internal/readline/interface:894:18)
    at REPLServer.[_onLine] [as _onLine] (node:internal/readline/interface:423:12)
    at REPLServer.emit (node:domain:489:12)
    at REPLServer.emit (node:events:529:35)
    at REPLServer.onLine (node:repl:899:10)
    at REPLServer.runBound [as eval] (node:domain:444:12)
    at bound (node:domain:433:15)
    at REPLServer.defaultEval (node:repl:636:7)
    at finishExecution (node:repl:547:7)
    at finish (node:repl:942:32)
    at REPLServer.writer (node:repl:225:25)
    at inspect (node:internal/util/inspect:364:10)
    at formatValue (node:internal/util/inspect:840:10)
    at formatRaw (node:internal/util/inspect:1062:12)
    at handleMaxCallStackSize (node:internal/util/inspect:1556:10)
    at Function.fail (node:internal/assert:20:9)
    at new NodeError (node:internal/errors:405:5)
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5) {
  code: 'ERR_INTERNAL_ASSERTION'
}

Reason is the env vars are set to empty strings:

> process.env.GRAPH_CONFIG
''
> process.env.ADDRESS_BOOK
''

It was the .env file LOL