Skip to content

Commit

Permalink
Remove origin from events and assertions
Browse files Browse the repository at this point in the history
Related to: matrix-org/matrix-spec#998

Setting `origin` field in PDUs is not required anymore, so I've removed
assertions and assignments to this field.
  • Loading branch information
gnieto committed Sep 25, 2022
1 parent 225593e commit 1b0eec0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
1 change: 0 additions & 1 deletion lib/SyTest/Federation/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ sub join_room
auth_events content depth prev_events room_id sender
state_key type ) ),

origin => $store->server_name,
origin_server_ts => $self->time_ms,
);

Expand Down
1 change: 0 additions & 1 deletion lib/SyTest/Federation/Datastore.pm
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ sub create_event

my $event = {
%fields,
origin => $self->server_name,
origin_server_ts => JSON::number( int( time() * 1000 )),
};

Expand Down
11 changes: 1 addition & 10 deletions tests/50federation/30room-join.pl
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ sub assert_is_valid_pdu {
my ( $event ) = @_;

assert_json_keys( $event, qw(
auth_events content depth hashes origin origin_server_ts
auth_events content depth hashes origin_server_ts
prev_events room_id sender signatures type
));

assert_json_list( $event->{auth_events} );
assert_json_number( $event->{depth} );
assert_json_object( $event->{hashes} );

assert_json_string( $event->{origin} );

assert_json_number( $event->{origin_server_ts} );
assert_json_list( $event->{prev_events} );

Expand Down Expand Up @@ -94,7 +92,6 @@ sub assert_is_valid_pdu {
user_id => $user_id,
);

$proto->{origin} = $inbound_server->server_name;
$proto->{origin_server_ts} = $inbound_server->time_ms;

$req->respond_json( {
Expand Down Expand Up @@ -276,7 +273,6 @@ sub assert_is_valid_pdu {
state_key type ) ),

event_id => $datastore->next_event_id,
origin => $local_server_name,
origin_server_ts => $inbound_server->time_ms,
);

Expand Down Expand Up @@ -445,7 +441,6 @@ sub assert_is_valid_pdu {

$join_event = $body->{event};

$join_event->{origin} = $sytest_server_name;
$join_event->{origin_server_ts} = $outbound_client->time_ms;

if( $room_version eq '1' || $room_version eq '2' ) {
Expand Down Expand Up @@ -858,7 +853,6 @@ sub assert_is_valid_pdu {
user_id => $user_id,
);

$proto->{origin} = $inbound_server->server_name;
$proto->{origin_server_ts} = $inbound_server->time_ms;

$req->respond_json( {
Expand Down Expand Up @@ -947,7 +941,6 @@ sub assert_is_valid_pdu {
user_id => $user_id,
);

$proto->{origin} = $inbound_server->server_name;
$proto->{origin_server_ts} = $inbound_server->time_ms;

$req->respond_json( {
Expand Down Expand Up @@ -1041,7 +1034,6 @@ sub assert_is_valid_pdu {
user_id => $user_id,
);

$proto->{origin} = $inbound_server->server_name;
$proto->{origin_server_ts} = $inbound_server->time_ms;

$req->respond_json( {
Expand Down Expand Up @@ -1182,7 +1174,6 @@ sub assert_is_valid_pdu {
auth_events content depth prev_events room_id sender
state_key type ) ),

origin => $local_server_name,
origin_server_ts => $inbound_server->time_ms,
);
# Insert a "bad" value into the send join, in this case a float.
Expand Down
4 changes: 2 additions & 2 deletions tests/50federation/32room-getevent.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
my ( $body ) = @_;
log_if_fail "Body", $body;

assert_json_keys( $body, qw( origin origin_server_ts pdus ));
assert_json_keys( $body, qw( origin_server_ts pdus ));
assert_json_list( my $events = $body->{pdus} );

@$events == 1 or
Expand All @@ -30,7 +30,7 @@

# Check that the string fields seem right
assert_eq( $event->{$_}, $member_event->{$_},
"event $_" ) for qw( depth origin room_id sender state_key type );
"event $_" ) for qw( depth room_id sender state_key type );

if ( $room->room_version eq "1" || $room->room_version eq "2" ) {
assert_eq( $event->{event_id}, $member_event->{event_id}, "event_id" );
Expand Down
8 changes: 2 additions & 6 deletions tests/50federation/35room-invite.pl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@
}

# this should be a member event
assert_json_keys( $body, qw( origin room_id sender type ));
assert_json_keys( $body, qw( room_id sender type ));

assert_eq( $body->{type}, "m.room.member",
'event type' );
assert_eq( $body->{origin}, $user->http->server_name,
'event origin' );
assert_eq( $body->{room_id}, $room_id,
'event room_id' );
assert_eq( $body->{sender}, $user->user_id,
Expand Down Expand Up @@ -226,7 +224,7 @@ sub invite_server

# Response should be the same event reflected back
assert_eq( $event->{$_}, $invitation->{$_},
"response $_" ) for qw( event_id origin room_id sender state_key type );
"response $_" ) for qw( event_id room_id sender state_key type );

# server should have signed it
exists $event->{signatures}{$first_home_server} or
Expand Down Expand Up @@ -602,7 +600,6 @@ sub do_v2_invite_request

$leave_event = $resp->{event};

$leave_event->{origin} = $outbound_client->server_name;
$leave_event->{origin_server_ts} = JSON::number($outbound_client->time_ms);
$leave_event->{event_id} = $leave_event_id = $outbound_client->datastore->next_event_id();

Expand Down Expand Up @@ -911,7 +908,6 @@ sub do_v2_invite_request
auth_events content depth prev_events room_id sender
state_key type)),

origin => $outbound_client->server_name,
origin_server_ts => $inbound_server->time_ms,
);
# Insert a "bad" value into the send leave, in this case a float.
Expand Down

0 comments on commit 1b0eec0

Please sign in to comment.