From 98865816674000e276ae32817415aa58a61105d5 Mon Sep 17 00:00:00 2001 From: hangleang Date: Tue, 23 Apr 2024 14:58:02 +0700 Subject: [PATCH] fix: change to bigint --- subgraph/.eslintrc.js | 3 +-- subgraph/schema.graphql | 4 ++-- subgraph/src/maci.ts | 3 +-- subgraph/src/utils/helper.ts | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/subgraph/.eslintrc.js b/subgraph/.eslintrc.js index 4349288565..963b802356 100644 --- a/subgraph/.eslintrc.js +++ b/subgraph/.eslintrc.js @@ -2,9 +2,8 @@ const path = require("path"); module.exports = { root: true, - extends: ["../.eslintrc.js", "plugin:@typescript-eslint/recommended"], + extends: ["../.eslintrc.js"], parser: "@typescript-eslint/parser", - plugins: ["@typescript-eslint"], parserOptions: { project: path.resolve(__dirname, "./tsconfig.json"), sourceType: "module", diff --git a/subgraph/schema.graphql b/subgraph/schema.graphql index 03a39ce72c..690effea56 100644 --- a/subgraph/schema.graphql +++ b/subgraph/schema.graphql @@ -1,7 +1,7 @@ type MACI @entity { id: ID! owner: Bytes! # address - stateTreeDepth: Int! # uint8 + stateTreeDepth: BigInt! # uint8 updatedAt: BigInt! blockNumber: BigInt! txHash: Bytes! @@ -39,7 +39,7 @@ type Poll @entity { id: Bytes! # poll address pollId: BigInt # uint256 duration: BigInt! # uint256 - treeDepth: Int! # uint8 + treeDepth: BigInt! # uint8 maxMessages: BigInt maxVoteOption: BigInt messageProcessor: Bytes # address diff --git a/subgraph/src/maci.ts b/subgraph/src/maci.ts index 751d9978e5..98a4fe7407 100644 --- a/subgraph/src/maci.ts +++ b/subgraph/src/maci.ts @@ -28,8 +28,7 @@ export function handleDeployPoll(event: DeployPollEvent): void { entity.subsidy = event.params.pollAddr.subsidy; entity.maxMessages = maxValues.value0; entity.maxVoteOption = maxValues.value1; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - entity.treeDepth = treeDepths.value0; + entity.treeDepth = GraphBN.fromI32(treeDepths.value0); entity.duration = durations.value1; entity.blockNumber = event.block.number; diff --git a/subgraph/src/utils/helper.ts b/subgraph/src/utils/helper.ts index a14389416b..764e932cc6 100644 --- a/subgraph/src/utils/helper.ts +++ b/subgraph/src/utils/helper.ts @@ -17,8 +17,7 @@ export const createOrLoadMACI = ( if (!maci) { maci = new MACI(DEFAULT_MACI_ID); maci.owner = owner !== null ? owner : (event.transaction.from as Bytes); - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - maci.stateTreeDepth = stateTreeDepth.toI32(); + maci.stateTreeDepth = stateTreeDepth; maci.updatedAt = event.block.timestamp; maci.blockNumber = event.block.number; maci.txHash = event.transaction.hash;