-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: no default objects + staking changes #350
Conversation
WalkthroughThe recent updates refine the GraphQL schema, emphasizing staking features by removing outdated elements like delegations and enhancing query handling. These changes streamline interactions, focusing on explicit data management through adjusted function signatures and the removal of default parameters. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Out of diff range and nitpick comments (2)
src/gql/query/distributionCommissions.ts (1)
Line range hint
19-29
: Consider removing default value assignments withindistributionCommissionsQueryString
to align with the PR's objective of explicit data handling.- if (!args.limit) args.limit = 100 - if (!args.order_desc) args.order_desc = true - if (!args.order_by) args.order_by = GQLDistributionCommissionOrder.GQLValidatorAddresssrc/gql/utils/defaultObjects.ts (1)
Line range hint
58-58
: Add missing propertiescreation_block
andself_delegation
todefaultValidator
to match theGQLValidator
type.+ creation_block: defaultBlock, + self_delegation: 0,
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (28)
- src/gql/heart-monitor/heart-monitor.test.ts (37 hunks)
- src/gql/heart-monitor/heart-monitor.ts (5 hunks)
- src/gql/query/communityPool.ts (2 hunks)
- src/gql/query/distributionCommissions.ts (3 hunks)
- src/gql/query/featureFlags.ts (2 hunks)
- src/gql/query/governance.ts (4 hunks)
- src/gql/query/ibc.ts (4 hunks)
- src/gql/query/index.ts (2 hunks)
- src/gql/query/inflation.ts (4 hunks)
- src/gql/query/markPriceCandles.ts (2 hunks)
- src/gql/query/oracle.ts (4 hunks)
- src/gql/query/perp.ts (4 hunks)
- src/gql/query/proxies.ts (2 hunks)
- src/gql/query/spotLpPositions.ts (2 hunks)
- src/gql/query/spotPoolCreated.ts (2 hunks)
- src/gql/query/spotPoolExited.ts (2 hunks)
- src/gql/query/spotPoolJoined.ts (2 hunks)
- src/gql/query/spotPoolSwap.ts (2 hunks)
- src/gql/query/spotPools.ts (2 hunks)
- src/gql/query/staking.ts (1 hunks)
- src/gql/query/stats.ts (4 hunks)
- src/gql/query/users.ts (2 hunks)
- src/gql/query/wasm.ts (4 hunks)
- src/gql/subscription/markPriceCandlesSubscription.ts (1 hunks)
- src/gql/subscription/oraclePricesSubscription.ts (2 hunks)
- src/gql/subscription/perpMarketSubscription.ts (2 hunks)
- src/gql/subscription/perpPositionsSubscription.ts (2 hunks)
- src/gql/utils/defaultObjects.ts (2 hunks)
Files skipped from review due to trivial changes (2)
- src/gql/query/markPriceCandles.ts
- src/gql/query/perp.ts
Additional Context Used
GitHub Check Runs (1)
checkout_cache_install_build_test failure (6)
src/gql/utils/defaultObjects.ts: [failure] 58-58:
Type '{ commission_update_time: string; commission_rates: { max_change_rate: number; max_rate: number; rate: number; }; delegator_shares: number; description: { details: string; identity: string; moniker: string; security_contact: string; website: string; }; ... 6 more ...; unbonding_time: string; }' is missing the following properties from type 'GQLValidator': creation_block, self_delegation
Additional comments not posted (75)
src/gql/query/proxies.ts (2)
16-21
: Explicit requirement offields
parameter enhances clarity and robustness in data handling.
27-27
: Change in function signature to requirefields
parameter aligns with the overall PR objectives and improves explicitness in data handling.src/gql/query/featureFlags.ts (2)
16-21
: Explicit requirement offields
parameter enhances clarity and robustness in data handling.
27-27
: Change in function signature to requirefields
parameter aligns with the overall PR objectives and improves explicitness in data handling.src/gql/query/index.ts (1)
21-21
: Addition of./staking
to exports aligns with the PR's focus on enhancing staking functionalities.src/gql/query/users.ts (2)
19-28
: Explicit requirement offields
parameter and effective handling of default values enhance clarity and robustness in data handling.
36-36
: Change in function signature to requirefields
parameter aligns with the overall PR objectives and improves explicitness in data handling.src/gql/subscription/markPriceCandlesSubscription.ts (2)
13-19
: Explicit requirement offields
parameter enhances clarity and robustness in data handling for subscriptions.
26-27
: Change in function signature to requirefields
parameter and optionally take aclient
aligns with the overall PR objectives and improves explicitness in data handling for subscriptions.src/gql/query/spotPools.ts (2)
19-28
: Explicit requirement offields
parameter and effective handling of default values enhance clarity and robustness in data handling.
36-36
: Change in function signature to requirefields
parameter aligns with the overall PR objectives and improves explicitness in data handling.src/gql/subscription/perpMarketSubscription.ts (2)
17-23
: Explicit requirement offields
parameter enhances clarity and robustness in data handling for subscriptions.
30-31
: Change in function signature to requirefields
parameter and optionally take aclient
aligns with the overall PR objectives and improves explicitness in data handling for subscriptions.src/gql/subscription/perpPositionsSubscription.ts (2)
17-19
: Explicit requirement offields
parameter enhances clarity and robustness in data handling for subscriptions.
23-24
: Change in function signature to requirefields
parameter and optionally take aclient
aligns with the overall PR objectives and improves explicitness in data handling for subscriptions.src/gql/subscription/oraclePricesSubscription.ts (2)
17-17
: Explicitly requiringfields
parameter enhances clarity and robustness in data handling.
30-31
: Proper handling of optionalclient
parameter allows for flexible usage scenarios.src/gql/query/spotPoolSwap.ts (2)
19-22
: Setting default values within the function enhances control and explicitness over query parameters.
36-36
: Requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.src/gql/query/communityPool.ts (2)
19-23
: Setting default values within the function enhances control and explicitness over query parameters.
36-36
: Requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.src/gql/query/spotPoolExited.ts (2)
19-22
: Setting default values within the function enhances control and explicitness over query parameters.
36-36
: Requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.src/gql/query/spotPoolJoined.ts (2)
19-22
: Setting default values within the function enhances control and explicitness over query parameters.
36-36
: Requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.src/gql/query/spotLpPositions.ts (2)
19-22
: Setting default values within the function enhances control and explicitness over query parameters.
36-36
: Requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.src/gql/query/spotPoolCreated.ts (2)
19-22
: Setting default values within the function enhances control and explicitness over query parameters.
36-36
: Requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.src/gql/query/wasm.ts (2)
23-23
: Requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.
47-47
: Explicitly requiringfields
parameter ensures all necessary fields are explicitly passed, aligning with PR objectives.src/gql/query/distributionCommissions.ts (1)
37-37
: Changes indistributionCommissions
function look good and align with the PR's objectives.src/gql/query/ibc.ts (2)
Line range hint
26-46
: Changes inibcQueryString
function look good and align with the PR's objectives of explicit data handling.
62-62
: Changes inibc
function look good and align with the PR's objectives.src/gql/query/oracle.ts (2)
29-29
: Changes inoracleQueryString
function look good and align with the PR's objectives of explicit data handling.
65-65
: Changes inoracle
function look good and align with the PR's objectives.src/gql/query/inflation.ts (2)
31-31
: Changes ininflationQueryString
function look good and align with the PR's objectives of explicit data handling.
78-78
: Changes ininflation
function look good and align with the PR's objectives.src/gql/query/governance.ts (2)
33-33
: Changes ingovernanceQueryString
function look good and align with the PR's objectives of explicit data handling.
80-80
: Changes ingovernance
function look good and align with the PR's objectives.src/gql/query/stats.ts (2)
49-49
: Changes inGQLStatsQueryString
function look good and align with the PR's objectives of explicit data handling.
140-140
: Changes instats
function look good and align with the PR's objectives.src/gql/query/staking.ts (2)
39-104
: Changes inGQLStakingQueryString
function look good and align with the PR's objectives of explicit data handling.
107-107
: Changes instaking
function look good and align with the PR's objectives.src/gql/heart-monitor/heart-monitor.ts (7)
94-97
: Addition of staking-related types and function.This addition aligns with the PR's objective to enhance staking functionalities.
107-107
: Ensure explicit field specification incommunityPool
method.Verification successful
The verification process has successfully identified two instances where the
communityPool
method is called within the TypeScript files of the project. Both instances explicitly specify thefields
parameter, which aligns with the requirement stated in the review comment to ensure explicit field specification.
- In
src/gql/heart-monitor/heart-monitor.ts
, the method is called withargs
,this.gqlEndpt
, andfields
.- In
src/gql/heart-monitor/heart-monitor.test.ts
, the method is called within a test environment withargs
andfields
.These findings confirm that the method calls adhere to the new changes requiring explicit field specification.
Conclusion:
All calls to thecommunityPool
method in the TypeScript files explicitly specify thefields
parameter as required. No issues were found regarding the adherence to the new method signature.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all calls to `communityPool` method explicitly specify fields as per new changes. # Test: Search for the function usage. Expect: No occurrences of calls without field specification. rg --type typescript $'communityPool\\('Length of output: 75
Script:
#!/bin/bash # Description: Verify that all calls to `communityPool` method explicitly specify fields as per new changes. # Test: Search for the function usage. Expect: No occurrences of calls without field specification. rg --type ts $'communityPool\\('Length of output: 227
116-116
: Addition offeatureFlags
method to handle feature flags.This method supports the new feature flags functionality, enhancing configurability.
213-217
: Addition ofstaking
method in the interface.This method supports the new staking functionality, aligning with the PR's objectives.
265-270
: Ensure explicit field specification incommunityPool
method implementation.Verification successful
The verification process has confirmed that all calls to the
communityPool
method in the codebase explicitly specify thefields
parameter. This aligns with the requirements mentioned in the review comment. Both instances found insrc/gql/heart-monitor/heart-monitor.ts
andsrc/gql/heart-monitor/heart-monitor.test.ts
include theargs
,this.gqlEndpt
, andfields
parameters in their calls tocommunityPool
.Conclusion:
- The implementation of the
communityPool
method correctly specifies thefields
parameter in all its calls, as required.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all calls to `communityPool` method in implementation explicitly specify fields as per new changes. # Test: Search for the function usage. Expect: No occurrences of calls without field specification. rg --type typescript $'communityPool\\('Length of output: 75
Script:
#!/bin/bash # Description: Verify that all calls to `communityPool` method in implementation explicitly specify fields as per new changes. # Test: Search for the function usage. Expect: No occurrences of calls without field specification. rg --type ts $'communityPool\\('Length of output: 227
273-273
: Implementation offeatureFlags
method.Proper implementation of the method to handle feature flags.
356-359
: Implementation ofstaking
method.Proper implementation of the method to handle new staking functionalities.
src/gql/heart-monitor/heart-monitor.test.ts (24)
96-101
: Addition of new constants and types for staking tests.These additions are necessary for testing the new staking functionalities.
149-149
: Modification intestCommunityPool
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
167-167
: Modification intestDistributionCommissions
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
184-184
: Addition oftestFeatureFlags
to test the new feature flags functionality.This test ensures that the new feature flags functionality is working as expected.
204-204
: Modification intestGovernance
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
283-283
: Modification intestInflation
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
322-322
: Modification intestMarkPriceCandles
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
359-359
: Addition oftestMarkPriceCandlesSubscription
to test the new subscription functionality.This test ensures that the new subscription functionality for mark price candles is working as expected.
428-428
: Addition oftestOraclePricesSubscription
to test the new subscription functionality.This test ensures that the new subscription functionality for oracle prices is working as expected.
452-452
: Modification intestPerp
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
545-545
: Addition oftestPerpMarketSubscription
to test the new subscription functionality.This test ensures that the new subscription functionality for perpetual market data is working as expected.
612-612
: Addition oftestPerpPositionsSubscription
to test the new subscription functionality.This test ensures that the new subscription functionality for perpetual positions is working as expected.
654-654
: Addition oftestProxies
to test the new proxies functionality.This test ensures that the new proxies functionality is working as expected.
673-676
: Addition oftestQueryBatchHandler
to test the new batch handler functionality.This test ensures that the new batch handler functionality is working as expected.
700-700
: Modification intestSpotLpPositions
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
721-721
: Modification intestSpotPoolCreated
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
739-739
: Modification intestSpotPoolExited
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
757-757
: Modification intestSpotPoolJoined
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
775-775
: Modification intestSpotPools
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
807-807
: Modification intestSpotPoolSwap
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
826-826
: Modification intestStats
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
848-851
: Addition oftestStaking
to test the new staking functionality.This test ensures that the new staking functionality is working as expected.
968-968
: Modification intestWasm
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
999-999
: Modification intestUsers
to ensure explicit field specification.This change aligns with the new requirement to explicitly specify fields in GraphQL queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/gql/heart-monitor/heart-monitor.test.ts (39 hunks)
Additional comments not posted (31)
src/gql/heart-monitor/heart-monitor.test.ts (31)
87-92
: Added new imports for feature flags and staking-related types and queries.
95-101
: Introduced a new utility functioncheckNoFields
to ensure certain fields are not present in objects. This is useful for testing the absence of fields in response objects.
140-140
: Modified thetestCommunityPool
function to explicitly require thefields
parameter, aligning with the removal of default objects in the system.
158-158
: Updated thetestDistributionCommissions
function to explicitly require thefields
parameter. This change is consistent with the overall PR goal of removing default objects.
175-175
: Added a new test functiontestFeatureFlags
to handle the testing of feature flags functionality. This addition is necessary due to the introduction of feature flags in the system.
195-195
: Modified thetestGovernance
function to explicitly require thefields
parameter, which is part of the broader changes to remove default objects.
236-236
: Updated thetestIbc
function to explicitly require thefields
parameter. This change supports the PR's objective of explicit field specification in GraphQL queries.
274-274
: Modified thetestInflation
function to explicitly require thefields
parameter, aligning with the removal of default objects.
300-300
: Updated thetestOracle
function to explicitly require thefields
parameter. This change is consistent with the PR's goal of removing default objects.
313-313
: Modified thetestMarkPriceCandles
function to explicitly require thefields
parameter, aligning with the removal of default objects.
334-343
: Added handling for undefined client scenario intestMarkPriceCandlesSubscription
. This is important for robustness, ensuring the system behaves correctly when the client is not properly initialized.
350-350
: Updated thetestMarkPriceCandlesSubscription
function to explicitly require thefields
parameter. This change supports the PR's objective of explicit field specification in GraphQL queries.
407-412
: Added handling for undefined client scenario intestOraclePricesSubscription
. This ensures that the system behaves correctly when the client is not properly initialized, which is crucial for robustness.
419-419
: Updated thetestOraclePricesSubscription
function to explicitly require thefields
parameter. This change is consistent with the PR's goal of removing default objects.
443-443
: Updated thetestPerp
function to explicitly require thefields
parameter. This change supports the PR's objective of explicit field specification in GraphQL queries.
524-529
: Added handling for undefined client scenario intestPerpMarketSubscription
. This is important for robustness, ensuring the system behaves correctly when the client is not properly initialized.
536-536
: Updated thetestPerpMarketSubscription
function to explicitly require thefields
parameter. This change is consistent with the PR's goal of removing default objects.
588-596
: Added handling for undefined client scenario intestPerpPositionsSubscription
. This ensures that the system behaves correctly when the client is not properly initialized, which is crucial for robustness.
603-603
: Updated thetestPerpPositionsSubscription
function to explicitly require thefields
parameter. This change supports the PR's objective of explicit field specification in GraphQL queries.
645-645
: Added a new test functiontestProxies
to handle the testing of proxy functionality. This addition is necessary due to the introduction of proxies in the system.
664-684
: Added a newqueryBatchHandler
function to handle batch queries for community pool and feature flags. This function is crucial for handling multiple queries in a single call, improving efficiency.
691-691
: Updated thetestSpotLpPositions
function to explicitly require thefields
parameter. This change is consistent with the PR's goal of removing default objects.
712-712
: Updated thetestSpotPoolCreated
function to explicitly require thefields
parameter, aligning with the removal of default objects.
730-730
: Updated thetestSpotPoolExited
function to explicitly require thefields
parameter. This change supports the PR's objective of explicit field specification in GraphQL queries.
748-748
: Updated thetestSpotPoolJoined
function to explicitly require thefields
parameter. This change is consistent with the PR's goal of removing default objects.
766-766
: Updated thetestSpotPools
function to explicitly require thefields
parameter, aligning with the removal of default objects.
798-798
: Updated thetestSpotPoolSwap
function to explicitly require thefields
parameter. This change supports the PR's objective of explicit field specification in GraphQL queries.
817-817
: Updated thetestStats
function to explicitly require thefields
parameter, aligning with the removal of default objects.
839-906
: Added a newtestStaking
function to handle the testing of staking functionality. This addition is necessary due to the introduction of staking in the system.
959-959
: Updated thetestWasm
function to explicitly require thefields
parameter. This change is consistent with the PR's goal of removing default objects.
990-990
: Updated thetestUsers
function to explicitly require thefields
parameter, aligning with the removal of default objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/gql/utils/consts.test.ts (1 hunks)
- src/gql/utils/defaultObjects.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/gql/utils/defaultObjects.ts
Additional comments not posted (1)
src/gql/utils/consts.test.ts (1)
17-41
: Ensure the new test forfeatureFlags
is comprehensive.Verification successful
The search results from the script indicate that the
featureFlags
are extensively tested across multiple files in the codebase, includingheart-monitor.test.ts
,heart-monitor.ts
, andfeatureFlags.ts
. The tests check for the presence offeatureFlags
in the response, validate its structure, and ensure that the query string and function handling are correctly implemented.Given this comprehensive testing across different modules, it appears that the new test for
featureFlags
inconsts.test.ts
is part of a well-covered feature in the codebase. The tests inconsts.test.ts
are consistent with the testing patterns observed in other parts of the codebase, suggesting that the necessary aspects offeatureFlags
are indeed being tested.Based on this information, the review comment concerning the comprehensiveness of the
featureFlags
test inconsts.test.ts
seems to be verified successfully.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new test for `featureFlags` covers all necessary aspects. # Test: Search for additional tests related to `featureFlags` in the test suite. rg --type ts $'featureFlags'Length of output: 2240
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/gql/heart-monitor/heart-monitor.test.ts (39 hunks)
- src/gql/utils/defaultObjects.ts (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/gql/heart-monitor/heart-monitor.test.ts
- src/gql/utils/defaultObjects.ts
## [4.3.0](v4.2.0...v4.3.0) (2024-05-13) ### Features * calc apr ([f66a2ab](f66a2ab)) * inflation rewards ([fcff7ef](fcff7ef)) * no default objects + staking changes ([#350](#350)) ([b4e4125](b4e4125)) * proxy prices ([#343](#343)) ([e5baeed](e5baeed)) ### Bug Fixes * comments ([9c60b39](9c60b39)) * latest formula ([ac9e57b](ac9e57b)) * mispell ([10d660f](10d660f)) * name ([84cf8b5](84cf8b5)) * optional mystake ([24f4f87](24f4f87)) * simplify ([8015860](8015860)) * test ([b52f442](b52f442)) * test ([dabe094](dabe094)) * test ([eb22f64](eb22f64)) * test ([11c5925](11c5925)) * test name ([796925f](796925f)) * update formula ([30d9887](30d9887)) * updates ([4f541d2](4f541d2)) ### Miscellaneous Chores * remove spot, perp, and marketing ([41d54d9](41d54d9)) ### Documentation * **math:** explain exported fns more ([6570b32](6570b32)) [skip ci]
🎉 This PR is included in version 4.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary by CodeRabbit
delegations
related logic withfeatureFlags
handling in thequeryBatchHandler
function for improved functionality.