feat: community privileged user sync message (#3879)

This commit is contained in:
Mykhailo Prakhov 2023-08-15 17:27:01 +02:00 committed by GitHub
parent b9b86712e7
commit 7eac9b170c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 936 additions and 591 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1337,7 +1337,14 @@ func (m *Manager) validateAndFilterEvents(community *Community, events []Communi
validatedEvents := make([]CommunityEvent, 0, len(events))
validateEvent := func(event *CommunityEvent) error {
signer, err := event.RecoverSigner()
if event.Signature == nil || len(event.Signature) == 0 {
return errors.New("missing signature")
}
signer, err := crypto.SigToPub(
crypto.Keccak256(event.Payload),
event.Signature,
)
if err != nil {
return err
}
@ -1478,6 +1485,69 @@ func (m *Manager) HandleCommunityEventsMessageRejected(signer *ecdsa.PublicKey,
return reapplyEventsMessage, nil
}
func (m *Manager) HandleCommunityPrivilegedUserSyncMessage(signer *ecdsa.PublicKey, message *protobuf.CommunityPrivilegedUserSyncMessage) error {
if signer == nil {
return errors.New("signer can't be nil")
}
community, err := m.persistence.GetByID(&m.identity.PublicKey, message.CommunityId)
if err != nil {
return err
}
if community == nil {
return ErrOrgNotFound
}
if !community.IsPrivilegedMember(&m.identity.PublicKey) {
return errors.New("user has no permissions to process privileged sync message")
}
isControlNodeMsg := common.IsPubKeyEqual(community.PublicKey(), signer)
if !(isControlNodeMsg || community.IsPrivilegedMember(signer)) {
return errors.New("user has no permissions to send privileged sync message")
}
err = validateCommunityPrivilegedUserSyncMessage(message)
if err != nil {
return err
}
switch message.Type {
case protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN:
fallthrough
case protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_REJECT_REQUEST_TO_JOIN:
if !isControlNodeMsg {
return errors.New("accepted/requested to join sync messages can be send only by the control node")
}
var state RequestToJoinState
if message.Type == protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN {
state = RequestToJoinStateAccepted
} else {
state = RequestToJoinStateDeclined
}
for signer, requestToJoinProto := range message.RequestToJoin {
requestToJoin := &RequestToJoin{
PublicKey: signer,
Clock: requestToJoinProto.Clock,
ENSName: requestToJoinProto.EnsName,
CommunityID: requestToJoinProto.CommunityId,
State: state,
}
requestToJoin.CalculateID()
_, err := m.saveOrUpdateRequestToJoin(signer, community.ID(), requestToJoin)
if err != nil {
return err
}
}
}
return nil
}
func (m *Manager) handleAdditionalAdminChanges(community *Community) error {
if !(community.IsControlNode() || community.HasPermissionToSendCommunityEvents()) {
@ -1538,12 +1608,6 @@ func (m *Manager) saveOrUpdateRequestToJoin(signer string, communityID types.Hex
}
func (m *Manager) handleCommunityEventRequestAccepted(community *Community, communityEvent *CommunityEvent) error {
requestToJoinState := RequestToJoinStateAccepted
if community.HasPermissionToSendCommunityEvents() {
// if we're an admin and we receive this admin event, we know the state is `pending`
requestToJoinState = RequestToJoinStateAcceptedPending
}
acceptedRequestsToJoin := make([]types.HexBytes, 0)
for signer, request := range communityEvent.AcceptedRequestsToJoin {
@ -1552,19 +1616,27 @@ func (m *Manager) handleCommunityEventRequestAccepted(community *Community, comm
Clock: request.Clock,
ENSName: request.EnsName,
CommunityID: request.CommunityId,
State: requestToJoinState,
State: RequestToJoinStateAcceptedPending,
}
requestToJoin.CalculateID()
if community.HasPermissionToSendCommunityEvents() {
existingRequestToJoin, err := m.persistence.GetRequestToJoin(requestToJoin.ID)
if err != nil && err != sql.ErrNoRows {
return err
}
if existingRequestToJoin.MarkedAsPendingByPrivilegedAccount() {
// the request is already in some pending state so we won't override it again
continue
existingRequestToJoin, err := m.persistence.GetRequestToJoin(requestToJoin.ID)
if err != nil && err != sql.ErrNoRows {
return err
}
if community.IsControlNode() {
// If request to join exists in control node, save request as RequestToJoinStateAccepted
// If request to join does not exist in control node, save request as RequestToJoinStateAcceptedPending
// as privileged users don't have revealed addresses. This can happen if control node received
// community event message before user request to join
if existingRequestToJoin != nil {
requestToJoin.State = RequestToJoinStateAccepted
}
} else if community.HasPermissionToSendCommunityEvents() && existingRequestToJoin.State != RequestToJoinStatePending {
// the request is already in some pending state or was processed by a control node,
// so we won't override it again
continue
}
requestUpdated, err := m.saveOrUpdateRequestToJoin(signer, community.ID(), requestToJoin)
@ -1587,13 +1659,6 @@ func (m *Manager) handleCommunityEventRequestAccepted(community *Community, comm
}
func (m *Manager) handleCommunityEventRequestRejected(community *Community, communityEvent *CommunityEvent) error {
requestToJoinState := RequestToJoinStateDeclined
if community.HasPermissionToSendCommunityEvents() {
// if we're an admin and we receive this admin event, we want to see the same
// state that the other admin has decided for
requestToJoinState = RequestToJoinStateDeclinedPending
}
rejectedRequestsToJoin := make([]types.HexBytes, 0)
for signer, request := range communityEvent.RejectedRequestsToJoin {
@ -1602,19 +1667,27 @@ func (m *Manager) handleCommunityEventRequestRejected(community *Community, comm
Clock: request.Clock,
ENSName: request.EnsName,
CommunityID: request.CommunityId,
State: requestToJoinState,
State: RequestToJoinStateDeclinedPending,
}
requestToJoin.CalculateID()
if community.HasPermissionToSendCommunityEvents() {
existingRequestToJoin, err := m.persistence.GetRequestToJoin(requestToJoin.ID)
if err != nil && err != sql.ErrNoRows {
return err
}
if existingRequestToJoin.MarkedAsPendingByPrivilegedAccount() {
// the request is already in some pending state so we won't override it again
continue
existingRequestToJoin, err := m.persistence.GetRequestToJoin(requestToJoin.ID)
if err != nil && err != sql.ErrNoRows {
return err
}
if community.IsControlNode() {
// If request to join exists in control node, save request as RequestToJoinStateDeclined
// If request to join does not exist in control node, save request as RequestToJoinStateDeclinedPending
// as privileged users don't have revealed addresses. This can happen if control node received
// community event message before user request to join
if existingRequestToJoin != nil {
requestToJoin.State = RequestToJoinStateDeclined
}
} else if community.HasPermissionToSendCommunityEvents() && existingRequestToJoin.State != RequestToJoinStatePending {
// the request is already in some pending state or was processed by a control node,
// so we won't override it again
continue
}
requestUpdated, err := m.saveOrUpdateRequestToJoin(signer, community.ID(), requestToJoin)
@ -1789,12 +1862,7 @@ func (m *Manager) accountsSatisfyPermissionsToJoinChannels(community *Community,
return result, nil
}
func (m *Manager) AcceptRequestToJoin(request *requests.AcceptRequestToJoinCommunity) (*Community, error) {
dbRequest, err := m.persistence.GetRequestToJoin(request.ID)
if err != nil {
return nil, err
}
func (m *Manager) AcceptRequestToJoin(dbRequest *RequestToJoin) (*Community, error) {
pk, err := common.HexToPubkey(dbRequest.PublicKey)
if err != nil {
return nil, err
@ -1805,7 +1873,7 @@ func (m *Manager) AcceptRequestToJoin(request *requests.AcceptRequestToJoinCommu
return nil, err
}
if community.HasPermissionToSendCommunityEvents() {
if community.HasPermissionToSendCommunityEvents() && !community.IsControlNode() {
if dbRequest.MarkedAsPendingByPrivilegedAccount() {
// if the request is in any pending state, it means our admin node has either
// already made a decision in the past, or previously received a decision by
@ -1887,15 +1955,10 @@ func (m *Manager) GetRequestToJoin(ID types.HexBytes) (*RequestToJoin, error) {
return m.persistence.GetRequestToJoin(ID)
}
func (m *Manager) DeclineRequestToJoin(request *requests.DeclineRequestToJoinCommunity) error {
dbRequest, err := m.persistence.GetRequestToJoin(request.ID)
if err != nil {
return err
}
func (m *Manager) DeclineRequestToJoin(dbRequest *RequestToJoin) (*Community, error) {
community, err := m.GetByID(dbRequest.CommunityID)
if err != nil {
return err
return nil, err
}
requestToJoinState := RequestToJoinStateDeclined
@ -1904,20 +1967,20 @@ func (m *Manager) DeclineRequestToJoin(request *requests.DeclineRequestToJoinCom
}
err = m.persistence.SetRequestToJoinState(dbRequest.PublicKey, dbRequest.CommunityID, requestToJoinState)
if err != nil {
return err
return nil, err
}
err = community.DeclineRequestToJoin(dbRequest)
if err != nil {
return err
return nil, err
}
err = m.saveAndPublish(community)
if err != nil {
return err
return nil, err
}
return nil
return community, nil
}
func (m *Manager) isUserRejectedFromCommunity(signer *ecdsa.PublicKey, community *Community, requestClock uint64) (bool, error) {
@ -2026,7 +2089,9 @@ func (m *Manager) HandleCommunityRequestToJoin(signer *ecdsa.PublicKey, request
// requests here, because if it's accepted/pending, we still need to perform
// some checks
if existingRequestToJoin.State == RequestToJoinStateDeclinedPending {
requestToJoin.State = RequestToJoinStateDeclined
if community.IsControlNode() {
requestToJoin.State = RequestToJoinStateDeclined
}
return requestToJoin, nil
}
} else {
@ -4535,3 +4600,30 @@ func (m *Manager) HandleCommunityTokensMetadata(communityID string, communityTok
}
return nil
}
func validateCommunityPrivilegedUserSyncMessage(message *protobuf.CommunityPrivilegedUserSyncMessage) error {
if message == nil {
return errors.New("invalid CommunityPrivilegedUserSyncMessage message")
}
if message.CommunityId == nil || len(message.CommunityId) == 0 {
return errors.New("invalid CommunityId in CommunityPrivilegedUserSyncMessage message")
}
switch message.Type {
case protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN:
fallthrough
case protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_REJECT_REQUEST_TO_JOIN:
if message.RequestToJoin == nil || len(message.RequestToJoin) == 0 {
return errors.New("invalid request to join in CommunityPrivilegedUserSyncMessage message")
}
for _, requestToJoinProto := range message.RequestToJoin {
if len(requestToJoinProto.CommunityId) == 0 {
return errors.New("no communityId in request to join in CommunityPrivilegedUserSyncMessage message")
}
}
}
return nil
}

View File

@ -116,13 +116,6 @@ func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerAcceptMemberRequ
testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders(s, community, user, additionalOwner)
}
func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerAcceptMemberRequestToJoinNotConfirmedByControlNode() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_OWNER, []*Messenger{})
// set up additional user that will send request to join
user := s.newMessenger("", []string{})
testAcceptMemberRequestToJoinNotConfirmedByControlNode(s, community, user)
}
func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerAcceptMemberRequestToJoin() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_OWNER, []*Messenger{})
@ -139,13 +132,6 @@ func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerRejectMemberRequ
testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders(s, community, user, additionalOwner)
}
func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerRejectMemberRequestToJoinNotConfirmedByControlNode() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_OWNER, []*Messenger{})
// set up additional user that will send request to join
user := s.newMessenger("", []string{})
testRejectMemberRequestToJoinNotConfirmedByControlNode(s, community, user)
}
func (s *OwnerWithoutCommunityKeyCommunityEventsSuite) TestOwnerRejectMemberRequestToJoin() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_OWNER, []*Messenger{})

View File

@ -131,13 +131,6 @@ func (s *TokenMasterCommunityEventsSuite) TestTokenMasterCannotDeleteBecomeToken
s, community, protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER, protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER)
}
func (s *TokenMasterCommunityEventsSuite) TestTokenMasterAcceptMemberRequestToJoinNotConfirmedByControlNode() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER, []*Messenger{})
// set up additional user that will send request to join
user := s.newMessenger("", []string{})
testAcceptMemberRequestToJoinNotConfirmedByControlNode(s, community, user)
}
func (s *TokenMasterCommunityEventsSuite) TestTokenMasterAcceptMemberRequestToJoin() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER, []*Messenger{})
// set up additional user that will send request to join
@ -161,13 +154,6 @@ func (s *TokenMasterCommunityEventsSuite) TestTokenMasterRejectMemberRequestToJo
testRejectMemberRequestToJoinResponseSharedWithOtherEventSenders(s, community, user, additionalTokenMaster)
}
func (s *TokenMasterCommunityEventsSuite) TestTokenMasterRejectMemberRequestToJoinNotConfirmedByControlNode() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER, []*Messenger{})
// set up additional user that will send request to join
user := s.newMessenger("", []string{})
testRejectMemberRequestToJoinNotConfirmedByControlNode(s, community, user)
}
func (s *TokenMasterCommunityEventsSuite) TestTokenMasterRejectMemberRequestToJoin() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_TOKEN_MASTER, []*Messenger{})
// set up additional user that will send request to join

View File

@ -875,26 +875,29 @@ func testAcceptMemberRequestToJoin(base CommunityEventsTestsInterface, community
// forwards its accept decision to the control node
s.Require().False(response.Communities()[0].HasMember(&user.identity.PublicKey))
// user receives community admin event without being a member yet
response, err = WaitOnMessengerResponse(
// at this point, the request to join is marked as accepted by GetEventSender node
acceptedRequestsPending, err := base.GetEventSender().AcceptedPendingRequestsToJoinForCommunity(community.ID())
s.Require().NoError(err)
s.Require().Len(acceptedRequestsPending, 1)
s.Require().Equal(acceptedRequestsPending[0].PublicKey, common.PubkeyToHex(&user.identity.PublicKey))
// user should not receive community admin event without being a member yet
_, err = WaitOnMessengerResponse(
user,
func(r *MessengerResponse) bool { return len(r.Communities()) > 0 },
"user did not receive community request to join response",
)
s.Require().NoError(err)
s.Require().Len(response.Communities(), 1)
// `user` should not be part of the community yet, we need to wait for
// the control node to confirm `eventSender`s decision
s.Require().False(response.Communities()[0].HasMember(&user.identity.PublicKey))
s.Require().Error(err)
// control node receives community event with accepted membership request
response, err = WaitOnMessengerResponse(
_, err = WaitOnMessengerResponse(
base.GetControlNode(),
func(r *MessengerResponse) bool { return len(r.Communities()) > 0 },
func(r *MessengerResponse) bool {
return len(r.Communities()) > 0 && r.Communities()[0].HasMember(&user.identity.PublicKey)
},
"control node did not receive community request to join response",
)
s.Require().NoError(err)
s.Require().Len(response.Communities(), 1)
// at this point, the request to join is marked as accepted by control node
acceptedRequests, err := base.GetControlNode().AcceptedRequestsToJoinForCommunity(community.ID())
@ -912,68 +915,32 @@ func testAcceptMemberRequestToJoin(base CommunityEventsTestsInterface, community
"alice did not receive community request to join response",
)
s.Require().NoError(err)
}
func testAcceptMemberRequestToJoinNotConfirmedByControlNode(base CommunityEventsTestsInterface, community *communities.Community, user *Messenger) {
// set up additional user that will send request to join
_, err := user.Start()
s := base.GetSuite()
s.Require().NoError(err)
defer user.Shutdown() // nolint: errcheck
advertiseCommunityTo(s, community, base.GetControlNode(), user)
// user sends request to join
requestToJoin := &requests.RequestToJoinCommunity{CommunityID: community.ID()}
response, err := user.RequestToJoinCommunity(requestToJoin)
s.Require().NoError(err)
s.Require().NotNil(response)
s.Require().Len(response.RequestsToJoinCommunity, 1)
sentRequest := response.RequestsToJoinCommunity[0]
// event sender receives request to join
response, err = WaitOnMessengerResponse(
// event sender receives updated community
_, err = WaitOnMessengerResponse(
base.GetEventSender(),
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
"event sender did not receive community request to join",
func(r *MessengerResponse) bool {
return len(r.Communities()) > 0 && r.Communities()[0].HasMember(&user.identity.PublicKey)
},
"event sender did not receive community with the new member",
)
s.Require().NoError(err)
s.Require().Len(response.RequestsToJoinCommunity, 1)
// event sender has not accepted request yet
eventSenderCommunity, err := base.GetEventSender().GetCommunityByID(community.ID())
s.Require().NoError(err)
s.Require().False(eventSenderCommunity.HasMember(&user.identity.PublicKey))
acceptRequestToJoin := &requests.AcceptRequestToJoinCommunity{ID: sentRequest.ID}
response, err = base.GetEventSender().AcceptRequestToJoinCommunity(acceptRequestToJoin)
s.Require().NoError(err)
s.Require().NotNil(response)
s.Require().Len(response.Communities(), 1)
// we don't expect `user` to be a member already, because `eventSender` merely
// forwards its accept decision to the control node
s.Require().False(response.Communities()[0].HasMember(&user.identity.PublicKey))
// at this point, the request to join is in accepted/pending state
acceptedPendingRequests, err := base.GetEventSender().AcceptedPendingRequestsToJoinForCommunity(community.ID())
s.Require().NoError(err)
s.Require().Len(acceptedPendingRequests, 1)
s.Require().Equal(acceptedPendingRequests[0].PublicKey, common.PubkeyToHex(&user.identity.PublicKey))
// user receives request to join response
response, err = WaitOnMessengerResponse(
user,
func(r *MessengerResponse) bool { return len(r.Communities()) > 0 },
"user did not receive community request to join response",
// check control node notify event sender about accepting request to join
_, err = WaitOnMessengerResponse(
base.GetEventSender(),
func(r *MessengerResponse) bool {
acceptedRequests, err := base.GetEventSender().AcceptedRequestsToJoinForCommunity(community.ID())
return err == nil && len(acceptedRequests) == 2 && (acceptedRequests[1].PublicKey == common.PubkeyToHex(&user.identity.PublicKey))
},
"no updates from control node",
)
s.Require().NoError(err)
s.Require().Len(response.Communities(), 1)
// `user` should not be part of the community yet, because control node
// hasn't confirmed the decistion yet
s.Require().False(response.Communities()[0].HasMember(&user.identity.PublicKey))
acceptedRequestsPending, err = base.GetEventSender().AcceptedPendingRequestsToJoinForCommunity(community.ID())
s.Require().NoError(err)
s.Require().Len(acceptedRequestsPending, 0)
}
func testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders(base CommunityEventsTestsInterface, community *communities.Community, user *Messenger, additionalEventSender *Messenger) {
@ -1092,60 +1059,6 @@ func testRejectMemberRequestToJoinResponseSharedWithOtherEventSenders(base Commu
s.Require().Equal(rejectedPendingRequests[0].PublicKey, common.PubkeyToHex(&user.identity.PublicKey))
}
func testRejectMemberRequestToJoinNotConfirmedByControlNode(base CommunityEventsTestsInterface, community *communities.Community, user *Messenger) {
// set up additional user that will send request to join
_, err := user.Start()
s := base.GetSuite()
s.Require().NoError(err)
defer user.Shutdown() // nolint: errcheck
advertiseCommunityTo(s, community, base.GetControlNode(), user)
// user sends request to join
requestToJoin := &requests.RequestToJoinCommunity{CommunityID: community.ID()}
response, err := user.RequestToJoinCommunity(requestToJoin)
s.Require().NoError(err)
s.Require().NotNil(response)
s.Require().Len(response.RequestsToJoinCommunity, 1)
sentRequest := response.RequestsToJoinCommunity[0]
// event sender receives request to join
response, err = WaitOnMessengerResponse(
base.GetEventSender(),
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
"event sender did not receive community request to join",
)
s.Require().NoError(err)
s.Require().Len(response.RequestsToJoinCommunity, 1)
// event sender has not accepted request
eventSenderCommunity, err := base.GetEventSender().GetCommunityByID(community.ID())
s.Require().NoError(err)
s.Require().False(eventSenderCommunity.HasMember(&user.identity.PublicKey))
declineRequestToJoin := &requests.DeclineRequestToJoinCommunity{ID: sentRequest.ID}
response, err = base.GetEventSender().DeclineRequestToJoinCommunity(declineRequestToJoin)
s.Require().NoError(err)
s.Require().NotNil(response)
// at this point, the request to join is in decline/pending state
declinedPendingRequests, err := base.GetEventSender().DeclinedPendingRequestsToJoinForCommunity(community.ID())
s.Require().NoError(err)
s.Require().Len(declinedPendingRequests, 1)
s.Require().Equal(declinedPendingRequests[0].PublicKey, common.PubkeyToHex(&user.identity.PublicKey))
// user won't receive anything
_, err = WaitOnMessengerResponse(
user,
func(r *MessengerResponse) bool { return len(r.Communities()) == 0 },
"user did not receive community request to join response",
)
s.Require().NoError(err)
}
func testRejectMemberRequestToJoin(base CommunityEventsTestsInterface, community *communities.Community, user *Messenger) {
_, err := user.Start()
@ -1196,18 +1109,50 @@ func testRejectMemberRequestToJoin(base CommunityEventsTestsInterface, community
s.Require().NoError(err)
s.Require().False(eventSenderCommunity.HasMember(&user.identity.PublicKey))
requests, err := base.GetEventSender().DeclinedPendingRequestsToJoinForCommunity(community.ID())
s.Require().Len(requests, 1)
s.Require().NoError(err)
// control node receives event sender event and stores rejected request to join
response, err = WaitOnMessengerResponse(
base.GetControlNode(),
func(r *MessengerResponse) bool { return len(r.Communities()) > 0 },
func(r *MessengerResponse) bool {
return len(r.Communities()) > 0 && !r.Communities()[0].HasMember(&user.identity.PublicKey)
},
"control node did not receive community request to join update from event sender",
)
s.Require().NoError(err)
s.Require().False(response.Communities()[0].HasMember(&user.identity.PublicKey))
requests, err := base.GetControlNode().DeclinedRequestsToJoinForCommunity(community.ID())
requests, err = base.GetControlNode().DeclinedRequestsToJoinForCommunity(community.ID())
s.Require().Len(requests, 1)
s.Require().NoError(err)
// event sender receives updated community
_, err = WaitOnMessengerResponse(
base.GetEventSender(),
func(r *MessengerResponse) bool {
return len(r.Communities()) > 0 && !r.Communities()[0].HasMember(&user.identity.PublicKey)
},
"event sender did not receive community update",
)
s.Require().NoError(err)
// check control node notify event sender about declined request to join
_, err = WaitOnMessengerResponse(
base.GetEventSender(),
func(r *MessengerResponse) bool {
declinedRequests, err := base.GetEventSender().DeclinedRequestsToJoinForCommunity(community.ID())
return err == nil && len(declinedRequests) == 1
},
"no updates from control node",
)
s.Require().NoError(err)
declinedRequestsPending, err := base.GetEventSender().DeclinedPendingRequestsToJoinForCommunity(community.ID())
s.Require().NoError(err)
s.Require().Len(declinedRequestsPending, 0)
}
func testEventSenderCannotOverrideRequestToJoinState(base CommunityEventsTestsInterface, community *communities.Community, user *Messenger, additionalEventSender *Messenger) {

View File

@ -145,13 +145,6 @@ func (s *AdminCommunityEventsSuite) TestAdminAcceptMemberRequestToJoinResponseSh
testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders(s, community, user, additionalAdmin)
}
func (s *AdminCommunityEventsSuite) TestAdminAcceptMemberRequestToJoinNotConfirmedByControlNode() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN, []*Messenger{})
// set up additional user that will send request to join
user := s.newMessenger("", []string{})
testAcceptMemberRequestToJoinNotConfirmedByControlNode(s, community, user)
}
func (s *AdminCommunityEventsSuite) TestAdminAcceptMemberRequestToJoin() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN, []*Messenger{})
@ -168,14 +161,6 @@ func (s *AdminCommunityEventsSuite) TestAdminRejectMemberRequestToJoinResponseSh
testRejectMemberRequestToJoinResponseSharedWithOtherEventSenders(s, community, user, additionalAdmin)
}
func (s *AdminCommunityEventsSuite) TestAdminRejectMemberRequestToJoinNotConfirmedByControlNode() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN, []*Messenger{})
// set up additional user that will send request to join
user := s.newMessenger("", []string{})
testRejectMemberRequestToJoinNotConfirmedByControlNode(s, community, user)
}
func (s *AdminCommunityEventsSuite) TestAdminRejectMemberRequestToJoin() {
community := setUpOnRequestCommunityAndRoles(s, protobuf.CommunityMember_ROLE_ADMIN, []*Messenger{})

View File

@ -4408,6 +4408,17 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
continue
}
case protobuf.CommunityPrivilegedUserSyncMessage:
logger.Debug("Handling CommunityPrivilegedUserSyncMessage")
message := msg.ParsedMessage.Interface().(protobuf.CommunityPrivilegedUserSyncMessage)
m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, message)
err = m.handleCommunityPrivilegedUserSyncMessage(messageState, publicKey, message)
if err != nil {
logger.Warn("failed to handle CommunityPrivilegedUserSyncMessage", zap.Error(err))
allMessagesProcessed = false
continue
}
case protobuf.AnonymousMetricBatch:
logger.Debug("Handling AnonymousMetricBatch")
if m.anonMetricsServer == nil {

View File

@ -14,11 +14,12 @@ import (
"golang.org/x/exp/slices"
"golang.org/x/time/rate"
"github.com/golang/protobuf/proto"
gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
@ -298,7 +299,6 @@ func (m *Messenger) handleCommunitiesSubscription(c chan *communities.Subscripti
if err != nil {
m.logger.Warn("failed to accept request to join ", zap.Error(err))
}
// TODO INFORM ADMINS
}
}
@ -311,8 +311,6 @@ func (m *Messenger) handleCommunitiesSubscription(c chan *communities.Subscripti
if err != nil {
m.logger.Warn("failed to decline request to join ", zap.Error(err))
}
// TODO INFORM ADMINS
}
}
@ -1351,7 +1349,7 @@ func (m *Messenger) AcceptRequestToJoinCommunity(request *requests.AcceptRequest
return nil, err
}
community, err := m.communitiesManager.AcceptRequestToJoin(request)
community, err := m.communitiesManager.AcceptRequestToJoin(requestToJoin)
if err != nil {
return nil, err
}
@ -1366,38 +1364,75 @@ func (m *Messenger) AcceptRequestToJoinCommunity(request *requests.AcceptRequest
return nil, err
}
requestToJoinResponseProto := &protobuf.CommunityRequestToJoinResponse{
Clock: community.Clock(),
Accepted: true,
CommunityId: community.ID(),
Community: community.Description(),
Grant: grant,
}
if community.IsControlNode() {
requestToJoinResponseProto := &protobuf.CommunityRequestToJoinResponse{
Clock: community.Clock(),
Accepted: true,
CommunityId: community.ID(),
Community: community.Description(),
Grant: grant,
}
if m.torrentClientReady() && m.communitiesManager.TorrentFileExists(community.IDString()) {
magnetlink, err := m.communitiesManager.GetHistoryArchiveMagnetlink(community.ID())
if m.torrentClientReady() && m.communitiesManager.TorrentFileExists(community.IDString()) {
magnetlink, err := m.communitiesManager.GetHistoryArchiveMagnetlink(community.ID())
if err != nil {
m.logger.Warn("couldn't get magnet link for community", zap.Error(err))
return nil, err
}
requestToJoinResponseProto.MagnetUri = magnetlink
}
payload, err := proto.Marshal(requestToJoinResponseProto)
if err != nil {
m.logger.Warn("couldn't get magnet link for community", zap.Error(err))
return nil, err
}
requestToJoinResponseProto.MagnetUri = magnetlink
}
payload, err := proto.Marshal(requestToJoinResponseProto)
if err != nil {
return nil, err
}
rawMessage := &common.RawMessage{
Payload: payload,
Sender: community.PrivateKey(),
SkipProtocolLayer: true,
MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN_RESPONSE,
}
rawMessage := &common.RawMessage{
Payload: payload,
Sender: community.PrivateKey(),
SkipProtocolLayer: true,
MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN_RESPONSE,
}
_, err = m.sender.SendPrivate(context.Background(), pk, rawMessage)
if err != nil {
return nil, err
}
_, err = m.sender.SendPrivate(context.Background(), pk, rawMessage)
if err != nil {
return nil, err
// Notify privileged members that request to join was accepted
// Send request to join without revealed addresses
requestToJoin.RevealedAccounts = make([]*protobuf.RevealedAccount, 0)
acceptedRequestsToJoin := make(map[string]*protobuf.CommunityRequestToJoin)
acceptedRequestsToJoin[requestToJoin.PublicKey] = requestToJoin.ToCommunityRequestToJoinProtobuf()
syncMsg := &protobuf.CommunityPrivilegedUserSyncMessage{
Type: protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN,
CommunityId: community.ID(),
RequestToJoin: acceptedRequestsToJoin,
}
payloadSyncMsg, err := proto.Marshal(syncMsg)
if err != nil {
return nil, err
}
rawSyncMessage := &common.RawMessage{
Payload: payloadSyncMsg,
Sender: community.PrivateKey(),
SkipProtocolLayer: true,
MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE,
}
privilegedMembers := community.GetPrivilegedMembers()
for _, privilegedMember := range privilegedMembers {
if privilegedMember.Equal(&m.identity.PublicKey) {
continue
}
_, err := m.sender.SendPrivate(context.Background(), privilegedMember, rawSyncMessage)
if err != nil {
return nil, err
}
}
}
response := &MessengerResponse{}
@ -1433,11 +1468,53 @@ func (m *Messenger) DeclineRequestToJoinCommunity(request *requests.DeclineReque
return nil, err
}
err := m.communitiesManager.DeclineRequestToJoin(request)
dbRequest, err := m.communitiesManager.GetRequestToJoin(request.ID)
if err != nil {
return nil, err
}
community, err := m.communitiesManager.DeclineRequestToJoin(dbRequest)
if err != nil {
return nil, err
}
if community.IsControlNode() {
// Notify privileged members that request to join was rejected
// Send request to join without revealed addresses
dbRequest.RevealedAccounts = make([]*protobuf.RevealedAccount, 0)
declinedRequestsToJoin := make(map[string]*protobuf.CommunityRequestToJoin)
declinedRequestsToJoin[dbRequest.PublicKey] = dbRequest.ToCommunityRequestToJoinProtobuf()
syncMsg := &protobuf.CommunityPrivilegedUserSyncMessage{
Type: protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_REJECT_REQUEST_TO_JOIN,
CommunityId: community.ID(),
RequestToJoin: declinedRequestsToJoin,
}
payloadSyncMsg, err := proto.Marshal(syncMsg)
if err != nil {
return nil, err
}
rawSyncMessage := &common.RawMessage{
Payload: payloadSyncMsg,
Sender: community.PrivateKey(),
SkipProtocolLayer: true,
MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE,
}
privilegedMembers := community.GetPrivilegedMembers()
for _, privilegedMember := range privilegedMembers {
if privilegedMember.Equal(&m.identity.PublicKey) {
continue
}
_, err := m.sender.SendPrivate(context.Background(), privilegedMember, rawSyncMessage)
if err != nil {
return nil, err
}
}
}
// Activity Center notification
notification, err := m.persistence.GetActivityCenterNotificationByID(request.ID)
if err != nil {
@ -2545,6 +2622,10 @@ func (m *Messenger) handleCommunityEventsMessageRejected(state *ReceivedMessageS
return nil
}
func (m *Messenger) handleCommunityPrivilegedUserSyncMessage(state *ReceivedMessageState, signer *ecdsa.PublicKey, message protobuf.CommunityPrivilegedUserSyncMessage) error {
return m.communitiesManager.HandleCommunityPrivilegedUserSyncMessage(signer, &message)
}
func (m *Messenger) handleSyncCommunity(messageState *ReceivedMessageState, syncCommunity protobuf.SyncCommunity) error {
logger := m.logger.Named("handleSyncCommunity")

View File

@ -1412,9 +1412,7 @@ func (m *Messenger) HandleCommunityRequestToJoin(state *ReceivedMessageState, si
}
}
declinedOrDeclinedPending := requestToJoin.State == communities.RequestToJoinStateDeclined || requestToJoin.State == communities.RequestToJoinStateDeclinedPending
if declinedOrDeclinedPending {
if requestToJoin.State == communities.RequestToJoinStateDeclined || requestToJoin.State == communities.RequestToJoinStateDeclinedPending {
cancel := &requests.DeclineRequestToJoinCommunity{
ID: requestToJoin.ID,
}

View File

@ -94,6 +94,7 @@ const (
ApplicationMetadataMessage_SYNC_ACCOUNT_CUSTOMIZATION_COLOR ApplicationMetadataMessage_Type = 69
ApplicationMetadataMessage_SYNC_ACCOUNTS_POSITIONS ApplicationMetadataMessage_Type = 70
ApplicationMetadataMessage_COMMUNITY_EVENTS_MESSAGE_REJECTED ApplicationMetadataMessage_Type = 71
ApplicationMetadataMessage_COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE ApplicationMetadataMessage_Type = 72
)
var ApplicationMetadataMessage_Type_name = map[int32]string{
@ -168,6 +169,7 @@ var ApplicationMetadataMessage_Type_name = map[int32]string{
69: "SYNC_ACCOUNT_CUSTOMIZATION_COLOR",
70: "SYNC_ACCOUNTS_POSITIONS",
71: "COMMUNITY_EVENTS_MESSAGE_REJECTED",
72: "COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE",
}
var ApplicationMetadataMessage_Type_value = map[string]int32{
@ -242,6 +244,7 @@ var ApplicationMetadataMessage_Type_value = map[string]int32{
"SYNC_ACCOUNT_CUSTOMIZATION_COLOR": 69,
"SYNC_ACCOUNTS_POSITIONS": 70,
"COMMUNITY_EVENTS_MESSAGE_REJECTED": 71,
"COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE": 72,
}
func (x ApplicationMetadataMessage_Type) String() string {
@ -320,70 +323,71 @@ func init() {
}
var fileDescriptor_ad09a6406fcf24c7 = []byte{
// 1028 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x56, 0x6b, 0x73, 0x53, 0x37,
0x10, 0x6d, 0x42, 0x9a, 0x04, 0xe5, 0xc1, 0x46, 0xe4, 0xe1, 0xbc, 0x13, 0x03, 0x21, 0x40, 0x6b,
0x5a, 0x68, 0x3b, 0x6d, 0x29, 0x6d, 0x65, 0xdd, 0x8d, 0xad, 0xf8, 0x5e, 0xe9, 0x22, 0xe9, 0xba,
0x63, 0xbe, 0x68, 0x4c, 0x71, 0x99, 0xcc, 0x00, 0xf1, 0x10, 0xf3, 0x21, 0x3f, 0xa6, 0xbf, 0xa2,
0x7f, 0xb0, 0xa3, 0xeb, 0xfb, 0x70, 0x12, 0x87, 0x7c, 0x4a, 0xbc, 0x7b, 0xb4, 0xd2, 0x39, 0x7b,
0x76, 0x6d, 0x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6c, 0x8b, 0x54, 0x52, 0x33, 0x28, 0x9b, 0x92, 0xa3, 0x78, 0x04,
0x3e, 0x00, 0xc7, 0x65, 0x48, 0xff, 0x64, 0x0f, 0xc8, 0xfe, 0x58, 0x41, 0x8f, 0xee, 0x28, 0xca,
0x71, 0x93, 0xde, 0x08, 0xf3, 0x38, 0xff, 0x40, 0xeb, 0x98, 0xb1, 0xac, 0x10, 0xda, 0xa0, 0x9c,
0x2d, 0x78, 0x11, 0xf8, 0x0e, 0x8e, 0x78, 0x71, 0x89, 0xd8, 0x26, 0x37, 0x25, 0x45, 0x60, 0x69,
0x80, 0x24, 0x8d, 0x4a, 0xd9, 0x8b, 0xc4, 0x3a, 0x1d, 0xc9, 0xd7, 0xf9, 0xbe, 0x08, 0xb5, 0xa1,
0x50, 0xa8, 0x2f, 0x43, 0x59, 0x1f, 0x6b, 0x2b, 0x11, 0x61, 0xe9, 0x11, 0x56, 0x76, 0xdd, 0x2d,
0xbc, 0x81, 0x63, 0x10, 0x38, 0xd1, 0x0d, 0x7c, 0x71, 0x4b, 0x58, 0x6c, 0x64, 0x5b, 0x86, 0xd0,
0xc8, 0x74, 0xe4, 0xd3, 0xe8, 0xf9, 0xd5, 0x9b, 0xf5, 0x85, 0xd7, 0x73, 0xb5, 0xa7, 0x2f, 0xf2,
0x1f, 0x20, 0x6f, 0xa6, 0xd3, 0xff, 0x9e, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x78, 0xda, 0xcb,
0xc2, 0x27, 0x09, 0x00, 0x00,
}

View File

@ -84,5 +84,6 @@ message ApplicationMetadataMessage {
SYNC_ACCOUNT_CUSTOMIZATION_COLOR = 69;
SYNC_ACCOUNTS_POSITIONS = 70;
COMMUNITY_EVENTS_MESSAGE_REJECTED = 71;
COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE = 72;
}
}

View File

@ -189,12 +189,13 @@ func (m *Grant) GetClock() uint64 {
}
type CommunityMember struct {
Roles []CommunityMember_Roles `protobuf:"varint,1,rep,packed,name=roles,proto3,enum=protobuf.CommunityMember_Roles" json:"roles,omitempty"`
RevealedAccounts []*RevealedAccount `protobuf:"bytes,2,rep,name=revealed_accounts,json=revealedAccounts,proto3" json:"revealed_accounts,omitempty"`
LastUpdateClock uint64 `protobuf:"varint,3,opt,name=last_update_clock,json=lastUpdateClock,proto3" json:"last_update_clock,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Roles []CommunityMember_Roles `protobuf:"varint,1,rep,packed,name=roles,proto3,enum=protobuf.CommunityMember_Roles" json:"roles,omitempty"`
// deprecated, do not put accounts here
RevealedAccounts []*RevealedAccount `protobuf:"bytes,2,rep,name=revealed_accounts,json=revealedAccounts,proto3" json:"revealed_accounts,omitempty"`
LastUpdateClock uint64 `protobuf:"varint,3,opt,name=last_update_clock,json=lastUpdateClock,proto3" json:"last_update_clock,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CommunityMember) Reset() { *m = CommunityMember{} }

View File

@ -0,0 +1,152 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: community_privileged_user_sync_message.proto
package protobuf
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type CommunityPrivilegedUserSyncMessage_EventType int32
const (
CommunityPrivilegedUserSyncMessage_UNKNOWN CommunityPrivilegedUserSyncMessage_EventType = 0
CommunityPrivilegedUserSyncMessage_CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN CommunityPrivilegedUserSyncMessage_EventType = 1
CommunityPrivilegedUserSyncMessage_CONTROL_NODE_REJECT_REQUEST_TO_JOIN CommunityPrivilegedUserSyncMessage_EventType = 2
CommunityPrivilegedUserSyncMessage_ADD_TOKEN CommunityPrivilegedUserSyncMessage_EventType = 3
)
var CommunityPrivilegedUserSyncMessage_EventType_name = map[int32]string{
0: "UNKNOWN",
1: "CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN",
2: "CONTROL_NODE_REJECT_REQUEST_TO_JOIN",
3: "ADD_TOKEN",
}
var CommunityPrivilegedUserSyncMessage_EventType_value = map[string]int32{
"UNKNOWN": 0,
"CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN": 1,
"CONTROL_NODE_REJECT_REQUEST_TO_JOIN": 2,
"ADD_TOKEN": 3,
}
func (x CommunityPrivilegedUserSyncMessage_EventType) String() string {
return proto.EnumName(CommunityPrivilegedUserSyncMessage_EventType_name, int32(x))
}
func (CommunityPrivilegedUserSyncMessage_EventType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_158595055b4cfee2, []int{0, 0}
}
type CommunityPrivilegedUserSyncMessage struct {
Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"`
Type CommunityPrivilegedUserSyncMessage_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=protobuf.CommunityPrivilegedUserSyncMessage_EventType" json:"type,omitempty"`
CommunityId []byte `protobuf:"bytes,3,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"`
RequestToJoin map[string]*CommunityRequestToJoin `protobuf:"bytes,4,rep,name=request_to_join,json=requestToJoin,proto3" json:"request_to_join,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CommunityPrivilegedUserSyncMessage) Reset() { *m = CommunityPrivilegedUserSyncMessage{} }
func (m *CommunityPrivilegedUserSyncMessage) String() string { return proto.CompactTextString(m) }
func (*CommunityPrivilegedUserSyncMessage) ProtoMessage() {}
func (*CommunityPrivilegedUserSyncMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_158595055b4cfee2, []int{0}
}
func (m *CommunityPrivilegedUserSyncMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommunityPrivilegedUserSyncMessage.Unmarshal(m, b)
}
func (m *CommunityPrivilegedUserSyncMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CommunityPrivilegedUserSyncMessage.Marshal(b, m, deterministic)
}
func (m *CommunityPrivilegedUserSyncMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_CommunityPrivilegedUserSyncMessage.Merge(m, src)
}
func (m *CommunityPrivilegedUserSyncMessage) XXX_Size() int {
return xxx_messageInfo_CommunityPrivilegedUserSyncMessage.Size(m)
}
func (m *CommunityPrivilegedUserSyncMessage) XXX_DiscardUnknown() {
xxx_messageInfo_CommunityPrivilegedUserSyncMessage.DiscardUnknown(m)
}
var xxx_messageInfo_CommunityPrivilegedUserSyncMessage proto.InternalMessageInfo
func (m *CommunityPrivilegedUserSyncMessage) GetClock() uint64 {
if m != nil {
return m.Clock
}
return 0
}
func (m *CommunityPrivilegedUserSyncMessage) GetType() CommunityPrivilegedUserSyncMessage_EventType {
if m != nil {
return m.Type
}
return CommunityPrivilegedUserSyncMessage_UNKNOWN
}
func (m *CommunityPrivilegedUserSyncMessage) GetCommunityId() []byte {
if m != nil {
return m.CommunityId
}
return nil
}
func (m *CommunityPrivilegedUserSyncMessage) GetRequestToJoin() map[string]*CommunityRequestToJoin {
if m != nil {
return m.RequestToJoin
}
return nil
}
func init() {
proto.RegisterEnum("protobuf.CommunityPrivilegedUserSyncMessage_EventType", CommunityPrivilegedUserSyncMessage_EventType_name, CommunityPrivilegedUserSyncMessage_EventType_value)
proto.RegisterType((*CommunityPrivilegedUserSyncMessage)(nil), "protobuf.CommunityPrivilegedUserSyncMessage")
proto.RegisterMapType((map[string]*CommunityRequestToJoin)(nil), "protobuf.CommunityPrivilegedUserSyncMessage.RequestToJoinEntry")
}
func init() {
proto.RegisterFile("community_privileged_user_sync_message.proto", fileDescriptor_158595055b4cfee2)
}
var fileDescriptor_158595055b4cfee2 = []byte{
// 362 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xc1, 0x4f, 0xf2, 0x30,
0x18, 0xc6, 0xbf, 0x31, 0xf8, 0xbe, 0x8f, 0x0e, 0x74, 0x36, 0x1e, 0x16, 0x4e, 0x13, 0x0f, 0xee,
0x60, 0x66, 0x82, 0x09, 0x31, 0x7a, 0x30, 0x38, 0x7a, 0x60, 0xe8, 0x86, 0x65, 0xc4, 0xc4, 0x4b,
0x03, 0xa3, 0x92, 0x09, 0xac, 0x73, 0xed, 0x48, 0xfa, 0x67, 0xfb, 0x1f, 0x18, 0xb7, 0x0c, 0x35,
0x98, 0x18, 0x4f, 0x7d, 0xfb, 0xf6, 0xe9, 0xef, 0x7d, 0xde, 0x07, 0x9c, 0x86, 0x6c, 0xbd, 0xce,
0xe2, 0x48, 0x48, 0x92, 0xa4, 0xd1, 0x26, 0x5a, 0xd1, 0x05, 0x9d, 0x93, 0x8c, 0xd3, 0x94, 0x70,
0x19, 0x87, 0x64, 0x4d, 0x39, 0x9f, 0x2e, 0xa8, 0x9d, 0xa4, 0x4c, 0x30, 0xf8, 0x3f, 0x3f, 0x66,
0xd9, 0x53, 0xeb, 0xa0, 0xfc, 0x17, 0x51, 0x5e, 0x3c, 0xb6, 0x5f, 0x55, 0xd0, 0x76, 0x4a, 0xda,
0x68, 0x0b, 0x9b, 0x70, 0x9a, 0x8e, 0x65, 0x1c, 0xde, 0x15, 0x24, 0x78, 0x08, 0x6a, 0xe1, 0x8a,
0x85, 0x4b, 0x43, 0x31, 0x15, 0xab, 0x8a, 0x8b, 0x0b, 0x74, 0x41, 0x55, 0xc8, 0x84, 0x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a, 0xf4, 0x3a, 0xfb, 0x9b, 0x57, 0xe7, 0x6f, 0x01, 0x00, 0x00,
0xff, 0xff, 0xcf, 0xca, 0x41, 0x8f, 0x56, 0x02, 0x00, 0x00,
}

View File

@ -0,0 +1,20 @@
syntax = "proto3";
option go_package = "./;protobuf";
package protobuf;
import "communities.proto";
message CommunityPrivilegedUserSyncMessage {
uint64 clock = 1;
EventType type = 2;
bytes community_id = 3;
map<string,CommunityRequestToJoin> request_to_join = 4;
enum EventType {
UNKNOWN = 0;
CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN = 1;
CONTROL_NODE_REJECT_REQUEST_TO_JOIN = 2;
ADD_TOKEN = 3;
}
}

View File

@ -4,7 +4,7 @@ import (
"github.com/golang/protobuf/proto"
)
//go:generate protoc --go_out=. ./chat_message.proto ./application_metadata_message.proto ./membership_update_message.proto ./command.proto ./contact.proto ./pairing.proto ./push_notifications.proto ./emoji_reaction.proto ./enums.proto ./group_chat_invitation.proto ./chat_identity.proto ./communities.proto ./pin_message.proto ./anon_metrics.proto ./status_update.proto ./sync_settings.proto ./contact_verification.proto ./community_update.proto ./url_data.proto
//go:generate protoc --go_out=. ./chat_message.proto ./application_metadata_message.proto ./membership_update_message.proto ./command.proto ./contact.proto ./pairing.proto ./push_notifications.proto ./emoji_reaction.proto ./enums.proto ./group_chat_invitation.proto ./chat_identity.proto ./communities.proto ./pin_message.proto ./anon_metrics.proto ./status_update.proto ./sync_settings.proto ./contact_verification.proto ./community_update.proto ./url_data.proto ./community_privileged_user_sync_message.proto
func Unmarshal(payload []byte) (*ApplicationMetadataMessage, error) {
var message ApplicationMetadataMessage

View File

@ -336,6 +336,8 @@ func (m *StatusMessage) HandleApplication() error {
return m.unmarshalProtobufData(new(protobuf.SyncAccountCustomizationColor))
case protobuf.ApplicationMetadataMessage_SYNC_ACCOUNTS_POSITIONS:
return m.unmarshalProtobufData(new(protobuf.SyncAccountsPositions))
case protobuf.ApplicationMetadataMessage_COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE:
return m.unmarshalProtobufData(new(protobuf.CommunityPrivilegedUserSyncMessage))
}
return nil