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

feat: kick all members after ownership change and auto-accept after sharing the address #4187

Merged
merged 6 commits into from
Oct 31, 2023

Conversation

mprakhov
Copy link
Contributor

@mprakhov mprakhov commented Oct 24, 2023

  • new community message to share an address with the new community owner on the ownership change
  • new request to join state RequestToJoinStateOwnershipChanged. On the client side - indicate, that the user was kicked by the owner and required to share the revealed address for the client. On the owner's side, this state will be used to auto-accept requests to join from the client
  • API promotes self as a control node
  • API to get awaiting address requests to join
  • remove CommunityDescription to validate from the validation loop if HandleCommunityDescription returns an error

status-desktop PR: status-im/status-desktop#12560

Closes: status-im/status-desktop#11969

@mprakhov
Copy link
Contributor Author

P.S. Not sure that some fn naming is good, so I'm open for a renamings

@status-im-auto
Copy link
Member

status-im-auto commented Oct 24, 2023

Jenkins Builds

Click to see older builds (56)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 9564de0 #1 2023-10-24 09:35:21 ~2 min tests 📄log
✔️ 9564de0 #1 2023-10-24 09:36:04 ~3 min linux 📦zip
✔️ 9564de0 #1 2023-10-24 09:37:53 ~5 min ios 📦zip
✔️ 9564de0 #1 2023-10-24 09:37:54 ~5 min android 📦aar
✔️ f5b57ee #2 2023-10-24 09:41:44 ~3 min ios 📦zip
✔️ f5b57ee #2 2023-10-24 09:41:48 ~3 min linux 📦zip
✔️ f5b57ee #2 2023-10-24 09:43:50 ~5 min android 📦aar
✖️ f5b57ee #2 2023-10-24 09:50:13 ~11 min tests 📄log
✔️ bc74aa6 #3 2023-10-25 10:45:17 ~2 min android 📦aar
✖️ bc74aa6 #3 2023-10-25 10:45:58 ~2 min tests 📄log
✔️ bc74aa6 #3 2023-10-25 10:46:26 ~3 min linux 📦zip
✔️ bc74aa6 #3 2023-10-25 10:48:20 ~5 min ios 📦zip
✖️ 5228a37 #4 2023-10-25 10:54:08 ~1 min tests 📄log
✔️ 5228a37 #4 2023-10-25 10:54:45 ~1 min linux 📦zip
✔️ 5228a37 #4 2023-10-25 10:55:08 ~2 min android 📦aar
✔️ 5228a37 #4 2023-10-25 10:58:03 ~5 min ios 📦zip
✖️ d9bf191 #5 2023-10-25 10:55:25 ~54 sec tests 📄log
✔️ d9bf191 #5 2023-10-25 10:56:16 ~1 min linux 📦zip
✔️ d9bf191 #5 2023-10-25 10:56:58 ~1 min android 📦aar
✔️ d9bf191 #5 2023-10-25 11:03:51 ~5 min ios 📦zip
✖️ b962226 #6 2023-10-25 11:55:43 ~1 min tests 📄log
✔️ b962226 #6 2023-10-25 11:56:27 ~2 min android 📦aar
✔️ b962226 #6 2023-10-25 11:57:26 ~2 min linux 📦zip
✔️ b962226 #6 2023-10-25 11:59:50 ~5 min ios 📦zip
✔️ c392e8c #7 2023-10-25 12:04:41 ~1 min linux 📦zip
✔️ c392e8c #7 2023-10-25 12:04:55 ~1 min android 📦aar
✔️ c392e8c #7 2023-10-25 12:08:18 ~5 min ios 📦zip
✖️ c392e8c #7 2023-10-25 12:37:38 ~34 min tests 📄log
✔️ 3eebe98 #8 2023-10-25 12:36:53 ~1 min android 📦aar
✔️ 3eebe98 #8 2023-10-25 12:37:24 ~2 min linux 📦zip
✔️ 3eebe98 #8 2023-10-25 12:40:31 ~5 min ios 📦zip
✖️ 3eebe98 #8 2023-10-25 12:40:31 ~2 min tests 📄log
✔️ 587fdf2 #9 2023-10-25 13:04:59 ~1 min linux 📦zip
✔️ 587fdf2 #9 2023-10-25 13:05:39 ~2 min android 📦aar
✔️ 587fdf2 #9 2023-10-25 13:09:18 ~5 min ios 📦zip
✖️ 587fdf2 #9 2023-10-25 13:24:21 ~20 min tests 📄log
✔️ 12f2b43 #10 2023-10-26 17:04:17 ~1 min linux 📦zip
✔️ 12f2b43 #10 2023-10-26 17:05:08 ~2 min android 📦aar
✔️ 12f2b43 #10 2023-10-26 17:08:11 ~5 min ios 📦zip
✖️ 12f2b43 #10 2023-10-26 17:18:15 ~15 min tests 📄log
✖️ 12f2b43 #11 2023-10-26 18:02:52 ~32 min tests 📄log
✔️ b17e98a #11 2023-10-26 20:41:25 ~1 min linux 📦zip
✔️ b17e98a #11 2023-10-26 20:42:00 ~2 min android 📦aar
✔️ b17e98a #11 2023-10-26 20:43:26 ~3 min ios 📦zip
✖️ b17e98a #12 2023-10-26 20:55:43 ~15 min tests 📄log
✖️ b17e98a #13 2023-10-26 22:01:54 ~15 min tests 📄log
✔️ b17e98a #14 2023-10-26 22:50:49 ~32 min tests 📄log
✔️ 90b567e #12 2023-10-27 15:29:37 ~1 min linux 📦zip
✔️ 90b567e #12 2023-10-27 15:30:05 ~2 min android 📦aar
✖️ 90b567e #15 2023-10-27 15:30:45 ~2 min tests 📄log
✔️ 90b567e #12 2023-10-27 15:31:34 ~3 min ios 📦zip
✖️ 90b567e #16 2023-10-27 16:28:53 ~15 min tests 📄log
78b7242 #13 2023-10-30 17:21:02 ~22 sec android 📄log
78b7242 #13 2023-10-30 17:21:03 ~22 sec ios 📄log
✖️ 78b7242 #17 2023-10-30 17:21:22 ~41 sec tests 📄log
78b7242 #13 2023-10-30 17:21:40 ~1 min linux 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 59dd24f #18 2023-10-31 09:16:08 ~39 sec tests 📄log
✔️ 59dd24f #14 2023-10-31 09:17:29 ~2 min android 📦aar
✔️ 59dd24f #14 2023-10-31 09:18:23 ~2 min linux 📦zip
✔️ 59dd24f #14 2023-10-31 09:18:47 ~3 min ios 📦zip
✔️ f5fce1c #15 2023-10-31 10:00:56 ~1 min linux 📦zip
✔️ f5fce1c #15 2023-10-31 10:01:13 ~2 min android 📦aar
✔️ f5fce1c #15 2023-10-31 10:02:08 ~3 min ios 📦zip
✖️ f5fce1c #19 2023-10-31 10:03:03 ~3 min tests 📄log
✖️ f5fce1c #20 2023-10-31 10:13:44 ~2 min tests 📄log
✖️ f5fce1c #21 2023-10-31 10:23:14 ~2 min tests 📄log
✖️ f5fce1c #22 2023-10-31 10:28:57 ~2 min tests 📄log
✖️ f5fce1c #23 2023-10-31 10:37:02 ~2 min tests 📄log
✔️ f5fce1c #24 2023-10-31 11:27:07 ~32 min tests 📄log

Copy link
Contributor

@osmaczko osmaczko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 I have few naming improvement proposals and concerns

protocol/communities/request_to_join.go Outdated Show resolved Hide resolved
protocol/communities/persistence.go Outdated Show resolved Hide resolved
protocol/protobuf/anon_metrics.pb.go Outdated Show resolved Hide resolved
protocol/protobuf/application_metadata_message.proto Outdated Show resolved Hide resolved
protocol/protobuf/communities.proto Outdated Show resolved Hide resolved
@@ -646,6 +646,10 @@ func (api *PublicAPI) DeleteCommunityCategory(request *requests.DeleteCommunityC
return api.service.messenger.DeleteCommunityCategory(request)
}

func (api *PublicAPI) CommunityNewOwnershipKickAllAndRequestRejoin(communityID types.HexBytes) (*protocol.MessengerResponse, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we don't want explicit endpoint for that, this should happen automatically when we set ourselves as control node.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that we were planning to call it directly from the status-desktop side.
So far it is not clear to me how we will set up as an owner. Will we have a separate API for this? As I understand - we will listen for a community token on the status-desktop side

Do you mean it must be put in PromoteSelfToControlNode ?
I'm asking as I have status-desktop changes where I call this API async and if we do not need it - then I need to remove it

P.S. Anyway, it was used by me for testing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The action will be triggered manually by the status-desktop client. The objective is to have a single API: PromoteSelfToControlNode. The specifics of what this API does should be determined internally in status-go logic. If the control node changes to a new user, the API will make the current user the new control node, update the contract with itself as a signer, remove all others, and then request addresses. If the control node changes among devices, the API will make the current installation the control node.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thank you. Should I implement this API or it is already in progress in some other task?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. To the best of my knowledge, it hasn't been implemented yet. It would be great if you could address it within the scope of this PR 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@endulab has a PR with the call to setPubkey (to make yourself owner), you can use the same API or create a new one that's called PromoteSelfToControlNode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added API PromoteSelfToControlNode

protocol/communities/manager.go Outdated Show resolved Hide resolved
@osmaczko
Copy link
Contributor

osmaczko commented Oct 24, 2023

A small reminder: please try to keep commits self-contained. If someone checks out 4a3cc37, it will not compile because it requires the subsequent commit that runs make generate. Every commit should be healthy so that it compiles and tests pass.

Otherwise, things like git bisect will become almost impossible.

@mprakhov
Copy link
Contributor Author

A small reminder: please try to keep commits self-contained. If someone checks out 4a3cc37, it will not compile because it requires the subsequent commit that runs make generate. Every commit should be healthy so that it compiles and tests pass.

Otherwise, things like git bisect will become almost impossible.

I always do squash and merge during the merge, so this problem will be not actual in develop branch. Here I'm trying to split mage generate "spam" and implementation. Also if some changes are done, from time to time I try to put them into a separate commit in order to see the changes

Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job!

protocol/communities/persistence.go Outdated Show resolved Hide resolved
protocol/messenger_communities.go Outdated Show resolved Hide resolved
protocol/messenger_communities.go Outdated Show resolved Hide resolved
protocol/messenger_communities.go Outdated Show resolved Hide resolved
protocol/messenger_handler.go Outdated Show resolved Hide resolved
protocol/protobuf/application_metadata_message.proto Outdated Show resolved Hide resolved
@mprakhov
Copy link
Contributor Author

mprakhov commented Oct 25, 2023

Found a bug with resending requests to join during the testing. When we have a new owner, CommunityDescription can be verified with a delay (due to loop interval) and it can cause the situation when the client received CommunityDescription but did not verify it, and then it receives a resend request to join message, but he is still not kicked and current contract owner != controlNode() pubkey from his old CommunityDescription

Taking into account, that the community description will be added to the verification loop only when there will be a new control node, the clients during publishing TokenCommunityValidated can detect themself if community has a new control node (owner) and automatically send revealed addresses to him. In this case, we do not need additional signal from control node to all members

protocol/communities/manager.go Outdated Show resolved Hide resolved
services/ext/api.go Outdated Show resolved Hide resolved
protocol/messenger_communities.go Outdated Show resolved Hide resolved
protocol/messenger_communities.go Outdated Show resolved Hide resolved
protocol/messenger_communities.go Outdated Show resolved Hide resolved
Comment on lines +1024 to +1025
if newControlNode != nil {
o.setControlNode(newControlNode)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osmaczko please, take a look in this commit changes

Previously, ControlNodeChanged was not set correctly from the loop as we updated the original Community ,while we need to update the modified Community

@mprakhov mprakhov merged commit eb437e9 into develop Oct 31, 2023
6 of 7 checks passed
@mprakhov mprakhov deleted the mp/issue-11969 branch October 31, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Community Ownership] new Owner should ask members for addresses
4 participants