Skip to content
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/network refactoring from master to dev #320

Merged
merged 9 commits into from
Apr 19, 2024

Conversation

aarmoa
Copy link
Collaborator

@aarmoa aarmoa commented Apr 19, 2024

Summary by CodeRabbit

  • New Features
    • Introduced new methods for creating specific grpc channels in the Network class.
  • Refactor
    • Deprecated the use_secure_connection and credentials parameters in the Network and AsyncClient classes respectively.
  • Security Updates
    • Updated aiohttp dependency to address a security vulnerability.
  • Tests
    • Added tests to verify deprecation warnings for outdated parameters in the Network and AsyncClient classes.
  • Documentation
    • Updated changelog to reflect new changes and deprecations in version 1.5.0 and 1.4.2.
  • Chores
    • Updated project version in preparation for new release.

Copy link
Contributor

coderabbitai bot commented Apr 19, 2024

Walkthrough

The recent updates focus on enhancing security and flexibility by refactoring the Network class for mixed secure and insecure endpoints and updating dependency versions. Additionally, deprecations in the AsyncClient and Network classes aim to streamline the API and improve maintainability. New test cases ensure these changes are well-documented and warn users of deprecated functionalities.

Changes

File Path Change Summary
CHANGELOG.md Added details on refactoring of the Network class and updated aiohttp dependency.
pyinjective/.../async_client.py Deprecated credentials parameter in AsyncClient; replaced with network object methods for gRPC channel creation. Added deprecation warnings.
pyinjective/core/network.py Deprecated use_secure_connection in Network; added methods for creating specific grpc channels.
pyproject.toml Updated version number from "1.5.0-pre" to "1.6.0-pre".
tests/.../test_network_deprecation_warnings.py
tests/test_async_client_deprecation_warnings.py
Introduced tests for deprecation warnings in Network and AsyncClient.

Poem

🐇 "Hoppity hop, the code does change,
🌟 From secure links to settings strange.
With each commit, we refine our craft,
🛠️ Deprecations forewarned, with no gaffe.
In the burrows of code, where tests do play,
We ensure our software's brighter day." 🌼


Recent Review Details

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 72407b4 and 79a4eb3.
Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • pyinjective/async_client.py (5 hunks)
  • pyinjective/core/network.py (12 hunks)
  • pyproject.toml (1 hunks)
  • tests/core/test_network_deprecation_warnings.py (1 hunks)
  • tests/test_async_client_deprecation_warnings.py (3 hunks)
Files not reviewed due to errors (2)
  • test_network_deprecation_warnings.py (no review received)
  • test_async_client_deprecation_warnings.py (no review received)
Files skipped from review due to trivial changes (1)
  • pyproject.toml
Additional Context Used
LanguageTool (141)
CHANGELOG.md (141)

Near line 6: Possible typo: you repeated a word
Context: ...this file. ## [1.6.0] - 9999-99-99 ### Added - Added support for all queries in the chain 't...


Near line 7: Possible spelling mistake found.
Context: ...d support for all queries in the chain 'tendermint' module - Added support for all queries...


Near line 20: Possible spelling mistake found.
Context: ...4.2] - 2024-03-19 ### Changed - Updated aiohttp dependency version to ">=3.9.2" to sol...


Near line 27: Possible typo: you repeated a word
Context: ...ed methods ## [1.4.0] - 2024-03-11 ### Added - Added support for all queries and messages in...


Near line 30: Possible spelling mistake found.
Context: ...in the chain 'exchange' module - Use of python-dotenv in all example scripts to load private ...


Near line 38: Possible spelling mistake found.
Context: ...3.0] - 2024-02-12 ### Changed - Removed asyncio from the dependencies ## [1.2.0] - 20...


Near line 48: Possible spelling mistake found.
Context: ...Changed - Updated the logic to create a MsgLiquidatePosition message ## [1.1.0] - 2024-01-15 ### A...


Near line 51: Possible typo: you repeated a word
Context: ...n` message ## [1.1.0] - 2024-01-15 ### Added - Added new functions in all Market classes to ...


Near line 60: Possible typo: you repeated a word
Context: ...ion files ## [1.0.1] - 2024-01-08 ### Added - Added low level API components for all module...


Near line 61: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... [1.0.1] - 2024-01-08 ### Added - Added low level API components for all modules (chain, ...


Near line 61: Possible spelling mistake found.
Context: ... API components for all modules (chain, exchain and explorer) to make the Python SDK co...


Near line 62: Possible spelling mistake found.
Context: ...TypeScript SDK. - Added support for all wasm module messages. - Added support for al...


Near line 67: Possible spelling mistake found.
Context: ...dexer v1.12.72 - Added new functions in AsyncClient to interact with chain, exchange and ex...


Near line 67: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... chain, exchange and explorer using the low level API components - Marked old function si...


Near line 68: Possible spelling mistake found.
Context: ...PI components - Marked old function sin AsyncClient as deprecated (the functions will be re...


Near line 69: Possible spelling mistake found.
Context: ...Updated all API examples to use the new AsyncClient functions ## [1.0] - 2023-11-01 ### Ad...


Near line 72: Possible typo: you repeated a word
Context: ...nt functions ## [1.0] - 2023-11-01 ### Added - Added logic to support use of Client Order ID...


Near line 73: Possible spelling mistake found.
Context: ...Client Order ID (CID) new identifier in OrderInfo - New chain stream support ### Changed...


Near line 77: Possible spelling mistake found.
Context: ... - Remove support for sentry nodes in mainnet network. The only supported node option...


Near line 77: Possible spelling mistake found.
Context: ...work. The only supported node option in mainnet is lb - Migrated all proto objects de...


Near line 78: Only proper nouns start with an uppercase character (there are exceptions for headlines).
Context: ...ported node option in mainnet is lb - Migrated all proto objects dependency to support...


Near line 80: Possible spelling mistake found.
Context: ...e to its own CHANGELOG.md file - Remove aiocron dependency. Use plain asyncio tasks to...


Near line 80: Possible spelling mistake found.
Context: ... Remove aiocron dependency. Use plain asyncio tasks to solve the timeout height synch...


Near line 82: Possible spelling mistake found.
Context: ...n in all examples - Refactored logic in AsyncClient to load markets and tokens, to ensure t...


Near line 82: Possible spelling mistake found.
Context: ... are no duplicated tokens with the same denom ## [0.9.12] * Synchronized markets and...


Near line 85: Possible spelling mistake found.
Context: ...ets and tokens config files to add KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and n...


Near line 85: Possible spelling mistake found.
Context: ...ens config files to add KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spo...


Near line 85: Possible spelling mistake found.
Context: ...onfig files to add KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot market...


Near line 85: Possible spelling mistake found.
Context: ...iles to add KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot markets #...


Near line 85: Possible spelling mistake found.
Context: ... KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot markets ## [0.9.11] ...


Near line 85: Possible spelling mistake found.
Context: ...J, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot markets ## [0.9.11] * Synchro...


Near line 85: Possible spelling mistake found.
Context: ...NJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot markets ## [0.9.11] * Synchronize...


Near line 88: Possible spelling mistake found.
Context: ... markets and tokens config files to add SEI/USDT and TIA/USDT perpetual markets ##...


Near line 94: Possible spelling mistake found.
Context: ... markets and tokens config files to add USDY/USDT and WHALE/USDT spot markets ## [0...


Near line 97: Possible spelling mistake found.
Context: ... markets and tokens config files to add PYTH/USDT spot market ## [0.9.7] * Added PY...


Near line 100: Possible spelling mistake found.
Context: ...TH/USDT spot market ## [0.9.7] * Added PYTH/USDT PERP market info in mainnet metada...


Near line 100: Possible spelling mistake found.
Context: ...] * Added PYTH/USDT PERP market info in mainnet metadata ini file ## [0.9.6] * Synchro...


Near line 100: Possible spelling mistake found.
Context: ...DT PERP market info in mainnet metadata ini file ## [0.9.6] * Synchronized denom i...


Near line 103: Possible spelling mistake found.
Context: ...ata ini file ## [0.9.6] * Synchronized denom ini files with Indexer information for ...


Near line 103: Possible spelling mistake found.
Context: ...i file ## [0.9.6] * Synchronized denom ini files with Indexer information for main...


Near line 103: Possible spelling mistake found.
Context: ... ini files with Indexer information for mainnet, testnet and devnet to include TALIS/IN...


Near line 103: Possible spelling mistake found.
Context: ...s with Indexer information for mainnet, testnet and devnet to include TALIS/INJ and KUJ...


Near line 103: Possible spelling mistake found.
Context: ...er information for mainnet, testnet and devnet to include TALIS/INJ and KUJI/USDT mark...


Near line 103: Possible spelling mistake found.
Context: ... mainnet, testnet and devnet to include TALIS/INJ and KUJI/USDT markets ## [0.9.5] *...


Near line 103: Possible spelling mistake found.
Context: ...et, testnet and devnet to include TALIS/INJ and KUJI/USDT markets ## [0.9.5] * Upd...


Near line 103: Possible spelling mistake found.
Context: ...net and devnet to include TALIS/INJ and KUJI/USDT markets ## [0.9.5] * Updated fetc...


Near line 106: Possible spelling mistake found.
Context: ...d fetch_metadata script (to synchronize denom ini files) to reuse logic in AsyncClien...


Near line 106: Possible spelling mistake found.
Context: ...h_metadata script (to synchronize denom ini files) to reuse logic in AsyncClient * ...


Near line 106: Possible spelling mistake found.
Context: ...nize denom ini files) to reuse logic in AsyncClient * Synchronized denom ini files with Ind...


Near line 107: Possible spelling mistake found.
Context: ...use logic in AsyncClient * Synchronized denom ini files with Indexer information for ...


Near line 107: Possible spelling mistake found.
Context: ...gic in AsyncClient * Synchronized denom ini files with Indexer information for main...


Near line 107: Possible spelling mistake found.
Context: ... ini files with Indexer information for mainnet, testnet and devnet ## [0.9.4] * Added...


Near line 107: Possible spelling mistake found.
Context: ...s with Indexer information for mainnet, testnet and devnet ## [0.9.4] * Added TIA/USDT...


Near line 107: Possible spelling mistake found.
Context: ...er information for mainnet, testnet and devnet ## [0.9.4] * Added TIA/USDT spot marke...


Near line 110: Possible spelling mistake found.
Context: ...[0.9.4] * Added TIA/USDT spot market in mainnet and testnet ini file ## [0.9.3] * Upda...


Near line 110: Possible spelling mistake found.
Context: ...ded TIA/USDT spot market in mainnet and testnet ini file ## [0.9.3] * Updated TIA/USDT...


Near line 110: Possible spelling mistake found.
Context: ...USDT spot market in mainnet and testnet ini file ## [0.9.3] * Updated TIA/USDT-30N...


Near line 113: This abbreviation for “identification” is spelled all-uppercase.
Context: ....3] * Updated TIA/USDT-30NOV2023 market id in denoms_mainnet.ini file ## [0.9.2] ...


Near line 113: Possible spelling mistake found.
Context: ...Updated TIA/USDT-30NOV2023 market id in denoms_mainnet.ini file ## [0.9.2] * Added fi...


Near line 116: Possible spelling mistake found.
Context: ...ini file ## [0.9.2] * Added fix to the grpc import error in Mac with M1 and M2 chip...


Near line 119: Possible spelling mistake found.
Context: ... ## [0.9.1] * Added new spot markets in mainnet ini file: KAVA/USDT, USDTkv/USDT * Adde...


Near line 119: Possible spelling mistake found.
Context: ....1] * Added new spot markets in mainnet ini file: KAVA/USDT, USDTkv/USDT * Added ne...


Near line 119: Possible spelling mistake found.
Context: ...d new spot markets in mainnet ini file: KAVA/USDT, USDTkv/USDT * Added new derivativ...


Near line 119: Possible spelling mistake found.
Context: ...markets in mainnet ini file: KAVA/USDT, USDTkv/USDT * Added new derivative markets in ...


Near line 120: Possible spelling mistake found.
Context: .../USDT * Added new derivative markets in mainnet ini file: TIA/USDT-30NOV2023, AXL/USDT,...


Near line 120: Possible spelling mistake found.
Context: ...Added new derivative markets in mainnet ini file: TIA/USDT-30NOV2023, AXL/USDT, BTC...


Near line 120: Possible spelling mistake found.
Context: ...file: TIA/USDT-30NOV2023, AXL/USDT, BTC/USDTkv, ETH/USDTkv ## [0.9.0] * Improvement i...


Near line 120: Possible spelling mistake found.
Context: ...DT-30NOV2023, AXL/USDT, BTC/USDTkv, ETH/USDTkv ## [0.9.0] * Improvement in broadcaste...


Near line 124: Possible spelling mistake found.
Context: ...out height only when required * Replace Pipenv with Poetry * Add pre-commit validation...


Near line 130: Possible spelling mistake found.
Context: ...verage for each PR ## [0.8.5] * Added NEOK/USDT and ORAI/USDT spot markets to the ...


Near line 130: Possible spelling mistake found.
Context: ...h PR ## [0.8.5] * Added NEOK/USDT and ORAI/USDT spot markets to the mainnet .ini f...


Near line 130: Possible spelling mistake found.
Context: .../USDT and ORAI/USDT spot markets to the mainnet .ini file ## [0.8.4] * Added methods t...


Near line 133: Possible spelling mistake found.
Context: ...ini file ## [0.8.4] * Added methods to SpotMarket, DerivativeMarket and BianaryOptionMark...


Near line 133: Possible spelling mistake found.
Context: ... [0.8.4] * Added methods to SpotMarket, DerivativeMarket and BianaryOptionMarket to translate ch...


Near line 133: Possible spelling mistake found.
Context: ...ods to SpotMarket, DerivativeMarket and BianaryOptionMarket to translate chain prices and quantitie...


Near line 142: Only proper nouns start with an uppercase character (there are exceptions for headlines).
Context: ...ecure or insecure connection inside the Network class. The AsyncClient's insecure par...


Near line 142: Possible spelling mistake found.
Context: ...onnection inside the Network class. The AsyncClient's insecure parameter is no longer use...


Near line 143: Possible spelling mistake found.
Context: ...ced bare-metal node the default one for mainnet (it is called lb). The legacy one (lo...


Near line 147: Possible spelling mistake found.
Context: ...loads the required information from the Denoms used in previous versions * Change in A...


Near line 148: Possible spelling mistake found.
Context: ...s used in previous versions * Change in AsyncClient to be able to create Composer instances...


Near line 149: Possible spelling mistake found.
Context: ... to create Composer instances using the AsyncClient * Added new nodes (bare-metal load bala...


Near line 150: Possible spelling mistake found.
Context: ...s (bare-metal load balancing nodes) for mainnet and testnet * Deprecated the kubernetes...


Near line 150: Possible spelling mistake found.
Context: ...l load balancing nodes) for mainnet and testnet * Deprecated the kubernetes load balanc...


Near line 151: Possible spelling mistake found.
Context: ...or mainnet and testnet * Deprecated the kubernetes load balanced nodes for testnet * Refac...


Near line 151: Possible spelling mistake found.
Context: ... the kubernetes load balanced nodes for testnet * Refactored the cookies management log...


Near line 152: An apostrophe may be missing.
Context: ...nced nodes for testnet * Refactored the cookies management logic into a cookie assistan...


Near line 153: Only proper nouns start with an uppercase character (there are exceptions for headlines).
Context: ...at for bare-metal load balanced nodes * Removed class Client. The only supported now is...


Near line 153: Possible spelling mistake found.
Context: ...pported now is the async version called AsyncClient. ## [0.7.1.1] * Fixed Testnet network ...


Near line 156: Possible spelling mistake found.
Context: ...lled AsyncClient. ## [0.7.1.1] * Fixed Testnet network URLs ## [0.7.2.1] * Synchroniz...


Near line 159: Possible spelling mistake found.
Context: ...URLs ## [0.7.2.1] * Synchronization of denoms configuration files. ## [0.7.2] * Adde...


Near line 162: Possible spelling mistake found.
Context: ...ded a new gas limit calculation for the TransactionBroadcaster that estimates the value based on the m...


Near line 165: Possible spelling mistake found.
Context: ...action simulation). ## [0.7.1.2] * Add NBLA ## [0.7.1.1] * Fixed Testnet network U...


Near line 168: Possible spelling mistake found.
Context: ...7.1.2] * Add NBLA ## [0.7.1.1] * Fixed Testnet network URLs ## [0.7.1] * Include impl...


Near line 171: Possible spelling mistake found.
Context: ...[0.7.1] * Include implementation of the TransactionBroadcaster, to simplify the transaction creation a...


Near line 174: Possible spelling mistake found.
Context: ...oadcasting process. ## [0.7.0.6] * ADD SEI/USDT in metadata ## [0.7.0.5] * Added ...


Near line 177: Possible spelling mistake found.
Context: ....0.5] * Added the required logic in the MsgSubaccountTransfer message to translate amounts and token ...


Near line 180: Possible spelling mistake found.
Context: ...4] * Synchronized decimals for ATOM and WETH in Testnet with the configuration provi...


Near line 180: Possible spelling mistake found.
Context: ...chronized decimals for ATOM and WETH in Testnet with the configuration provided by the ...


Near line 183: Possible spelling mistake found.
Context: ...ided by the indexer ## [0.7.0.3] * Add FRCOIN testnet ## [0.7.0.2] * Removed from As...


Near line 183: Possible spelling mistake found.
Context: ... the indexer ## [0.7.0.3] * Add FRCOIN testnet ## [0.7.0.2] * Removed from AsyncClien...


Near line 186: Possible spelling mistake found.
Context: ...IN testnet ## [0.7.0.2] * Removed from AsyncClient all references to the deprecated OrderB...


Near line 186: Possible spelling mistake found.
Context: ...Client all references to the deprecated OrderBook RPC endpoints (replaced them with Order...


Near line 187: Possible spelling mistake found.
Context: ...ed them with OrderBookV2) * Updated all orderbook examples ## [0.7] * Removed references...


Near line 194: Possible spelling mistake found.
Context: ...emoved k8s from the list of supported mainnet nodes (lb should be used instead) ##...


Near line 199: Possible spelling mistake found.
Context: ...rders for more than one market_id * Add pytest as a development dependency to impleme...


Near line 211: Possible spelling mistake found.
Context: ...## [0.6.2.1] * Remove version deps from Pipfile ## [0.6.2.0] * Add MsgUnderwrite, MsgR...


Near line 214: Possible spelling mistake found.
Context: ...n deps from Pipfile ## [0.6.2.0] * Add MsgUnderwrite, MsgRequestRedemption in Composer ## [...


Near line 214: Possible spelling mistake found.
Context: ...file ## [0.6.2.0] * Add MsgUnderwrite, MsgRequestRedemption in Composer ## [0.6.1.8] * Add MsgCrea...


Near line 217: Possible spelling mistake found.
Context: ...emption in Composer ## [0.6.1.8] * Add MsgCreateInsuranceFund in Composer * Re-gen mainnet denoms ##...


Near line 218: Possible spelling mistake found.
Context: ...reateInsuranceFund in Composer * Re-gen mainnet denoms ## [0.6.1.5] * Add MsgExecuteCo...


Near line 218: Possible spelling mistake found.
Context: ...uranceFund in Composer * Re-gen mainnet denoms ## [0.6.1.5] * Add MsgExecuteContract ...


Near line 221: Possible spelling mistake found.
Context: ...-gen mainnet denoms ## [0.6.1.5] * Add MsgExecuteContract in Composer ## [0.6.1.4] * Add wMATIC ...


Near line 224: Possible spelling mistake found.
Context: ...ontract in Composer ## [0.6.1.4] * Add wMATIC ## [0.6.1.2] * Add OrderbookV2 method ...


Near line 237: Possible spelling mistake found.
Context: ...ault * Proto re-gen ## [0.6.0.8] * Add USDCfr ## [0.6.0.7] * Add LDO ## [0.6.0.6] *...


Near line 240: Possible spelling mistake found.
Context: ...6.0.8] * Add USDCfr ## [0.6.0.7] * Add LDO ## [0.6.0.6] * Set default testnet end...


Near line 243: Possible spelling mistake found.
Context: ...] * Add LDO ## [0.6.0.6] * Set default testnet endpoints to K8S * Remove LB config for...


Near line 244: Possible spelling mistake found.
Context: ...endpoints to K8S * Remove LB config for testnet * Fix relative imports in composer * Ad...


Near line 246: Possible spelling mistake found.
Context: ... Fix relative imports in composer * Add AccountPortfolio & StreamAccountPortfolio ## [0.6.0.5] ...


Near line 246: Possible spelling mistake found.
Context: ...ts in composer * Add AccountPortfolio & StreamAccountPortfolio ## [0.6.0.5] * Add new testnet endpoin...


Near line 249: Possible spelling mistake found.
Context: ...ccountPortfolio ## [0.6.0.5] * Add new testnet endpoints * Re-gen mainnet denoms ## [...


Near line 250: Possible spelling mistake found.
Context: ...5] * Add new testnet endpoints * Re-gen mainnet denoms ## [0.6.0.4] * Remove explicit ...


Near line 250: Possible spelling mistake found.
Context: ... new testnet endpoints * Re-gen mainnet denoms ## [0.6.0.4] * Remove explicit version...


Near line 253: Possible spelling mistake found.
Context: ....6.0.4] * Remove explicit versions from protobuf and grpcio-tools dependencies ## [0.6....


Near line 253: Possible spelling mistake found.
Context: ...ove explicit versions from protobuf and grpcio-tools dependencies ## [0.6.0.2] * Re-gen mai...


Near line 256: Possible spelling mistake found.
Context: ...ols dependencies ## [0.6.0.2] * Re-gen mainnet denoms ## [0.6.0.0] * Change default n...


Near line 256: Possible spelling mistake found.
Context: ...ndencies ## [0.6.0.2] * Re-gen mainnet denoms ## [0.6.0.0] * Change default network ...


Near line 260: Possible spelling mistake found.
Context: ...* Change default network to LB * Re-gen mainnet denoms ## [0.5.9.7] * Re-gen mainnet d...


Near line 260: Possible spelling mistake found.
Context: ... default network to LB * Re-gen mainnet denoms ## [0.5.9.7] * Re-gen mainnet denoms ...


Near line 263: Possible spelling mistake found.
Context: ...n mainnet denoms ## [0.5.9.7] * Re-gen mainnet denoms ## [0.5.9.6] * Re-gen proto ##...


Near line 263: Possible spelling mistake found.
Context: ...t denoms ## [0.5.9.7] * Re-gen mainnet denoms ## [0.5.9.6] * Re-gen proto ## [0.5.9...


Near line 269: Possible spelling mistake found.
Context: ...9.6] * Re-gen proto ## [0.5.9.5] * Add orderbook snaphot methods ## [0.5.9.4] * Re-gen ...


Near line 269: Possible spelling mistake found.
Context: ...gen proto ## [0.5.9.5] * Add orderbook snaphot methods ## [0.5.9.4] * Re-gen mainnet ...


Near line 272: Possible spelling mistake found.
Context: ... snaphot methods ## [0.5.9.4] * Re-gen mainnet denoms ## [0.5.9.4] * Re-gen mainnet d...


Near line 272: Possible spelling mistake found.
Context: ... methods ## [0.5.9.4] * Re-gen mainnet denoms ## [0.5.9.4] * Re-gen mainnet denoms ...


Near line 275: Possible spelling mistake found.
Context: ...n mainnet denoms ## [0.5.9.4] * Re-gen mainnet denoms ## [0.5.9.2] * Fix margin conve...


Near line 275: Possible spelling mistake found.
Context: ...t denoms ## [0.5.9.4] * Re-gen mainnet denoms ## [0.5.9.2] * Fix margin conversion f...


Near line 281: Possible spelling mistake found.
Context: ...tions ## [0.5.9.1] * Add skip/limit to BinaryOptionsMarketsRequest ## [0.5.9.0] * Re-gen proto * Fix MsgR...


Near line 285: Possible spelling mistake found.
Context: ...uest ## [0.5.9.0] * Re-gen proto * Fix MsgRewardsOptOut * Remove pysha3 dependency ## [0.5.8.8...


Near line 289: Possible spelling mistake found.
Context: ...e pysha3 dependency ## [0.5.8.8] * Add grpc_explorer_endpoint in Network * Add expl...


Near line 294: Possible spelling mistake found.
Context: ...njective/constant.py#L166) must now set grpc_explorer_endpoint during init


Near line 294: Possible spelling mistake found.
Context: ...t now set grpc_explorer_endpoint during init

Additional comments not posted (14)
CHANGELOG.md (2)

13-17: Validate the deprecation process for the use_secure_connection parameter.

Given the deprecation of the use_secure_connection parameter in the Network class, it's crucial to ensure that this parameter is not being used elsewhere in the codebase. This script will help identify any remaining references.

Verification successful

The review of the deprecation process for the use_secure_connection parameter in the Network class shows that the parameter is still present in the codebase, specifically in the network.py file and associated tests. However, its presence is justified as follows:

  • In network.py, the parameter is included in the method signatures but is accompanied by comments and conditional checks that issue deprecation warnings if the parameter is used. This is a standard practice in managing deprecation, allowing for backward compatibility while discouraging the use of the deprecated feature.
  • In tests/core/test_network_deprecation_warnings.py, the parameter is used explicitly to test that the deprecation warnings are correctly issued. This is an appropriate use of the parameter in the context of testing deprecation handling.

Based on this analysis, the deprecation process for the use_secure_connection parameter is being handled correctly in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any remaining usage of `use_secure_connection` in the Python files.
rg --type py 'use_secure_connection'

Length of output: 1582


18-20: Confirm the resolution of the security vulnerability with the aiohttp update.

The update of the aiohttp dependency to version ">=3.9.2" was to address a security vulnerability. This script will verify that the installed version of aiohttp meets this new requirement.

pyinjective/core/network.py (8)

121-133: Deprecation of use_secure_connection is handled correctly with a warning.


121-125: Ensure that the new grpc_channel_credentials parameters are documented in the class docstring for clarity.


118-137: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [121-150]

Initialization of new grpc_channel_credentials parameters is correctly implemented.


175-185: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [178-220]

Secure credentials are correctly initialized for different environments in the testnet and mainnet class methods.


295-307: Deprecation warning for use_secure_connection in the custom method is consistent with the main constructor.


292-311: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [295-329]

Initialization of grpc_channel_credentials in the custom method mirrors the main constructor, ensuring consistency across different network configurations.


363-380: The methods for creating grpc channels are implemented correctly, using the appropriate credentials based on the endpoint.


2-11: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [10-50]

The CookieAssistant and its subclasses are implemented correctly, handling cookies and metadata appropriately.

pyinjective/async_client.py (4)

122-122: Use of network.create_chain_grpc_channel() to create gRPC channels is a good practice for modularity.


134-134: Use of network.create_exchange_grpc_channel() to create gRPC channels is a good practice for modularity.


147-147: Use of network.create_explorer_grpc_channel() to create gRPC channels is a good practice for modularity.


150-150: Use of network.create_chain_stream_grpc_channel() to create gRPC channels is a good practice for modularity.


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aarmoa aarmoa merged commit d8192bb into dev Apr 19, 2024
12 checks passed
@aarmoa aarmoa deleted the feat/network_refactoring_from_master_to_dev branch April 19, 2024 14:42
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Actionable comments outside the diff hunks (1)
CHANGELOG.md (1)

Line range hint 58-58: Address formatting issues with multiple consecutive blank lines.

- 
-
+ 

There are multiple consecutive blank lines which can be reduced to a single blank line to improve the readability and maintain the consistency of the document format.

Comment on lines 104 to 116
DeprecationWarning,
stacklevel=2,
)
# the `credentials` parameter is ignored and will be deprecated soon. The value is taken directly from `network`
if credentials is not None:
warn(
"credentials parameter in AsyncClient is no longer used and will be deprecated",
DeprecationWarning,
stacklevel=2,
)

self.addr = ""
self.number = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The output from the executed script reveals extensive usage of the credentials parameter across various files in the codebase. This includes direct references in the AsyncClient class within test_async_client_deprecation_warnings.py, as well as numerous instances across various protocol buffer (gRPC) service files. The references in the protocol buffer files are mostly related to channel_credentials and call_credentials, which are standard parameters for gRPC channel and call configurations and do not directly relate to the credentials parameter being deprecated in the AsyncClient class.

However, the direct usage of the credentials parameter in the test_async_client_deprecation_warnings.py suggests that there might be a need to update the test cases to align with the new method of handling credentials through the network object, as indicated in the original review comment.

Given this information, it is clear that while the deprecation of the credentials parameter in the AsyncClient class is handled, there are still dependencies in the test suite that require attention to fully migrate away from using this deprecated parameter.

Conclusion:

  • The deprecation of the credentials parameter in the AsyncClient class is correctly implemented with appropriate warnings.
  • The test suite (test_async_client_deprecation_warnings.py) still uses the deprecated credentials parameter, which needs to be updated to use the new method through the network object.

Action Items:

  • Update the test suite to remove direct usage of the deprecated credentials parameter and ensure it aligns with the new implementation.
Analysis chain

📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [98-113]

Deprecation of credentials parameter handled correctly with warnings.

Ensure that all dependent code has been updated to use the new method of handling credentials through the network object.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any remaining direct uses of the `credentials` parameter in the codebase.
rg --type py 'credentials='

Length of output: 125138

Comment on lines +5 to +21
## [1.6.0] - 9999-99-99
### Added
- Added support for all queries in the chain 'tendermint' module
- Added support for all queries in the IBC Transfer module

### Changed
- Refactored cookies management logic to use all gRPC calls' responses to update the current cookies

## [1.5.0] - 2024-04-19
### Changed
- Refactoring in Network class to support mixed secure and insecure endpoints.
- Marked the Network parameter `use_secure_connection` as deprecated.

## [1.4.2] - 2024-03-19
### Changed
- Updated `aiohttp` dependency version to ">=3.9.2" to solve a security vulnerability detected by Dependabot

Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistency in list item markers.

- * Synchronized markets and tokens config files to add KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot markets
+ - Synchronized markets and tokens config files to add KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot markets

The use of asterisks (*) for list items is inconsistent with the use of dashes (-) in other parts of the document. Consider standardizing to dashes for all list items to maintain consistency.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## [1.6.0] - 9999-99-99
### Added
- Added support for all queries in the chain 'tendermint' module
- Added support for all queries in the IBC Transfer module
### Changed
- Refactored cookies management logic to use all gRPC calls' responses to update the current cookies
## [1.5.0] - 2024-04-19
### Changed
- Refactoring in Network class to support mixed secure and insecure endpoints.
- Marked the Network parameter `use_secure_connection` as deprecated.
## [1.4.2] - 2024-03-19
### Changed
- Updated `aiohttp` dependency version to ">=3.9.2" to solve a security vulnerability detected by Dependabot
## [1.6.0] - 9999-99-99
### Added
- Added support for all queries in the chain 'tendermint' module
- Added support for all queries in the IBC Transfer module
### Changed
- Refactored cookies management logic to use all gRPC calls' responses to update the current cookies
- Synchronized markets and tokens config files to add KIRA/INJ, NINJA/INJ, KATANA/INJ, BRETT/INJ and nINJ/INJ spot markets
## [1.5.0] - 2024-04-19
### Changed
- Refactoring in Network class to support mixed secure and insecure endpoints.
- Marked the Network parameter `use_secure_connection` as deprecated.
## [1.4.2] - 2024-03-19
### Changed
- Updated `aiohttp` dependency version to ">=3.9.2" to solve a security vulnerability detected by Dependabot

@@ -2,14 +2,23 @@

All notable changes to this project will be documented in this file.

## [1.5.0] - 9999-99-99
## [1.6.0] - 9999-99-99
Copy link
Contributor

Choose a reason for hiding this comment

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

Add surrounding blank lines for headings.

+
## [1.6.0] - 9999-99-99
+

Headings should be surrounded by blank lines to enhance the readability and structure of the document.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## [1.6.0] - 9999-99-99
## [1.6.0] - 9999-99-99

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.

1 participant