From c97008143b3530590ad8f38b20af0d8f8d0d4e07 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 27 May 2024 22:37:18 -0700 Subject: [PATCH 1/6] Deal with transaction serialization issues --- dev/generate | 1 + pkg/authn/authn.pb.go | 4 +- pkg/mls/store/queries/db.go | 2 +- pkg/mls/store/queries/models.go | 2 +- pkg/mls/store/queries/queries.sql.go | 2 +- pkg/mls/store/store.go | 31 +- pkg/mls/store/store_test.go | 72 +++- pkg/mlsvalidate/mocks/mock.gen.go | 142 ++++++++ pkg/proto/message_contents/frames.pb.go | 69 ++-- pkg/proto/mls/database/intents.pb.go | 395 +++++++++++++++++----- pkg/proto/mls_validation/v1/service.pb.go | 4 +- 11 files changed, 593 insertions(+), 131 deletions(-) create mode 100644 pkg/mlsvalidate/mocks/mock.gen.go diff --git a/dev/generate b/dev/generate index 77fc43eb..1896e37c 100755 --- a/dev/generate +++ b/dev/generate @@ -4,6 +4,7 @@ set -e go generate ./... mockgen -package api github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1 MlsApi_SubscribeGroupMessagesServer,MlsApi_SubscribeWelcomeMessagesServer > pkg/mls/api/v1/mock.gen.go +mockgen -package mocks -source ./pkg/mlsvalidate/service.go MLSValidationService > pkg/mlsvalidate/mocks/mock.gen.go rm -rf pkg/proto/**/*.pb.go pkg/proto/**/*.pb.gw.go pkg/proto/**/*.swagger.json if ! buf generate https://github.com/xmtp/proto.git#branch=main,subdir=proto; then echo "Failed to generate protobuf definitions" diff --git a/pkg/authn/authn.pb.go b/pkg/authn/authn.pb.go index 945e3a48..c0de527b 100644 --- a/pkg/authn/authn.pb.go +++ b/pkg/authn/authn.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.24.4 +// protoc-gen-go v1.28.1 +// protoc v4.25.3 // source: authn.proto package authn diff --git a/pkg/mls/store/queries/db.go b/pkg/mls/store/queries/db.go index fa785733..ef8b0c29 100644 --- a/pkg/mls/store/queries/db.go +++ b/pkg/mls/store/queries/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.26.0 +// sqlc v1.25.0 package queries diff --git a/pkg/mls/store/queries/models.go b/pkg/mls/store/queries/models.go index cc2ae9d3..711ac5b8 100644 --- a/pkg/mls/store/queries/models.go +++ b/pkg/mls/store/queries/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.26.0 +// sqlc v1.25.0 package queries diff --git a/pkg/mls/store/queries/queries.sql.go b/pkg/mls/store/queries/queries.sql.go index 99a27987..720a5323 100644 --- a/pkg/mls/store/queries/queries.sql.go +++ b/pkg/mls/store/queries/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.26.0 +// sqlc v1.25.0 // source: queries.sql package queries diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index 67e915e3..89ca64f5 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -102,13 +102,15 @@ func (s *Store) GetInboxIds(ctx context.Context, req *identity.GetInboxIdsReques } func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.PublishIdentityUpdateRequest, validationService mlsvalidate.MLSValidationService) (*identity.PublishIdentityUpdateResponse, error) { - new_update := req.GetIdentityUpdate() - if new_update == nil { + newUpdate := req.GetIdentityUpdate() + if newUpdate == nil { return nil, errors.New("IdentityUpdate is required") } - if err := s.RunInSerializableTx(ctx, 3, func(ctx context.Context, txQueries *queries.Queries) error { - inboxLogEntries, err := txQueries.GetAllInboxLogs(ctx, new_update.GetInboxId()) + if err := s.RunInRepeatableReadTx(ctx, 3, func(ctx context.Context, txQueries *queries.Queries) error { + inboxId := newUpdate.GetInboxId() + log := s.log.With(zap.String("inbox_id", inboxId)) + inboxLogEntries, err := txQueries.GetAllInboxLogs(ctx, inboxId) if err != nil { return err } @@ -125,38 +127,37 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish } updates = append(updates, identityUpdate) } - _ = append(updates, new_update) + _ = append(updates, newUpdate) - state, err := validationService.GetAssociationState(ctx, updates, []*associations.IdentityUpdate{new_update}) + state, err := validationService.GetAssociationState(ctx, updates, []*associations.IdentityUpdate{newUpdate}) if err != nil { return err } - s.log.Info("Got association state", zap.Any("state", state)) - protoBytes, err := proto.Marshal(new_update) + protoBytes, err := proto.Marshal(newUpdate) if err != nil { return err } sequence_id, err := txQueries.InsertInboxLog(ctx, queries.InsertInboxLogParams{ - InboxID: new_update.GetInboxId(), + InboxID: inboxId, ServerTimestampNs: nowNs(), IdentityUpdateProto: protoBytes, }) - s.log.Info("Inserted inbox log", zap.Any("sequence_id", sequence_id)) + log.Info("Inserted inbox log", zap.Any("sequence_id", sequence_id)) if err != nil { return err } for _, new_member := range state.StateDiff.NewMembers { - s.log.Info("New member", zap.Any("member", new_member)) + log.Info("New member", zap.Any("member", new_member)) if address, ok := new_member.Kind.(*associations.MemberIdentifier_Address); ok { _, err = txQueries.InsertAddressLog(ctx, queries.InsertAddressLogParams{ Address: address.Address, InboxID: state.AssociationState.InboxId, - AssociationSequenceID: sql.NullInt64{Valid: true, Int64: sequence_id}, + AssociationSequenceID: sequence_id, RevocationSequenceID: sql.NullInt64{Valid: false}, }) if err != nil { @@ -166,7 +167,7 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish } for _, removed_member := range state.StateDiff.RemovedMembers { - s.log.Info("New member", zap.Any("member", removed_member)) + log.Info("Removed member", zap.Any("member", removed_member)) if address, ok := removed_member.Kind.(*associations.MemberIdentifier_Address); ok { err = txQueries.RevokeAddressFromLog(ctx, queries.RevokeAddressFromLogParams{ Address: address.Address, @@ -607,14 +608,14 @@ func (s *Store) RunInTx( return tx.Commit() } -func (s *Store) RunInSerializableTx(ctx context.Context, numRetries int, fn func(ctx context.Context, txQueries *queries.Queries) error) error { +func (s *Store) RunInRepeatableReadTx(ctx context.Context, numRetries int, fn func(ctx context.Context, txQueries *queries.Queries) error) error { var err error for i := 0; i < numRetries; i++ { select { case <-ctx.Done(): return ctx.Err() default: - err = s.RunInTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}, fn) + err = s.RunInTx(ctx, &sql.TxOptions{Isolation: sql.LevelRepeatableRead}, fn) if err == nil { return nil } diff --git a/pkg/mls/store/store_test.go b/pkg/mls/store/store_test.go index d5103161..00cb960a 100644 --- a/pkg/mls/store/store_test.go +++ b/pkg/mls/store/store_test.go @@ -3,15 +3,21 @@ package store import ( "context" "database/sql" + "fmt" "sort" + "sync" "testing" "time" "github.com/stretchr/testify/require" queries "github.com/xmtp/xmtp-node-go/pkg/mls/store/queries" + "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" + "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate/mocks" identity "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" + "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" test "github.com/xmtp/xmtp-node-go/pkg/testing" + "go.uber.org/mock/gomock" ) func NewTestStore(t *testing.T) (*Store, func()) { @@ -29,6 +35,64 @@ func NewTestStore(t *testing.T) (*Store, func()) { return store, dbCleanup } +func TestPublishIdentityUpdateParallel(t *testing.T) { + store, cleanup := NewTestStore(t) + defer cleanup() + ctx := context.Background() + + // for i := 0; i < 10000; i++ { + // inboxId := fmt.Sprintf("fake_%d", i) + // store.queries.InsertInboxLog(ctx, queries.InsertInboxLogParams{ + // InboxID: inboxId, + // ServerTimestampNs: nowNs(), + // IdentityUpdateProto: []byte(inboxId), + // }) + // } + + // Create a mapping of inboxes to addresses + inboxes := make(map[string]string) + for i := 0; i < 10; i++ { + inboxes[fmt.Sprintf("inbox_%d", i)] = fmt.Sprintf("address_%d", i) + } + + mockController := gomock.NewController(t) + mockMlsValidation := mocks.NewMockMLSValidationService(mockController) + + // Retun the matching address from the map. Each inboxId will return a different address + mockMlsValidation.EXPECT().GetAssociationState(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(_ any, _ any, updates []*associations.IdentityUpdate) (*mlsvalidate.AssociationStateResult, error) { + inboxId := updates[0].InboxId + address := inboxes[inboxId] + return &mlsvalidate.AssociationStateResult{ + AssociationState: &associations.AssociationState{ + InboxId: inboxId, + }, + StateDiff: &associations.AssociationStateDiff{ + NewMembers: []*associations.MemberIdentifier{{ + Kind: &associations.MemberIdentifier_Address{ + Address: address, + }, + }}, + }, + }, nil + }).AnyTimes() + + var wg sync.WaitGroup + for inboxId := range inboxes { + inboxId := inboxId + wg.Add(1) + go func() { + defer wg.Done() + _, err := store.PublishIdentityUpdate(ctx, &identity.PublishIdentityUpdateRequest{ + IdentityUpdate: &associations.IdentityUpdate{ + InboxId: inboxId, + }, + }, mockMlsValidation) + require.NoError(t, err) + }() + } + wg.Wait() +} + func TestInboxIds(t *testing.T) { store, cleanup := NewTestStore(t) defer cleanup() @@ -54,7 +118,7 @@ func TestInboxIds(t *testing.T) { require.Equal(t, "correct", *resp.Responses[0].InboxId) - _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "correct_inbox2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 5}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "correct_inbox2", AssociationSequenceID: 5, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) resp, _ = store.GetInboxIds(context.Background(), req) require.Equal(t, "correct_inbox2", *resp.Responses[0].InboxId) @@ -63,7 +127,7 @@ func TestInboxIds(t *testing.T) { req = &identity.GetInboxIdsRequest{ Requests: reqs, } - _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address2", InboxID: "inbox2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 8}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address2", InboxID: "inbox2", AssociationSequenceID: 8, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) resp, _ = store.GetInboxIds(context.Background(), req) require.Equal(t, "inbox2", *resp.Responses[1].InboxId) @@ -74,9 +138,9 @@ func TestMultipleInboxIds(t *testing.T) { defer cleanup() ctx := context.Background() - _, err := store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_1", InboxID: "inbox_1", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 1}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err := store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_1", InboxID: "inbox_1", AssociationSequenceID: 1, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) - _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_2", InboxID: "inbox_2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 2}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_2", InboxID: "inbox_2", AssociationSequenceID: 2, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) reqs := make([]*identity.GetInboxIdsRequest_Request, 0) diff --git a/pkg/mlsvalidate/mocks/mock.gen.go b/pkg/mlsvalidate/mocks/mock.gen.go new file mode 100644 index 00000000..fef93f1f --- /dev/null +++ b/pkg/mlsvalidate/mocks/mock.gen.go @@ -0,0 +1,142 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./pkg/mlsvalidate/service.go +// +// Generated by this command: +// +// mockgen -package mocks -source ./pkg/mlsvalidate/service.go MLSValidationService +// + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + mlsvalidate "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" + apiv1 "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" + associations "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" + apiv10 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" + gomock "go.uber.org/mock/gomock" +) + +// MockMLSValidationService is a mock of MLSValidationService interface. +type MockMLSValidationService struct { + ctrl *gomock.Controller + recorder *MockMLSValidationServiceMockRecorder +} + +// MockMLSValidationServiceMockRecorder is the mock recorder for MockMLSValidationService. +type MockMLSValidationServiceMockRecorder struct { + mock *MockMLSValidationService +} + +// NewMockMLSValidationService creates a new mock instance. +func NewMockMLSValidationService(ctrl *gomock.Controller) *MockMLSValidationService { + mock := &MockMLSValidationService{ctrl: ctrl} + mock.recorder = &MockMLSValidationServiceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMLSValidationService) EXPECT() *MockMLSValidationServiceMockRecorder { + return m.recorder +} + +// GetAssociationState mocks base method. +func (m *MockMLSValidationService) GetAssociationState(ctx context.Context, oldUpdates, newUpdates []*associations.IdentityUpdate) (*mlsvalidate.AssociationStateResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAssociationState", ctx, oldUpdates, newUpdates) + ret0, _ := ret[0].(*mlsvalidate.AssociationStateResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAssociationState indicates an expected call of GetAssociationState. +func (mr *MockMLSValidationServiceMockRecorder) GetAssociationState(ctx, oldUpdates, newUpdates any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAssociationState", reflect.TypeOf((*MockMLSValidationService)(nil).GetAssociationState), ctx, oldUpdates, newUpdates) +} + +// ValidateGroupMessages mocks base method. +func (m *MockMLSValidationService) ValidateGroupMessages(ctx context.Context, groupMessages []*apiv10.GroupMessageInput) ([]mlsvalidate.GroupMessageValidationResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidateGroupMessages", ctx, groupMessages) + ret0, _ := ret[0].([]mlsvalidate.GroupMessageValidationResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidateGroupMessages indicates an expected call of ValidateGroupMessages. +func (mr *MockMLSValidationServiceMockRecorder) ValidateGroupMessages(ctx, groupMessages any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGroupMessages", reflect.TypeOf((*MockMLSValidationService)(nil).ValidateGroupMessages), ctx, groupMessages) +} + +// ValidateInboxIdKeyPackages mocks base method. +func (m *MockMLSValidationService) ValidateInboxIdKeyPackages(ctx context.Context, keyPackages [][]byte) ([]mlsvalidate.InboxIdValidationResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidateInboxIdKeyPackages", ctx, keyPackages) + ret0, _ := ret[0].([]mlsvalidate.InboxIdValidationResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidateInboxIdKeyPackages indicates an expected call of ValidateInboxIdKeyPackages. +func (mr *MockMLSValidationServiceMockRecorder) ValidateInboxIdKeyPackages(ctx, keyPackages any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateInboxIdKeyPackages", reflect.TypeOf((*MockMLSValidationService)(nil).ValidateInboxIdKeyPackages), ctx, keyPackages) +} + +// ValidateV3KeyPackages mocks base method. +func (m *MockMLSValidationService) ValidateV3KeyPackages(ctx context.Context, keyPackages [][]byte) ([]mlsvalidate.IdentityValidationResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidateV3KeyPackages", ctx, keyPackages) + ret0, _ := ret[0].([]mlsvalidate.IdentityValidationResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidateV3KeyPackages indicates an expected call of ValidateV3KeyPackages. +func (mr *MockMLSValidationServiceMockRecorder) ValidateV3KeyPackages(ctx, keyPackages any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateV3KeyPackages", reflect.TypeOf((*MockMLSValidationService)(nil).ValidateV3KeyPackages), ctx, keyPackages) +} + +// MockIdentityStore is a mock of IdentityStore interface. +type MockIdentityStore struct { + ctrl *gomock.Controller + recorder *MockIdentityStoreMockRecorder +} + +// MockIdentityStoreMockRecorder is the mock recorder for MockIdentityStore. +type MockIdentityStoreMockRecorder struct { + mock *MockIdentityStore +} + +// NewMockIdentityStore creates a new mock instance. +func NewMockIdentityStore(ctrl *gomock.Controller) *MockIdentityStore { + mock := &MockIdentityStore{ctrl: ctrl} + mock.recorder = &MockIdentityStoreMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockIdentityStore) EXPECT() *MockIdentityStoreMockRecorder { + return m.recorder +} + +// GetInboxLogs mocks base method. +func (m *MockIdentityStore) GetInboxLogs(ctx context.Context, req *apiv1.GetIdentityUpdatesRequest) (*apiv1.GetIdentityUpdatesResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetInboxLogs", ctx, req) + ret0, _ := ret[0].(*apiv1.GetIdentityUpdatesResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetInboxLogs indicates an expected call of GetInboxLogs. +func (mr *MockIdentityStoreMockRecorder) GetInboxLogs(ctx, req any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInboxLogs", reflect.TypeOf((*MockIdentityStore)(nil).GetInboxLogs), ctx, req) +} diff --git a/pkg/proto/message_contents/frames.pb.go b/pkg/proto/message_contents/frames.pb.go index 4f909297..c9f1e7b0 100644 --- a/pkg/proto/message_contents/frames.pb.go +++ b/pkg/proto/message_contents/frames.pb.go @@ -49,6 +49,8 @@ type FrameActionBody struct { State string `protobuf:"bytes,7,opt,name=state,proto3" json:"state,omitempty"` // A 0x wallet address Address string `protobuf:"bytes,8,opt,name=address,proto3" json:"address,omitempty"` + // A hash from a transaction + TransactionId string `protobuf:"bytes,9,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` } func (x *FrameActionBody) Reset() { @@ -140,6 +142,13 @@ func (x *FrameActionBody) GetAddress() string { return "" } +func (x *FrameActionBody) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + // The outer payload that will be sent as the `messageBytes` in the // `trusted_data` part of the Frames message type FrameAction struct { @@ -219,7 +228,7 @@ var file_message_contents_frames_proto_rawDesc = []byte{ 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x02, 0x0a, 0x0f, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x02, 0x0a, 0x0f, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c, @@ -238,35 +247,37 @@ var file_message_contents_frames_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xd5, 0x01, - 0x0a, 0x0b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x20, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x65, 0x0a, - 0x18, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, - 0x65, 0x79, 0x5f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x15, 0x73, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x25, 0x0a, + 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xd5, 0x01, 0x0a, 0x0b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x65, 0x0a, 0x18, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, - 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x42, 0xd2, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, - 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x73, 0x42, 0x0b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, - 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, - 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, - 0x58, 0xaa, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xca, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x5c, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, - 0x02, 0x20, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x15, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x42, 0xd2, 0x01, 0x0a, + 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x0b, 0x46, 0x72, 0x61, 0x6d, + 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, + 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x58, 0xaa, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x2e, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xca, + 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x20, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, + 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/proto/mls/database/intents.pb.go b/pkg/proto/mls/database/intents.pb.go index 650ee88f..c052ff6d 100644 --- a/pkg/proto/mls/database/intents.pb.go +++ b/pkg/proto/mls/database/intents.pb.go @@ -22,6 +22,62 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Type of update to admin lists +type AdminListUpdateType int32 + +const ( + AdminListUpdateType_ADMIN_LIST_UPDATE_TYPE_UNSPECIFIED AdminListUpdateType = 0 + AdminListUpdateType_ADMIN_LIST_UPDATE_TYPE_ADD_ADMIN AdminListUpdateType = 1 + AdminListUpdateType_ADMIN_LIST_UPDATE_TYPE_REMOVE_ADMIN AdminListUpdateType = 2 + AdminListUpdateType_ADMIN_LIST_UPDATE_TYPE_ADD_SUPER_ADMIN AdminListUpdateType = 3 + AdminListUpdateType_ADMIN_LIST_UPDATE_TYPE_REMOVE_SUPER_ADMIN AdminListUpdateType = 4 +) + +// Enum value maps for AdminListUpdateType. +var ( + AdminListUpdateType_name = map[int32]string{ + 0: "ADMIN_LIST_UPDATE_TYPE_UNSPECIFIED", + 1: "ADMIN_LIST_UPDATE_TYPE_ADD_ADMIN", + 2: "ADMIN_LIST_UPDATE_TYPE_REMOVE_ADMIN", + 3: "ADMIN_LIST_UPDATE_TYPE_ADD_SUPER_ADMIN", + 4: "ADMIN_LIST_UPDATE_TYPE_REMOVE_SUPER_ADMIN", + } + AdminListUpdateType_value = map[string]int32{ + "ADMIN_LIST_UPDATE_TYPE_UNSPECIFIED": 0, + "ADMIN_LIST_UPDATE_TYPE_ADD_ADMIN": 1, + "ADMIN_LIST_UPDATE_TYPE_REMOVE_ADMIN": 2, + "ADMIN_LIST_UPDATE_TYPE_ADD_SUPER_ADMIN": 3, + "ADMIN_LIST_UPDATE_TYPE_REMOVE_SUPER_ADMIN": 4, + } +) + +func (x AdminListUpdateType) Enum() *AdminListUpdateType { + p := new(AdminListUpdateType) + *p = x + return p +} + +func (x AdminListUpdateType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AdminListUpdateType) Descriptor() protoreflect.EnumDescriptor { + return file_mls_database_intents_proto_enumTypes[0].Descriptor() +} + +func (AdminListUpdateType) Type() protoreflect.EnumType { + return &file_mls_database_intents_proto_enumTypes[0] +} + +func (x AdminListUpdateType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AdminListUpdateType.Descriptor instead. +func (AdminListUpdateType) EnumDescriptor() ([]byte, []int) { + return file_mls_database_intents_proto_rawDescGZIP(), []int{0} +} + // The data required to publish a message type SendMessageData struct { state protoimpl.MessageState @@ -543,6 +599,74 @@ type UpdateMetadataData_V1_ struct { func (*UpdateMetadataData_V1_) isUpdateMetadataData_Version() {} +// The data required to update group admin/super admin lists +type UpdateAdminListsData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Version: + // + // *UpdateAdminListsData_V1_ + Version isUpdateAdminListsData_Version `protobuf_oneof:"version"` +} + +func (x *UpdateAdminListsData) Reset() { + *x = UpdateAdminListsData{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_database_intents_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateAdminListsData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateAdminListsData) ProtoMessage() {} + +func (x *UpdateAdminListsData) ProtoReflect() protoreflect.Message { + mi := &file_mls_database_intents_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateAdminListsData.ProtoReflect.Descriptor instead. +func (*UpdateAdminListsData) Descriptor() ([]byte, []int) { + return file_mls_database_intents_proto_rawDescGZIP(), []int{8} +} + +func (m *UpdateAdminListsData) GetVersion() isUpdateAdminListsData_Version { + if m != nil { + return m.Version + } + return nil +} + +func (x *UpdateAdminListsData) GetV1() *UpdateAdminListsData_V1 { + if x, ok := x.GetVersion().(*UpdateAdminListsData_V1_); ok { + return x.V1 + } + return nil +} + +type isUpdateAdminListsData_Version interface { + isUpdateAdminListsData_Version() +} + +type UpdateAdminListsData_V1_ struct { + V1 *UpdateAdminListsData_V1 `protobuf:"bytes,1,opt,name=v1,proto3,oneof"` +} + +func (*UpdateAdminListsData_V1_) isUpdateAdminListsData_Version() {} + // Generic data-type for all post-commit actions type PostCommitAction struct { state protoimpl.MessageState @@ -558,7 +682,7 @@ type PostCommitAction struct { func (x *PostCommitAction) Reset() { *x = PostCommitAction{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[8] + mi := &file_mls_database_intents_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -571,7 +695,7 @@ func (x *PostCommitAction) String() string { func (*PostCommitAction) ProtoMessage() {} func (x *PostCommitAction) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[8] + mi := &file_mls_database_intents_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -584,7 +708,7 @@ func (x *PostCommitAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PostCommitAction.ProtoReflect.Descriptor instead. func (*PostCommitAction) Descriptor() ([]byte, []int) { - return file_mls_database_intents_proto_rawDescGZIP(), []int{8} + return file_mls_database_intents_proto_rawDescGZIP(), []int{9} } func (m *PostCommitAction) GetKind() isPostCommitAction_Kind { @@ -623,7 +747,7 @@ type SendMessageData_V1 struct { func (x *SendMessageData_V1) Reset() { *x = SendMessageData_V1{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[9] + mi := &file_mls_database_intents_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -636,7 +760,7 @@ func (x *SendMessageData_V1) String() string { func (*SendMessageData_V1) ProtoMessage() {} func (x *SendMessageData_V1) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[9] + mi := &file_mls_database_intents_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -671,7 +795,7 @@ type AddMembersData_V1 struct { func (x *AddMembersData_V1) Reset() { *x = AddMembersData_V1{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[10] + mi := &file_mls_database_intents_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -684,7 +808,7 @@ func (x *AddMembersData_V1) String() string { func (*AddMembersData_V1) ProtoMessage() {} func (x *AddMembersData_V1) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[10] + mi := &file_mls_database_intents_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -719,7 +843,7 @@ type RemoveMembersData_V1 struct { func (x *RemoveMembersData_V1) Reset() { *x = RemoveMembersData_V1{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[11] + mi := &file_mls_database_intents_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -732,7 +856,7 @@ func (x *RemoveMembersData_V1) String() string { func (*RemoveMembersData_V1) ProtoMessage() {} func (x *RemoveMembersData_V1) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[11] + mi := &file_mls_database_intents_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -770,7 +894,7 @@ type UpdateGroupMembershipData_V1 struct { func (x *UpdateGroupMembershipData_V1) Reset() { *x = UpdateGroupMembershipData_V1{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[12] + mi := &file_mls_database_intents_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -783,7 +907,7 @@ func (x *UpdateGroupMembershipData_V1) String() string { func (*UpdateGroupMembershipData_V1) ProtoMessage() {} func (x *UpdateGroupMembershipData_V1) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[12] + mi := &file_mls_database_intents_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -826,7 +950,7 @@ type UpdateMetadataData_V1 struct { func (x *UpdateMetadataData_V1) Reset() { *x = UpdateMetadataData_V1{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[14] + mi := &file_mls_database_intents_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -839,7 +963,7 @@ func (x *UpdateMetadataData_V1) String() string { func (*UpdateMetadataData_V1) ProtoMessage() {} func (x *UpdateMetadataData_V1) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[14] + mi := &file_mls_database_intents_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -869,6 +993,62 @@ func (x *UpdateMetadataData_V1) GetFieldValue() string { return "" } +// V1 of UpdateAdminListsPublishData +type UpdateAdminListsData_V1 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdminListUpdateType AdminListUpdateType `protobuf:"varint,1,opt,name=admin_list_update_type,json=adminListUpdateType,proto3,enum=xmtp.mls.database.AdminListUpdateType" json:"admin_list_update_type,omitempty"` + InboxId string `protobuf:"bytes,2,opt,name=inbox_id,json=inboxId,proto3" json:"inbox_id,omitempty"` +} + +func (x *UpdateAdminListsData_V1) Reset() { + *x = UpdateAdminListsData_V1{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_database_intents_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateAdminListsData_V1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateAdminListsData_V1) ProtoMessage() {} + +func (x *UpdateAdminListsData_V1) ProtoReflect() protoreflect.Message { + mi := &file_mls_database_intents_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateAdminListsData_V1.ProtoReflect.Descriptor instead. +func (*UpdateAdminListsData_V1) Descriptor() ([]byte, []int) { + return file_mls_database_intents_proto_rawDescGZIP(), []int{8, 0} +} + +func (x *UpdateAdminListsData_V1) GetAdminListUpdateType() AdminListUpdateType { + if x != nil { + return x.AdminListUpdateType + } + return AdminListUpdateType_ADMIN_LIST_UPDATE_TYPE_UNSPECIFIED +} + +func (x *UpdateAdminListsData_V1) GetInboxId() string { + if x != nil { + return x.InboxId + } + return "" +} + // An installation type PostCommitAction_Installation struct { state protoimpl.MessageState @@ -882,7 +1062,7 @@ type PostCommitAction_Installation struct { func (x *PostCommitAction_Installation) Reset() { *x = PostCommitAction_Installation{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[15] + mi := &file_mls_database_intents_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -895,7 +1075,7 @@ func (x *PostCommitAction_Installation) String() string { func (*PostCommitAction_Installation) ProtoMessage() {} func (x *PostCommitAction_Installation) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[15] + mi := &file_mls_database_intents_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -908,7 +1088,7 @@ func (x *PostCommitAction_Installation) ProtoReflect() protoreflect.Message { // Deprecated: Use PostCommitAction_Installation.ProtoReflect.Descriptor instead. func (*PostCommitAction_Installation) Descriptor() ([]byte, []int) { - return file_mls_database_intents_proto_rawDescGZIP(), []int{8, 0} + return file_mls_database_intents_proto_rawDescGZIP(), []int{9, 0} } func (x *PostCommitAction_Installation) GetInstallationKey() []byte { @@ -938,7 +1118,7 @@ type PostCommitAction_SendWelcomes struct { func (x *PostCommitAction_SendWelcomes) Reset() { *x = PostCommitAction_SendWelcomes{} if protoimpl.UnsafeEnabled { - mi := &file_mls_database_intents_proto_msgTypes[16] + mi := &file_mls_database_intents_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -951,7 +1131,7 @@ func (x *PostCommitAction_SendWelcomes) String() string { func (*PostCommitAction_SendWelcomes) ProtoMessage() {} func (x *PostCommitAction_SendWelcomes) ProtoReflect() protoreflect.Message { - mi := &file_mls_database_intents_proto_msgTypes[16] + mi := &file_mls_database_intents_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -964,7 +1144,7 @@ func (x *PostCommitAction_SendWelcomes) ProtoReflect() protoreflect.Message { // Deprecated: Use PostCommitAction_SendWelcomes.ProtoReflect.Descriptor instead. func (*PostCommitAction_SendWelcomes) Descriptor() ([]byte, []int) { - return file_mls_database_intents_proto_rawDescGZIP(), []int{8, 1} + return file_mls_database_intents_proto_rawDescGZIP(), []int{9, 1} } func (x *PostCommitAction_SendWelcomes) GetInstallations() []*PostCommitAction_Installation { @@ -1075,6 +1255,20 @@ var file_mls_database_intents_proto_rawDesc = []byte{ 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xdd, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x44, 0x61, 0x74, 0x61, 0x12, 0x3c, + 0x0a, 0x02, 0x76, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, 0x74, + 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x44, + 0x61, 0x74, 0x61, 0x2e, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x1a, 0x7c, 0x0a, 0x02, + 0x56, 0x31, 0x12, 0x5b, 0x0a, 0x16, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x69, 0x73, 0x74, + 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x13, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x19, 0x0a, 0x08, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x49, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe8, 0x02, 0x0a, 0x10, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x57, 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, @@ -1098,19 +1292,34 @@ var file_mls_database_intents_proto_rawDesc = []byte{ 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, - 0x42, 0xc0, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, - 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x0c, 0x49, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, - 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x6d, 0x6c, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0xa2, - 0x02, 0x03, 0x58, 0x4d, 0x44, 0xaa, 0x02, 0x11, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, - 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0xca, 0x02, 0x11, 0x58, 0x6d, 0x74, 0x70, - 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0xe2, 0x02, 0x1d, - 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, - 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, - 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, 0x3a, 0x3a, 0x44, 0x61, 0x74, 0x61, 0x62, - 0x61, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2a, 0xe7, 0x01, 0x0a, 0x13, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x41, 0x44, 0x4d, 0x49, + 0x4e, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x24, 0x0a, 0x20, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x55, + 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x41, + 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x5f, + 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, + 0x2a, 0x0a, 0x26, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x55, 0x50, + 0x44, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x44, 0x44, 0x5f, 0x53, 0x55, + 0x50, 0x45, 0x52, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x03, 0x12, 0x2d, 0x0a, 0x29, 0x41, + 0x44, 0x4d, 0x49, 0x4e, 0x5f, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f, 0x53, 0x55, 0x50, + 0x45, 0x52, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x04, 0x42, 0xc0, 0x01, 0x0a, 0x15, 0x63, + 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, + 0x62, 0x61, 0x73, 0x65, 0x42, 0x0c, 0x49, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, + 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6c, 0x73, + 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x44, 0xaa, + 0x02, 0x11, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, + 0x61, 0x73, 0x65, 0xca, 0x02, 0x11, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x44, + 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0xe2, 0x02, 0x1d, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, + 0x6c, 0x73, 0x5c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, + 0x4d, 0x6c, 0x73, 0x3a, 0x3a, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1125,44 +1334,50 @@ func file_mls_database_intents_proto_rawDescGZIP() []byte { return file_mls_database_intents_proto_rawDescData } -var file_mls_database_intents_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_mls_database_intents_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_mls_database_intents_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_mls_database_intents_proto_goTypes = []interface{}{ - (*SendMessageData)(nil), // 0: xmtp.mls.database.SendMessageData - (*AccountAddresses)(nil), // 1: xmtp.mls.database.AccountAddresses - (*InstallationIds)(nil), // 2: xmtp.mls.database.InstallationIds - (*AddressesOrInstallationIds)(nil), // 3: xmtp.mls.database.AddressesOrInstallationIds - (*AddMembersData)(nil), // 4: xmtp.mls.database.AddMembersData - (*RemoveMembersData)(nil), // 5: xmtp.mls.database.RemoveMembersData - (*UpdateGroupMembershipData)(nil), // 6: xmtp.mls.database.UpdateGroupMembershipData - (*UpdateMetadataData)(nil), // 7: xmtp.mls.database.UpdateMetadataData - (*PostCommitAction)(nil), // 8: xmtp.mls.database.PostCommitAction - (*SendMessageData_V1)(nil), // 9: xmtp.mls.database.SendMessageData.V1 - (*AddMembersData_V1)(nil), // 10: xmtp.mls.database.AddMembersData.V1 - (*RemoveMembersData_V1)(nil), // 11: xmtp.mls.database.RemoveMembersData.V1 - (*UpdateGroupMembershipData_V1)(nil), // 12: xmtp.mls.database.UpdateGroupMembershipData.V1 - nil, // 13: xmtp.mls.database.UpdateGroupMembershipData.V1.MembershipUpdatesEntry - (*UpdateMetadataData_V1)(nil), // 14: xmtp.mls.database.UpdateMetadataData.V1 - (*PostCommitAction_Installation)(nil), // 15: xmtp.mls.database.PostCommitAction.Installation - (*PostCommitAction_SendWelcomes)(nil), // 16: xmtp.mls.database.PostCommitAction.SendWelcomes + (AdminListUpdateType)(0), // 0: xmtp.mls.database.AdminListUpdateType + (*SendMessageData)(nil), // 1: xmtp.mls.database.SendMessageData + (*AccountAddresses)(nil), // 2: xmtp.mls.database.AccountAddresses + (*InstallationIds)(nil), // 3: xmtp.mls.database.InstallationIds + (*AddressesOrInstallationIds)(nil), // 4: xmtp.mls.database.AddressesOrInstallationIds + (*AddMembersData)(nil), // 5: xmtp.mls.database.AddMembersData + (*RemoveMembersData)(nil), // 6: xmtp.mls.database.RemoveMembersData + (*UpdateGroupMembershipData)(nil), // 7: xmtp.mls.database.UpdateGroupMembershipData + (*UpdateMetadataData)(nil), // 8: xmtp.mls.database.UpdateMetadataData + (*UpdateAdminListsData)(nil), // 9: xmtp.mls.database.UpdateAdminListsData + (*PostCommitAction)(nil), // 10: xmtp.mls.database.PostCommitAction + (*SendMessageData_V1)(nil), // 11: xmtp.mls.database.SendMessageData.V1 + (*AddMembersData_V1)(nil), // 12: xmtp.mls.database.AddMembersData.V1 + (*RemoveMembersData_V1)(nil), // 13: xmtp.mls.database.RemoveMembersData.V1 + (*UpdateGroupMembershipData_V1)(nil), // 14: xmtp.mls.database.UpdateGroupMembershipData.V1 + nil, // 15: xmtp.mls.database.UpdateGroupMembershipData.V1.MembershipUpdatesEntry + (*UpdateMetadataData_V1)(nil), // 16: xmtp.mls.database.UpdateMetadataData.V1 + (*UpdateAdminListsData_V1)(nil), // 17: xmtp.mls.database.UpdateAdminListsData.V1 + (*PostCommitAction_Installation)(nil), // 18: xmtp.mls.database.PostCommitAction.Installation + (*PostCommitAction_SendWelcomes)(nil), // 19: xmtp.mls.database.PostCommitAction.SendWelcomes } var file_mls_database_intents_proto_depIdxs = []int32{ - 9, // 0: xmtp.mls.database.SendMessageData.v1:type_name -> xmtp.mls.database.SendMessageData.V1 - 1, // 1: xmtp.mls.database.AddressesOrInstallationIds.account_addresses:type_name -> xmtp.mls.database.AccountAddresses - 2, // 2: xmtp.mls.database.AddressesOrInstallationIds.installation_ids:type_name -> xmtp.mls.database.InstallationIds - 10, // 3: xmtp.mls.database.AddMembersData.v1:type_name -> xmtp.mls.database.AddMembersData.V1 - 11, // 4: xmtp.mls.database.RemoveMembersData.v1:type_name -> xmtp.mls.database.RemoveMembersData.V1 - 12, // 5: xmtp.mls.database.UpdateGroupMembershipData.v1:type_name -> xmtp.mls.database.UpdateGroupMembershipData.V1 - 14, // 6: xmtp.mls.database.UpdateMetadataData.v1:type_name -> xmtp.mls.database.UpdateMetadataData.V1 - 16, // 7: xmtp.mls.database.PostCommitAction.send_welcomes:type_name -> xmtp.mls.database.PostCommitAction.SendWelcomes - 3, // 8: xmtp.mls.database.AddMembersData.V1.addresses_or_installation_ids:type_name -> xmtp.mls.database.AddressesOrInstallationIds - 3, // 9: xmtp.mls.database.RemoveMembersData.V1.addresses_or_installation_ids:type_name -> xmtp.mls.database.AddressesOrInstallationIds - 13, // 10: xmtp.mls.database.UpdateGroupMembershipData.V1.membership_updates:type_name -> xmtp.mls.database.UpdateGroupMembershipData.V1.MembershipUpdatesEntry - 15, // 11: xmtp.mls.database.PostCommitAction.SendWelcomes.installations:type_name -> xmtp.mls.database.PostCommitAction.Installation - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 11, // 0: xmtp.mls.database.SendMessageData.v1:type_name -> xmtp.mls.database.SendMessageData.V1 + 2, // 1: xmtp.mls.database.AddressesOrInstallationIds.account_addresses:type_name -> xmtp.mls.database.AccountAddresses + 3, // 2: xmtp.mls.database.AddressesOrInstallationIds.installation_ids:type_name -> xmtp.mls.database.InstallationIds + 12, // 3: xmtp.mls.database.AddMembersData.v1:type_name -> xmtp.mls.database.AddMembersData.V1 + 13, // 4: xmtp.mls.database.RemoveMembersData.v1:type_name -> xmtp.mls.database.RemoveMembersData.V1 + 14, // 5: xmtp.mls.database.UpdateGroupMembershipData.v1:type_name -> xmtp.mls.database.UpdateGroupMembershipData.V1 + 16, // 6: xmtp.mls.database.UpdateMetadataData.v1:type_name -> xmtp.mls.database.UpdateMetadataData.V1 + 17, // 7: xmtp.mls.database.UpdateAdminListsData.v1:type_name -> xmtp.mls.database.UpdateAdminListsData.V1 + 19, // 8: xmtp.mls.database.PostCommitAction.send_welcomes:type_name -> xmtp.mls.database.PostCommitAction.SendWelcomes + 4, // 9: xmtp.mls.database.AddMembersData.V1.addresses_or_installation_ids:type_name -> xmtp.mls.database.AddressesOrInstallationIds + 4, // 10: xmtp.mls.database.RemoveMembersData.V1.addresses_or_installation_ids:type_name -> xmtp.mls.database.AddressesOrInstallationIds + 15, // 11: xmtp.mls.database.UpdateGroupMembershipData.V1.membership_updates:type_name -> xmtp.mls.database.UpdateGroupMembershipData.V1.MembershipUpdatesEntry + 0, // 12: xmtp.mls.database.UpdateAdminListsData.V1.admin_list_update_type:type_name -> xmtp.mls.database.AdminListUpdateType + 18, // 13: xmtp.mls.database.PostCommitAction.SendWelcomes.installations:type_name -> xmtp.mls.database.PostCommitAction.Installation + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_mls_database_intents_proto_init() } @@ -1268,7 +1483,7 @@ func file_mls_database_intents_proto_init() { } } file_mls_database_intents_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PostCommitAction); i { + switch v := v.(*UpdateAdminListsData); i { case 0: return &v.state case 1: @@ -1280,7 +1495,7 @@ func file_mls_database_intents_proto_init() { } } file_mls_database_intents_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendMessageData_V1); i { + switch v := v.(*PostCommitAction); i { case 0: return &v.state case 1: @@ -1292,7 +1507,7 @@ func file_mls_database_intents_proto_init() { } } file_mls_database_intents_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddMembersData_V1); i { + switch v := v.(*SendMessageData_V1); i { case 0: return &v.state case 1: @@ -1304,7 +1519,7 @@ func file_mls_database_intents_proto_init() { } } file_mls_database_intents_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveMembersData_V1); i { + switch v := v.(*AddMembersData_V1); i { case 0: return &v.state case 1: @@ -1316,6 +1531,18 @@ func file_mls_database_intents_proto_init() { } } file_mls_database_intents_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveMembersData_V1); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mls_database_intents_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateGroupMembershipData_V1); i { case 0: return &v.state @@ -1327,7 +1554,7 @@ func file_mls_database_intents_proto_init() { return nil } } - file_mls_database_intents_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_mls_database_intents_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateMetadataData_V1); i { case 0: return &v.state @@ -1339,7 +1566,19 @@ func file_mls_database_intents_proto_init() { return nil } } - file_mls_database_intents_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_mls_database_intents_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateAdminListsData_V1); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mls_database_intents_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PostCommitAction_Installation); i { case 0: return &v.state @@ -1351,7 +1590,7 @@ func file_mls_database_intents_proto_init() { return nil } } - file_mls_database_intents_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_mls_database_intents_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PostCommitAction_SendWelcomes); i { case 0: return &v.state @@ -1384,6 +1623,9 @@ func file_mls_database_intents_proto_init() { (*UpdateMetadataData_V1_)(nil), } file_mls_database_intents_proto_msgTypes[8].OneofWrappers = []interface{}{ + (*UpdateAdminListsData_V1_)(nil), + } + file_mls_database_intents_proto_msgTypes[9].OneofWrappers = []interface{}{ (*PostCommitAction_SendWelcomes_)(nil), } type x struct{} @@ -1391,13 +1633,14 @@ func file_mls_database_intents_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mls_database_intents_proto_rawDesc, - NumEnums: 0, - NumMessages: 17, + NumEnums: 1, + NumMessages: 19, NumExtensions: 0, NumServices: 0, }, GoTypes: file_mls_database_intents_proto_goTypes, DependencyIndexes: file_mls_database_intents_proto_depIdxs, + EnumInfos: file_mls_database_intents_proto_enumTypes, MessageInfos: file_mls_database_intents_proto_msgTypes, }.Build() File_mls_database_intents_proto = out.File diff --git a/pkg/proto/mls_validation/v1/service.pb.go b/pkg/proto/mls_validation/v1/service.pb.go index 1d8181f9..49c95f9e 100644 --- a/pkg/proto/mls_validation/v1/service.pb.go +++ b/pkg/proto/mls_validation/v1/service.pb.go @@ -486,7 +486,7 @@ type ValidateInboxIdKeyPackagesResponse_Response struct { ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` Credential *identity.MlsCredential `protobuf:"bytes,3,opt,name=credential,proto3" json:"credential,omitempty"` InstallationPublicKey []byte `protobuf:"bytes,4,opt,name=installation_public_key,json=installationPublicKey,proto3" json:"installation_public_key,omitempty"` - Expiration uint64 `protobuf:"varint,6,opt,name=expiration,proto3" json:"expiration,omitempty"` + Expiration uint64 `protobuf:"varint,5,opt,name=expiration,proto3" json:"expiration,omitempty"` } func (x *ValidateInboxIdKeyPackagesResponse_Response) Reset() { @@ -972,7 +972,7 @@ var file_mls_validation_v1_service_proto_rawDesc = []byte{ 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x15, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, + 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8a, 0x02, 0x0a, 0x1a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x60, 0x0a, 0x0c, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, From 302b1940b00e3c4782f362d524249870f5af6e06 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 27 May 2024 22:40:08 -0700 Subject: [PATCH 2/6] Revert schema change --- pkg/mls/store/store.go | 2 +- pkg/mls/store/store_test.go | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index 89ca64f5..f442892b 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -157,7 +157,7 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish _, err = txQueries.InsertAddressLog(ctx, queries.InsertAddressLogParams{ Address: address.Address, InboxID: state.AssociationState.InboxId, - AssociationSequenceID: sequence_id, + AssociationSequenceID: sql.NullInt64{Valid: true, Int64: sequence_id}, RevocationSequenceID: sql.NullInt64{Valid: false}, }) if err != nil { diff --git a/pkg/mls/store/store_test.go b/pkg/mls/store/store_test.go index 00cb960a..1922b1c6 100644 --- a/pkg/mls/store/store_test.go +++ b/pkg/mls/store/store_test.go @@ -40,18 +40,9 @@ func TestPublishIdentityUpdateParallel(t *testing.T) { defer cleanup() ctx := context.Background() - // for i := 0; i < 10000; i++ { - // inboxId := fmt.Sprintf("fake_%d", i) - // store.queries.InsertInboxLog(ctx, queries.InsertInboxLogParams{ - // InboxID: inboxId, - // ServerTimestampNs: nowNs(), - // IdentityUpdateProto: []byte(inboxId), - // }) - // } - // Create a mapping of inboxes to addresses inboxes := make(map[string]string) - for i := 0; i < 10; i++ { + for i := 0; i < 50; i++ { inboxes[fmt.Sprintf("inbox_%d", i)] = fmt.Sprintf("address_%d", i) } @@ -118,7 +109,7 @@ func TestInboxIds(t *testing.T) { require.Equal(t, "correct", *resp.Responses[0].InboxId) - _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "correct_inbox2", AssociationSequenceID: 5, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "correct_inbox2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 5}, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) resp, _ = store.GetInboxIds(context.Background(), req) require.Equal(t, "correct_inbox2", *resp.Responses[0].InboxId) @@ -127,7 +118,7 @@ func TestInboxIds(t *testing.T) { req = &identity.GetInboxIdsRequest{ Requests: reqs, } - _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address2", InboxID: "inbox2", AssociationSequenceID: 8, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address2", InboxID: "inbox2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 8}, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) resp, _ = store.GetInboxIds(context.Background(), req) require.Equal(t, "inbox2", *resp.Responses[1].InboxId) @@ -138,9 +129,9 @@ func TestMultipleInboxIds(t *testing.T) { defer cleanup() ctx := context.Background() - _, err := store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_1", InboxID: "inbox_1", AssociationSequenceID: 1, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err := store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_1", InboxID: "inbox_1", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 1}, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) - _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_2", InboxID: "inbox_2", AssociationSequenceID: 2, RevocationSequenceID: sql.NullInt64{Valid: false}}) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address_2", InboxID: "inbox_2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 2}, RevocationSequenceID: sql.NullInt64{Valid: false}}) require.NoError(t, err) reqs := make([]*identity.GetInboxIdsRequest_Request, 0) From f3a7d12000a7bc959e38d559880a01797618688f Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 27 May 2024 23:01:44 -0700 Subject: [PATCH 3/6] Use pg_advisory_xact_lock --- pkg/mls/store/queries.sql | 7 +++++-- pkg/mls/store/queries/queries.sql.go | 11 ++++++++++- pkg/mls/store/store.go | 3 +++ pkg/mls/store/store_test.go | 10 ++++++++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/pkg/mls/store/queries.sql b/pkg/mls/store/queries.sql index 29ad2e84..13420c6c 100644 --- a/pkg/mls/store/queries.sql +++ b/pkg/mls/store/queries.sql @@ -1,3 +1,7 @@ +-- name: LockInboxLog :exec +SELECT + pg_advisory_xact_lock(hashtext(@inbox_id)); + -- name: GetAllInboxLogs :many SELECT * @@ -6,8 +10,7 @@ FROM WHERE inbox_id = $1 ORDER BY - sequence_id ASC -FOR UPDATE; + sequence_id ASC; -- name: GetInboxLogFiltered :many SELECT diff --git a/pkg/mls/store/queries/queries.sql.go b/pkg/mls/store/queries/queries.sql.go index 720a5323..2543dd85 100644 --- a/pkg/mls/store/queries/queries.sql.go +++ b/pkg/mls/store/queries/queries.sql.go @@ -174,7 +174,6 @@ WHERE inbox_id = $1 ORDER BY sequence_id ASC -FOR UPDATE ` func (q *Queries) GetAllInboxLogs(ctx context.Context, inboxID string) ([]InboxLog, error) { @@ -473,6 +472,16 @@ func (q *Queries) InsertWelcomeMessage(ctx context.Context, arg InsertWelcomeMes return i, err } +const lockInboxLog = `-- name: LockInboxLog :exec +SELECT + pg_advisory_xact_lock(hashtext($1)) +` + +func (q *Queries) LockInboxLog(ctx context.Context, inboxID string) error { + _, err := q.db.ExecContext(ctx, lockInboxLog, inboxID) + return err +} + const queryGroupMessages = `-- name: QueryGroupMessages :many SELECT id, created_at, group_id, data, group_id_data_hash diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index f442892b..e475b914 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -109,6 +109,9 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish if err := s.RunInRepeatableReadTx(ctx, 3, func(ctx context.Context, txQueries *queries.Queries) error { inboxId := newUpdate.GetInboxId() + // We use a pg_advisory_lock to lock the inbox_id instead of SELECT FOR UPDATE + // This allows the lock to be enforced even when there are no existing `inbox_log`s + txQueries.LockInboxLog(ctx, inboxId) log := s.log.With(zap.String("inbox_id", inboxId)) inboxLogEntries, err := txQueries.GetAllInboxLogs(ctx, inboxId) if err != nil { diff --git a/pkg/mls/store/store_test.go b/pkg/mls/store/store_test.go index 1922b1c6..65109fbc 100644 --- a/pkg/mls/store/store_test.go +++ b/pkg/mls/store/store_test.go @@ -3,6 +3,7 @@ package store import ( "context" "database/sql" + "errors" "fmt" "sort" "sync" @@ -49,10 +50,15 @@ func TestPublishIdentityUpdateParallel(t *testing.T) { mockController := gomock.NewController(t) mockMlsValidation := mocks.NewMockMLSValidationService(mockController) - // Retun the matching address from the map. Each inboxId will return a different address + // For each inbox_id in the map, return an AssociationStateDiff that adds the corresponding address mockMlsValidation.EXPECT().GetAssociationState(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(_ any, _ any, updates []*associations.IdentityUpdate) (*mlsvalidate.AssociationStateResult, error) { inboxId := updates[0].InboxId - address := inboxes[inboxId] + address, ok := inboxes[inboxId] + + if !ok { + return nil, errors.New("inbox id not found") + } + return &mlsvalidate.AssociationStateResult{ AssociationState: &associations.AssociationState{ InboxId: inboxId, From 9bcd0ade03594703436e0ca845439bbd17e8e878 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Mon, 27 May 2024 23:20:42 -0700 Subject: [PATCH 4/6] Check return value of lock --- pkg/mls/store/store.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index e475b914..da2cce5d 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -111,7 +111,10 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish inboxId := newUpdate.GetInboxId() // We use a pg_advisory_lock to lock the inbox_id instead of SELECT FOR UPDATE // This allows the lock to be enforced even when there are no existing `inbox_log`s - txQueries.LockInboxLog(ctx, inboxId) + if err := txQueries.LockInboxLog(ctx, inboxId); err != nil { + return err + } + log := s.log.With(zap.String("inbox_id", inboxId)) inboxLogEntries, err := txQueries.GetAllInboxLogs(ctx, inboxId) if err != nil { From 9e3f58815ea0edfca2a45816b056283ab5590b75 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 28 May 2024 10:32:52 -0700 Subject: [PATCH 5/6] Add random sleep --- pkg/mls/store/store.go | 2 ++ pkg/utils/sleep.go | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 pkg/utils/sleep.go diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index da2cce5d..04dcc58f 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -17,6 +17,7 @@ import ( identity "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" + "github.com/xmtp/xmtp-node-go/pkg/utils" "go.uber.org/zap" "google.golang.org/protobuf/proto" ) @@ -626,6 +627,7 @@ func (s *Store) RunInRepeatableReadTx(ctx context.Context, numRetries int, fn fu return nil } s.log.Warn("Error in serializable tx", zap.Error(err)) + utils.RandomSleep(20) } } return err diff --git a/pkg/utils/sleep.go b/pkg/utils/sleep.go new file mode 100644 index 00000000..c4120540 --- /dev/null +++ b/pkg/utils/sleep.go @@ -0,0 +1,10 @@ +package utils + +import ( + "math/rand" + "time" +) + +func RandomSleep(maxTimeMs int) { + time.Sleep(time.Millisecond * time.Duration(rand.Intn(maxTimeMs))) +} From 91797e78d9c14ec68825484b15aecfb33984d4c3 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Tue, 28 May 2024 11:04:26 -0700 Subject: [PATCH 6/6] Remove unused line --- pkg/mls/store/store.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index 04dcc58f..2c2f42ca 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -134,7 +134,6 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish } updates = append(updates, identityUpdate) } - _ = append(updates, newUpdate) state, err := validationService.GetAssociationState(ctx, updates, []*associations.IdentityUpdate{newUpdate}) if err != nil {