Update README and graph-node tests (#110)

* Update README with proper steps for installing github packages

* Update graph-node readme to run tests
This commit is contained in:
nikugogoi 2022-04-27 15:37:13 +05:30 committed by GitHub
parent 9a8ae3f308
commit 654edf4008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 85 deletions

View File

@ -4,13 +4,28 @@
There are packages used from github so we need to follow the following steps to install them:
* To install this package we need to follow steps required to install github packages.
1. Create a github PAT (personal access token) if it does not already exist.
https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#installing-a-package
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-token
* We will need to authenticate to github packages. Follow the steps in https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages.
2. Configure the PAT with scopes mentioned in https://docs.github.com/en/packages/learn-github-packages/about-permissions-for-github-packages#about-scopes-and-permissions-for-package-registries. This is required to install or publish github packages.
Use personal access token to authenticate to github packages ( https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token).
3. Follow the steps in https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token to authenticate to github packages. We can also run the follwing to authenticate by logging in to npm.
```bash
$ npm login --scope=@vulcanize --registry=https://npm.pkg.github.com
> Username: USERNAME
> Password: TOKEN
> Email: PUBLIC-EMAIL-ADDRESS
```
Replace with the following:
- `USERNAME`: GitHub username
- `TOKEN`: Personal access token (configured above)
- `PUBLIC-EMAIL-ADDRESS`: Email address
4. When authenticating to github packages for the first time, yarn install may throw Unauthorized error. To overcome this we need to run yarn install in `packages/graph-node` directory of graph-watcher repo. After this yarn install for graph-watcher-ts works properly even from root of the repo.
This project uses [yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/).
@ -20,7 +35,11 @@ Install packages (Node.JS v16.13.1):
yarn
```
### Services
## Tests
* [graph-node](./packages/graph-node/README.md)
## Services
The default config files used by the watchers assume the following services are setup and running on localhost:
@ -28,13 +47,13 @@ The default config files used by the watchers assume the following services are
* `vulcanize/ipld-eth-server` with native GQL API enabled, on port 8082
* `postgraphile` on the `vulcanize/ipld-eth-server` database, on port 5000
#### Note
### Note
* In `vulcanize/ipld-eth-server`, add the following statement to `[ethereum]` section in `environments/config.toml`:
`chainConfig = "./chain.json" # ETH_CHAIN_CONFIG`
### Databases
## Databases
Note: Requires `postgres12`.
@ -140,10 +159,3 @@ If the watcher uses a job queue, start the job runner in another terminal:
```bash
yarn job-runner
```
## Known Issues
* When authenticating to github packages for the first time, yarn install throws Unauthorized error in [graph-watcher-ts](https://github.com/vulcanize/graph-watcher-ts) repo even after setup.
To overcome this we need to run yarn install in `packages/graph-node` directory of graph-watcher repo. After this yarn install for graph-watcher-ts works properly even from root of the repo.

View File

@ -10,32 +10,9 @@
$ cp .env.example .env
```
3. To deploy contract for example subgraph use https://github.com/deep-stack/eth-contract-tests
3. Run `yarn build:example` to build the wasm files.
```bash
# In eth-contract-test repo.
$ yarn
$ yarn example:deploy
```
Use the address the contract got deployed to and set it to `EXAMPLE_CONTRACT_ADDRESS` in .env file.
3. To deploy contracts for eden subgraph use https://github.com/vulcanize/governance
4. Follow the steps in https://github.com/vulcanize/governance/tree/watcher-ts#instructions
5. Set the contract addresses for eden contracts in .env file from `deployments/localhost` directory in the governance repository.
Following are the contracts whose address needs to be set in .env file:
* EdenNetwork - EDEN_NETWORK_CONTRACT_ADDRESS
* MerkleDistributor - EDEN_NETWORK_DISTRIBUTION_CONTRACT_ADDRESS
* DistributorGovernance - EDEN_NETWORK_GOVERNANCE_CONTRACT_ADDRESS
6. Run `yarn build:example` to build the wasm files.
7. Run `yarn test`.
4. Run `yarn test`.
## Run

View File

@ -34,7 +34,7 @@
"asbuild:debug": "asc assembly/index.ts --lib ./node_modules --exportRuntime --target debug --runPasses asyncify --runtime stub --maximumMemory 10",
"asbuild:release": "asc assembly/index.ts --lib ./node_modules --exportRuntime --target release --runPasses asyncify",
"asbuild": "yarn asbuild:debug && yarn asbuild:release",
"test": "yarn asbuild:debug && DEBUG=vulcanize:* node --experimental-wasm-bigint node_modules/.bin/_mocha src/**/*.test.ts",
"test": "yarn asbuild:debug && DEBUG=vulcanize:* node node_modules/.bin/_mocha src/**/*.test.ts",
"build:example": "cd test/subgraph/example1 && yarn && yarn codegen && yarn build",
"watch": "DEBUG=vulcanize:* nodemon --watch src src/watcher.ts",
"compare-entity": "node bin/compare-entity"

View File

@ -20,7 +20,7 @@ chai.use(spies);
const sandbox = chai.spy.sandbox();
describe('call handler in mapping code', () => {
xdescribe('call handler in mapping code', () => {
let exports: any;
let db: Database;
let indexer: Indexer;

View File

@ -25,7 +25,7 @@ chai.use(spies);
const sandbox = chai.spy.sandbox();
describe('eden wasm loader tests', async () => {
xdescribe('eden wasm loader tests', async () => {
let db: Database;
let indexer: Indexer;
let provider: BaseProvider;

View File

@ -14,7 +14,7 @@ import { Database } from './database';
import { Indexer } from '../test/utils/indexer';
import { EventData } from './utils';
describe('eth-call wasm tests', () => {
xdescribe('eth-call wasm tests', () => {
let exports: any;
let db: Database;
let indexer: Indexer;

View File

@ -6,7 +6,7 @@ dataSources:
name: Example1
network: mainnet
source:
address: ""
address: "0xD5567AFC3C6c1325698F27d97b74D9ea9c44295e"
abi: Example1
startBlock: 100
mapping:
@ -24,44 +24,3 @@ dataSources:
blockHandlers:
- handler: handleBlock
file: ./src/mapping.ts
- kind: ethereum/contract
name: Factory
network: mainnet
source:
address: ""
abi: Factory
startBlock: 100
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
entities: []
abis:
- name: Factory
file: ./abis/factory.json
- name: Pool
file: ./abis/pool.json
eventHandlers:
- event: PoolCreated(indexed address,indexed address,indexed uint24,int24,address)
handler: handlePoolCreated
file: ./src/factory.ts
templates:
- kind: ethereum/contract
name: Pool
network: mainnet
source:
abi: Pool
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
entities: []
file: ./src/pool.ts
abis:
- name: Pool
file: ./abis/pool.json
blockHandlers:
- handler: handleBlock
eventHandlers:
- event: Initialize(uint160,int24)
handler: handleInitialize