Skip to content

Get a stream of gateway info (V4)#478

Merged
kurotych merged 2 commits intomasterfrom
gateway-info-v4
Feb 4, 2026
Merged

Get a stream of gateway info (V4)#478
kurotych merged 2 commits intomasterfrom
gateway-info-v4

Conversation

@kurotych
Copy link
Member

@kurotych kurotych commented Jan 29, 2026

Implement gateway_info_v4 with added owner and owner_changed_at

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a V4 version of the gateway info streaming API to support tracking gateway ownership changes. The changes add two new fields (owner and owner_changed_at) to enable filtering and monitoring gateway ownership transfers.

Changes:

  • Adds gateway_info_v4 message with owner tracking fields
  • Adds gateway_info_stream_req_v4 request message with owner change timestamp filtering
  • Adds gateway_info_stream_res_v4 response message and info_stream_v4 RPC method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +245 to +251
// Use 0 if you don't want to apply this filter
// NOTE: It is recommended to use the highest `updated_at` field from
// returned radios in the next subsequent requests.
uint64 min_updated_at = 5;
// The Unix epoch timestamp (in seconds).
// Filters the response based on the last time gateway changed its location.
// Use 0 if you don't want to apply this filter
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instruction text differs from the corresponding field in gateway_info_stream_req_v3 (line 229-230). In v3, it says "Use 0 to fetch all gateways" while in v4 line 251 it says "Use 0 if you don't want to apply this filter". For consistency across API versions, consider using the same phrasing as v3.

Suggested change
// Use 0 if you don't want to apply this filter
// NOTE: It is recommended to use the highest `updated_at` field from
// returned radios in the next subsequent requests.
uint64 min_updated_at = 5;
// The Unix epoch timestamp (in seconds).
// Filters the response based on the last time gateway changed its location.
// Use 0 if you don't want to apply this filter
// Use 0 to fetch all gateways.
// NOTE: It is recommended to use the highest `updated_at` field from
// returned radios in the next subsequent requests.
uint64 min_updated_at = 5;
// The Unix epoch timestamp (in seconds).
// Filters the response based on the last time gateway changed its location.
// Use 0 to fetch all gateways.

Copilot uses AI. Check for mistakes.
Comment on lines 131 to 151
message gateway_info_v4 {
// The public key binary address and on-chain identity of the gateway
bytes address = 1;
// The gateway metadata
gateway_metadata_v3 metadata = 2;
// The asserted device type of the gateway
device_type_v2 device_type = 3;
// The Unix epoch timestamp (in seconds) when the gateway was first added to
// the database
uint64 created_at = 4;
// The Unix epoch timestamp (in seconds) when the gateway parameters were last
// updated. NOTE: This field is also updated when the location or owner
// changes.
uint64 updated_at = 5;
// Count of hotspot location changes
uint64 num_location_asserts = 6;
// The gateway's owner
string owner = 7;
// The last time the owner was changed (in seconds)
uint64 owner_changed_at = 8;
}
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a discrepancy between the PR description and the code changes. The PR description states "Add owner and owner_changed_at to gateway_info_v3", but the code actually creates a new gateway_info_v4 message with these fields, leaving gateway_info_v3 unchanged. This is the correct approach for maintaining backward compatibility, but the PR description should be updated to reflect that this creates a V4 version rather than modifying V3.

Copilot uses AI. Check for mistakes.
uint64 num_location_asserts = 6;
// The gateway's owner
string owner = 7;
// The last time the owner was changed (in seconds)
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment format is inconsistent with the pattern used for other timestamp fields. The field 'owner_changed_at' should include "Unix epoch timestamp" at the beginning for consistency with other timestamp fields in this message (lines 138-144) and throughout the file. Consider changing to: "The Unix epoch timestamp (in seconds) when the owner was last changed"

Suggested change
// The last time the owner was changed (in seconds)
// The Unix epoch timestamp (in seconds) when the owner was last changed

Copilot uses AI. Check for mistakes.
bytes signer = 2;
bytes signature = 3;
// Device types that will be returned in the response
// Use empty array if you don't want to apply this filter
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment format is inconsistent compared to the corresponding field descriptions in gateway_info_stream_req_v3. For consistency, lines 218-220 in v3 say "Returns all devices if empty" while v4 says "Use empty array if you don't want to apply this filter". While both are technically correct, it would be better to maintain consistency across versions unless there's a specific reason to change the wording.

Suggested change
// Use empty array if you don't want to apply this filter
// Returns all devices if empty

Copilot uses AI. Check for mistakes.
@kurotych kurotych marked this pull request as ready for review January 30, 2026 10:38
@kurotych kurotych merged commit e81cec7 into master Feb 4, 2026
7 checks passed
@kurotych kurotych deleted the gateway-info-v4 branch February 4, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants