Skip to content

Commit ee8db0e

Browse files
committed
refactor(subgraph): set correct type for tree depth
1 parent 968fb10 commit ee8db0e

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

apps/subgraph/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type ValidatedProof @entity {
2929
message: BigInt!
3030
scope: BigInt!
3131
merkleTreeRoot: BigInt!
32-
merkleTreeDepth: BigInt!
32+
merkleTreeDepth: Int!
3333
nullifier: BigInt!
3434
proof: [BigInt!]!
3535
group: Group!

apps/subgraph/src/semaphore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ export function addValidatedProof(event: ProofValidated): void {
217217
validatedProof.group = group.id
218218
validatedProof.message = event.params.message
219219
validatedProof.merkleTreeRoot = event.params.merkleTreeRoot
220+
validatedProof.merkleTreeDepth = event.params.merkleTreeDepth.toI32()
220221
validatedProof.scope = event.params.scope
221222
validatedProof.nullifier = event.params.nullifier
222223
validatedProof.proof = event.params.proof

apps/subgraph/tests/semaphore.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ describe("Semaphore subgraph", () => {
181181

182182
assert.fieldEquals("ValidatedProof", id, "group", groupId.toString())
183183
assert.fieldEquals("ValidatedProof", id, "merkleTreeRoot", "1001")
184+
assert.fieldEquals("ValidatedProof", id, "merkleTreeDepth", "32")
184185
assert.fieldEquals("ValidatedProof", id, "scope", "1")
185186
assert.fieldEquals("ValidatedProof", id, "nullifier", "666")
186187
assert.fieldEquals("ValidatedProof", id, "message", "2")

0 commit comments

Comments
 (0)