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 cosmwasm-std 2.1 #231

Closed
wants to merge 5 commits into from
Closed

feat: update cosmwasm-std 2.1 #231

wants to merge 5 commits into from

Conversation

gorgos
Copy link
Member

@gorgos gorgos commented Jul 30, 2024

Summary by CodeRabbit

  • New Features

    • Updated to the latest Rust toolchain, enhancing build performance and tooling capabilities.
    • Introduced new parameter min_notional in relevant functions, improving validation in market operations.
    • Added a method for predictable contract address generation to the address generation process.
    • Created a configuration file to streamline common Cargo commands, improving the development workflow.
  • Bug Fixes

    • Standardized error messages for consistency in error handling.
  • Dependency Updates

    • Upgraded multiple dependencies including cosmwasm-std, cw-storage-plus, and cw-utils to newer versions, enhancing functionality and compatibility.
  • Refactor

    • Improved type safety in tests by replacing string literals with appropriate types.

Copy link

coderabbitai bot commented Jul 30, 2024

Walkthrough

This update enhances multiple Rust projects by upgrading dependencies, particularly the cosmwasm-std library and its related components. Key improvements include enhanced error handling, refined type safety, and streamlined testing processes. The introduction of new parameters and functions ensures that the codebase remains robust and maintainable, aligning with modern Rust practices and facilitating better compatibility with WebAssembly targets.

Changes

File(s) Change Summary
.github/workflows/Basic.yml Updated Rust toolchain from 1.73.0 to 1.78.0.
contracts/atomic-order-example/Cargo.toml Upgraded dependencies (e.g., cosmwasm-std from 1.5.0 to 2.1.0, cw-storage-plus and cw-utils from 1.2.0 to 2.0.0). Removed backtraces feature.
contracts/atomic-order-example/src/{contract.rs,error.rs,tests.rs} Improved error handling, standardized naming (UnrecognizedReply), and transitioned from string literals to Addr::unchecked for address handling.
contracts/dummy/Cargo.toml Similar dependency updates as contracts/atomic-order-example/Cargo.toml, including removal of backtraces feature.
contracts/dummy/src/mock_pyth_attestation.rs Updated address handling to use Addr type; replaced mock_info with message_info.
contracts/injective-cosmwasm-mock/Cargo.toml Dependency updates including cosmwasm-std and others; removed backtraces feature; enhancements in other libraries.
contracts/injective-cosmwasm-mock/src/testing/test_exchange_derivative.rs Added min_notional parameter to enhance the test case for derivative markets.
contracts/injective-cosmwasm-mock/src/utils.rs Introduced min_notional to launch_spot_market and launch_perp_market; added expedited parameter to set_address_of_pyth_contract.
packages/injective-cosmwasm/Cargo.toml Dependency upgrades similar to previous Cargo files; included cosmwasm_2_0 feature.
packages/injective-cosmwasm/src/exchange/types.rs Modified SubaccountId implementations with new methods and constants for better deserialization.
packages/injective-cosmwasm/src/exchange_mock_querier.rs Enhanced monetary value handling with explicit type annotations; updated method signatures for clarity.
packages/injective-math/Cargo.toml Updated dependencies, including cosmwasm-std and cosmwasm-schema.
packages/injective-testing/Cargo.toml Version updates for injective-testing package and its dependencies.
packages/injective-testing/src/address_generator.rs Replaced next_address method with contract_address, added parameters for better error handling.
packages/injective-testing/src/chain_mock.rs Introduced InjectiveStargate enum and modified routing functionality to accommodate new types.
.cargo/config.toml New configuration file establishes aliases for common Cargo commands, improving the development workflow for WebAssembly targets.

Poem

🐇 In fields of code where rabbits play,
We hop along, brightening the day.
With new tools in paws, we leap so high,
Upgrading our world, oh me, oh my!
Through versions we scurry, with joy we sing,
For every change, a brighter spring! 🌸✨


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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

CodeRabbit Configuration 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.

@maxrobot maxrobot marked this pull request as ready for review July 31, 2024 13:42
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

Outside diff range, codebase verification and nitpick comments (3)
contracts/injective-cosmwasm-mock/src/utils.rs (3)

329-329: Function signature mismatch: launch_spot_market

The launch_spot_market function definition and its usages do not reflect the new min_notional parameter.

  • Ensure that the launch_spot_market function is updated to include the min_notional parameter in its definition.
  • Update all usages of the launch_spot_market function to match the new signature.
Analysis chain

LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to launch_spot_market match the new signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `launch_spot_market` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type rust -A 5 $'launch_spot_market'

Length of output: 1214


760-760: Function signature not updated

The function set_address_of_pyth_contract has not been updated to include the new expedited parameter. Please update the function definition and all its usages to match the new signature.

  • Definition: contracts/injective-cosmwasm-mock/src/utils.rs
  • Usage: contracts/injective-cosmwasm-mock/src/testing/test_oracle.rs
Analysis chain

LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to set_address_of_pyth_contract match the new signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `set_address_of_pyth_contract` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type rust -A 5 $'set_address_of_pyth_contract'

Length of output: 2003


368-368: Function signature mismatch: launch_perp_market

The function launch_perp_market has been updated to include a new parameter min_notional, but the current function calls and definition do not reflect this change.

  • File: contracts/injective-cosmwasm-mock/src/utils.rs
    • Function Definition: Update the function definition to include the min_notional parameter.
    • Function Calls: Ensure all calls to launch_perp_market include the min_notional parameter.

Please update the function definition and all its calls to match the new signature.

Analysis chain

LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to launch_perp_market match the new signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `launch_perp_market` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type rust -A 5 $'launch_perp_market'

Length of output: 1085

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between feabd33 and 0e0cb27.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (20)
  • .github/workflows/Basic.yml (3 hunks)
  • contracts/atomic-order-example/Cargo.toml (3 hunks)
  • contracts/atomic-order-example/src/contract.rs (2 hunks)
  • contracts/atomic-order-example/src/error.rs (1 hunks)
  • contracts/atomic-order-example/src/tests.rs (5 hunks)
  • contracts/dummy/Cargo.toml (2 hunks)
  • contracts/dummy/src/mock_pyth_attestation.rs (2 hunks)
  • contracts/injective-cosmwasm-mock/Cargo.toml (2 hunks)
  • contracts/injective-cosmwasm-mock/src/testing/test_exchange_derivative.rs (1 hunks)
  • contracts/injective-cosmwasm-mock/src/utils.rs (3 hunks)
  • packages/injective-cosmwasm/Cargo.toml (1 hunks)
  • packages/injective-cosmwasm/src/exchange/subaccount.rs (1 hunks)
  • packages/injective-cosmwasm/src/exchange/types.rs (2 hunks)
  • packages/injective-cosmwasm/src/exchange_mock_querier.rs (8 hunks)
  • packages/injective-math/Cargo.toml (1 hunks)
  • packages/injective-math/src/fp_decimal/arithmetic.rs (1 hunks)
  • packages/injective-protobuf/Cargo.toml (1 hunks)
  • packages/injective-testing/Cargo.toml (1 hunks)
  • packages/injective-testing/src/address_generator.rs (3 hunks)
  • packages/injective-testing/src/chain_mock.rs (5 hunks)
Files skipped from review due to trivial changes (3)
  • contracts/atomic-order-example/src/error.rs
  • packages/injective-cosmwasm/src/exchange/subaccount.rs
  • packages/injective-math/src/fp_decimal/arithmetic.rs
Additional comments not posted (59)
packages/injective-math/Cargo.toml (2)

24-24: Verify compatibility with cosmwasm-schema version 2.1.0.

The version upgrade might introduce breaking changes. Ensure that the codebase is compatible with the new version.

Verification successful

Let's perform a more thorough search to verify the usage of cosmwasm-schema in the codebase.


Let's extract and review the relevant code snippets where cosmwasm_schema is used to ensure compatibility with version 2.1.0.


Let's correct the regex pattern and re-run the script to extract the relevant code snippets.


Verify compatibility with cosmwasm-schema version 2.1.0.

The codebase uses cosmwasm_schema for serialization and schema management. The features used (cw_serde, export_schema, remove_schemas, schema_for) are standard and should be compatible with version 2.1.0.

  • contracts/injective-cosmwasm-mock/src/state.rs: Uses cosmwasm_schema::cw_serde.
  • contracts/atomic-order-example/examples/schema.rs: Uses cosmwasm_schema::{export_schema, remove_schemas, schema_for}.

No breaking changes were detected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility with `cosmwasm-schema` version `2.1.0`.

# Test: Search for the usage of `cosmwasm-schema` features. Expect: No breaking changes.
rg --type rust -A 5 'cosmwasm-schema'

Length of output: 37


Script:

#!/bin/bash
# Description: Verify compatibility with `cosmwasm-schema` version `2.1.0`.

# Search for `cosmwasm-schema` in all Cargo.toml files to find dependencies.
rg 'cosmwasm-schema' --glob '**/Cargo.toml'

# Search for `cosmwasm-schema` in Rust source files to find usage.
rg 'cosmwasm_schema' --type rust

Length of output: 673


Script:

#!/bin/bash
# Extract and review the relevant code snippets where `cosmwasm_schema` is used.

# Extract usage of `cosmwasm_schema::cw_serde` in `contracts/injective-cosmwasm-mock/src/state.rs`.
rg 'cosmwasm_schema::cw_serde' -A 10 contracts/injective-cosmwasm-mock/src/state.rs

# Extract usage of `cosmwasm_schema::{export_schema, remove_schemas, schema_for}` in `contracts/atomic-order-example/examples/schema.rs`.
rg 'cosmwasm_schema::{export_schema, remove_schemas, schema_for}' -A 10 contracts/atomic-order-example/examples/schema.rs

Length of output: 670


Script:

#!/bin/bash
# Extract and review the relevant code snippets where `cosmwasm_schema` is used.

# Extract usage of `cosmwasm_schema::{export_schema, remove_schemas, schema_for}` in `contracts/atomic-order-example/examples/schema.rs`.
rg 'cosmwasm_schema::\{export_schema, remove_schemas, schema_for\}' -A 10 contracts/atomic-order-example/examples/schema.rs

Length of output: 473


16-16: Verify compatibility with cosmwasm-std version 2.1.0.

The version upgrade and added feature might introduce breaking changes. Ensure that the codebase is compatible with the new version and feature.

packages/injective-testing/Cargo.toml (3)

8-8: LGTM! Version change is consistent with semantic versioning.

The package version update from 0.1.6 to 0.1.7 is appropriate for the changes made.


13-13: Verify compatibility with cosmwasm-std version 2.1.0.

The version upgrade and added feature might introduce breaking changes. Ensure that the codebase is compatible with the new version and feature.


14-14: Verify compatibility with cw-multi-test version 2.1.0.

The version upgrade might introduce breaking changes. Ensure that the codebase is compatible with the new version.

Verification successful

Let's re-verify the usage of the cw-multi-test dependency to ensure compatibility with the updated version.


To ensure thorough verification, let's search for cw-multi-test in other relevant files, such as configuration and documentation files, to confirm its usage or lack thereof.


To ensure thorough verification, let's search for the usage of cw-multi-test in all Rust files within the directories where it is listed in Cargo.toml.


No issues found with the cw-multi-test version upgrade to 2.1.0.

The dependency is listed in the Cargo.toml files but not actively used in the Rust source files. Therefore, the version upgrade should not introduce any breaking changes.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility with `cw-multi-test` version `2.1.0`.

# Test: Search for the usage of `cw-multi-test` features. Expect: No breaking changes.
rg --type rust -A 5 'cw-multi-test'

Length of output: 35


Script:

#!/bin/bash
# Description: Verify usage and compatibility of `cw-multi-test` version `2.1.0`.

# Step 1: Search for the usage of `cw-multi-test` in the Rust files.
rg 'cw-multi-test' --type rust

# Step 2: If `cw-multi-test` is found, list all functions and methods to check for compatibility issues.
if rg -q 'cw-multi-test' --type rust; then
  rg 'cw-multi-test' --type rust -A 10
fi

Length of output: 64


Script:

#!/bin/bash
# Description: Verify usage and compatibility of `cw-multi-test` version `2.1.0` in configuration and documentation files.

# Step 1: Search for the usage of `cw-multi-test` in configuration files.
rg 'cw-multi-test' --glob 'Cargo.toml' --glob '**/Cargo.toml'

# Step 2: Search for the usage of `cw-multi-test` in documentation files.
rg 'cw-multi-test' --glob '*.md' --glob '**/*.md'

Length of output: 272


Script:

#!/bin/bash
# Description: Verify usage and compatibility of `cw-multi-test` version `2.1.0` in relevant Rust files.

# Step 1: Search for the usage of `cw-multi-test` in Rust files within `packages/injective-testing`.
rg 'cw-multi-test' --type rust packages/injective-testing/

# Step 2: Search for the usage of `cw-multi-test` in Rust files within `contracts/atomic-order-example`.
rg 'cw-multi-test' --type rust contracts/atomic-order-example/

Length of output: 121

packages/injective-protobuf/Cargo.toml (1)

19-19: Verify compatibility with cosmwasm-std version 2.1.0.

The version upgrade and added feature might introduce breaking changes. Ensure that the codebase is compatible with the new version and feature.

packages/injective-cosmwasm/Cargo.toml (2)

13-13: Verify compatibility with cosmwasm-std version 2.1.0.

Ensure that the codebase is compatible with the new version and features of cosmwasm-std.

Verification successful

Verify compatibility with cosmwasm-std version 2.1.0.

Ensure that the codebase is compatible with the new version and features of cosmwasm-std.


Verify compatibility with cosmwasm-std version 2.1.0.

Ensure that the codebase is compatible with the new version and features of cosmwasm-std.


Compatibility with cosmwasm-std version 2.1.0 verified.

The codebase is compatible with the new version and features of cosmwasm-std, and no breaking changes have been identified.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `cosmwasm-std` in the codebase to ensure compatibility with version `2.1.0`.

# Test: Search for the usage of `cosmwasm-std`. Expect: No breaking changes.
rg --type rust -A 5 $'cosmwasm_std'

Length of output: 146622


Script:

#!/bin/bash
# Description: Check for breaking changes or deprecated methods introduced in `cosmwasm-std` version `2.1.0`.

# Test: Search for deprecated methods in the codebase. Expect: No deprecated methods.
rg --type rust 'deprecated'

# Test: Search for usage of specific features added in `cosmwasm-std` 2.1.0. Expect: Correct usage.
rg --type rust 'cosmwasm_2_0'

Length of output: 2900


Script:

#!/bin/bash
# Description: Check for breaking changes or deprecated methods introduced in `cosmwasm-std` version `2.1.0`.

# Test: Search for usage of `cosmwasm-std` specific methods and features to ensure compatibility.
rg --type rust 'cosmwasm_std::' -A 5

Length of output: 146624


14-14: Verify compatibility with cw-storage-plus version 2.0.0.

Ensure that the codebase is compatible with the new version of cw-storage-plus.

Verification successful

Let's gather information on the changes introduced in cw-storage-plus version 2.0.0 and compare them with the current usage in the codebase.


Let's correct the regex error and attempt to fetch the changelog again to identify any breaking changes. Additionally, we'll verify the usage of other utilities separately to avoid regex errors.


Let's verify the usage of Item in the identified files to ensure compatibility with cw-storage-plus version 2.0.0.


The codebase is compatible with cw-storage-plus version 2.0.0.

No breaking changes were found that affect the current usage of cw_storage_plus::Item.

  • The Item type is used consistently across the codebase.
  • The breaking changes in 2.0.0 do not impact the current usage patterns.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `cw-storage-plus` in the codebase to ensure compatibility with version `2.0.0`.

# Test: Search for the usage of `cw-storage-plus`. Expect: No breaking changes.
rg --type rust -A 5 $'cw_storage_plus'

Length of output: 1943


Script:

#!/bin/bash
# Description: Fetch the changelog or release notes for `cw-storage-plus` to identify changes in version `2.0.0`.

# Fetch the changelog or release notes for `cw-storage-plus`
curl -s https://raw.githubusercontent.com/CosmWasm/cw-storage-plus/main/CHANGELOG.md | grep -A 20 "## [2.0.0]"

Length of output: 112


Script:

#!/bin/bash
# Description: Verify the usage of `cw-storage-plus` in the codebase to ensure compatibility with version `2.0.0`.

# Test: Search for the usage of `cw_storage_plus::Item` in the codebase.
rg --type rust 'cw_storage_plus::Item'

# Test: Search for the usage of `cw_storage_plus::{Key, KeyDeserialize, Prefixer, PrimaryKey}` in the codebase.
rg --type rust 'cw_storage_plus::{Key, KeyDeserialize, Prefixer, PrimaryKey}'

Length of output: 483


Script:

#!/bin/bash
# Description: Fetch the changelog or release notes for `cw-storage-plus` to identify changes in version `2.0.0`.

# Fetch the changelog or release notes for `cw-storage-plus`
curl -s https://raw.githubusercontent.com/CosmWasm/cw-storage-plus/main/CHANGELOG.md | grep -A 20 "## \[2.0.0\]"

Length of output: 1084


Script:

#!/bin/bash
# Description: Verify the usage of `cw-storage-plus` in the codebase to ensure compatibility with version `2.0.0`.

# Test: Search for the usage of `cw_storage_plus::Item` in the codebase.
rg --type rust 'cw_storage_plus::Item'

# Test: Search for the usage of `cw_storage_plus::Key` in the codebase.
rg --type rust 'cw_storage_plus::Key'

# Test: Search for the usage of `cw_storage_plus::KeyDeserialize` in the codebase.
rg --type rust 'cw_storage_plus::KeyDeserialize'

# Test: Search for the usage of `cw_storage_plus::Prefixer` in the codebase.
rg --type rust 'cw_storage_plus::Prefixer'

# Test: Search for the usage of `cw_storage_plus::PrimaryKey` in the codebase.
rg --type rust 'cw_storage_plus::PrimaryKey'

Length of output: 417


Script:

#!/bin/bash
# Description: Verify the usage of `cw_storage_plus::Item` in the identified files to ensure compatibility with version `2.0.0`.

# Test: Display the usage of `cw_storage_plus::Item` in contracts/dummy/src/contract.rs
rg --type rust -A 10 'cw_storage_plus::Item' contracts/dummy/src/contract.rs

# Test: Display the usage of `cw_storage_plus::Item` in contracts/injective-cosmwasm-mock/src/state.rs
rg --type rust -A 10 'cw_storage_plus::Item' contracts/injective-cosmwasm-mock/src/state.rs

# Test: Display the usage of `cw_storage_plus::Item` in contracts/atomic-order-example/src/state.rs
rg --type rust -A 10 'cw_storage_plus::Item' contracts/atomic-order-example/src/state.rs

Length of output: 1294

contracts/dummy/Cargo.toml (3)

32-32: Verify compatibility with cw2 version 2.0.0.

Ensure that the codebase is compatible with the new version of cw2.


30-30: Verify compatibility with cosmwasm-std version 2.1.0.

Ensure that the codebase is compatible with the new version and features of cosmwasm-std.

Verification successful

Verify compatibility with cosmwasm-std version 2.1.0.

Ensure that the codebase does not use any deprecated features or breaking changes introduced in the new version of cosmwasm-std.


Verify compatibility with cosmwasm-std version 2.1.0.

Ensure that the codebase does not use any deprecated features or breaking changes introduced in the new version of cosmwasm-std.


No deprecated features or breaking changes found for cosmwasm-std version 2.1.0.

The codebase appears to be compatible with the new version of cosmwasm-std. No deprecated features or breaking changes were detected in the search.

  • No further action required for compatibility verification with cosmwasm-std version 2.1.0.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `cosmwasm-std` in the codebase to ensure compatibility with version `2.1.0`.

# Test: Search for the usage of `cosmwasm-std`. Expect: No breaking changes.
rg --type rust -A 5 $'cosmwasm_std'

Length of output: 146622


Script:

#!/bin/bash
# Description: Verify the usage of deprecated features or breaking changes in `cosmwasm-std` version `2.1.0`.

# Test: Search for deprecated features or breaking changes. Expect: No deprecated features or breaking changes.
rg --type rust -A 5 'deprecated' | rg 'cosmwasm_std' 

Length of output: 50


Script:

#!/bin/bash
# Description: Verify the usage of deprecated features or breaking changes in `cosmwasm-std` version `2.1.0`.

# Test: Search for common breaking changes or deprecated patterns related to `cosmwasm-std`. Expect: No deprecated features or breaking changes.
rg --type rust -A 5 'cosmwasm_std::' | rg -i 'deprecated|removed|changed|replaced'

Length of output: 82


31-31: Verify compatibility with cw-storage-plus version 2.0.0.

Ensure that the codebase is compatible with the new version of cw-storage-plus.

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

44-44: Verify compatibility with cosmwasm-schema version 2.1.0.

Ensure that the codebase is compatible with the new version of cosmwasm-schema.


45-45: Verify compatibility with cw-multi-test version 2.1.0.

Ensure that the codebase is compatible with the new version of cw-multi-test.


33-33: Verify compatibility with cw-utils version 2.0.0.

Ensure that the codebase is compatible with the new version of cw-utils.

Verification successful

No issues found with cw-utils version 2.0.0.

The dependency cw-utils does not appear to be used directly in the codebase, and therefore, the upgrade to version 2.0.0 does not impact the existing code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `cw-utils` in the codebase to ensure compatibility with version `2.0.0`.

# Test: Search for the usage of `cw-utils`. Expect: No breaking changes.
rg --type rust -A 5 $'cw_utils'

Length of output: 30


Script:

#!/bin/bash
# Description: Verify the usage of `cw-utils` in the codebase to ensure compatibility with version `2.0.0`.

# Test: Search for the usage of `cw-utils` in the entire codebase. Expect: No breaking changes.
rg --type rust -w 'cw-utils' -A 5
rg --type rust -w 'cw_utils' -A 5
rg --type rust -w 'cw::utils' -A 5

Length of output: 102


32-32: Verify compatibility with cw-storage-plus version 2.0.0.

Ensure that the codebase is compatible with the new version of cw-storage-plus.

Verification successful

Verify compatibility with cw-storage-plus version 2.0.0.

The usage of cw_storage_plus::Item in the identified files appears consistent and does not show any breaking changes or deprecated features. The upgrade to version 2.0.0 seems compatible with the existing codebase.

  • contracts/dummy/src/contract.rs
  • contracts/injective-cosmwasm-mock/src/state.rs
  • contracts/atomic-order-example/src/state.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `cw-storage-plus` in the codebase to ensure compatibility with version `2.0.0`.

# Test: Search for the usage of `cw-storage-plus`. Expect: No breaking changes.
rg --type rust -A 5 $'cw_storage_plus'

Length of output: 1943


Script:

#!/bin/bash
# Description: Check for breaking changes or deprecated features in the usage of `cw-storage-plus` in the identified files.

# Inspect the usage in `contracts/dummy/src/contract.rs`
rg --type rust -A 5 'use cw_storage_plus::Item;' contracts/dummy/src/contract.rs

# Inspect the usage in `contracts/injective-cosmwasm-mock/src/state.rs`
rg --type rust -A 5 'use cw_storage_plus::Item;' contracts/injective-cosmwasm-mock/src/state.rs

# Inspect the usage in `packages/injective-cosmwasm/src/exchange/types.rs`
rg --type rust -A 5 'use cw_storage_plus::{Key, KeyDeserialize, Prefixer, PrimaryKey};' packages/injective-cosmwasm/src/exchange/types.rs

# Inspect the usage in `contracts/atomic-order-example/src/state.rs`
rg --type rust -A 5 'use cw_storage_plus::Item;' contracts/atomic-order-example/src/state.rs

Length of output: 1160


Script:

#!/bin/bash
# Description: Check for breaking changes or deprecated features in the usage of `cw-storage-plus` in the identified files.

# Inspect the usage in `contracts/dummy/src/contract.rs`
rg --type rust -A 5 'use cw_storage_plus::Item;' contracts/dummy/src/contract.rs

# Inspect the usage in `contracts/injective-cosmwasm-mock/src/state.rs`
rg --type rust -A 5 'use cw_storage_plus::Item;' contracts/injective-cosmwasm-mock/src/state.rs

# Inspect the usage in `packages/injective-cosmwasm/src/exchange/types.rs`
rg --type rust -A 5 'use cw_storage_plus::Key;' packages/injective-cosmwasm/src/exchange/types.rs

# Inspect the usage in `contracts/atomic-order-example/src/state.rs`
rg --type rust -A 5 'use cw_storage_plus::Item;' contracts/atomic-order-example/src/state.rs

Length of output: 950


30-30: Verify compatibility with cosmwasm-std version 2.1.0.

Ensure that the codebase is compatible with the new version and features of cosmwasm-std.


34-34: Verify compatibility with cw2 version 2.0.0.

Ensure that the codebase is compatible with the new version of cw2.

contracts/injective-cosmwasm-mock/Cargo.toml (7)

32-32: Verify compatibility with cosmwasm-schema version 2.1.0.

Ensure that the codebase is compatible with the updated version and check for any breaking changes introduced in cosmwasm-schema 2.1.0.


33-33: Verify compatibility with cosmwasm-std version 2.1.0 and usage of new features.

Ensure that the codebase is compatible with the updated version and check for any breaking changes introduced in cosmwasm-std 2.1.0. Verify the usage of the added features: abort, cosmwasm_1_2, cosmwasm_1_3, cosmwasm_1_4, cosmwasm_2_0, iterator, and stargate.


34-34: Verify compatibility with cw-storage-plus version 2.0.0.

Ensure that the codebase is compatible with the updated version and check for any breaking changes introduced in cw-storage-plus 2.0.0.


35-35: Verify compatibility with cw2 version 2.0.0.

Ensure that the codebase is compatible with the updated version and check for any breaking changes introduced in cw2 2.0.0.


39-39: Verify compatibility with injective-std version 1.13.0 and the path.

Ensure that the codebase is compatible with the updated version and check for any breaking changes introduced in injective-std 1.13.0. Verify that the specified path is correct.


46-46: Verify compatibility with injective-test-tube version 1.13.0-a90d21322682bbfdfc72445dc0a9b45ee49f1084 and the path.

Ensure that the codebase is compatible with the updated version and check for any breaking changes introduced in injective-test-tube. Verify that the specified path is correct.


47-47: Verify compatibility with injective-testing version 0.1.7 and the path.

Ensure that the codebase is compatible with the updated version and check for any breaking changes introduced in injective-testing 0.1.7. Verify that the specified path is correct.

.github/workflows/Basic.yml (4)

27-27: Verify compatibility with Rust toolchain version 1.78.0.

Ensure that the codebase is compatible with the updated Rust toolchain version 1.78.0 and check for any breaking changes.


44-44: Verify compatibility with Rust toolchain version 1.78.0.

Ensure that the codebase is compatible with the updated Rust toolchain version 1.78.0 and check for any breaking changes.


68-68: Verify compatibility with Rust toolchain version 1.78.0.

Ensure that the codebase is compatible with the updated Rust toolchain version 1.78.0 and check for any breaking changes.


76-76: Verify compatibility with Rust toolchain version 1.78.0.

Ensure that the codebase is compatible with the updated Rust toolchain version 1.78.0 and check for any breaking changes.

Also applies to: 83-83

contracts/dummy/src/mock_pyth_attestation.rs (3)

48-51: Verify the usage of message_info and Addr from cosmwasm_std.

Ensure that the imported functions and types are used correctly in the code.


60-60: Verify the usage of Addr for sender_addr.

Ensure that the usage of Addr improves type safety and is correctly implemented.


63-63: Verify the usage of message_info for info.

Ensure that the usage of message_info aligns with the updated API for creating mock messages.

packages/injective-testing/src/address_generator.rs (3)

18-20: LGTM!

The function contract_address correctly wraps the result of generate_inj_address in an Ok variant, aligning with the new return type anyhow::Result<Addr>.


22-33: LGTM!

The function predictable_contract_address correctly generates a predictable contract address using instantiate2_address and humanizes it using the api parameter.


Line range hint 50-69:
LGTM!

The function contract_address in StorageAwareInjectiveAddressGenerator correctly wraps the generated address in an Ok result, ensuring compatibility with the new return type anyhow::Result<Addr>.

contracts/atomic-order-example/src/tests.rs (6)

3-6: LGTM!

The replacement of mock_info with message_info improves consistency and correctness in the mock environment setup.


29-29: LGTM!

The creation of sender_addr using Addr::unchecked enhances type safety and clarity.


36-36: LGTM!

The replacement of mock_info with message_info improves consistency and correctness in the mock environment setup.


45-46: LGTM!

The creation of contract_addr and sender_addr using Addr::unchecked enhances type safety and clarity.


55-55: LGTM!

The replacement of mock_info with message_info improves consistency and correctness in the mock environment setup.


100-109: LGTM!

The changes to the Reply struct, setting data to None and introducing a payload field, refine the structure of reply messages and align with updated expectations in the contract's response handling.

contracts/atomic-order-example/src/contract.rs (2)

141-141: LGTM!

The change from UnrecognisedReply to UnrecognizedReply standardizes the spelling and improves consistency in error handling.


156-162: LGTM!

The updated data extraction process in handle_atomic_order_reply introduces an additional layer of safety by checking for the existence of a response before accessing its value, and references .value instead of data.

packages/injective-testing/src/chain_mock.rs (5)

6-9: LGTM! Addition of InjectiveStargate enum is clear and well-defined.

The enum encapsulates two variants: Accepting and Failing, which enhances the handling of different stargate scenarios.


24-27: LGTM! Function signature update for no_init is appropriate.

The inclusion of InjectiveStargate as a generic parameter enhances the flexibility of the routing mechanism.


30-30: LGTM! Simplification of MockedInjectiveApp type alias is clear and enhances readability.

The removal of the InjectiveStargate type from its signature likely improves clarity or usability.


314-315: LGTM! Method chaining approach for WasmKeeper instantiation is clear and idiomatic.

The use of with_address_generator enhances code readability and aligns with Rust best practices.


343-345: LGTM! Update to copy_binary function enhances clarity and robustness.

The use of to_vec() ensures that the binary data is handled more effectively.

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

72-72: LGTM! Addition of min_notional field enhances the test case.

The inclusion of min_notional allows for validation of a minimum notional value in the context of the derivative market being tested.

packages/injective-cosmwasm/src/exchange/types.rs (5)

367-368: LGTM! Addition of KEY_ELEMS constant is clear and well-defined.

The constant likely indicates a fixed number of key elements associated with the deserialization process.


370-373: LGTM! Return type update for from_vec function is appropriate.

The change from StdResult<Self::Output> to std::result::Result<SubaccountId, StdError> impacts the error handling mechanism and is correctly implemented.


374-376: LGTM! Addition of from_slice method enhances usability.

The method allows SubaccountId to be constructed directly from a byte slice, providing more flexibility in data deserialization.


400-401: LGTM! Addition of KEY_ELEMS constant is clear and well-defined.

The constant likely indicates a fixed number of key elements associated with the deserialization process.


402-404: LGTM! Function update for from_vec ensures consistency.

The update to use Self::Output::from_vec(value) ensures consistency in the deserialization process.

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

257-257: LGTM! Enhanced type safety and clarity.

The explicit type annotation for the numeric literal enhances type safety and clarity, particularly in financial computations.


268-268: LGTM! Enhanced type safety and clarity.

The explicit type annotation for the numeric literal enhances type safety and clarity, particularly in financial computations.


273-273: LGTM! Enhanced type safety and clarity.

The explicit type annotation for the numeric literal enhances type safety and clarity, particularly in financial computations.


Line range hint 282-299:
LGTM! Enhanced type safety and clarity.

The explicit type annotations for the numeric literals enhance type safety and clarity, particularly in financial computations.


1331-1344: LGTM! Aligned with updated type expectations.

The parameter type change from impl ToString to Addr aligns with the updated type expectations for handling addresses.


1347-1359: LGTM! Aligned with updated type expectations.

The parameter type change from impl ToString to Addr aligns with the updated type expectations for handling addresses.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0e0cb27 and f8f6aa3.

Files selected for processing (1)
  • .cargo/config.toml (1 hunks)
Files skipped from review due to trivial changes (1)
  • .cargo/config.toml

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f8f6aa3 and 2b19baf.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (1)
  • contracts/injective-cosmwasm-mock/Cargo.toml (2 hunks)
Additional comments not posted (6)
contracts/injective-cosmwasm-mock/Cargo.toml (6)

32-32: Verify compatibility with cosmwasm-schema version 2.1.0.

Ensure that the codebase is compatible with the new version of cosmwasm-schema and that any new features or changes are appropriately utilized.


46-47: Verify compatibility with injective-test-tube and injective-testing.

Ensure that the codebase is compatible with the new versions of injective-test-tube and injective-testing and that any new features or changes are appropriately utilized.


39-39: Verify compatibility with injective-std version 1.13.0.

Ensure that the codebase is compatible with the new version of injective-std and that any new features or changes are appropriately utilized.


34-34: Verify compatibility with cw-storage-plus version 2.0.0.

Ensure that the codebase is compatible with the new version of cw-storage-plus and that any new features or changes are appropriately utilized.

Verification successful

Verify compatibility with cw-storage-plus version 2.0.0.

The extracted code sections show that the cw_storage_plus crate is used for creating items and handling keys. Based on the provided context and the extracted code, there are no apparent breaking changes in the usage of Item, Key, KeyDeserialize, Prefixer, and PrimaryKey that would affect compatibility with version 2.0.0.

  • contracts/injective-cosmwasm-mock/src/state.rs
  • contracts/dummy/src/contract.rs
  • packages/injective-cosmwasm/src/exchange/types.rs
  • contracts/atomic-order-example/src/state.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility with `cw-storage-plus` version 2.0.0.

# Test: Search for the usage of `cw-storage-plus` in the codebase. Expect: No breaking changes.
rg --type rust -A 5 $'cw_storage_plus'

Length of output: 1943


Script:

#!/bin/bash
# Extract relevant code sections where `cw_storage_plus` is used for manual verification.

# Extract usage in `contracts/injective-cosmwasm-mock/src/state.rs`
echo "contracts/injective-cosmwasm-mock/src/state.rs"
rg --type rust -A 10 $'use cw_storage_plus::Item;' contracts/injective-cosmwasm-mock/src/state.rs

# Extract usage in `contracts/dummy/src/contract.rs`
echo "contracts/dummy/src/contract.rs"
rg --type rust -A 10 $'use cw_storage_plus::Item;' contracts/dummy/src/contract.rs

# Extract usage in `packages/injective-cosmwasm/src/exchange/types.rs`
echo "packages/injective-cosmwasm/src/exchange/types.rs"
rg --type rust -A 10 $'use cw_storage_plus::{Key, KeyDeserialize, Prefixer, PrimaryKey};' packages/injective-cosmwasm/src/exchange/types.rs

# Extract usage in `contracts/atomic-order-example/src/state.rs`
echo "contracts/atomic-order-example/src/state.rs"
rg --type rust -A 10 $'use cw_storage_plus::Item;' contracts/atomic-order-example/src/state.rs

Length of output: 2000


Script:

#!/bin/bash
# Correct the regex error and re-extract relevant code sections where `cw_storage_plus` is used in `packages/injective-cosmwasm/src/exchange/types.rs`.

# Extract usage in `packages/injective-cosmwasm/src/exchange/types.rs`
echo "packages/injective-cosmwasm/src/exchange/types.rs"
rg --type rust -A 10 'use cw_storage_plus::' packages/injective-cosmwasm/src/exchange/types.rs

Length of output: 588


33-33: Verify compatibility and usage of cosmwasm-std version 2.1.0.

Ensure that the codebase is compatible with the new version of cosmwasm-std and that the additional features (abort, cosmwasm_1_2, cosmwasm_1_3, cosmwasm_1_4, cosmwasm_2_0, iterator, stargate) are appropriately utilized.

Verification successful

The compatibility and usage of cosmwasm-std version 2.1.0 have been verified.

The stargate feature is utilized in the codebase, and no breaking changes or incompatibilities were found. The other features (abort, cosmwasm_1_2, cosmwasm_1_3, cosmwasm_1_4, cosmwasm_2_0, iterator) are not currently in use.

  • contracts/injective-cosmwasm-mock/src/handle.rs
  • contracts/injective-cosmwasm-mock/src/order_management.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility and usage of `cosmwasm-std` version 2.1.0.

# Test: Search for the usage of `cosmwasm-std` and its features in the codebase. Expect: No breaking changes.
rg --type rust -A 5 $'cosmwasm_std'

Length of output: 146622


Script:

#!/bin/bash
# Description: Verify compatibility and usage of specific features in `cosmwasm-std` version 2.1.0.

# Test: Search for the usage of specific features in the codebase. Expect: No breaking changes.
rg --type rust -A 5 'abort|cosmwasm_1_2|cosmwasm_1_3|cosmwasm_1_4|cosmwasm_2_0|iterator|stargate'

Length of output: 2221


35-35: Verify compatibility with cw2 version 2.0.0.

Ensure that the codebase is compatible with the new version of cw2 and that any new features or changes are appropriately utilized.

@maxrobot
Copy link
Contributor

maxrobot commented Aug 8, 2024

Closing due to duplication.

@maxrobot maxrobot closed this Aug 8, 2024
@maxrobot maxrobot deleted the f/upgrade-to-cosmwasm-2 branch August 8, 2024 09:16
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.

2 participants