Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into insipx/feat/286-group…
Browse files Browse the repository at this point in the history
…-database-tables
  • Loading branch information
insipx committed Nov 1, 2023
2 parents 5e73f02 + 9c0984d commit 7c960f4
Show file tree
Hide file tree
Showing 19 changed files with 929 additions and 184 deletions.
191 changes: 96 additions & 95 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev/docker/up
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -eou pipefail
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

"${script_dir}"/compose pull
"${script_dir}"/compose up -d
"${script_dir}"/compose up -d --build
6 changes: 4 additions & 2 deletions xmtp_mls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ native = ["libsqlite3-sys/bundled-sqlcipher-vendored-openssl"]
[dependencies]
anyhow = "1.0.71"
async-trait = "0.1.68"
diesel = { version = "2.0.4", features = ["sqlite", "r2d2", "returning_clauses_for_sqlite_3_35"] }
diesel_migrations = { version = "2.0.0", features = ["sqlite"] }
diesel = { version = "2.1.3", features = ["sqlite", "r2d2", "returning_clauses_for_sqlite_3_35"] }
diesel_migrations = { version = "2.1.0", features = ["sqlite"] }
ethers = "2.0.4"
ethers-core = "2.0.4"
futures = "0.3.28"
Expand All @@ -41,8 +41,10 @@ tracing = "0.1.37"
toml = "0.7.4"
xmtp_cryptography = { path = "../xmtp_cryptography"}
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] }
tls_codec = "0.3.0"

[dev-dependencies]
mockall = "0.11.4"
rand = "0.8.5"
tempfile = "3.5.0"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
Expand Down
24 changes: 5 additions & 19 deletions xmtp_mls/migrations/2023-10-29-205333_state_machine_init/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ CREATE INDEX groups_membership_state ON groups(membership_state);

-- Successfully processed messages meant to be returned to the user
CREATE TABLE group_messages (
"id" BLOB PRIMARY KEY NOT NULL,
-- Derived via SHA256(CONCAT(decrypted_message_bytes, conversation_id, timestamp))
"id" BLOB PRIMARY KEY NOT NULL,
"group_id" BLOB NOT NULL,
-- Message contents after decryption
"decrypted_message_bytes" BLOB NOT NULL,
Expand Down Expand Up @@ -49,24 +49,10 @@ CREATE TABLE group_intents (
-- INTENT_STATE,
"state" INT NOT NULL,
-- The hash of the encrypted, concrete, form of the message if it was published.
"message_hash" BLOB,
FOREIGN KEY (group_id) REFERENCES groups(id)
);

CREATE INDEX group_intents_group_id_id ON group_intents(group_id, id);

CREATE TABLE outbound_welcome_messages (
-- Derived via SHA256(CONCAT(group_id, welcome_message, installation_id))
"id" BLOB PRIMARY KEY NOT NULL,
-- OUTBOUND_WELCOME_STATE
"state" INT NOT NULL,
"installation_id" BLOB NOT NULL,
-- The hash of the commit message which created this welcome
"commit_hash" BLOB NOT NULL,
-- The group this welcome belongs to
"group_id" BLOB NOT NULL,
"welcome_message" BLOB NOT NULL,
"payload_hash" BLOB,
-- (Optional) data needed for the post-commit flow. For example, welcome messages
"post_commit_data" BLOB,
FOREIGN KEY (group_id) REFERENCES groups(id)
);

CREATE INDEX outbound_welcome_messages_commit_hash ON outbound_welcome_messages(commit_hash, state);
CREATE INDEX group_intents_group_id_id ON group_intents(group_id, id);
Loading

0 comments on commit 7c960f4

Please sign in to comment.