Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Identity DB ready for prod #394

Merged
merged 15 commits into from
May 31, 2024
Merged

Get Identity DB ready for prod #394

merged 15 commits into from
May 31, 2024

Conversation

neekolas
Copy link
Collaborator

@neekolas neekolas commented May 29, 2024

tl;dr

  • WIPES THE MLS/IDENTITY DATABASE
  • Makes some schema changes to be more inbox_id native
  • Removes the GetIdentityUpdates method which is now unused
  • Consolidates on mockery for mock generation

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
# Generate mocks
mockery
Copy link
Collaborator Author

@neekolas neekolas May 29, 2024

Choose a reason for hiding this comment

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

Steven was previously using mockgen to generate mocks. I decided to switch us back to the more standard testify/mock and mockery. It's more widely used and more actively maintained. Otherwise very similar, other than some syntax changes.

This probably should have been a separate PR, but a lot of the things that were being mocked were also changing.

@@ -0,0 +1,71 @@
SET statement_timeout = 0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I consolidated all our MLS schema into one big migration after the drops. Just easier to read this way

);

--bun:split
CREATE INDEX idx_group_messages_group_id_id ON group_messages(group_id, id);
Copy link
Collaborator Author

@neekolas neekolas May 29, 2024

Choose a reason for hiding this comment

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

This index is different from before. We were previously indexing on (group_id, created_at) and it never got updated when we changed the sort/cursor on queries to be the id field.

id BYTEA PRIMARY KEY,
created_at BIGINT NOT NULL,
updated_at BIGINT NOT NULL,
inbox_id BYTEA NOT NULL,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We now store inbox_id on installations instead of account_address

);

--bun:split
CREATE INDEX idx_welcome_messages_installation_key_id ON welcome_messages(installation_key, id);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also changed to match the sort/cursor field

@@ -118,45 +118,22 @@ func (s *Service) RegisterInstallation(ctx context.Context, req *mlsv1.RegisterI
return nil, err
}

if req.IsInboxIdCredential {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed support for legacy credentials, since we no longer even have an account_address field to store the resulting address.

@neekolas
Copy link
Collaborator Author

I've also now tested this with the libxmtp test suite and everything passes

@neekolas neekolas marked this pull request as ready for review May 30, 2024 23:18
@neekolas neekolas merged commit 24971f4 into main May 31, 2024
3 checks passed
@neekolas neekolas deleted the nm/identity-db-overhaul branch May 31, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants