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

fix_: community sync #5880

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

fix_: community sync #5880

wants to merge 4 commits into from

Conversation

osmaczko
Copy link
Contributor

Prevent community description message being stored without signature. Details: status-im/status-mobile#21303 (comment)

fixes: status-im/status-mobile#21303

@osmaczko osmaczko requested review from qfrank and a team September 25, 2024 19:38
@status-im-auto
Copy link
Member

status-im-auto commented Sep 25, 2024

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 5bfb6df #1 2024-09-25 19:40:10 ~3 min tests-rpc 📄log
✔️ 5bfb6df #1 2024-09-25 19:40:57 ~4 min linux 📦zip
✔️ 5bfb6df #1 2024-09-25 19:42:09 ~5 min android 📦aar
✔️ 5bfb6df #1 2024-09-25 19:42:53 ~5 min ios 📦zip
✔️ 5bfb6df #1 2024-09-25 20:10:51 ~33 min tests 📄log
✔️ 6d88d06 #2 2024-10-04 12:22:51 ~3 min tests-rpc 📄log
✔️ 6d88d06 #2 2024-10-04 12:23:42 ~4 min linux 📦zip
✔️ 6d88d06 #2 2024-10-04 12:24:10 ~5 min ios 📦zip
✔️ 6d88d06 #2 2024-10-04 12:24:10 ~5 min android 📦aar
✔️ 6d88d06 #2 2024-10-04 12:52:27 ~33 min tests 📄log

@qfrank
Copy link
Contributor

qfrank commented Sep 26, 2024

Thank you for your PR! I created the draft mobile PR for QA to test. It just point status-go version to your PR. It would be great if we can have a test that shows signer will be nil in some cases or we can assert signer is always not nil? @osmaczko

@qfrank
Copy link
Contributor

qfrank commented Sep 26, 2024

The bug might not be reproducible every time

Could you explain how we can reproduce it in 100%? @osmaczko

@osmaczko
Copy link
Contributor Author

The bug might not be reproducible every time

Could you explain how we can reproduce it in 100%? @osmaczko

There is no easy way to reproduce. I am trying to come up with integration test for the regression.

@igor-sirotin igor-sirotin changed the title Fix/community sync fix_: community sync Oct 3, 2024
Comment on lines -3501 to -3543
communityDescriptionBytes, err := proto.Marshal(request.Community)
if err != nil {
return nil, err
}

// We need to wrap `request.Community` in an `ApplicationMetadataMessage`
// of type `CommunityDescription` because `UpdateCommunityDescription` expects this.
//
// This is merely for marsheling/unmarsheling, hence we attaching a `Signature`
// is not needed.
metadataMessage := &protobuf.ApplicationMetadataMessage{
Payload: communityDescriptionBytes,
Type: protobuf.ApplicationMetadataMessage_COMMUNITY_DESCRIPTION,
}

appMetadataMsg, err := proto.Marshal(metadataMessage)
if err != nil {
return nil, err
}

isControlNodeSigner := common.IsPubKeyEqual(community.ControlNode(), signer)
if !isControlNodeSigner {
m.logger.Debug("signer is not control node", zap.String("signer", common.PubkeyToHex(signer)), zap.String("controlNode", common.PubkeyToHex(community.ControlNode())))
return nil, ErrNotAuthorized
}

_, processedDescription, err := m.preprocessDescription(community.ID(), request.Community)
if err != nil {
return nil, err
}

_, err = community.UpdateCommunityDescription(processedDescription, appMetadataMsg, nil)
if err != nil {
return nil, err
}

if err = m.handleCommunityTokensMetadata(community); err != nil {
return nil, err
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, don't we want to keep this around for 3 versions, until users upgrade?
(only process it if CommunityDescriptionMessage is missing)

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 18 lines in your changes missing coverage. Please review.

Project coverage is 47.40%. Comparing base (c1dd939) to head (6d88d06).
Report is 1 commits behind head on develop.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
protocol/communities/manager.go 40.74% 8 Missing and 8 partials ⚠️
protocol/messenger_communities.go 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5880      +/-   ##
===========================================
+ Coverage    45.78%   47.40%   +1.61%     
===========================================
  Files          830      830              
  Lines       137660   137643      -17     
===========================================
+ Hits         63034    65251    +2217     
+ Misses       67300    64633    -2667     
- Partials      7326     7759     +433     
Flag Coverage Δ
functional 10.15% <0.00%> (?)
unit 46.72% <57.14%> (+0.93%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rotocol/communities/community_events_processing.go 80.34% <100.00%> (+4.30%) ⬆️
protocol/messenger.go 62.33% <100.00%> (-0.98%) ⬇️
protocol/messenger_handler.go 59.33% <100.00%> (-0.46%) ⬇️
protocol/messenger_communities.go 53.54% <81.81%> (-0.53%) ⬇️
protocol/communities/manager.go 65.30% <40.74%> (-0.63%) ⬇️

... and 148 files with indirect coverage changes

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.

Part of communities are not synced after syncing with Desktop
4 participants