Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid updating off-chain group info on-chain #354

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
)

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 @@
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
Loading