From 62c8b04980ea514b2c3ea9f55c5e5eb214cc67dc Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Fri, 6 Sep 2024 09:49:24 +0100 Subject: [PATCH 1/3] Use v1.114.0 not v1.94.0 to pull in an SSS capable synapse --- .github/workflows/single_sdk_tests.yml | 6 +++--- .github/workflows/tests.yaml | 6 +++--- README.md | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/single_sdk_tests.yml b/.github/workflows/single_sdk_tests.yml index 55e4d29..21e21b7 100644 --- a/.github/workflows/single_sdk_tests.yml +++ b/.github/workflows/single_sdk_tests.yml @@ -95,12 +95,12 @@ jobs: ln -s . complement-crypto # Setup code we always need - - name: Pull synapse service v1.94.0 and mitmproxy + - name: Pull synapse service v1.114.0 and mitmproxy shell: bash run: | - docker pull ghcr.io/matrix-org/synapse-service:v1.94.0 + docker pull ghcr.io/matrix-org/synapse-service:v1.114.0 docker pull mitmproxy/mitmproxy:10.1.5 - docker tag ghcr.io/matrix-org/synapse-service:v1.94.0 homeserver:latest + docker tag ghcr.io/matrix-org/synapse-service:v1.114.0 homeserver:latest - name: Setup | Go uses: actions/setup-go@v4 with: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index eeb2a0e..c8ec884 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -72,12 +72,12 @@ jobs: ./install_uniffi_bindgen_go.sh && ./rebuild_rust_sdk.sh ./rust-sdk # Temporary: as it takes 3m to build the complement synapse image >:( - - name: Pull synapse service v1.94.0 and mitmproxy + - name: Pull synapse service v1.114.0 and mitmproxy shell: bash run: | - docker pull ghcr.io/matrix-org/synapse-service:v1.94.0 + docker pull ghcr.io/matrix-org/synapse-service:v1.114.0 docker pull mitmproxy/mitmproxy:10.1.5 - docker tag ghcr.io/matrix-org/synapse-service:v1.94.0 homeserver:latest + docker tag ghcr.io/matrix-org/synapse-service:v1.114.0 homeserver:latest # Build homeserver image, honouring branch names #- name: "Checkout corresponding Synapse branch" diff --git a/README.md b/README.md index a74471f..f860e3c 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,13 @@ The [version] is split into the URL and TAG|BRANCH then fed directly into 'git c ### Running -Find a complement-compatible homeserver image. If you don't care which image is used, use `ghcr.io/matrix-org/synapse-service:v1.94.0` +Find a complement-compatible homeserver image. If you don't care which image is used, use `ghcr.io/matrix-org/synapse-service:v1.114.0` which will Just Work out-of-the-box. To run only rust tests: ``` COMPLEMENT_CRYPTO_TEST_CLIENT_MATRIX=rr \ -COMPLEMENT_BASE_IMAGE=ghcr.io/matrix-org/synapse-service:v1.94.0 \ +COMPLEMENT_BASE_IMAGE=ghcr.io/matrix-org/synapse-service:v1.114.0 \ LIBRARY_PATH=$LIBRARY_PATH:/path/to/matrix-rust-sdk/target/debug \ go test -v -count=1 -tags=rust -timeout 15m ./tests ``` @@ -70,7 +70,7 @@ go test -v -count=1 -tags=rust -timeout 15m ./tests To run only JS tests: ``` COMPLEMENT_CRYPTO_TEST_CLIENT_MATRIX=jj \ -COMPLEMENT_BASE_IMAGE=ghcr.io/matrix-org/synapse-service:v1.94.0 \ +COMPLEMENT_BASE_IMAGE=ghcr.io/matrix-org/synapse-service:v1.114.0 \ go test -v -count=1 -tags=jssdk -timeout 15m ./tests ``` From 3a9031e69c4ccb9eb2457193fa938ba8b93a4875 Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:57:46 +0100 Subject: [PATCH 2/3] Swap to SSS not SS --- internal/api/rust/rust.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/api/rust/rust.go b/internal/api/rust/rust.go index 7857191..a712d58 100644 --- a/internal/api/rust/rust.go +++ b/internal/api/rust/rust.go @@ -64,7 +64,7 @@ type RustClient struct { func NewRustClient(t ct.TestLike, opts api.ClientCreationOpts) (api.Client, error) { t.Logf("NewRustClient[%s][%s] creating...", opts.UserID, opts.DeviceID) matrix_sdk_ffi.LogEvent("rust.go", &zero, matrix_sdk_ffi.LogLevelInfo, t.Name(), fmt.Sprintf("NewRustClient[%s][%s] creating...", opts.UserID, opts.DeviceID)) - slidingSyncVersion := matrix_sdk_ffi.SlidingSyncVersionBuilderProxy{Url: opts.SlidingSyncURL} + slidingSyncVersion := matrix_sdk_ffi.SlidingSyncVersionBuilderNative{} ab := matrix_sdk_ffi.NewClientBuilder(). HomeserverUrl(opts.BaseURL). SlidingSyncVersionBuilder(slidingSyncVersion). @@ -94,13 +94,11 @@ func NewRustClient(t ct.TestLike, opts api.ClientCreationOpts) (api.Client, erro } if opts.AccessToken != "" { // restore the session session := matrix_sdk_ffi.Session{ - AccessToken: opts.AccessToken, - UserId: opts.UserID, - DeviceId: opts.DeviceID, - HomeserverUrl: opts.BaseURL, - SlidingSyncVersion: matrix_sdk_ffi.SlidingSyncVersionProxy{ - Url: opts.SlidingSyncURL, - }, + AccessToken: opts.AccessToken, + UserId: opts.UserID, + DeviceId: opts.DeviceID, + HomeserverUrl: opts.BaseURL, + SlidingSyncVersion: matrix_sdk_ffi.SlidingSyncVersionNative{}, } if err := client.RestoreSession(session); err != nil { return nil, fmt.Errorf("RestoreSession: %s", err) From 623eabde5e00760d089cb8bfcaacbf2d90e1cc58 Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:55:47 +0100 Subject: [PATCH 3/3] Increase timeouts for SSS. If the timeout between HS2 coming online again and Charlie on HS1 sending the message is too short, HS1 will reject Charlie's attempt to `/keys/claim` with a HTTP 502 and "Not ready for retry". It does this because nothing cleared the 10 minute backoff which was created when HS2 went offline. In SS, the backoff gets cleared by Bob on HS2 hitting `/keys/query` on HS1. It does this due to receiving data about Charlie (his join) promptly down `/sync`. This does not seem to happen in SSS, instead the data does appear but only after the 30s timeout is reached. Therefore, we need to wait at least 30s + some grace time for HS1 to realise HS2 is back online. --- FAQ.md | 9 +++++++++ internal/deploy/rpc/server.go | 2 +- tests/federation_connectivity_test.go | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/FAQ.md b/FAQ.md index 7c75d12..ad80d2c 100644 --- a/FAQ.md +++ b/FAQ.md @@ -44,6 +44,15 @@ You cannot currently: ## Debugging +### How do I make Synapse more chatty? + +Set these env vars when running your test: +``` +COMPLEMENT_SHARE_ENV_PREFIX=PASS_ +PASS_SYNAPSE_LOG_LEVEL=DEBUG +PASS_SYNAPSE_LOG_SENSITIVE=1 +``` + ### How do I access client SDK logs for the test and correlate it with the failing test line? *You should have a file name and line number by this point.* diff --git a/internal/deploy/rpc/server.go b/internal/deploy/rpc/server.go index 976e470..1c83d14 100644 --- a/internal/deploy/rpc/server.go +++ b/internal/deploy/rpc/server.go @@ -11,7 +11,7 @@ import ( "github.com/matrix-org/complement-crypto/internal/api/langs" ) -const InactivityThreshold = 30 * time.Second +const InactivityThreshold = 60 * time.Second // Server exposes the api.Client interface over the wire, consumed via net/rpc. // Args and return params must be encodable with encoding/gob. diff --git a/tests/federation_connectivity_test.go b/tests/federation_connectivity_test.go index aaf4efc..4b6b624 100644 --- a/tests/federation_connectivity_test.go +++ b/tests/federation_connectivity_test.go @@ -72,7 +72,7 @@ func TestNewUserCannotGetKeysForOfflineServer(t *testing.T) { // See https://github.com/matrix-org/matrix-rust-sdk/issues/281 for why we want to backoff. // See https://github.com/matrix-org/matrix-rust-sdk/issues/2804 for discussions on what the backoff should be. t.Logf("sleeping until client timeout is ready...") - time.Sleep(20 * time.Second) + time.Sleep(33 * time.Second) // send another message, bob should be able to decrypt it. wantMsgBody = "Bob can see this because his server is now back online"