Skip to content

Commit aed2b10

Browse files
committed
Restore origin fields to ensure compatibility with Dendrite
1 parent 1b0eec0 commit aed2b10

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

lib/SyTest/Federation/Client.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ sub join_room
240240
auth_events content depth prev_events room_id sender
241241
state_key type ) ),
242242

243+
# The spec does not require the origin field, but Dendrite does. This can be removed
244+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
245+
origin => $store->server_name,
243246
origin_server_ts => $self->time_ms,
244247
);
245248

lib/SyTest/Federation/Datastore.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ sub create_event
194194

195195
my $event = {
196196
%fields,
197+
# The spec does not require the origin field, but Dendrite does. This can be removed
198+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
199+
origin => $self->server_name,
197200
origin_server_ts => JSON::number( int( time() * 1000 )),
198201
};
199202

tests/50federation/30room-join.pl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ sub assert_is_valid_pdu {
9292
user_id => $user_id,
9393
);
9494

95+
# The spec does not require the origin field, but Dendrite does. This can be removed
96+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
97+
$proto->{origin} = $inbound_server->server_name;
9598
$proto->{origin_server_ts} = $inbound_server->time_ms;
9699

97100
$req->respond_json( {
@@ -273,6 +276,9 @@ sub assert_is_valid_pdu {
273276
state_key type ) ),
274277

275278
event_id => $datastore->next_event_id,
279+
# The spec does not require the origin field, but Dendrite does. This can be removed
280+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
281+
origin => $local_server_name,
276282
origin_server_ts => $inbound_server->time_ms,
277283
);
278284

@@ -441,6 +447,9 @@ sub assert_is_valid_pdu {
441447

442448
$join_event = $body->{event};
443449

450+
# The spec does not require the origin field, but Dendrite does. This can be removed
451+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
452+
$join_event->{origin} = $sytest_server_name;
444453
$join_event->{origin_server_ts} = $outbound_client->time_ms;
445454

446455
if( $room_version eq '1' || $room_version eq '2' ) {
@@ -853,6 +862,9 @@ sub assert_is_valid_pdu {
853862
user_id => $user_id,
854863
);
855864

865+
# The spec does not require the origin field, but Dendrite does. This can be removed
866+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
867+
$proto->{origin} = $inbound_server->server_name;
856868
$proto->{origin_server_ts} = $inbound_server->time_ms;
857869

858870
$req->respond_json( {
@@ -941,6 +953,9 @@ sub assert_is_valid_pdu {
941953
user_id => $user_id,
942954
);
943955

956+
# The spec does not require the origin field, but Dendrite does. This can be removed
957+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
958+
$proto->{origin} = $inbound_server->server_name;
944959
$proto->{origin_server_ts} = $inbound_server->time_ms;
945960

946961
$req->respond_json( {
@@ -1034,6 +1049,9 @@ sub assert_is_valid_pdu {
10341049
user_id => $user_id,
10351050
);
10361051

1052+
# The spec does not require the origin field, but Dendrite does. This can be removed
1053+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
1054+
$proto->{origin} = $inbound_server->server_name;
10371055
$proto->{origin_server_ts} = $inbound_server->time_ms;
10381056

10391057
$req->respond_json( {
@@ -1173,7 +1191,9 @@ sub assert_is_valid_pdu {
11731191
( map { $_ => $protoevent->{$_} } qw(
11741192
auth_events content depth prev_events room_id sender
11751193
state_key type ) ),
1176-
1194+
# The spec does not require the origin field, but Dendrite does. This can be removed
1195+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
1196+
origin => $local_server_name,
11771197
origin_server_ts => $inbound_server->time_ms,
11781198
);
11791199
# Insert a "bad" value into the send join, in this case a float.

tests/50federation/35room-invite.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@ sub do_v2_invite_request
600600

601601
$leave_event = $resp->{event};
602602

603+
# The spec does not require the origin field, but Dendrite does. This can be removed
604+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
605+
$leave_event->{origin} = $outbound_client->server_name;
603606
$leave_event->{origin_server_ts} = JSON::number($outbound_client->time_ms);
604607
$leave_event->{event_id} = $leave_event_id = $outbound_client->datastore->next_event_id();
605608

@@ -908,6 +911,9 @@ sub do_v2_invite_request
908911
auth_events content depth prev_events room_id sender
909912
state_key type)),
910913

914+
# The spec does not require the origin field, but Dendrite does. This can be removed
915+
# once this issue gets solved: https://github.com/matrix-org/dendrite/issues/2736
916+
origin => $outbound_client->server_name,
911917
origin_server_ts => $inbound_server->time_ms,
912918
);
913919
# Insert a "bad" value into the send leave, in this case a float.

0 commit comments

Comments
 (0)