-
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
refactor: tests #301
refactor: tests #301
Conversation
Warning Rate Limit Exceeded@cgilbe27 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 47 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThese changes encompass a comprehensive overhaul of a TypeScript project, focusing on enhancing code quality, testing, and GraphQL capabilities. The updates include setting up ESLint and Prettier for code consistency, refining GitHub Actions workflows for testing and building, and expanding the GraphQL schema with new queries and mutations. Additionally, improvements to the SDK's transaction and query handling aim to streamline development processes and enhance code robustness. 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.
Review Status
Actionable comments generated: 15
Configuration used: CodeRabbit UI
Files ignored due to path filters (3)
package.json
is excluded by:!**/*.json
tsconfig.json
is excluded by:!**/*.json
yarn.lock
is excluded by:!**/*.lock
Files selected for processing (65)
- .eslintrc.json (1 hunks)
- .github/workflows/test-ts-sdk.yaml (1 hunks)
- .prettierrc.json (1 hunks)
- index.ts (1 hunks)
- jest.config.ts (1 hunks)
- src/gql/graphql-codegen/codegen-loader.js (1 hunks)
- src/gql/graphql-codegen/codegen.test.ts (1 hunks)
- src/gql/graphql-codegen/codegen.ts (1 hunks)
- src/gql/heart-monitor/heart-monitor.test.ts (6 hunks)
- src/gql/heart-monitor/heart-monitor.ts (4 hunks)
- src/gql/query/communityPool.ts (1 hunks)
- src/gql/query/delegations.ts (1 hunks)
- src/gql/query/distributionCommissions.ts (1 hunks)
- src/gql/query/featureFlags.ts (1 hunks)
- src/gql/query/governance.ts (1 hunks)
- src/gql/query/ibc.ts (3 hunks)
- src/gql/query/index.ts (1 hunks)
- src/gql/query/inflation.ts (1 hunks)
- src/gql/query/markPriceCandles.ts (1 hunks)
- src/gql/query/oracle.ts (1 hunks)
- src/gql/query/perp.ts (2 hunks)
- src/gql/query/redelegations.ts (1 hunks)
- src/gql/query/spotLpPositions.ts (1 hunks)
- src/gql/query/spotPoolCreated.ts (1 hunks)
- src/gql/query/spotPoolExited.ts (1 hunks)
- src/gql/query/spotPoolJoined.ts (1 hunks)
- src/gql/query/spotPoolSwap.ts (1 hunks)
- src/gql/query/spotPools.ts (1 hunks)
- src/gql/query/stats.ts (2 hunks)
- src/gql/query/unbondings.ts (1 hunks)
- src/gql/query/users.ts (1 hunks)
- src/gql/query/validators.ts (1 hunks)
- src/gql/query/wasm.ts (1 hunks)
- src/gql/subscription/markPriceCandlesSubscription.ts (2 hunks)
- src/gql/subscription/oraclePricesSubscription.ts (1 hunks)
- src/gql/subscription/perpMarketSubscription.ts (2 hunks)
- src/gql/subscription/perpPositionsSubscription.ts (2 hunks)
- src/gql/utils/consts.test.ts (2 hunks)
- src/gql/utils/consts.ts (2 hunks)
- src/gql/utils/defaultObjects.ts (5 hunks)
- src/sdk/msg/encode-types.ts (1 hunks)
- src/sdk/msg/perp.ts (1 hunks)
- src/sdk/msg/spot.ts (1 hunks)
- src/sdk/query/oracle.test.ts (1 hunks)
- src/sdk/query/oracle.ts (1 hunks)
- src/sdk/query/perp.ts (1 hunks)
- src/sdk/query/query.test.ts (18 hunks)
- src/sdk/query/query.ts (1 hunks)
- src/sdk/query/spot.ts (1 hunks)
- src/sdk/tx/event.test.ts (1 hunks)
- src/sdk/tx/signer.test.ts (1 hunks)
- src/sdk/tx/txClient.test.ts (6 hunks)
- src/sdk/tx/txClient.ts (1 hunks)
- src/sdk/utils/chain.test.ts (3 hunks)
- src/sdk/utils/chain.ts (2 hunks)
- src/sdk/utils/faucet.test.ts (5 hunks)
- src/sdk/utils/faucet.ts (2 hunks)
- src/sdk/utils/hash.test.ts (2 hunks)
- src/sdk/utils/hash.ts (1 hunks)
- src/sdk/utils/parse.test.ts (1 hunks)
- src/sdk/utils/result.test.ts (1 hunks)
- src/sdk/utils/result.ts (1 hunks)
- src/sdk/utils/testutil.ts (1 hunks)
- src/sdk/utils/types.test.ts (1 hunks)
- src/sdk/utils/types.ts (1 hunks)
Files skipped from review due to trivial changes (4)
- .prettierrc.json
- index.ts
- src/sdk/msg/encode-types.ts
- src/sdk/query/query.ts
Additional comments: 67
src/sdk/query/perp.ts (1)
- 13-13: The import statement for
fromSdkDec
has been modified to import from".."
instead of a specific location. Ensure that the new import path correctly resolves to the intended module.src/sdk/utils/hash.ts (1)
- 1-1: The import statement for
Result
has been changed to import from"."
. Verify that this new import path correctly resolves to the intendedResult
module.src/gql/query/inflation.ts (1)
- 1-12: Imports have been reorganized to import from
".."
. This change should be verified to ensure that all imported entities are correctly resolved from the new import path.src/gql/query/governance.ts (1)
- 2-2: The import for
defaultGovernance
has been moved, affecting the structure of imported entities. Verify thatdefaultGovernance
is correctly resolved from the new import path..github/workflows/test-ts-sdk.yaml (2)
- 53-58: Added a step to login to GitHub Container Registry. Ensure that the credentials used (
nibibot
andNIBIBOT_GIT_TOKEN
) are correctly configured and have the necessary permissions.- 60-64: Modified the step to run the Nibiru network. Verify that the
make chaosnet
command correctly starts the network as intended and that there are no conflicts with other steps.src/sdk/utils/hash.test.ts (1)
- 62-70: Added new test cases for
hexToBytes
with empty and incorrect strings. Ensure these tests cover all expected behaviors and edge cases for thehexToBytes
function.src/sdk/tx/signer.test.ts (1)
- 2-2: Modified the import statement for
getRegistry
,newRandomWallet
, andnewSignerFromMnemonic
to import from"."
. Verify that these functions are correctly resolved from the new import path.src/sdk/utils/result.ts (1)
- 38-38: Added a
console.error
statement to handle cases where bothok
anderr
states are defined simultaneously. Ensure this error handling is consistent with the intended use cases of theResult
class.src/sdk/tx/txClient.ts (1)
- 21-30: Added
perpTypes
andspotTypes
imports directly intxClient.ts
. Verify that these types are correctly utilized within the file and that the direct import does not introduce any redundancy.src/gql/utils/consts.ts (1)
- 130-132: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [123-135]
Added a new test case for
faucetUrlFromChain
when the chain includes "cataclysm". Ensure this test case accurately reflects the expected behavior for chains with the "cataclysm" name.src/gql/query/perp.ts (1)
- 20-20: Reorganized imports by removing specific imports from
../utils
and instead importing all from".."
. Verify that all imported entities are correctly resolved from the new import path.src/sdk/utils/parse.test.ts (1)
- 1-1: Modified the import statement for
fromSdkDec
,toSdkDec
, andtoSdkInt
to import from"."
. Verify that these functions are correctly resolved from the new import path.src/gql/query/stats.ts (3)
- 27-27: The import statement consolidates multiple imports from a parent directory. Ensure that all necessary types and functions are correctly exported from the parent module to prevent any missing import errors.
- 24-30: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [27-115]
The
GQLStatsQueryString
function constructs a GraphQL query string dynamically based on the provided arguments. Verify that the use ofgqlQuery
function aligns with its expected input and output, especially in handling default values and partial objects. Also, ensure that the concatenation of query parts into a single string does not introduce any syntax errors in the final GraphQL query.
- 6-14: > 📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [117-125]
The
stats
function performs a GraphQL query using the constructed query string. Ensure that error handling is adequately implemented for thedoGqlQuery
call to manage any potential exceptions or failed queries gracefully.src/sdk/utils/chain.test.ts (3)
- 17-18: The import of
Localnet
andNibiruTxClient
directly from the parent directory suggests a reorganization of the module structure. Confirm that these entities are correctly exported from the parent module and that their usage in tests aligns with their intended functionality.- 14-34: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [23-89]
Each test case should independently verify a specific functionality or behavior. Ensure that the tests adequately cover the expected behaviors of
Localnet
,CustomChain
, and other utilities under various conditions. Also, verify that assertions are correctly used to validate the outcomes of operations.
- 14-34: > 📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [114-115]
The update of endpoint URLs for
Localnet
configuration from port443
to5555
should be verified to ensure it matches the intended local network setup and does not impact connectivity or functionality in tests.src/sdk/msg/perp.ts (3)
- 12-12: The import of
toSdkDec
,toSdkInt
, andTxMessage
from a parent directory suggests a reorganization of the module structure. Confirm that these functions and types are correctly exported from the parent module and that their usage throughout the file aligns with their intended functionality.- 9-15: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [12-25]
Review the usage of
toSdkDec
andtoSdkInt
in message construction functions such asopenPosition
to ensure that the conversion from numbers to blockchain-compatible formats is correctly applied. Also, verify thatTxMessage
is correctly utilized for constructing transaction messages.
- 9-15: > 📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [27-199]
Ensure that each message construction function in the
PerpMsgFactory
class correctly implements the logic for creating messages of the corresponding type. Verify that the use offromPartial
and the setting of message fields align with the expected message formats for the perp module.src/sdk/query/oracle.ts (3)
- 34-34: The import of
fromSdkDec
from a parent directory suggests a reorganization of the module structure. Confirm thatfromSdkDec
is correctly exported from the parent module and that its usage in the file aligns with its intended functionality for converting blockchain numbers to JavaScript numbers.- 34-34: Verify the usage of
fromSdkDec
in functions likeexchangeRate
andnewExchangeRatesMap
to ensure that the conversion from blockchain number formats to JavaScript numbers is correctly applied and does not introduce any inaccuracies in the conversion process.- 36-36: Review the setup of the
OracleExtension
and ensure that each query function correctly implements the logic for querying oracle data. Verify that the use ofQueryClientImpl
and the construction of query requests align with the expected functionality and data structures of the oracle module.src/sdk/utils/chain.ts (3)
- 2-2: The import of
Result
from the parent directory suggests a reorganization of the module structure. Confirm thatResult
is correctly exported from the parent module and that its usage in functions likequeryChainIdWithRest
aligns with its intended functionality for handling operation results.- 114-115: The update of endpoint URLs for
Localnet
configuration from port443
to5555
should be verified to ensure it matches the intended local network setup and does not impact connectivity or functionality in the utility functions.- 1-1: Review the overall structure and logic of the
CustomChain
class and other utility functions to ensure they correctly implement the functionality for managing chain configurations and querying chain data. Verify that the logic for constructing chain endpoints and parsing chain IDs is accurate and aligns with the expected formats.src/sdk/tx/txClient.test.ts (3)
- 11-25: The import of
TxLog
,TxMessage
,PERP_MSG_TYPE_URLS
,NibiruQuerier
, and other entities from the parent directory suggests a reorganization of the module structure. Confirm that these entities are correctly exported from the parent module and that their usage in tests aligns with their intended functionality.- 29-29: Each test case should independently verify a specific functionality or behavior of the
NibiruTxClient
. Ensure that the tests adequately cover the expected behaviors of transaction creation, signing, and broadcasting under various conditions. Also, verify that assertions are correctly used to validate the outcomes of operations.- 29-29: The use of
Localnet.endptTm
in connecting to the transaction client and querier should be verified to ensure it matches the intended local network setup and does not impact the correctness or functionality of the tests.src/sdk/query/spot.ts (3)
- 39-39: The import of
fromSdkDec
from a parent directory suggests a reorganization of the module structure. Confirm thatfromSdkDec
is correctly exported from the parent module and that its usage in the file aligns with its intended functionality for converting blockchain numbers to JavaScript numbers.- 39-39: Verify the usage of
fromSdkDec
in functions liketransformPoolParams
andtransformPool
to ensure that the conversion from blockchain number formats to JavaScript numbers is correctly applied and does not introduce any inaccuracies in the conversion process.- 41-41: Review the setup of the
SpotExtension
and ensure that each query function correctly implements the logic for querying spot data. Verify that the use ofQueryClientImpl
and the construction of query requests align with the expected functionality and data structures of the spot module.src/sdk/query/oracle.test.ts (1)
- 4-4: The import path for
setupOracleExtension
has been updated. Verify that the new path correctly points to the intended module.Verification successful
Given the lack of output from the previous script, it's possible that the file
setupOracleExtension.ts
does not exist, or the export statement forsetupOracleExtension
is not present in the expected format. This could mean that the import path update mentioned in the review might not correctly point to the intended module, or the module's location or its export statement could be different than anticipated.To further investigate, a more comprehensive approach is needed to verify the existence and correct export of
setupOracleExtension
. This involves checking for any file that exportssetupOracleExtension
, regardless of its name, and ensuring that the export statement matches the expected pattern.
The script output confirms that
setupOracleExtension
is exported fromsrc/sdk/query/oracle.ts
. This information verifies that the import statement forsetupOracleExtension
in the filesrc/sdk/query/oracle.test.ts
, which now points to".."
(indicating a higher-level directory import), should be correctly set up to import from the module wheresetupOracleExtension
is defined, assuming the project's structure supports such imports.Given this confirmation, the updated import path for
setupOracleExtension
as seen in the review comment appears to correctly point to the intended module, assuming the relative import path".."
correctly resolves to includesrc/sdk/query/oracle.ts
based on the project's structure.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the new import path for setupOracleExtension fd setupOracleExtension.ts --exec grep -H "export const setupOracleExtension" {}Length of output: 84
Script:
#!/bin/bash # Search for any file exporting setupOracleExtension rg "export const setupOracleExtension" --type tsLength of output: 152
src/sdk/query/query.test.ts (21)
- 6-15: Updated imports and constants usage. Ensure that
NibiruQuerier
,Localnet
,newSignerFromMnemonic
, andNibiruTxClient
are correctly imported from their new locations and thatLocalnet
is correctly used throughout the tests.- 23-25: Usage of
Localnet.endptTm
inquerier.getBlock()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint.Verification successful
The
Localnet
object'sendptTm
property is defined as"http://127.0.0.1:26657"
in thesrc/sdk/utils/chain.ts
file. This endpoint is a standard address for a local Tendermint RPC server, typically used for local development and testing environments. Given this information, the usage ofLocalnet.endptTm
inquerier.getBlock()
correctly points to a Tendermint endpoint, specifically for a local network setup.* 2-32: > 📝 **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [29-34]Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the correctness of Localnet.endptTm endpoint echo "Verify Localnet.endptTm points to the correct Tendermint endpoint."Length of output: 142
Script:
#!/bin/bash # Search for the definition of Localnet within the codebase rg "Localnet" --multilineLength of output: 3643
Script:
#!/bin/bash # Display the contents of src/sdk/utils/chain.ts to examine the Localnet object cat src/sdk/utils/chain.tsLength of output: 6560
Direct fetch call using
Localnet.endptTm
. Ensure that the endpoint and the expected block structure are correct.Verification successful
The verification process has revealed that the
Localnet.endptTm
endpoint is consistently used across various test files in the SDK, indicating a standard practice for connecting to the local network's Tendermint endpoint. This widespread usage suggests that the endpoint is correctly implemented as per the SDK's design. Additionally, theBlockResp
interface is defined with a structure that expects aresult
containing ablock
, which aligns with the expected block structure from a Tendermint endpoint. Given this context, the direct fetch call usingLocalnet.endptTm
and the handling of the expected block structure in the provided code snippet appear to be correctly implemented according to the SDK's design and usage patterns.* 36-42: > 📝 **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [39-48]Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the correctness of the endpoint and expected block structure echo "Verify the endpoint and expected block structure in the direct fetch call."Length of output: 158
Script:
#!/bin/bash # Search for documentation or comments regarding Localnet.endptTm echo "Searching for Localnet.endptTm references..." rg "Localnet.endptTm" --context 5 # Locate the definition of BlockResp to understand the expected block structure echo "Locating BlockResp definition..." rg "interface BlockResp" --context 5Length of output: 20734
Usage of
Localnet.endptTm
inquerier.getAllBalances()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and thatunibi
is a valid denomination.Verification successful
The provided script output does not offer any new information regarding the correctness of
Localnet.endptTm
or the validity of the denominationunibi
. To verify the original review comment, we need to inspect the code to confirm thatLocalnet.endptTm
points to the correct Tendermint endpoint and to check ifunibi
is indeed a valid denomination within the context of the application.Given the limitations of the provided script output, we need to proceed with a different approach to gather the necessary information.
Based on the output from the executed scripts, we can observe the following:
References to
Localnet.endptTm
: The variableLocalnet.endptTm
is widely used across various test files in the SDK, includingfaucet.test.ts
,chain.test.ts
,txClient.test.ts
, and notably, multiple times withinquery.test.ts
. This consistent usage across different parts of the test suite suggests thatLocalnet.endptTm
is a standard way to reference the Tendermint endpoint within this project. However, without seeing the actual value assigned toLocalnet.endptTm
, we cannot definitively confirm its correctness, but its widespread use implies it is correctly pointing to the intended Tendermint endpoint.Occurrences of the denomination
unibi
: The denominationunibi
is found in various files, including theREADME.md
,QUERIES.md
, and several test files (faucet.test.ts
,txClient.test.ts
,chain.test.ts
, etc.), as well as in the SDK's utility and transaction client code. This indicates thatunibi
is a valid denomination used within the context of this project, both in documentation and code, especially for testing purposes.Given this information, it can be concluded that
Localnet.endptTm
is indeed used as intended to point to the Tendermint endpoint within the project's tests and thatunibi
is a valid denomination used throughout the project's codebase and documentation.Therefore, the original review comment concerning the verification of
Localnet.endptTm
pointing to the correct Tendermint endpoint andunibi
being a valid denomination is supported by the evidence found in the codebase.* 51-57: > 📝 **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [54-63]Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the correctness of Localnet.endptTm and the denomination 'unibi' echo "Verify Localnet.endptTm points to the correct Tendermint endpoint and 'unibi' is a valid denomination."Length of output: 220
Script:
#!/bin/bash # Find references to Localnet.endptTm to confirm it points to the correct Tendermint endpoint rg "Localnet.endptTm" # Search for any instance of 'unibi' to confirm it as a valid denomination rg "unibi"Length of output: 4622
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.spot.params()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the expected fields are present in the response.
- 68-74: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [71-78]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.oracle.actives()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 80-86: Usage of
Localnet.endptTm
inquerier.nibiruExtensions.oracle.params()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.- 77-91: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [88-97]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.oracle.exchangeRates()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 104-110: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [107-116]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.epochs.epochsInfo()
andcurrentEpoch()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 122-128: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [125-130]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.staking.validators()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 133-139: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [136-147]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.distribution.params()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 151-157: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [154-163]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.gov.params()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 164-170: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [167-186]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.ibc.channel.allChannels()
andallConnections()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 203-209: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [206-215]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.ibc.client.params()
andtransfer.params()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 223-229: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [226-235]
Usage of
Localnet.endptTm
inquerier.nibiruExtensions.ibc.verified.channel.channel()
. Confirm thatLocalnet.endptTm
correctly points to the Tendermint endpoint and that the response structure is as expected.
- 253-259: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [256-287]
Deployment of contract using
Localnet.endptTm
. Confirm that the deployment process, includingwasmClient.upload
andwasmClient.instantiate
, works as expected with the provided endpoint and that the contract deployment is successful.Verification successful
The provided script output does not offer any information regarding the actual execution or verification of the contract deployment process using
wasmClient.upload
andwasmClient.instantiate
methods. It merely echoes the instruction without performing any actionable checks or validations against the codebase or deployment process. To properly verify the review comment, we would need to execute commands that can inspect the codebase for references to these methods and potentially validate their usage, configurations, or integration tests that might indicate their operational status. However, without access to a live blockchain environment or specific test scripts designed to simulate the deployment process, our verification capabilities are limited to codebase inspection.Given the limitations, the next best step is to search the codebase for references to
wasmClient.upload
andwasmClient.instantiate
to confirm their usage and potentially find related tests that might indicate how these methods are expected to work with theLocalnet.endptTm
endpoint. This approach will allow us to infer whether the deployment process is likely to be correctly implemented as per the review comment's concern.
The script output confirms the presence of
wasmClient.upload
andwasmClient.instantiate
methods within thesrc/sdk/query/query.test.ts
file, directly aligning with the code snippet provided in the review comment. This indicates that the deployment process involving these methods is indeed implemented in the codebase, specifically within a test file, which suggests that there is at least a framework for testing the deployment of contracts using the specified methods.Given this information, it can be inferred that the deployment process, including
wasmClient.upload
andwasmClient.instantiate
, is implemented and likely tested within the context of the provided endpointLocalnet.endptTm
. However, without executing these tests in a live or simulated environment, we cannot definitively confirm the success of the contract deployment process. The presence of these methods in a test file strongly suggests that the process is designed to work as expected, pending actual execution results.Therefore, based on the codebase inspection, the review comment concerning the verification of the contract deployment process using
Localnet.endptTm
is supported by the evidence found within thesrc/sdk/query/query.test.ts
file.* 321-321: Usage of `Localnet.endptTm` in `querier.nibiruExtensions.auth.account()`. Confirm that `Localnet.endptTm` correctly points to the Tendermint endpoint and that the account information retrieval is successful. * 329-335: Usage of `jest.useFakeTimers()` and `setTimeoutSpy` in `waitForHeight` test. Ensure that the use of fake timers and the spy on `setTimeout` are correctly implemented and necessary for the test. * 348-354: Testing of `getTxByHash` with a non-existent transaction hash. Ensure that the test correctly handles the case where a transaction does not exist and that the error handling is appropriate. * 358-362: Testing of `getTxByHash` with an incorrect hash format. Ensure that the test correctly handles the case of an incorrect hash format and that the error handling is appropriate. * 366-376: Testing of `getTxByHashBytes` with a specific hash. Ensure that the test correctly handles the retrieval process and that the error handling is appropriate for cases where the transaction does not exist.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the contract deployment process echo "Verify the contract deployment process including wasmClient.upload and wasmClient.instantiate works as expected."Length of output: 234
Script:
#!/bin/bash # Search for references to wasmClient.upload and wasmClient.instantiate in the codebase echo "Searching for references to wasmClient.upload and wasmClient.instantiate..." rg "wasmClient\.upload" || echo "No references to wasmClient.upload found." rg "wasmClient\.instantiate" || echo "No references to wasmClient.instantiate found."Length of output: 392
Verification successful
The provided script output does not offer any information regarding the actual implementation or behavior of the
getTxByHashBytes
method within theNibiruQuerier
class, nor does it provide insight into the error handling mechanisms in place for scenarios where a transaction does not exist. To verify the review comment, we need to examine the implementation ofgetTxByHashBytes
and any associated error handling logic directly within the codebase.Given the lack of direct information from the script output, the next step is to generate a new script that will help us inspect the implementation of
getTxByHashBytes
and its error handling. This involves searching the codebase for the method definition and any relevant tests that might illustrate how errors are managed.
The output from the executed scripts provides the necessary context to verify the review comment regarding the
getTxByHashBytes
method in theNibiruQuerier
class and its associated test.Observations from the Script Output
Implementation of
getTxByHashBytes
: The method is designed to query a transaction using its SHA-256 hash in byte format. It usesResult.ofSafeExecAsync
to execute the query asynchronously, which suggests that error handling is built into the method's execution flow. The method converts the byte array to a hex format for validation before making the request, indicating an upfront error handling mechanism for format validation.Test for
getTxByHashBytes
: The test case provided in the output attempts to query a transaction using a specific hash byte array. The expectation set in the test (expect(result.isErr()).toEqual(true)
) checks for an error result, which implies that the test is specifically designed to handle scenarios where the transaction does not exist or another error occurs during the retrieval process.Conclusion
Based on the provided context, the implementation of
getTxByHashBytes
includes upfront validation for the hash format and utilizes a safe execution pattern for asynchronous operations, which inherently supports error handling. The associated test case explicitly checks for an error result, demonstrating that the test is designed to verify both the retrieval process and the appropriate handling of errors, such as when a transaction does not exist.Given this information, the review comment concerning the testing of
getTxByHashBytes
with a specific hash and ensuring that the test correctly handles the retrieval process and error handling for cases where the transaction does not exist is supported by the evidence from the codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the retrieval process and error handling in getTxByHashBytes test echo "Verify the retrieval process and error handling in getTxByHashBytes test is appropriate."Length of output: 186
Script:
#!/bin/bash # Search for the implementation of getTxByHashBytes in the NibiruQuerier class rg "getTxByHashBytes" --context 5 # Additionally, search for any tests related to getTxByHashBytes to understand how error handling is tested rg "getTxByHashBytes" -t ts --context 5Length of output: 3349
src/gql/heart-monitor/heart-monitor.ts (7)
- 85-187: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [39-106]
Reorganized imports and added new entities. Ensure all imported entities are used within the file and that the new entities (
GQLFeatureFlags
,GQLInflationDistribution
,GQLInflationInfo
) are correctly integrated.
- 114-114: The method
communityPool
uses partial types for arguments and fields. Confirm that this usage aligns with the intended flexibility and type safety of the method's implementation.Verification successful
The usage of partial types in the
communityPool
method, as observed from the method's implementation and its call pattern, aligns with the intended flexibility and type safety of the method's design. This suggests that the method is designed to accept a subset of arguments based on varying requirements, justifying the use ofPartial
for its parameters. Without direct access to theGQLQueryGqlCommunityPoolArgs
definition, the conclusion is based on the available context, which supports the use of partial types as intended for the method's functionality.* 128-130: Added `featureFlags` method without argument but with optional partial fields. Ensure that the implementation correctly handles the retrieval of feature flags without requiring arguments.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the usage of partial types in communityPool method echo "Verify the usage of partial types in communityPool method aligns with intended flexibility and type safety."Length of output: 224
Script:
#!/bin/bash # Find and display the definition of GQLQueryGqlCommunityPoolArgs echo "Definition of GQLQueryGqlCommunityPoolArgs:" fd "GQLQueryGqlCommunityPoolArgs.ts" --exec cat {} # Search for the implementation of the communityPool method echo -e "\nImplementation of communityPool method:" fd "heart-monitor.ts" --exec grep -A 10 -B 3 "communityPool(" {} # Optionally, identify calls to communityPool to see how arguments are passed echo -e "\nCalls to communityPool method:" fd ".ts" --exec grep "communityPool(" {}Length of output: 1091
Verification successful
The provided script output reveals the implementation of the
featureFlags
method within theheart-monitor.ts
file. The method signature indicates that it accepts an optional parameterfields
of typePartial<GQLFeatureFlags>
, and it returns aPromise<GqlOutFeatureFlags>
. The implementation of the method shows that it indeed handles calls without arguments by making thefields
parameter optional. This aligns with the review comment's concern about ensuring the method can retrieve feature flags without requiring arguments.Based on the script output, the
featureFlags
method is designed to handle optional arguments correctly, as it is implemented with an optionalfields
parameter. This means the method can be called without any arguments, and the implementation will still proceed as intended, likely using default behavior or fetching all available feature flags when no specific fields are provided.Given this information, it can be concluded that the implementation of the
featureFlags
method in theheart-monitor.ts
file correctly handles the retrieval of feature flags without requiring arguments, as per the review comment's verification request.* 142-145: Added `inflation` method with partial arguments and fields. Confirm that the implementation correctly handles the retrieval of inflation data with the flexibility provided by partial types. * 285-285: Usage of partial types in `communityPool` method. Confirm that the partial types are correctly applied and provide the intended flexibility for the method's arguments and fields. * 299-300: Implementation of `featureFlags` method. Ensure that the method correctly retrieves feature flags data without requiring arguments and handles optional partial fields appropriately.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the implementation of featureFlags method echo "Verify the implementation of featureFlags method correctly handles retrieval without requiring arguments."Length of output: 220
Script:
#!/bin/bash # Search for the implementation of the `featureFlags` method in `heart-monitor.ts` and display its content fd heart-monitor.ts --exec cat {} \; | grep -A 10 'featureFlags'Length of output: 1051
Verification successful
The output from the scripts provides valuable insights into the implementation and testing of the
featureFlags
method within theheart-monitor.ts
file and its corresponding test fileheart-monitor.test.ts
.
Implementation in
heart-monitor.ts
: The methodfeatureFlags
is defined as an asynchronous function that optionally accepts an argumentfields
of typePartial<GQLFeatureFlags>
. This aligns with the requirement for the method to handle optional partial fields appropriately. The method then calls anotherfeatureFlags
function, passingthis.gqlEndpt
and thefields
argument to it. This suggests that the method is designed to retrieve feature flags data, potentially from a GraphQL endpoint, and it is implemented to work correctly without requiring thefields
argument, as it is optional.Usage in
heart-monitor.test.ts
: The test file contains a test for thefeatureFlags
method, indicating that it is indeed tested with different scenarios. One test case explicitly callsheartMonitor.featureFlags(fields)
with an argument, and the expectation is set to check for a property"featureFlags"
, suggesting that the method's functionality, including its handling of arguments, is covered by tests.Given this information, it can be concluded that the
featureFlags
method inheart-monitor.ts
is implemented to correctly retrieve feature flags data without requiring arguments and handles optional partial fields appropriately. The presence of tests inheart-monitor.test.ts
further supports that the method's behavior aligns with the expectations outlined in the review comment.Based on the evidence gathered from the codebase, the implementation of the
featureFlags
method meets the criteria mentioned in the review comment.* 310-311: Implementation of `inflation` method with partial arguments. Confirm that the method correctly handles the retrieval of inflation data with the flexibility provided by partial types.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the correct retrieval of feature flags data in featureFlags method echo "Verify the featureFlags method correctly retrieves data without requiring arguments and handles optional partial fields appropriately."Length of output: 278
Script:
#!/bin/bash # Search for the definition of the `featureFlags` method to understand its implementation ast-grep --lang typescript --pattern $'class $_ { $$$ featureFlags($_) { $$$ } $$$ }' # Search for usage instances of the `featureFlags` method to see how it's called rg "featureFlags\(" -A 2 -B 2Length of output: 1152
Verification successful
The provided script output reveals the implementation of the
inflation
method within theheart-monitor.ts
file. The method signature indicates that it acceptsargs
as aPartial<QueryInflationArgs>
andfields
as an optionalPartial<InflationFields>
. The method then calls another function,inflation
, passingargs
andfields
along withthis.gqlEndpt
as arguments.This implementation confirms that the
inflation
method is designed to handle partial arguments for retrieving inflation data, leveraging the flexibility provided by TypeScript'sPartial
type. The method's structure allows for optional parameters to be passed, accommodating various query needs without requiring a full set of arguments. This approach is consistent with GraphQL's flexibility and the description provided in the review comment.Given the information extracted, it can be concluded that the
inflation
method correctly handles the retrieval of inflation data with the flexibility provided by partial types, as it is designed to accept partial arguments and pass them to another function that presumably handles the data fetching logic.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Confirm the correct retrieval of inflation data in inflation method echo "Verify the inflation method correctly handles retrieval with the flexibility provided by partial types."Length of output: 216
Script:
#!/bin/bash # Search for the implementation of the `inflation` method in the `heart-monitor.ts` file rg "inflation = async" src/gql/heart-monitor/heart-monitor.tsLength of output: 85
Script:
#!/bin/bash # Attempt to extract more context around the `inflation` method implementation rg -C 20 "inflation = async" src/gql/heart-monitor/heart-monitor.tsLength of output: 1482
src/gql/heart-monitor/heart-monitor.test.ts (4)
- 311-322: Ensure that the
testInflation
function correctly handles cases whereinflation
data might be missing or incomplete. Consider adding null checks or default values to prevent runtime errors.- 264-275: For the
testIbc
function, verify that the conditional inclusion of"ibcChannels"
in thecheckFields
call accurately reflects the expected behavior and data structure of theibc
response.- 189-204: The tests for
featureFlags
,ibc
, andinflation
are refactored. Ensure that these tests cover all relevant cases and edge conditions, especially considering the dynamic nature of feature flags and the complexity of IBC and inflation data.Also applies to: 264-309, 311-341
- 86-98: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-95]
The import section is significantly expanded with new entities related to
Inflation
,QueryInflationArgs
,GQLFeatureFlags
, and their defaults. Ensure that all imported entities are used within the file to avoid unnecessary imports which can lead to increased bundle size and confusion.Verification successful
The grep command output confirms that the newly imported entities related to
Inflation
,QueryInflationArgs
,GQLFeatureFlags
, and their defaults (defaultInflationInfo
,defaultInflationDistribution
,defaultFeatureFlags
) are indeed utilized within theheart-monitor.test.ts
file. This indicates that the imports are not unnecessary and serve a purpose within the file, addressing the concern raised in the review comment about potential unused imports leading to increased bundle size and confusion.Based on this evidence, the review comment suggesting to verify the usage of newly imported entities has been addressed, and it is confirmed that these entities are used within the file.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that all newly imported entities are utilized within the file. grep -E 'InflationFields|QueryInflationArgs|defaultInflationInfo|defaultInflationDistribution|GQLFeatureFlags|defaultFeatureFlags' src/gql/heart-monitor/heart-monitor.test.tsLength of output: 570
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
package.json
is excluded by:!**/*.json
Files selected for processing (1)
- src/gql/heart-monitor/heart-monitor.test.ts (6 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/gql/heart-monitor/heart-monitor.test.ts
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- .github/workflows/test-ts-sdk.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- .github/workflows/test-ts-sdk.yaml
Only thing failing is quality gate |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (12)
- src/gql/graphql-codegen/codegen-loader.js (1 hunks)
- src/gql/heart-monitor/heart-monitor.test.ts (7 hunks)
- src/gql/heart-monitor/heart-monitor.ts (4 hunks)
- src/gql/index.ts (1 hunks)
- src/gql/mutation/index.ts (1 hunks)
- src/gql/mutation/marketing.ts (1 hunks)
- src/gql/query/communityPool.ts (1 hunks)
- src/gql/query/index.ts (1 hunks)
- src/gql/query/marketing.ts (1 hunks)
- src/gql/utils/consts.ts (4 hunks)
- src/gql/utils/defaultObjects.ts (6 hunks)
- src/sdk/tx/txClient.test.ts (5 hunks)
Files skipped from review as they are similar to previous changes (4)
- src/gql/graphql-codegen/codegen-loader.js
- src/gql/heart-monitor/heart-monitor.ts
- src/gql/query/communityPool.ts
- src/sdk/tx/txClient.test.ts
Additional comments: 27
src/gql/mutation/index.ts (1)
- 1-1: Exporting from
./marketing
is approved.src/gql/index.ts (1)
- 8-8: Exporting from
./mutation/index
is approved.src/gql/query/index.ts (1)
- 8-12: Exporting new modules
featureFlags
,inflation
, andmarketing
is approved.src/gql/mutation/marketing.ts (5)
- 1-9: Imports are correctly organized and relevant to the functionality provided in this file.
- 11-13: Type definition for
MutationMarketingArgs
is correctly structured.- 15-17: Interface
GqlOutMarketingMutation
is correctly defined.- 19-32: Function
marketingMutationString
is correctly implemented, ensuring flexibility with partial types and proper conversion of objects to strings.- 34-39: Function
marketingMutation
is correctly implemented, making use ofmarketingMutationString
for query construction.src/gql/utils/consts.ts (2)
- 100-101: Parameters
excludeParentObject
andisMutation
ingqlQuery
function are correctly utilized to construct the query string conditionally.- 119-119: The conditional inclusion of parentheses around query arguments based on their presence is correctly implemented.
src/gql/query/marketing.ts (6)
- 1-19: Imports are correctly organized and relevant to the functionality provided in this file.
- 21-26: Type definition for
QueryMarketingArgs
is correctly structured.- 28-30: Interface
GqlOutMarketingQuery
is correctly defined.- 32-38: Type definition for
MarketingFields
is correctly structured, allowing for partial specification of fields.- 40-153: Function
marketingQueryString
is correctly implemented, ensuring flexibility with partial types and proper conversion of objects to strings. The handling of default objects when specific fields are not provided is correctly done.- 155-165: Function
marketingQuery
is correctly implemented, making use ofmarketingQueryString
for query construction.src/gql/utils/defaultObjects.ts (7)
- 5-5: SKIP: Past comment on missing import for
GQLFeatureFlags
is still valid.- 14-15: SKIP: Past comment on missing import for
GQLInflationDistribution
andGQLInflationInfo
is still valid.- 77-77: SKIP: Past comment on incorrect enum value assignment for
GQLValidatorStatus.GQLUnbonded
is still valid.- 422-429: SKIP: Past comment on missing type annotations for properties in
defaultInflationDistribution
is still valid.- 431-436: SKIP: Past comment on missing type annotations for properties in
defaultInflationInfo
is still valid.- 438-444: SKIP: Past comment on missing type annotations for properties in
defaultFeatureFlags
is still valid.- 447-480: Definition of default objects for new entities such as
GQLTwitterUser
,GQLTweet
,GQLRetweet
,GQLLike
, andGQLTask
is approved. These objects are correctly structured and provide a comprehensive default state for their respective types.src/gql/heart-monitor/heart-monitor.test.ts (4)
- 89-102: The addition of new entities related to
Inflation
,QueryInflationArgs
,GQLFeatureFlags
,MarketingFields
, and their defaults is acknowledged. Ensure corresponding tests cover these new entities adequately to validate their integration and functionality.- 196-212: The
testFeatureFlags
function correctly tests the feature flags functionality. However, ensure that the test coverage fordefaultFeatureFlags
is comprehensive, covering all possible flag states and their impacts on the system's behavior.- 318-348: The
testInflation
function implementation is correct. It's important to verify that the test cases fordefaultInflationInfo
anddefaultInflationDistribution
thoroughly assess the inflation functionality, including edge cases and error handling.- 470-532: The
testMarketing
function tests the marketing query functionality. Ensure that the tests fordefaultTwitterUser
,defaultTweet
,defaultRetweet
,defaultLike
, anddefaultTask
are comprehensive, covering various scenarios and edge cases to validate the marketing features thoroughly.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- src/gql/heart-monitor/heart-monitor.test.ts (7 hunks)
- src/gql/index.ts (1 hunks)
- src/gql/mutation/index.ts (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- src/gql/heart-monitor/heart-monitor.test.ts
- src/gql/index.ts
- src/gql/mutation/index.ts
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/gql/heart-monitor/heart-monitor.test.ts (7 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/gql/heart-monitor/heart-monitor.test.ts
GQL is failing, see test |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/gql/heart-monitor/heart-monitor.test.ts (7 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/gql/heart-monitor/heart-monitor.test.ts
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- src/gql/heart-monitor/heart-monitor.test.ts (9 hunks)
- src/gql/heart-monitor/heart-monitor.ts (4 hunks)
- src/gql/query/featureFlags.ts (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- src/gql/heart-monitor/heart-monitor.test.ts
- src/gql/heart-monitor/heart-monitor.ts
- src/gql/query/featureFlags.ts
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- jest.config.ts (1 hunks)
- src/gql/heart-monitor/heart-monitor.test.ts (9 hunks)
- src/gql/query/marketing.ts (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- jest.config.ts
- src/gql/heart-monitor/heart-monitor.test.ts
- src/gql/query/marketing.ts
Failure is on sonarqube quality gate, but good to merge |
## [3.0.0](v2.0.1...v3.0.0) (2024-02-05) ### Bug Fixes * fix merge ([4f93be8](4f93be8)) * gql where args ([#298](#298)) ([b57ef0a](b57ef0a)) * more file reorg ([#300](#300)) ([d6a053a](d6a053a)) ### Miscellaneous Chores * pr title lint workflow ([#293](#293)) ([b5dd050](b5dd050)) ### Code Refactors * tests ([#301](#301)) ([e14b83b](e14b83b)) [skip ci]
🎉 This PR is included in version 3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Tests, partials, inflation, marketing(query and mutation) and featureflags
Uses make chaosnet
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Chores