xmtp / xmtp-react-native

A package you can use to build with XMTP in a React Native or Expo app.
MIT License
35 stars 14 forks source link

Bug: `listGroups` fails in the latest Beta #378

Closed peterferguson closed 2 months ago

peterferguson commented 2 months ago

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:)

https://github.com/xmtp/xmtp-react-native/blob/efdf49f934a367eb09cc539d62ecbce98f815a63/ios/Wrappers/GroupWrapper.swift#L12-L30

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.

https://github.com/xmtp/xmtp-react-native/blob/efdf49f934a367eb09cc539d62ecbce98f815a63/ios/XMTPModule.swift#L345-L365

Expected behavior

No response

Steps to reproduce the bug

No response

neekolas commented 2 months ago

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 commented 2 months ago

@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 commented 2 months ago

@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 commented 2 months ago

@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 commented 2 months ago

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