status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
287 stars 78 forks source link

Community Owner was transfer to another user but the original one still shows as the Owner #16226

Open jrainville opened 2 weeks ago

jrainville commented 2 weeks ago

Bug Report

Description

Very weird issue that is happening to our users.

86 was the owner of the Status Inu community. He decided to transfer the owner token to dfern. We can confirm on chain that the token is now owned by dfern: https://optimistic.etherscan.io/tx/0x3e3c98d7f69fd22620d54f077d04047d2f0ed0dba24a2b39da865ec2d416e1da

dfern then called the contract to change the signer to himself: https://optimistic.etherscan.io/tx/0x68465bfbf577edd570d1891dec1ce9f664cd6bf0646ff68f5964f944869388a9

I checked the contract myself and the new signer is 0x04d1deed9de5df9f60a696b6c004c9932d0761427d9ddd21c2f598cb21b049a289f8fab348fb803cdce21a9595219c6b41deccdcd4c7effc95ada956331e12e063 which once compressed gives zQ3shtmMVfJRppbyjqzY9tXKXABrMH6FULfGdFrEahwu1sLvC, which is dfern's chatkey.

dfern tried to restart the app to trigger a re-evaluation and despite that, 86 still appears as the owner on my screen and 86's screen. Only dfern sees himself as owner.

I tried checking the community with a new account, but it never shows up in the Portal because the only accessible community descriptions are from 86, who is no longer the rightful owner.

DEBUG[08-30|18:56:40.255|github.com/status-im/status-go/protocol/communities/manager.go:2118]                        HandleCommunityDescriptionMessage        communityID= clock=1,725,042,960,649
INFO [08-30|18:56:40.256|github.com/status-im/status-go/protocol/communities/manager.go:2204]                        updating verified owner                  communityID=0x024fa9114e8884d220111653fe9a2095e62c8d0890198ac9787d512d707e276501 verifiedOwner=0x04d1deed9de5df9f60a696b6c004c9932d0761427d9ddd21c2f598cb21b049a289f8fab348fb803cdce21a9595219c6b41deccdcd4c7effc95ada956331e12e063 signer=0x044fa9114e8884d220111653fe9a2095e62c8d0890198ac9787d512d707e276501c8d21e17830203dbfe5f0a0b1d2a82bdc204b3d4fca1328b408fbf2705971b24 controlNode=0x044fa9114e8884d220111653fe9a2095e62c8d0890198ac9787d512d707e276501c8d21e17830203dbfe5f0a0b1d2a82bdc204b3d4fca1328b408fbf2705971b24
ERROR[08-30|18:56:40.256|github.com/status-im/status-go/protocol/communities/manager.go:694]                         failed to handle community               error="not authorized"

Which is returned here: https://github.com/status-im/status-go/blob/bd0464d192971a284f29cf64c97a1914124307fe/protocol/communities/manager.go#L2213-L2215

Steps to reproduce

We are not fully sure, but there have been some funny scenarios happening

  1. Have the Owner token on Optimism
  2. Import the same account on a different device
  3. Make the new device control node (in this case, 86 actually waited weeks before doing this)
  4. Transfer the owner token to another account
  5. Complete the transfer steps on the other account

Expected behavior

The new account appears as control node and can update the community

Actual behavior

Old account still appears as control node. Now we are stuck with both account not sending anything

Additional Information

jrainville commented 2 weeks ago

@osmaczko would you mind looking at the control node transfer code and see if maybe there is a bug in there?

osmaczko commented 1 week ago

There are at least a few issues I've found so far:

1) The community description is published by both 86.eth and dfern, as if 86.eth didn't know the control node was transferred to dfern: descriptions.csv. 2) Members still seem to accept the community description from 86.eth. 3) The CommunityID field is empty, but the entire owner token concept logic relies on it being set. I'm not sure how this happened and how it works without it.

The good news is that this state is most likely recoverable, but it will require a well-thought-out and thoroughly tested patch. It might take some time.