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: update to latest chain #221

Merged
merged 2 commits into from
May 17, 2024
Merged

feat: update to latest chain #221

merged 2 commits into from
May 17, 2024

Conversation

gorgos
Copy link
Member

@gorgos gorgos commented May 7, 2024

Summary by CodeRabbit

  • New Features

    • Added scaling options for querying oracle prices in smart contracts.
    • Introduced min_notional fields to market launch structures to specify minimum trade values.
  • Enhancements

    • Updated several packages to newer pre-release versions, enhancing compatibility and performance.
  • Bug Fixes

    • Adjusted function parameters and pattern matching to accommodate new features and improve reliability in price queries.

@gorgos gorgos requested a review from maxrobot May 7, 2024 12:20
Copy link

coderabbitai bot commented May 7, 2024

Walkthrough

The recent updates focus on enhancing the injective-cosmwasm package by upgrading its version across various contracts and packages, adding a new parameter scaling_options to functions querying oracle prices, and introducing structural changes in query handling. Additionally, the injective-std package sees a version bump, and new fields are added to market launch structs.

Changes

Files Change Summary
.../atomic-order-example/Cargo.toml, .../dummy/Cargo.toml, .../injective-cosmwasm/Cargo.toml, .../injective-testing/Cargo.toml Updated injective-cosmwasm version to "0.2.23-rc1".
.../injective-cosmwasm-mock/src/contract.rs, .../injective-cosmwasm-mock/src/query.rs, .../injective-cosmwasm/src/exchange_mock_querier.rs, .../injective-cosmwasm/src/querier.rs, .../injective-cosmwasm/src/query.rs Added scaling_options parameter to oracle price query functions and adjusted related query structures.
.../injective-cosmwasm/src/oracle/types.rs, .../injective-std/src/types/injective/exchange/v1beta1.rs Introduced ScalingOptions struct and added min_notional fields to market launch structs.
.../injective-std/Cargo.toml Updated version from "1.12.10-testnet" to "1.12.11-testnet-rc1". No changes to exported entities.

🐰✨
Oh hark! A change, a tweak, a twist,
In the land of code where logic is kissed.
Versions leap up, like bunnies in spring,
While new fields and types, joy they bring.
Celebrate, dear code, your new attire,
For every line refines desire.


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.

Copy link

@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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between aa8d4fe and 7a56877.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (12)
  • contracts/atomic-order-example/Cargo.toml (1 hunks)
  • contracts/dummy/Cargo.toml (1 hunks)
  • contracts/injective-cosmwasm-mock/src/contract.rs (1 hunks)
  • contracts/injective-cosmwasm-mock/src/query.rs (2 hunks)
  • packages/injective-cosmwasm/Cargo.toml (1 hunks)
  • packages/injective-cosmwasm/src/exchange_mock_querier.rs (1 hunks)
  • packages/injective-cosmwasm/src/oracle/types.rs (1 hunks)
  • packages/injective-cosmwasm/src/querier.rs (3 hunks)
  • packages/injective-cosmwasm/src/query.rs (2 hunks)
  • packages/injective-std/Cargo.toml (1 hunks)
  • packages/injective-std/src/types/injective/exchange/v1beta1.rs (2 hunks)
  • packages/injective-testing/Cargo.toml (1 hunks)
Files skipped from review due to trivial changes (3)
  • packages/injective-cosmwasm/Cargo.toml
  • packages/injective-std/Cargo.toml
  • packages/injective-testing/Cargo.toml
Additional comments not posted (8)
contracts/dummy/Cargo.toml (1)

35-35: Updated injective-cosmwasm to version "0.2.23-rc1" aligns with the PR's objectives to update dependencies.

contracts/atomic-order-example/Cargo.toml (1)

37-37: Updated injective-cosmwasm to version "0.2.23-rc1" aligns with the PR's objectives to update dependencies.

packages/injective-cosmwasm/src/oracle/types.rs (1)

32-36: Added ScalingOptions struct with fields base_decimals and quote_decimals enhances oracle price querying functionalities.

packages/injective-cosmwasm/src/query.rs (1)

139-139: Added scaling_options to OraclePrice query type enhances flexibility in oracle price queries.

contracts/injective-cosmwasm-mock/src/query.rs (1)

141-147: Added scaling_options parameter to handle_oracle_price_query enhances flexibility in oracle price queries.

contracts/injective-cosmwasm-mock/src/contract.rs (1)

133-133: Updated handle_oracle_price_query function call to include None for the new optional parameter.

packages/injective-cosmwasm/src/querier.rs (1)

428-441: Modified query_oracle_price method to include scaling_options enhances flexibility in oracle price queries.

packages/injective-cosmwasm/src/exchange_mock_querier.rs (1)

689-691: The adjustment to include unspecified additional fields in the oracle price query enhances flexibility and future-proofs the query handling.

Comment on lines +1867 to +1868
#[prost(string, tag = "7")]
pub min_notional: ::prost::alloc::string::String,
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The verification process aimed to confirm the uniqueness of the protobuf tag "7" for the field min_notional in the MsgInstantSpotMarketLaunch struct. The output from the executed script shows multiple occurrences of tag = "7" across various fields and data types in the file packages/injective-std/src/types/injective/exchange/v1beta1.rs. This indicates that the tag "7" is not unique within this file, which could lead to serialization and deserialization issues in protobuf, as each field within a protobuf message should have a unique tag.

Given this information, it is clear that the addition of the min_notional field with the tag "7" could potentially conflict with other fields using the same tag, leading to incorrect behavior in the system that relies on this protobuf definition.

Action Required:

  • The developers should assign a unique protobuf tag to the min_notional field in the MsgInstantSpotMarketLaunch struct to avoid conflicts with other fields.

Locations needing attention:

  • MsgInstantSpotMarketLaunch struct in packages/injective-std/src/types/injective/exchange/v1beta1.rs needs a unique tag for the min_notional field.
Analysis chain

Field min_notional added to MsgInstantSpotMarketLaunch.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the uniqueness of the protobuf tag for `min_notional` in `MsgInstantSpotMarketLaunch`.

# Test: Search for the tag "7" in the file. Expect: Only one occurrence.
rg --type rust 'tag = "7"' packages/injective-std/src/types/injective/exchange/v1beta1.rs

Length of output: 878

Comment on lines +1935 to +1936
#[prost(string, tag = "14")]
pub min_notional: ::prost::alloc::string::String,
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The verification process has revealed that the protobuf tag "14" is not unique within the file packages/injective-std/src/types/injective/exchange/v1beta1.rs. The tag is used multiple times for different types of fields, which could lead to serialization issues and data corruption. This needs to be addressed to ensure the integrity of the data structure.

Issues found in the protobuf tag usage:

  • Multiple occurrences of tag = "14" for different types such as uint32, enumeration, string, bool, and message.
  • This could potentially lead to conflicts in the protobuf serialization process.
Analysis chain

Field min_notional added to MsgInstantPerpetualMarketLaunch.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the uniqueness of the protobuf tag for `min_notional` in `MsgInstantPerpetualMarketLaunch`.

# Test: Search for the tag "14" in the file. Expect: Only one occurrence.
rg --type rust 'tag = "14"' packages/injective-std/src/types/injective/exchange/v1beta1.rs

Length of output: 552

Copy link
Contributor

@maxrobot maxrobot left a comment

Choose a reason for hiding this comment

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

LGTM

@maxrobot maxrobot merged commit 6b2d549 into dev May 17, 2024
4 checks passed
@maxrobot maxrobot deleted the f/update-to-latest-chain branch May 17, 2024 14:15
Copy link

@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: 0

Out of diff range and nitpick comments (2)
contracts/injective-cosmwasm-mock/src/testing/test_token_factory.rs (1)

19-20: The addition of name and symbol fields to MsgCreateDenom struct is correctly implemented.

Consider adding comments describing the purpose of these new fields, especially if they have specific constraints or usage within the system.

contracts/injective-cosmwasm-mock/src/utils.rs (1)

416-416: The addition of the cid parameter to order functions is implemented correctly.

Consider initializing cid with a meaningful default value if applicable, rather than an empty string, to enhance clarity and functionality.

Also applies to: 542-542

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7a56877 and ed98277.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (4)
  • contracts/injective-cosmwasm-mock/Cargo.toml (2 hunks)
  • contracts/injective-cosmwasm-mock/src/testing/test_token_factory.rs (1 hunks)
  • contracts/injective-cosmwasm-mock/src/utils.rs (2 hunks)
  • packages/injective-std/Cargo.toml (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/injective-std/Cargo.toml
Additional comments not posted (1)
contracts/injective-cosmwasm-mock/Cargo.toml (1)

33-44: Dependencies have been updated and adjusted appropriately.

Please ensure to run comprehensive tests to verify that the new library versions do not introduce any regressions or compatibility issues.

Also applies to: 50-50

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.

None yet

2 participants