xmtp / xmtp-react-native

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

Bug: App Crash xmtp_rust_swift::ffi::__swift_bridge__RustClient_publish:: #327

Closed alexrisch closed 6 months ago

alexrisch commented 6 months ago

Describe the bug

App crashes with xmtp_rust_swift::ffi::__swift_bridge__RustClientpublish::$u7b$$u7b$closure$u7d$$u7d$::hee8486f9c2d86159 + 1184068

Seen when using: XMTP Pod: 0.7.7-alpha0 React Native SDK: 1.24.5

Seems to happen when fetching list of conversations, but not entirely sure

Expected behavior

No response

Steps to reproduce the bug

No response

alexrisch commented 6 months ago

This is able to be recreated with the following:


  const alix = await Client.createRandom({ env: 'local' })
  const allowAddresses: string[] = []
  const blockAddresses: string[] = []
  await alix.contacts.refreshConsentList()
  await alix.contacts.consentList()
  const arr = Array(41).fill(true)
  await Promise.all(
    arr.map(async (_, index) => {
      const client = await Client.createRandom({ env: 'local' })
      if (index % 2) {
        blockAddresses.push(client.address)
        await alix.contacts.deny(blockAddresses)
      } else {
        allowAddresses.push(client.address)
        await alix.contacts.allow(allowAddresses)
      }
    })
  )
  console.log('Finished1')
  allowAddresses.push(alix.address)
  blockAddresses.push(alix.address)

  await Promise.all([
    alix.contacts.allow(allowAddresses),
    alix.contacts.deny(blockAddresses),
  ])
  console.log('Finished2')
  await alix.contacts.consentList()
  console.log('Finished3')
  return true
})```
Note this will work if the allow/deny inside of the first Promise.all it will work
So this is an issue with integration