-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Peer API fix for library users of fuel-core (#1542)
This PR restructures the changes from #1524 to fix an error that would block users from calling `client.chain_info()` without having the p2p feature enabled. While throwing errors on apis that use disabled features is our current convention, it would mean that the sdk testing harness would fail when trying to get the consensus parameters unless it also enabled the p2p feature flag. What changed in this PR: - Information about peers now part of NodeInfo instead of ChainInfo. This seemed like a more suitable location, as chain info relates more towards global network settings and state. NodeInfo on the other hand shows details about the current node instance you've connected to. - Peers are not returned in the default query for NodeInfo, and instead use a special query fragment that's used to only return info about peers. This is beneficial since it will allow users without p2p enabled to still fetch NodeInfo, and also reduce api bandwidth by only returning potentially bulky information about peers through a dedicated api request instead of by default. *Note: This is a release blocker for 0.22 as it will prevent the sdk from working properly*
- Loading branch information
Showing
12 changed files
with
233 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...hots/fuel_core_client__client__schema__node_info__tests__peers_info_query_gql_output.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
source: crates/client/src/client/schema/node_info.rs | ||
expression: operation.query | ||
--- | ||
query { | ||
nodeInfo { | ||
peers { | ||
id | ||
addresses | ||
clientVersion | ||
blockHeight | ||
lastHeartbeatMs | ||
appScore | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.