Skip to content

Commit

Permalink
Merge pull request #354 from privacy-scaling-explorations/ref/comment…
Browse files Browse the repository at this point in the history
…-code-sync-on-chain

Avoid updating off-chain group info on-chain
  • Loading branch information
vplasencia authored Jan 17, 2024
2 parents a47a54a + 9cf7585 commit cf0dc0b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
34 changes: 17 additions & 17 deletions apps/api/src/app/groups/groups.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ describe("GroupsService", () => {
)

expect(treeDepth).toBe(newTreeDepth)
expect(
// @ts-ignore
groupsService.bandadaContract.updateGroups
).toHaveBeenCalled()
// expect(
// // @ts-ignore
// groupsService.bandadaContract.updateGroups
// ).toHaveBeenCalled()
})
})

Expand Down Expand Up @@ -290,21 +290,21 @@ describe("GroupsService", () => {
expect(members).toHaveLength(1)
})

it("Should update contract on adding member", async () => {
const invite2 = await invitesService.createInvite(
{ groupId },
"admin"
)
// it("Should update contract on adding member", async () => {

Check warning on line 293 in apps/api/src/app/groups/groups.service.test.ts

View workflow job for this annotation

GitHub Actions / style

Some tests seem to be commented
// const invite2 = await invitesService.createInvite(
// { groupId },
// "admin"
// )

await groupsService.joinGroup(groupId, "124", {
inviteCode: invite2.code
})
// await groupsService.joinGroup(groupId, "124", {
// inviteCode: invite2.code
// })

expect(
// @ts-ignore
groupsService.bandadaContract.updateGroups
).toHaveBeenCalled()
})
// expect(
// // @ts-ignore
// groupsService.bandadaContract.updateGroups
// ).toHaveBeenCalled()
// })

it("Should not add any member if they already exist", async () => {
const fun = groupsService.joinGroup(groupId, "123123", {
Expand Down
22 changes: 11 additions & 11 deletions apps/api/src/app/groups/groups.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export class GroupsService {
await this._cacheGroups()

/* istanbul ignore next */
if (process.env.NODE_ENV !== "test") {
setTimeout(async () => {
await this._syncContractGroups()
}, 5000)
}
// if (process.env.NODE_ENV !== "test") {
// setTimeout(async () => {
// await this._syncContractGroups()
// }, 5000)
// }
}

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ export class GroupsService {

this.cachedGroups.set(_groupId, cachedGroup)

this._updateFingerprintDuration(group.id, fingerprintDuration)
// this._updateFingerprintDuration(group.id, fingerprintDuration)

Logger.log(
`GroupsService: group '${name}' has been created with id '${_groupId}'`
Expand Down Expand Up @@ -169,7 +169,7 @@ export class GroupsService {
group.members.map((m) => m.id)
)
this.cachedGroups.set(groupId, cachedGroup)
this._updateContractGroup(cachedGroup)
// this._updateContractGroup(cachedGroup)
}

if (group.credentials && credentials) {
Expand Down Expand Up @@ -380,7 +380,7 @@ export class GroupsService {
`GroupsService: member '${memberId}' has been added to the group '${group.name}'`
)

this._updateContractGroup(cachedGroup)
// this._updateContractGroup(cachedGroup)

return group
}
Expand Down Expand Up @@ -432,7 +432,7 @@ export class GroupsService {
)
})

this._updateContractGroup(cachedGroup)
// this._updateContractGroup(cachedGroup)

return group
}
Expand Down Expand Up @@ -510,7 +510,7 @@ export class GroupsService {
})
)

this._updateContractGroup(cachedGroup)
// this._updateContractGroup(cachedGroup)

return this.getGroup(groupId)
}
Expand Down Expand Up @@ -588,7 +588,7 @@ export class GroupsService {
})
)

this._updateContractGroup(cachedGroup)
// this._updateContractGroup(cachedGroup)

return this.getGroup(groupId)
}
Expand Down

0 comments on commit cf0dc0b

Please sign in to comment.