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

Bug: listGroups fails in the latest Beta #378

Closed
Tracked by #309
peterferguson opened this issue Apr 29, 2024 · 5 comments
Closed
Tracked by #309

Bug: listGroups fails in the latest Beta #378

peterferguson opened this issue Apr 29, 2024 · 5 comments
Assignees
Labels

Comments

@peterferguson
Copy link
Contributor

Describe the bug

I am seeing failures in all methods that use listGroups, I cannot create groups or even list older ones.

I was only getting GenericErrors with no context as to what was actually going wrong. After a day or two of digging I have been able to surface the following error Group metadata: policy error invalid policy from the libxmtp xmtpv3.swift pod.

I am not sure if it is related but it seems that I have somehow been able to create groups where I am the only user (i.e. peerAddresses is an empty array for several groups when debugging the following:)

struct GroupWrapper {
static func encodeToObj(_ group: XMTP.Group, client: XMTP.Client) throws -> [String: Any] {
let permissionString = switch try group.permissionLevel() {
case .everyoneIsAdmin:
"everyone_admin"
case .groupCreatorIsAdmin:
"creator_admin"
}
return [
"clientAddress": client.address,
"id": group.id.toHex,
"createdAt": UInt64(group.createdAt.timeIntervalSince1970 * 1000),
"peerAddresses": XMTP.Conversation.group(group).peerAddresses,
"version": "GROUP",
"topic": group.topic,
"permissionLevel": permissionString,
"adminAddress": try group.adminAddress()
]
}

Although the error says that it is a libxmtp GenericError AFAICT the failure actually happens at the encoding. Which then leads to the loop over this taskGroup prematurely exiting.

AsyncFunction("listGroups") { (clientAddress: String) -> [String] in
guard let client = await clientsManager.getClient(key: clientAddress) else {
throw Error.noClient
}
let groupList = try await client.conversations.groups()
return try await withThrowingTaskGroup(of: String.self) { taskGroup in
for group in groupList {
taskGroup.addTask {
await self.groupsManager.set(group.cacheKey(clientAddress), group)
return try GroupWrapper.encode(group, client: client)
}
}
var results: [String] = []
for try await result in taskGroup {
results.append(result)
}
return results
}
}

Expected behavior

No response

Steps to reproduce the bug

No response

@peterferguson peterferguson added the bug Something isn't working label Apr 29, 2024
@neekolas
Copy link
Contributor

Have you tried this with a fresh wallet/database? Do you get the same issue?

Creating groups with no other members is allowed.

CC @cameronvoell

@peterferguson
Copy link
Contributor Author

@neekolas

I have tried deleting the local db but the issue seems to be actually encoding the groups sent back from the network rather than any local data issue.

Resetting the db & reconnecting refilled 7 groups in the database but when listing groups I can only ever see two in the debugger because the above code throws before listing the rest.

I will try creating a fresh wallet and see if the same issue comes up

Creating groups with no other members is allowed.

There is a guard against creating empty groups in the ios lib

https://github.com/xmtp/xmtp-ios/blob/895fb781c20dd1dc5bff64175711853408ae871d/Sources/XMTPiOS/Conversations.swift#L118-L129

https://github.com/xmtp/xmtp-ios/blob/895fb781c20dd1dc5bff64175711853408ae871d/Sources/XMTPiOS/Conversations.swift#L19-L38

@cameronvoell
Copy link
Contributor

@peterferguson thanks for detailed issue report 🙏 . can you confirm you're testing latest beta RN SDK, should be version v1.32.5-beta.5.

We had an issue with listGroups on an earlier release v1.32.5-beta.3 that got fixed in v1.32.5-beta.4, but if youre seeing this on the latest, than it must be something else. (I just verified that specific issue from beta.3 is not showing up on latest release).

@peterferguson
Copy link
Contributor Author

peterferguson commented Apr 29, 2024

@peterferguson thanks for detailed issue report 🙏 . can you confirm you're testing latest beta RN SDK, should be version v1.32.5-beta.5.

We had an issue with listGroups on an earlier release v1.32.5-beta.3 that got fixed in v1.32.5-beta.4, but if youre seeing this on the latest, than it must be something else. (I just verified that specific issue from beta.3 is not showing up on latest release).

@cameronvoell Yep this is when using v1.32.5-beta.5.

Is there more details on the fix that happened in beta.4 I can also have a look and see if it is related on my side

@peterferguson
Copy link
Contributor Author

This is no longer happening if I use newer accounts and do not invite the older accounts to groups.

Seems I have somehow bricked some accounts & cannot use them to listGroups or even create new groups with them as members.

Will close this as it seems that it will not be an issue going forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants