Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/xmtp/libxmtp into np/retry-…
Browse files Browse the repository at this point in the history
…disconnect-errors
  • Loading branch information
nplasterer committed Aug 29, 2024
2 parents a09431d + e6e8cab commit 514225e
Show file tree
Hide file tree
Showing 49 changed files with 5,981 additions and 6,916 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/release-node-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- name: Configure aarch64 toolchain
if: startsWith(matrix.target, 'aarch64')
run: |
sudo apt-get update
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf
cat >>~/.cargo/config <<EOF
[target.aarch64-unknown-linux-gnu]
Expand All @@ -53,6 +54,7 @@ jobs:
- name: Configure x86_64-unknown-linux-musl toolchain
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Setup node
Expand Down Expand Up @@ -194,6 +196,11 @@ jobs:
.
bindings_node
- name: Upgrade Visual Studio 2022 enterprise
uses: crazy-max/ghaction-chocolatey@v3
with:
args: upgrade visualstudio2022enterprise

- name: Install Visual Studio 2022 build tools
uses: crazy-max/ghaction-chocolatey@v3
with:
Expand Down
23 changes: 12 additions & 11 deletions Cargo.lock

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

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ members = [
"xmtp_id",
]

exclude = [
"bindings_ffi",
"bindings_wasm",
"xmtp_api_grpc_gateway",
"bindings_node",
]
exclude = ["bindings_ffi", "bindings_wasm", "bindings_node"]

# Make the feature resolver explicit.
# See https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html#details
resolver = "2"

[workspace.package]
version = "0.0.1"

[workspace.dependencies]
anyhow = "1.0"
async-stream = "0.3"
Expand All @@ -36,6 +34,7 @@ ethers = "2.0.11"
ethers-core = "2.0.4"
futures = "0.3.30"
futures-core = "0.3.30"
getrandom = { version = "0.2", default-features = false }
hex = "0.4.3"
log = { version = "0.4" }
openmls = { git = "https://github.com/xmtp/openmls", rev = "87e7e257d8eb15d6662b104518becfc75ef6db76", default-features = false }
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ libxmtp/

├ examples/

  [`android/xmtpv3_example`](./examples/android/xmtpv3_example): Example Android app (in progress)
[`android/xmtpv3_example`](./examples/android/xmtpv3_example): Example Android app (in progress)

  [`cli`](./examples/cli): Example XMTP console client. Use the CLI to try out sending double ratchet messages on the XMTP `dev` network.
[`cli`](./examples/cli): Example XMTP console client. Use the CLI to try out sending double ratchet messages on the XMTP `dev` network.

[`xmtp_api_grpc`](./xmtp_api_grpc): API client for XMTP's gRPC API, using code from `xmtp_proto`

[`xmtp_api_grpc_gateway`](./xmtp_api_grpc_gateway): API client for XMTP's gRPC Gateway API, using code from `xmtp_proto` (in progress)
[`xmtp_api_http`](./xmtp_api_http): API client for XMTP's gRPC Gateway API, using code from `xmtp_proto`

[`xmtp_cryptography`](./xmtp_cryptography): Cryptographic operations

Expand All @@ -71,7 +71,6 @@ libxmtp/

[`xmtp_v2`](./xmtp_v2): Version 2 of XMTP which uses a [user key bundle](https://xmtp.org/docs/concepts/key-generation-and-usage) to encrypt and exchange messages.


### Run the benchmarks

**possible benchmarks include:**
Expand Down
21 changes: 11 additions & 10 deletions bindings_ffi/Cargo.lock

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

8 changes: 4 additions & 4 deletions bindings_ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "xmtpv3"
version = "0.1.0"
version = "0.0.1"

[lib]
crate-type = ["lib", "cdylib", "staticlib"]
Expand All @@ -10,6 +10,7 @@ crate-type = ["lib", "cdylib", "staticlib"]
env_logger = "0.11.3"
futures = "0.3.28"
log = { version = "0.4", features = ["std"] }
parking_lot = "0.12.3"
thiserror = "1.0"
thread-id = "4.2.1"
tokio = { version = "1.28.1", features = ["macros"] }
Expand All @@ -22,7 +23,6 @@ xmtp_mls = { path = "../xmtp_mls", features = ["grpc", "native"] }
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full", "grpc"] }
xmtp_user_preferences = { path = "../xmtp_user_preferences" }
xmtp_v2 = { path = "../xmtp_v2" }
parking_lot = "0.12.3"

tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# NOTE: A regression in openssl-sys exists where libatomic is dynamically linked
Expand All @@ -47,9 +47,9 @@ ethers-core = "2.0.13"
tempfile = "3.5.0"
tokio = { version = "1.28.1", features = ["full"] }
tokio-test = "0.4"
uniffi = { version = "0.28.0", features = ["bindgen-tests"] }
tracing-subscriber = "0.3"
uuid = { version = "1.9", features = ["v4", "fast-rng" ] }
uniffi = { version = "0.28.0", features = ["bindgen-tests"] }
uuid = { version = "1.9", features = ["v4", "fast-rng"] }

# NOTE: The release profile reduces bundle size from 230M to 41M - may have performance impliciations
# https://stackoverflow.com/a/54842093
Expand Down
29 changes: 28 additions & 1 deletion bindings_ffi/src/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,11 @@ mod tests {
use tokio::{sync::Notify, time::error::Elapsed};
use xmtp_cryptography::{signature::RecoverableSignature, utils::rng};
use xmtp_id::associations::generate_inbox_id;
use xmtp_mls::{storage::EncryptionKey, InboxOwner};
use xmtp_mls::{
groups::{GroupError, MlsGroup},
storage::EncryptionKey,
InboxOwner,
};

#[derive(Clone)]
pub struct LocalWalletInboxOwner {
Expand Down Expand Up @@ -1728,6 +1732,20 @@ mod tests {
new_test_client_with_wallet(wallet).await
}

impl FfiGroup {
#[cfg(test)]
async fn update_installations(&self) -> Result<(), GroupError> {
let group = MlsGroup::new(
self.inner_client.context().clone(),
self.group_id.clone(),
self.created_at_ns,
);

group.update_installations(&self.inner_client).await?;
Ok(())
}
}

#[tokio::test]
async fn get_inbox_id() {
let client = new_test_client().await;
Expand Down Expand Up @@ -2464,6 +2482,8 @@ mod tests {
// Recreate client2 (new installation)
let client2 = new_test_client_with_wallet(wallet2).await;

client1_group.update_installations().await.unwrap();

// Send a message that will break the group
client1_group
.send("This message will break the group".as_bytes().to_vec())
Expand Down Expand Up @@ -2517,6 +2537,8 @@ mod tests {
let alix_group = alix.group(group.id()).unwrap();
let bo_group = bo.group(group.id()).unwrap();
let caro_group = caro.group(group.id()).unwrap();

alix_group.update_installations().await.unwrap();
log::info!("Alix sending first message");
// Alix sends a message in the group
alix_group
Expand All @@ -2525,6 +2547,7 @@ mod tests {
.unwrap();

log::info!("Caro sending second message");
caro_group.update_installations().await.unwrap();
// Caro sends a message in the group
caro_group
.send("Second message".as_bytes().to_vec())
Expand All @@ -2542,6 +2565,8 @@ mod tests {
.await;
bo_stream_messages.wait_for_ready().await;

alix_group.update_installations().await.unwrap();

log::info!("Alix sending third message after Bo's second installation added");
// Alix sends a message to the group
alix_group
Expand All @@ -2555,13 +2580,15 @@ mod tests {

log::info!("Bo sending fourth message");
// Bo sends a message to the group
bo2_group.update_installations().await.unwrap();
bo2_group
.send("Fourth message".as_bytes().to_vec())
.await
.unwrap();

log::info!("Caro sending fifth message");
// Caro sends a message in the group
caro_group.update_installations().await.unwrap();
caro_group
.send("Fifth message".as_bytes().to_vec())
.await
Expand Down
5 changes: 5 additions & 0 deletions bindings_node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# @xmtp/mls-client-bindings-node

## 0.0.10

- Fixed several group syncing issues
- Improved performance

## 0.0.9

- Added optimistic sending
Expand Down
Loading

0 comments on commit 514225e

Please sign in to comment.