Skip to content

Commit

Permalink
Release/v0.4.1 (#4)
Browse files Browse the repository at this point in the history
* Update MSC2946 implementation for stable spaces (matrix-org#1859)

Now that MSC1772 passed FCP its identifiers have stabilised
This outright drops support for experimental spaces but that's what you get for being on the bleeding edge

* Update dendrite-demo-pinecone

* Update go.mod/go.sum

* Update go.mod/go.sum

* Update pinecone demo

* Allow clearing federation blacklist at startup for P2P demos

* Demo tweaks

* Update go.mod/go.sum

* Update go.mod/go.sum

* Update gomatrixserverlib to matrix-org/gomatrixserverlib#259

* Update go.mod/go.sum for matrix-org/pinecone (Build 79)

* Split the select+update query for txn_id counter (matrix-org#1855)

The update part wasn't executed actually for SQLite, so it is moved to
a separate statement.

Fixes matrix-org#1852.

Signed-off-by: Bohdan Horbeshko <[email protected]>

* Fix SIGSEGV in IsInterestedInRoomID (matrix-org#1846)

* Avoid crash on non-compiled room regex

Roughly fixes matrix-org#1845 (actual compiling still needed)

Signed-off-by: Bohdan Horbeshko <[email protected]>

* Compile regexes for all namespaces

Deadheres the regex compiling from building larger regexes for possibly
exclusive namespaces only. A complete fix for matrix-org#1845, so regexes for
rooms namespaces and other non-whitelisted namespaces can be used
more safely.

Signed-off-by: Bohdan Horbeshko <[email protected]>

* Appservice config: handle regexp parsing errors

Signed-off-by: diamondburned <[email protected]>
Signed-off-by: Bohdan Horbeshko <[email protected]>

Co-authored-by: Kegsay <[email protected]>

* Use LimitReader to prevent DoS risk (matrix-org#1843)

* Use LimitReader to prevent DoS risk

Signed-off-by: Till Faelligen <[email protected]>

* Check if bytesWritten is equal to the maxFileSize
Add tests

Signed-off-by: Till Faelligen <[email protected]>

* Use oldschool defer to cleanup after the tests

* Let LimitReader read MaxFileSizeBytes + 1

Co-authored-by: Kegsay <[email protected]>

* Try to optimize SelectOneTimeKeys (matrix-org#1851)

* Try to optimize SelectOneTimeKeys

Signed-off-by: Till Faelligen <[email protected]>

* Use pg.Array when using ANY...

Co-authored-by: Kegsay <[email protected]>

* Add missing IPv6 "ssl" keyword in nginx config examples (matrix-org#1854)

Signed-off-by: Arnaud Venturi <[email protected]>

* Link to Synapse (matrix-org#1863)

Not everyone is very familiar.

* Add CORS to nginx config (matrix-org#1791)

Without this entry, setups where users have the homeserver on the URL
matrix.myurl.com but want the servername to be myurl.com don't work by default
since clients like element.io can't connect to the homeserver

* Pinecone demo updates

* Update go.mod/go.sum

* Use NotFound instead of Forbidden for missing account data (matrix-org#1872)

Signed-off-by: Adam Greig <[email protected]>

* Add parameters to specify password (matrix-org#1868)

* Add parameters to specify password

Signed-off-by: Till Faelligen <[email protected]>

* Fix typo

* Add testdata

* Use go1.13 compatible way to read files

* Fix Key Generation Docs - resolves matrix-org#1759 (matrix-org#1865)

This fixes the issue found in matrix-org#1759 which broke due to go changes. The new command allows you to generate keys with docker, and drop them in the current working directory.

* Remove mention of enabling naffka in install instructions, as it is the default value (matrix-org#1853)

Signed-off-by: Arnaud Venturi <[email protected]>

* Set MaxFileSizeBytes <= 0 to "unlimited" (matrix-org#1875)

* Set MaxFileSizeBytes < 0 to "unlimited"

Signed-off-by: Till Faelligen <[email protected]>

* int64 overflows later in mediaapi/routing/upload.go[doUpload]

* Prevent int overflow when uploading

* Update go.mod/go.sum

* Ensure user IDs match the spec (matrix-org/gomatrixserverlib#261)

* Revert "Ensure user IDs match the spec (matrix-org/gomatrixserverlib#261)"

This reverts commit 30e9353.

* Fix panic in roomserver

* ✂️ Media API: Handle unlimited file size (matrix-org#1881)

* dendrite-demo-pinecone: Accept any origin

* dendritejs-pinecone

* Update go.mod/go.sum

* Fix bugs in P2P demos

* Use a custom FIFO queue for the RS input API (matrix-org#1888)

* Use a FIFO queue instead of a channel to reduce backpressure

* Make sure someone wakes up

* Tweaks

* Add comments

* Protect processEventWithMissingState with per-room mutex, to prevent mass CPU burn/RAM usage

Squashed commit of the following:

commit 7fad77c
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 15:06:52 2021 +0100

    Fix processEventWithMissingStateMutexes

commit 138cddc
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 13:59:44 2021 +0100

    Use internal.MutexByRoom

commit 6e6f026
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 13:50:18 2021 +0100

    Try to slow things down per room

commit b97d406
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 13:41:27 2021 +0100

    Try to slow things down

commit 8866120
Merge: 9f2de8a 4a37b19
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 13:40:33 2021 +0100

    Merge branch 'neilalexander/rsinputfifo' into neilalexander/rsinputfifo2

commit 4a37b19
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 13:34:54 2021 +0100

    Add comments

commit f9ab3f4
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 13:31:21 2021 +0100

    Tweaks

commit 9f2de8a
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 13:15:59 2021 +0100

    Ask origin only for missing things for now

commit 8fd878c
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 11:18:11 2021 +0100

    Make sure someone wakes up

commit b63f699
Author: Neil Alexander <[email protected]>
Date:   Mon Jun 28 11:12:58 2021 +0100

    Use a FIFO queue instead of a channel to reduce backpressure

* Restore the getServers RS query (needs optimisation)

* Put gmectx back to 5 minutes

* db migration: fix matrix-org#1844 and add additional assertions (matrix-org#1889)

* db migration: fix matrix-org#1844 and add additional assertions

- Migration scripts will now check to see if there are any unconverted
  snapshot IDs and fail the migration if there are any. This should
  prevent people from getting a corrupt database in the event the root
  cause is still unknown.
- Add an ORDER BY clause when doing batch queries in the postgres
  migration. LIMIT and OFFSET without ORDER BY are undefined and must
  not be relied upon to produce a deterministic ordering (e.g row order).
  See https://www.postgresql.org/docs/current/queries-limit.html

* Linting

Co-authored-by: Neil Alexander <[email protected]>

* Reduce memory usage in federation /send endpoint (matrix-org#1890)

* More aggressive event caching

* Deduplicate /state results

* Deduplicate more

* Ensure we use the correct list of events when excluding repeated state

* Fixes

* Ensure we track all events we already knew about properly

* Give up on loops when the context expires (matrix-org#1891)

* Change how servers are selected for missing auth/prev events (matrix-org#1892)

* Change how servers are selected for missing auth/prev events

* Shuffle order

* Move ServersInRoomProvider into api package

* Fix concurrent map read/write on haveEvents (matrix-org#1893)

* Roomserver input backpressure metric

Squashed commit of the following:

commit 56e934a
Author: Neil Alexander <[email protected]>
Date:   Fri Jul 2 09:39:30 2021 +0100

    Fix metric

commit 3911f3a
Author: Neil Alexander <[email protected]>
Date:   Fri Jul 2 09:36:29 2021 +0100

    Register correct metric

commit a9ddbfa
Author: Neil Alexander <[email protected]>
Date:   Fri Jul 2 09:33:33 2021 +0100

    Try to capture RS input backpressure metric

* Federation API workers for /send to reduce memory usage (matrix-org#1897)

* Try to process rooms concurrently in FS /send

* Clean up

* Use request context so that dead things don't linger for so long

* Remove mutex

* Free up pdus slice so only references remaining are in channel

* Revert "Remove mutex"

This reverts commit 8558075.

* Process EDUs in parallel

* Try refactoring /send concurrency

* Fix waitgroup

* Release on waitgroup

* Respond to transaction

* Reduce CPU usage, fix unit tests

* Tweaks

* Move into one file

* Update to matrix-org/gomatrixserverlib#265 for faster power level content parsing

* Update to matrix-org/gomatrixserverlib#266 (+ missing file)

* Remove processEventWithMissingStateMutex

* Federation API fixes (matrix-org#1899)

* Ensure worker has work before starting goroutine

* Revert "Remove processEventWithMissingStateMutex"

This reverts commit 7f02eab.

* Use request context when processing transactions

* Keep goroutine count down by not starting work for things where the caller gave up

* Remove mutex, start workers at correct time

* Track expiry rate on pduCountTotal

* Add dendrite-upgrade-test (matrix-org#1901)

* Add WIP binary for testing dendrite version upgrades

* WIP dendrite upgrade work

* Finish dendrite upgrade checks

* go mod tidy

* Review comments; print container logs on failure

* Linting

* dendrite-upgrade-test: support --from HEAD-N, cleanup on startup (matrix-org#1903)

* db migration: handle create events with no state blocks from v0.1.0 (matrix-org#1904)

* Fix concurrent map reads/writes on t.hadEvents (matrix-org#1902)

* Fix concurrent map reads/writes on t.hadEvents

* Add hadEvent function

* Improve error handling and close files post-tarring

* linting

* dendrite-upgrade-test: tweaks to get it to run under CI in docker (matrix-org#1905)

* dendrite-upgrade-test: tweaks to get it to run under CI in docker

* Linting

* Only log filename and not entire path (matrix-org#1906)

* Fix bug when rejecting invites (matrix-org#1907)

* Fix rejecting invites maybe

* Remove comment that is no longer correct

* Review comment on performFederatedRejectInvite

* bugfix: order the state blocks so recreating state snapshots works correctly (matrix-org#1908)

* Logging

* Revert "Logging"

This reverts commit 23ce334.

* bugfix: order the state blocks so recreating state snapshots works correctly

* Add more optimised code path for checking if we're in a room (matrix-org#1909)

* Add more optimised code path for checking if we're in a room

* Fix database queries

* Fix federation API test

* Fix logging

* Review comments

* Make separate API call for room membership

* Implement /_synapse/admin/v1/register (matrix-org#1911)

* Implement /_synapse/admin/v1/register

This is implemented identically to Synapse, so scripts which work
with Synapse should work with Dendrite.

```
    Test 27 POST /_synapse/admin/v1/register with shared secret... OK
    Test 28 POST /_synapse/admin/v1/register admin with shared secret... OK
    Test 29 POST /_synapse/admin/v1/register with shared secret downcases capitals... OK
    Test 30 POST /_synapse/admin/v1/register with shared secret disallows symbols... OK
```

Sytest however has `implementation_specific => "synapse"` which stops these
tests from running.

* Add missing muxes to gobind

* Linting

* Move a couple of callers to helpers.IsServerCurrentlyInRoom over to the query API (matrix-org#1912)

* Propose config better (matrix-org#1758)

Better explain where the config file are located and how to deal with the yml file.

Co-authored-by: kegsay <[email protected]>

* Add shared secret sytests to whitelist

* Version 0.4.0

* Fix attribution in changelog

* Update blacklist

* Update are we synapse groupings (matrix-org#1913)

* Actually bump GMSL

* update whitelist (matrix-org#1914)

* update whitelist

* newline

* Expose more data when outputting output room events (matrix-org#1916)

* Add more logging for content fields

* Fix fields

* Fix failing complement test (matrix-org#1917)

Specifically `TestBannedUserCannotSendJoin`

* bugfix: retire invites even when we cannot talk to the remote server to make/send_leave (matrix-org#1918)

* bugfix: retire invites even when we cannot talk to the remote server to make/send_leave

Also modify the leave response in /sync to include a fake event as this is ultimately
what clients (and sytest) will use to determine leave-ness.

* hash the event ID

* Base64 not hex

* AWSY: update list and shuffle groups (matrix-org#1919)

So it's more accurate.

* Remove unused binaries

* sytests: fix failing PL tests by updating GMSL (matrix-org#1920)

* Add missing sytest to whitelist

* Update dendrite-demo-yggdrasil to Yggdrasil 0.4 (matrix-org#1921)

* Update Yggdrasil P2P demo for Yggdrasil v0.4

* Build fixes

* fedsender: add cache tables for notary keys (matrix-org#1923)

* Add notary server tables for postgres

* Add sqlite tables

* fedsender: GetServerKeys -> QueryServerKeys

As it now checks a cache and can return multiple responses

* fedsender: try to satisfy all notary key requests from the cache first (matrix-org#1925)

* fedsender: try to satisfy all notary key requests from the cache first

* Linting

* Fix DNS CacheLifetime (matrix-org#1926)

Signed-off-by: Till Faelligen <[email protected]>

* Fix failing Complement tests (matrix-org#1931)

* Check for missing state keys to avoid panicking

* Check for not allowed errors on send_leave

* More logging

* handle send_join errors too

* Additional send_join checks

* s/join/gmsl.json/

* Update to matrix-org/gomatrixserverlib#269

* dendrite_roomserver_calculate_state_duration_microseconds as histogram rather than summary

* Set buckets for dendrite_roomserver_calculate_state_duration_microseconds

* Metric fixes

Squashed commit of the following:

commit c6eb4d8
Author: Neil Alexander <[email protected]>
Date:   Mon Jul 19 16:52:57 2021 +0100

    Fix bug

commit d420966
Author: Neil Alexander <[email protected]>
Date:   Mon Jul 19 16:46:12 2021 +0100

    Update metric

commit 0ad6e37
Author: Neil Alexander <[email protected]>
Date:   Mon Jul 19 16:30:14 2021 +0100

    Fix observe for calculateStateDurations

* Set MaxFileSizeBytes <= 0 to unlimited (matrix-org#1876)

* Revert "Set MaxFileSizeBytes <= 0 to "unlimited" (matrix-org#1875)"

This reverts commit 9ed0440.

* Actually allow unlimited upload

Signed-off-by: Till Faelligen <[email protected]>

Co-authored-by: kegsay <[email protected]>

* Fix failing ban tests (matrix-org#1884)

* Add room membership and powerlevel checks for func SendBan

* Added non-error return to func GetStateEvent when no state events with the specified state key are found

* Add passing tests to whitelist

* Fixed formatting

* Update roomserver/storage/shared/storage.go

Co-authored-by: Neil Alexander <[email protected]>
Co-authored-by: kegsay <[email protected]>
Co-authored-by: kegsay <[email protected]>

* Rename Riot to Element (matrix-org#1874)

* s/riot/element/g

Signed-off-by: Till Faelligen <[email protected]>

* fix formatting

Co-authored-by: kegsay <[email protected]>
Co-authored-by: Neil Alexander <[email protected]>

* Fixed log printing bug (closes matrix-org#1885)

Signed-off-by: Kilos [email protected]>

* Only include go-sqlite3 on the relevant binaries (matrix-org#1900)

* Only include go-sqlite3 on the relevant binaries

* The driver name is always sqlite3 now

* Update to matrix-org/go-sqlite3-js@e537baa

* Add startup testing for Wasm Pinecone build (matrix-org#1910)

* Only include go-sqlite3 on the relevant binaries

* The driver name is always sqlite3 now

* Update to matrix-org/go-sqlite3-js@e537baa

* Add initial Wasm test harness

* Upgrade go-sqlite3-js

This fixes an error about semicolons in single statements.

* Add browser-like WebSocket API for testing

* Upgrade go-sqlite3-js

This upgrade includes printing panic messages next to stacks.

* Run for all PRs targeting any branch

* Use manual Node caching

* Temporarily run for all pushes

* Use npm ci instead of install

* Use HTTPS auth for repo packages

* Match path style from build.sh

* update utp

Co-authored-by: Neil Alexander <[email protected]>

* Update to matrix-org/gomatrixserverlib#270

* Support initial_state properly in `/createRoom` (matrix-org#1932)

* Refactor room creation to allow initial_state

* GMSL types

* Tweaks to alias

* Fix ordering

* Fix bugs

* Fix create content

* Only unmarshal create content if specified

* Review comments @kegsay

* Optimise QueryServerJoinedToRoom (matrix-org#1933)

* Optimise checking if a server is in a room

* Fix queries

* Fix queries

* Various alias fixes (matrix-org#1934)

* Generate m.room.canonical_alias instead of legacy m.room.aliases

* Add omitempty tags

* Add aliases endpoint to client API

* Check power levels when setting aliases

* Don't return null on /aliases

* Don't return error if the state event fails

* Update sytest-whitelist

* Don't send updated m.room.canonical_alias events

* Don't check PLs after all because for local aliases they are apparently irrelevant

* Fix some bugs

* Allow deleting a local alias with enough PL

* Fix some more bugs

* Update sytest-whitelist

* Fix copyright notices

* Review comments

* Update to matrix-org/gomatrixserverlib#271

* Update to matrix-org/gomatrixserverlib@ae88543

* Update to matrix-org/gomatrixserverlib@b9eb787

* Track knocking in membership updater (matrix-org#1935)

* Topologically sort outliers in SendEventWithState

* Knock in membership updater

* Update gomatrixserverlib

* Update gomatrixserverlib

* Get the NID of the knock event properly for the membership updater

* Don't set prev state when it is the same as the event it replaces (matrix-org#1936)

* fix:Inviting to an unsupported room version return M_BAD_JSON instead of Incompatible_Version (matrix-org#1930)

* fix:Inviting to an unsupported room version return M_BAD_JSON instead of M_UNSUPPORTED_ROOM_VERSION

Signed-off-by: Meenal Trivedi <[email protected]>

* fix

Signed-off-by: Meenal Trivedi <[email protected]>

* fix

Signed-off-by: Meenal Trivedi <[email protected]>

* feat: make requested changes

Signed-off-by: Meenal Trivedi <[email protected]>

* Use error typecast from matrix-org/gomatrixserverlib#272

Co-authored-by: Neil Alexander <[email protected]>

* Not finding the snapshot is not fatal (matrix-org#1940)

* Version 0.4.1

Co-authored-by: Michael Telatynski <[email protected]>
Co-authored-by: Neil Alexander <[email protected]>
Co-authored-by: bodqhrohro <[email protected]>
Co-authored-by: Kegsay <[email protected]>
Co-authored-by: S7evinK <[email protected]>
Co-authored-by: Arnaud Venturi <[email protected]>
Co-authored-by: Ben Langfeld <[email protected]>
Co-authored-by: Rasmus Thomsen <[email protected]>
Co-authored-by: Adam Greig <[email protected]>
Co-authored-by: Ben Yanke <[email protected]>
Co-authored-by: database64128 <[email protected]>
Co-authored-by: Melroy van den Berg <[email protected]>
Co-authored-by: David Spenler <[email protected]>
Co-authored-by: kegsay <[email protected]>
Co-authored-by: J. Ryan Stinnett <[email protected]>
Co-authored-by: Meenal Trivedi <[email protected]>
  • Loading branch information
17 people authored Aug 13, 2021
1 parent 43f6e93 commit 7bc2240
Show file tree
Hide file tree
Showing 148 changed files with 4,938 additions and 3,084 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: WebAssembly

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.5

- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 14

- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Reconfigure Git to use HTTPS auth for repo packages
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Install test dependencies
working-directory: ./test/wasm
run: npm ci

- name: Test
run: ./test-dendritejs.sh
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Hidden files
.*

# Allow GitHub config
!.github

# Downloads
/.downloads

Expand Down Expand Up @@ -36,6 +39,7 @@ _testmain.go
*.exe
*.test
*.prof
*.wasm

# Generated keys
*.pem
Expand All @@ -53,3 +57,6 @@ dendrite.yaml

# Generated code
cmd/dendrite-demo-yggdrasil/embed/fs*.go

# Test dependencies
test/wasm/node_modules
61 changes: 61 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# Changelog

## Dendrite 0.4.1 (2021-07-26)

### Features

* Support for room version 7 has been added
* Key notary support is now more complete, allowing Dendrite to be used as a notary server for looking up signing keys
* State resolution v2 performance has been optimised further by caching the create event, power levels and join rules in memory instead of parsing them repeatedly
* The media API now handles cases where the maximum file size is configured to be less than 0 for unlimited size
* The `initial_state` in a `/createRoom` request is now respected when creating a room
* Code paths for checking if servers are joined to rooms have been optimised significantly

### Fixes

* A bug resulting in `cannot xref null state block with snapshot` during the new state storage migration has been fixed
* Invites are now retired correctly when rejecting an invite from a remote server which is no longer reachable
* The DNS cache `cache_lifetime` option is now handled correctly (contributed by [S7evinK](https://github.com/S7evinK))
* Invalid events in a room join response are now dropped correctly, rather than failing the entire join
* The `prev_state` of an event will no longer be populated incorrectly to the state of the current event
* Receiving an invite to an unsupported room version will now correctly return the `M_UNSUPPORTED_ROOM_VERSION` error code instead of `M_BAD_JSON` (contributed by [meenal06](https://github.com/meenal06))

## Dendrite 0.4.0 (2021-07-12)

### Features

* All-new state storage in the roomserver, which dramatically reduces disk space utilisation
* State snapshots and blocks are now aggressively deduplicated and reused wherever possible, with state blocks being reduced by up to 15x and snapshot references being reduced up to 2x
* Dendrite will upgrade to the new state storage automatically on the first run after upgrade, although this may take some time depending on the size of the state storage
* Appservice support has been improved significantly, with many bridges now working correctly with Dendrite
* Events are now correctly sent to appservices based on room memberships
* Aliases and namespaces are now handled correctly, calling the appservice to query for aliases as needed
* Appservice user registrations are no longer being subject to incorrect validation checks
* Shared secret registration has now been implemented correctly
* The roomserver input API implements a new queuing system to reduce backpressure across rooms
* Checking if the local server is in a room has been optimised substantially, reducing CPU usage
* State resolution v2 has been optimised further by improving the power level checks, reducing CPU usage
* The federation API `/send` endpoint now deduplicates missing auth and prev events more aggressively to reduce memory usage
* The federation API `/send` endpoint now uses workers to reduce backpressure across rooms
* The bcrypt cost for password storage is now configurable with the `user_api.bcrypt_cost` option
* The federation API will now use significantly less memory when calling `/get_missing_events`
* MSC2946 Spaces endpoints have been updated to stable endpoint naming
* The media API can now be configured without a maximum file size
* A new `dendrite-upgrade-test` test has been added for verifying database schema upgrades across versions
* Added Prometheus metrics for roomserver backpressure, excessive device list updates and federation API event processing summaries
* Sentry support has been added for error reporting

### Fixes

* Removed the legacy `/v1` register endpoint. Dendrite only implements `/r0` of the CS API, and the legacy `/v1` endpoint had implementation errors which made it possible to bypass shared secret registration (thanks to Jakob Varmose Bentzen for reporting this)
* Attempting to register an account that already exists now returns a sensible error code rather than a HTTP 500
* Dendrite will no longer attempt to `/make_join` with itself if listed in the request `server_names`
* `/sync` will no longer return immediately if there is nothing to sync, which happened particularly with new accounts, causing high CPU usage
* Malicious media uploads can no longer exhaust all available memory (contributed by [S7evinK](https://github.com/S7evinK))
* Selecting one-time keys from the database has been optimised (contributed by [S7evinK](https://github.com/S7evinK))
* The return code when trying to fetch missing account data has been fixed (contributed by [adamgreig](https://github.com/adamgreig))
* Dendrite will no longer attempt to use `/make_leave` over federation when rejecting a local invite
* A panic has been fixed in `QueryMembershipsForRoom`
* A panic on duplicate membership events has been fixed in the federation sender
* A panic has been fixed in in `IsInterestedInRoomID` (contributed by [bodqhrohro](https://github.com/bodqhrohro))
* A panic in the roomserver has been fixed when handling empty state sets
* A panic in the federation API has been fixed when handling cached events

## Dendrite 0.3.11 (2021-03-02)

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dendrite [![Build Status](https://badge.buildkite.com/4be40938ab19f2bbc4a6c6724517353ee3ec1422e279faf374.svg?branch=master)](https://buildkite.com/matrix-dot-org/dendrite) [![Dendrite](https://img.shields.io/matrix/dendrite:matrix.org.svg?label=%23dendrite%3Amatrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#dendrite:matrix.org) [![Dendrite Dev](https://img.shields.io/matrix/dendrite-dev:matrix.org.svg?label=%23dendrite-dev%3Amatrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#dendrite-dev:matrix.org)

Dendrite is a second-generation Matrix homeserver written in Go.
It intends to provide an **efficient**, **reliable** and **scalable** alternative to Synapse:
It intends to provide an **efficient**, **reliable** and **scalable** alternative to [Synapse](https://github.com/matrix-org/synapse):
- Efficient: A small memory footprint with better baseline performance than an out-of-the-box Synapse.
- Reliable: Implements the Matrix specification as written, using the
[same test suite](https://github.com/matrix-org/sytest) as Synapse as well as
Expand Down
1 change: 0 additions & 1 deletion appservice/storage/sqlite3/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
_ "github.com/mattn/go-sqlite3"
)

// Database stores events intended to be later sent to application services
Expand Down
17 changes: 15 additions & 2 deletions appservice/storage/sqlite3/txn_id_counter_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ INSERT OR IGNORE INTO appservice_counters (name, last_id) VALUES('txn_id', 1);
`

const selectTxnIDSQL = `
SELECT last_id FROM appservice_counters WHERE name='txn_id';
UPDATE appservice_counters SET last_id=last_id+1 WHERE name='txn_id';
SELECT last_id FROM appservice_counters WHERE name='txn_id'
`

const updateTxnIDSQL = `
UPDATE appservice_counters SET last_id=last_id+1 WHERE name='txn_id'
`

type txnStatements struct {
db *sql.DB
writer sqlutil.Writer
selectTxnIDStmt *sql.Stmt
updateTxnIDStmt *sql.Stmt
}

func (s *txnStatements) prepare(db *sql.DB, writer sqlutil.Writer) (err error) {
Expand All @@ -54,6 +58,10 @@ func (s *txnStatements) prepare(db *sql.DB, writer sqlutil.Writer) (err error) {
return
}

if s.updateTxnIDStmt, err = db.Prepare(updateTxnIDSQL); err != nil {
return
}

return
}

Expand All @@ -63,6 +71,11 @@ func (s *txnStatements) selectTxnID(
) (txnID int, err error) {
err = s.writer.Do(s.db, nil, func(txn *sql.Tx) error {
err := s.selectTxnIDStmt.QueryRowContext(ctx).Scan(&txnID)
if err != nil {
return err
}

_, err = s.updateTxnIDStmt.ExecContext(ctx)
return err
})
return
Expand Down
30 changes: 25 additions & 5 deletions are-we-synapse-yet.list
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ reg POST /register rejects registration of usernames with '£'
reg POST /register rejects registration of usernames with 'é'
reg POST /register rejects registration of usernames with '\n'
reg POST /register rejects registration of usernames with '''
reg POST /register allows registration of usernames with 'q'
reg POST /register allows registration of usernames with '3'
reg POST /register allows registration of usernames with '.'
reg POST /register allows registration of usernames with '_'
reg POST /register allows registration of usernames with '='
reg POST /register allows registration of usernames with '-'
reg POST /register allows registration of usernames with '/'
reg POST /r0/admin/register with shared secret
reg POST /r0/admin/register admin with shared secret
reg POST /r0/admin/register with shared secret downcases capitals
Expand Down Expand Up @@ -76,7 +83,7 @@ rst GET /rooms/:room_id/state/m.room.topic gets topic
rst GET /rooms/:room_id/state fetches entire room state
crm POST /createRoom with creation content
ali PUT /directory/room/:room_alias creates alias
nsp GET /rooms/:room_id/aliases lists aliases
ali GET /rooms/:room_id/aliases lists aliases
jon POST /rooms/:room_id/join can join a room
jon POST /join/:room_alias can join a room
jon POST /join/:room_id can join a room
Expand All @@ -95,6 +102,7 @@ typ Typing notifications don't leak (3 subtests)
rst GET /rooms/:room_id/state/m.room.power_levels can fetch levels
rst PUT /rooms/:room_id/state/m.room.power_levels can set levels
rst PUT power_levels should not explode if the old power levels were empty
rst Users cannot set notifications powerlevel higher than their own (2 subtests)
rst Both GET and PUT work
rct POST /rooms/:room_id/receipt can create receipts
red POST /rooms/:room_id/read_markers can create read marker
Expand Down Expand Up @@ -175,7 +183,7 @@ ali Users with sufficient power-level can delete other's aliases
ali Can delete canonical alias
ali Alias creators can delete alias with no ops
ali Alias creators can delete canonical alias with no ops
ali Only room members can list aliases of a room
msc Only room members can list aliases of a room
inv Can invite users to invite-only rooms
inv Uninvited users cannot join the room
inv Invited user can reject invite
Expand Down Expand Up @@ -353,6 +361,7 @@ syn Syncing a new room with a large timeline limit isn't limited
syn A full_state incremental update returns only recent timeline
syn A prev_batch token can be used in the v1 messages API
syn A next_batch token can be used in the v1 messages API
syn A prev_batch token from incremental sync can be used in the v1 messages API
syn User sees their own presence in a sync
syn User is offline if they set_presence=offline in their sync
syn User sees updates to presence from other users in the incremental sync.
Expand Down Expand Up @@ -574,6 +583,7 @@ fqu Outbound federation can query profile data
fqu Inbound federation can query profile data
fqu Outbound federation can query room alias directory
fqu Inbound federation can query room alias directory
fsj Membership event with an invalid displayname in the send_join response should not cause room join to fail
fsj Outbound federation can query v1 /send_join
fsj Outbound federation can query v2 /send_join
fmj Outbound federation passes make_join failures through to the client
Expand All @@ -596,7 +606,7 @@ fsj Inbound: send_join rejects invalid JSON for room version 6
fed Outbound federation can send events
fed Inbound federation can receive events
fed Inbound federation can receive redacted events
fed Ephemeral messages received from servers are correctly expired
msc Ephemeral messages received from servers are correctly expired
fed Events whose auth_events are in the wrong room do not mess up the room state
fed Inbound federation can return events
fed Inbound federation redacts events from erased users
Expand Down Expand Up @@ -743,6 +753,10 @@ nsp Set group joinable and join it
nsp Group is not joinable by default
nsp Group is joinable over federation
nsp Room is transitioned on local and remote groups upon room upgrade
nsp POST /_synapse/admin/v1/register with shared secret
nsp POST /_synapse/admin/v1/register admin with shared secret
nsp POST /_synapse/admin/v1/register with shared secret downcases capitals
nsp POST /_synapse/admin/v1/register with shared secret disallows symbols
3pd Can bind 3PID via home server
3pd Can bind and unbind 3PID via homeserver
3pd Can unbind 3PID via homeserver when bound out of band
Expand Down Expand Up @@ -859,8 +873,14 @@ jso Invalid JSON special values
inv Can invite users to invite-only rooms (2 subtests)
plv setting 'm.room.name' respects room powerlevel (2 subtests)
psh Messages that notify from another user increment notification_count
psh Messages that org.matrix.msc2625.mark_unread from another user increment org.matrix.msc2625.unread_count
msc Messages that org.matrix.msc2625.mark_unread from another user increment org.matrix.msc2625.unread_count
dvk Can claim one time key using POST (2 subtests)
fdk Can query remote device keys using POST (1 subtests)
fdk Can claim remote one time key using POST (2 subtests)
fmj Inbound /make_join rejects attempts to join rooms where all users have left
fmj Inbound /make_join rejects attempts to join rooms where all users have left
msc Local users can peek into world_readable rooms by room ID
msc We can't peek into rooms with shared history_visibility
msc We can't peek into rooms with invited history_visibility
msc We can't peek into rooms with joined history_visibility
msc Local users can peek by room alias
msc Peeked rooms only turn up in the sync for the device who peeked them
4 changes: 4 additions & 0 deletions are-we-synapse-yet.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"nsp": "Non-Spec API",
"unk": "Unknown API (no group specified)",
"app": "Application Services API",
"msc": "MSCs",
"f": "Federation", # flag to mark test involves federation

"federation_apis": {
Expand Down Expand Up @@ -223,6 +224,7 @@ def main(results_tap_path, verbose):
},
"nonspec": {
"nsp": {},
"msc": {},
"unk": {}
},
}
Expand All @@ -237,6 +239,8 @@ def main(results_tap_path, verbose):
summary["nonspec"]["unk"][name] = test_result["ok"]
if group_id == "nsp":
summary["nonspec"]["nsp"][name] = test_result["ok"]
elif group_id == "msc":
summary["nonspec"]["msc"][name] = test_result["ok"]
elif group_id == "app":
summary["appservice"]["app"][name] = test_result["ok"]
elif group_id in test_mappings["federation_apis"]:
Expand Down
2 changes: 1 addition & 1 deletion build-dendritejs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh -eu

export GIT_COMMIT=$(git rev-list -1 HEAD) && \
GOOS=js GOARCH=wasm go build -ldflags "-X main.GitCommit=$GIT_COMMIT" -o main.wasm ./cmd/dendritejs
GOOS=js GOARCH=wasm go build -ldflags "-X main.GitCommit=$GIT_COMMIT" -o bin/main.wasm ./cmd/dendritejs-pinecone
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ mkdir -p bin

CGO_ENABLED=1 go build -trimpath -ldflags "$FLAGS" -v -o "bin/" ./cmd/...

CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -ldflags "$FLAGS" -o bin/main.wasm ./cmd/dendritejs
CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -ldflags "$FLAGS" -o bin/main.wasm ./cmd/dendritejs-pinecone
30 changes: 15 additions & 15 deletions build/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,29 @@ There are three sample `docker-compose` files:
The `docker-compose` files refer to the `/etc/dendrite` volume as where the
runtime config should come from. The mounted folder must contain:

- `dendrite.yaml` configuration file (based on the sample `dendrite-config.yaml`
in the `docker/config` folder in the [Dendrite repository](https://github.com/matrix-org/dendrite)
- `dendrite.yaml` configuration file (based on the [`dendrite-config.yaml`](https://raw.githubusercontent.com/matrix-org/dendrite/master/dendrite-config.yaml)
sample in the `build/docker/config` folder of this repository.)
- `matrix_key.pem` server key, as generated using `cmd/generate-keys`
- `server.crt` certificate file
- `server.key` private key file for the above certificate

To generate keys:

```
go run github.com/matrix-org/dendrite/cmd/generate-keys \
--private-key=matrix_key.pem \
--tls-cert=server.crt \
--tls-key=server.key
docker run --rm --entrypoint="" \
-v $(pwd):/mnt \
matrixdotorg/dendrite-monolith:latest \
/usr/bin/generate-keys \
-private-key /mnt/matrix_key.pem \
-tls-cert /mnt/server.crt \
-tls-key /mnt/server.key
```

## Starting Dendrite as a monolith deployment
The key files will now exist in your current working directory, and can be mounted into place.

Create your config based on the `dendrite.yaml` configuration file in the `docker/config`
folder in the [Dendrite repository](https://github.com/matrix-org/dendrite). Additionally,
make the following changes to the configuration:
## Starting Dendrite as a monolith deployment

- Enable Naffka: `use_naffka: true`
Create your config based on the [`dendrite-config.yaml`](https://raw.githubusercontent.com/matrix-org/dendrite/master/dendrite-config.yaml) configuration file in the `build/docker/config` folder of this repository. And rename the config file to `dendrite.yml` (and put it in your `config` directory).

Once in place, start the PostgreSQL dependency:

Expand All @@ -65,8 +66,7 @@ docker-compose -f docker-compose.monolith.yml up

## Starting Dendrite as a polylith deployment

Create your config based on the `dendrite.yaml` configuration file in the `docker/config`
folder in the [Dendrite repository](https://github.com/matrix-org/dendrite).
Create your config based on the [`dendrite-config.yaml`](https://raw.githubusercontent.com/matrix-org/dendrite/master/dendrite-config.yaml) configuration file in the `build/docker/config` folder of this repository. And rename the config file to `dendrite.yml` (and put it in your `config` directory).

Once in place, start all the dependencies:

Expand All @@ -82,10 +82,10 @@ docker-compose -f docker-compose.polylith.yml up

## Building the images

The `docker/images-build.sh` script will build the base image, followed by
The `build/docker/images-build.sh` script will build the base image, followed by
all of the component images.

The `docker/images-push.sh` script will push them to Docker Hub (subject
The `build/docker/images-push.sh` script will push them to Docker Hub (subject
to permissions).

If you wish to build and push your own images, rename `matrixdotorg/dendrite` to
Expand Down
Loading

0 comments on commit 7bc2240

Please sign in to comment.