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: added injective-std-derive #232

Merged
merged 6 commits into from
Jul 31, 2024
Merged

feat: added injective-std-derive #232

merged 6 commits into from
Jul 31, 2024

Conversation

maxrobot
Copy link
Contributor

@maxrobot maxrobot commented Jul 30, 2024

As discussed.

Summary by CodeRabbit

  • New Features

    • Introduced the injective-std-derive package that provides procedural macros to streamline development with CosmWasm smart contracts.
    • Added a macro for automatically generating traits and implementations for types used in the Cosmos ecosystem, enhancing developer efficiency.
  • Bug Fixes

    • Updated type URLs for several structures to correct potential errors in serialization and deserialization, ensuring compatibility within the protocol.
  • Documentation

    • Added a README for the injective-std-derive package to explain its purpose and usage, improving developer understanding.
  • Tests

    • Introduced test suites to verify the correctness of derived implementations, ensuring reliable functionality of the new features.
  • Style

    • Updated field names in several structures to follow camelCase convention, improving consistency with Rust naming standards.
    • Added attributes to allow non-snake-case naming conventions within modules, enhancing flexibility in naming styles.

@maxrobot maxrobot requested a review from gorgos July 30, 2024 22:34
Copy link

coderabbitai bot commented Jul 30, 2024

Walkthrough

The recent changes introduce the injective-std-derive package, a procedural macro library designed to enhance the integration of CosmWasm smart contracts with the Cosmos SDK. This addition streamlines the development process by offering new capabilities for proto-generated types, improved query functionalities, and enhanced serialization. Alongside this, the injective-std package has been updated to leverage these new macros, ensuring greater stability and functionality within the ecosystem.

Changes

Files Change Summary
packages/injective-std-derive/* Introduced the injective-std-derive package, including Cargo.toml, README.md, and lib.rs, which implements the derive_cosmwasm_ext macro to generate traits and handle Cosmos SDK queries. Added test files to ensure the correctness of implementations and functionalities.
packages/injective-std/Cargo.toml Downgraded the package version from 1.13.2-testnet to 1.13.0, updated cosmwasm-std to version 2.1.0, and replaced osmosis-std-derive with injective-std-derive.
packages/injective-std/src/types/cosmos/* Updated multiple files to change the import of CosmwasmExt from osmosis_std_derive to injective_std_derive, indicating a shift in dependency. Several data structures were also modified for consistent naming conventions, particularly changing from snake_case to camelCase.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant ProceduralMacro
    participant CosmosSDK
    participant QuerySystem

    Developer->>ProceduralMacro: Define message struct with attributes
    ProceduralMacro->>Developer: Generate traits and implementations
    Developer->>CosmosSDK: Use generated traits for smart contract
    Developer->>QuerySystem: Execute queries using new request structures
    QuerySystem->>CosmosSDK: Return results based on query execution
Loading

🐰 In fields of code, I hop with glee,
Procedural macros set my logic free!
With traits and queries, I dance and play,
Enhancing contracts in a clever way.
Join me, dear devs, let’s code with delight,
The future is bright, let’s code day and night! 🌟


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.

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: 4

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1919a2c and 22f645b.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (9)
  • packages/injective-std-derive/Cargo.toml (1 hunks)
  • packages/injective-std-derive/README.md (1 hunks)
  • packages/injective-std-derive/src/lib.rs (1 hunks)
  • packages/injective-std-derive/tests/main.rs (1 hunks)
  • packages/injective-std-derive/tests/query.rs (1 hunks)
  • packages/injective-std-derive/tests/struct.rs (1 hunks)
  • packages/injective-std/Cargo.toml (1 hunks)
  • packages/injective-std/README.md (1 hunks)
  • packages/injective-std/src/types/cosmos/base/v1beta1.rs (4 hunks)
Files skipped from review due to trivial changes (2)
  • packages/injective-std-derive/README.md
  • packages/injective-std/README.md
Additional comments not posted (21)
packages/injective-std-derive/tests/main.rs (1)

1-6: LGTM! Verify the test paths.

The code changes are approved.

However, ensure that the test paths tests/struct.rs and tests/query.rs exist and are correctly configured.

Verification successful

LGTM!

The test paths tests/struct.rs and tests/query.rs exist and are correctly configured.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the test files.

# Test: Check if the test files exist. Expect: Both files should exist.
test -f packages/injective-std-derive/tests/struct.rs && echo "struct.rs exists" || echo "struct.rs missing"
test -f packages/injective-std-derive/tests/query.rs && echo "query.rs exists" || echo "query.rs missing"

Length of output: 194

packages/injective-std-derive/Cargo.toml (4)

1-6: LGTM! Package metadata is accurate.

The package metadata follows standard conventions and is accurate.


10-11: LGTM! Library configuration is correct.

The library is correctly configured as a procedural macro.


13-18: LGTM! Dependencies are appropriate and up-to-date.

The dependencies listed are appropriate for a procedural macro library and are up-to-date.


20-24: LGTM! Dev-dependencies are appropriate and up-to-date.

The dev-dependencies listed are appropriate for development and testing and are up-to-date.

packages/injective-std-derive/tests/struct.rs (3)

1-2: LGTM! Imports are correct and necessary.

The imports are correct and necessary for the test.


4-12: LGTM! Struct definition is correct and appropriate.

The MsgCreateDenom struct is correctly defined and the derived traits are appropriate.


14-21: LGTM! Main function is comprehensive and correctly implemented.

The main function comprehensively tests the MsgCreateDenom struct and is correctly implemented.

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

8-8: Verify the version downgrade.

The version has been downgraded from 1.13.2-testnet to 1.13.0. Ensure this aligns with the project's versioning strategy and doesn't introduce any regressions.


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

The cosmwasm-std dependency has been updated from 1.5.0 to 2.1.0. Ensure all existing code is compatible with this new version.


15-15: Verify the new injective-std-derive dependency.

The dependency osmosis-std-derive has been replaced with injective-std-derive version 1.13.0. Ensure this new dependency is correctly integrated and compatible with the existing code.

packages/injective-std-derive/tests/query.rs (3)

1-2: Imports look good.

The imports from cosmwasm_std and injective_std_derive are appropriate and necessary for the functionality being tested.


4-13: Struct definition looks good.

The QueryDenomsFromCreatorRequest struct is defined with appropriate derives and proto annotations. Ensure that the proto annotations align with the expected schema.


14-26: Struct and main function look good.

The QueryDenomsFromCreatorResponse struct and the main function are defined correctly. The main function tests the conversion of the request struct into a QueryRequest.

packages/injective-std-derive/src/lib.rs (7)

7-23: LGTM!

The macro match_kv_attr is well-defined and correctly uses pattern matching to verify key-value pairs.


25-125: LGTM!

The procedural macro derive_cosmwasm_ext is well-structured and correctly implements various traits and conversion methods for CosmWasm extensions.


127-147: LGTM!

The function get_type_url is well-implemented and correctly handles various cases for extracting the type URL from attributes.


149-185: LGTM!

The function get_query_attrs is well-implemented and correctly uses the custom matcher to extract query attributes.


188-192: LGTM!

The function get_attr is simple and correctly retrieves the specified attribute from a list of attributes.


194-197: LGTM!

The function proto_message_attr_error is well-implemented and correctly generates a compile error for invalid proto_message attributes.


199-205: LGTM!

The function proto_query_attr_error is well-implemented and correctly generates a compile error for invalid proto_query attributes.

packages/injective-std/src/types/cosmos/base/v1beta1.rs Outdated Show resolved Hide resolved
packages/injective-std/src/types/cosmos/base/v1beta1.rs Outdated Show resolved Hide resolved
packages/injective-std/src/types/cosmos/base/v1beta1.rs Outdated Show resolved Hide resolved
packages/injective-std/src/types/cosmos/base/v1beta1.rs Outdated Show resolved Hide resolved
@maxrobot maxrobot force-pushed the f/injective-tooling branch from b3990f7 to 294da57 Compare July 30, 2024 23:02
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: 1

Outside diff range, codebase verification and nitpick comments (1)
packages/injective-std/src/types/injective/peggy/v1.rs (1)

1311-1311: The renaming of the struct field has not been fully propagated.

The field batch_fees in the QueryBatchFeeResponse struct has been renamed to batchFees, but there are still references to the old field name batch_fees in the codebase. Ensure that all references are updated to match the new naming convention.

  • packages/injective-std/src/types/injective/peggy/v1.rs: Function batch_fees still uses the old field name.
#!/bin/bash
# Description: Verify all instances of the old and new field names.

# Test: Search for the usage of both batch_fees and batchFees.
rg --type rust 'batch_fees'
rg --type rust 'batchFees'
Analysis chain

Verify the impact of renaming the struct field.

The field batch_fees in the QueryBatchFeeResponse struct has been renamed to batchFees. Ensure that all references to this field in the codebase are updated to match the new naming convention.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the references to the renamed struct field.

# Test: Search for the usage of batchFees. Expect: No references to the old field name.
rg --type rust 'batch_fees'

Length of output: 170

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 22f645b and 05a5fc1.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (31)
  • packages/injective-protobuf/src/proto/mod.rs (1 hunks)
  • packages/injective-std-derive/src/lib.rs (1 hunks)
  • packages/injective-std/Cargo.toml (1 hunks)
  • packages/injective-std/src/types/cosmos/auth/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/auth/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/authz/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/authz/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/bank/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/bank/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/base/node/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/base/query/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/base/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/distribution/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/distribution/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/feegrant/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/gov/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/gov/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/gov/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/params/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/params/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/staking/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmwasm/wasm/v1.rs (1 hunks)
  • packages/injective-std/src/types/injective/auction/v1beta1.rs (2 hunks)
  • packages/injective-std/src/types/injective/exchange/v1beta1.rs (15 hunks)
  • packages/injective-std/src/types/injective/insurance/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/injective/oracle/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/injective/peggy/v1.rs (2 hunks)
  • packages/injective-std/src/types/injective/permissions/v1beta1.rs (2 hunks)
  • packages/injective-std/src/types/injective/tokenfactory/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/injective/wasmx/v1.rs (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/injective-protobuf/src/proto/mod.rs
Files skipped from review as they are similar to previous changes (3)
  • packages/injective-std-derive/src/lib.rs
  • packages/injective-std/Cargo.toml
  • packages/injective-std/src/types/cosmos/base/v1beta1.rs
Additional context used
GitHub Check: Lints
packages/injective-std/src/types/injective/auction/v1beta1.rs

[failure] 176-176:
structure field auctionRound should have a snake case name


[failure] 183-183:
structure field auctionClosingTime should have a snake case name


[failure] 186-186:
structure field highestBidder should have a snake case name


[failure] 189-189:
structure field highestBidAmount should have a snake case name

packages/injective-std/src/types/injective/exchange/v1beta1.rs

[failure] 332-332:
structure field isPerpetual should have a snake case name


[failure] 816-816:
structure field isReduceOnly should have a snake case name


[failure] 886-886:
structure field isLong should have a snake case name


[failure] 905-905:
structure field isBuy should have a snake case name


[failure] 1472-1472:
structure field executionType should have a snake case name


[failure] 1472-1472:
method executionType should have a snake case name

GitHub Check: Test Suite
packages/injective-std/src/types/injective/auction/v1beta1.rs

[warning] 176-176:
structure field auctionRound should have a snake case name


[warning] 183-183:
structure field auctionClosingTime should have a snake case name


[warning] 186-186:
structure field highestBidder should have a snake case name


[warning] 189-189:
structure field highestBidAmount should have a snake case name

packages/injective-std/src/types/injective/exchange/v1beta1.rs

[warning] 332-332:
structure field isPerpetual should have a snake case name


[warning] 816-816:
structure field isReduceOnly should have a snake case name


[warning] 886-886:
structure field isLong should have a snake case name


[warning] 905-905:
structure field isBuy should have a snake case name


[warning] 1472-1472:
structure field executionType should have a snake case name


[warning] 1472-1472:
method executionType should have a snake case name

Additional comments not posted (71)
packages/injective-std/src/types/cosmos/authz/module/v1.rs (1)

1-1: Verify the new import path.

Ensure that the injective_std_derive::CosmwasmExt path is correct and that the new macro provides the expected functionality.

Verification successful

The import path injective_std_derive::CosmwasmExt is correct and the macro is used as expected.

  • The CosmwasmExt macro is defined and used extensively in the codebase.
  • The import path injective_std_derive::CosmwasmExt is valid and referenced in multiple files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive` crate is correctly imported and used.

# Test: Search for the `injective_std_derive` crate. Expect: The crate should be present in the dependencies.
rg --type toml 'injective_std_derive'

Length of output: 37


Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive` crate is correctly imported and used.

# 1. Search for the `injective_std_derive` crate in all Cargo.toml files.
echo "Searching for injective_std_derive in Cargo.toml files..."
rg --type toml 'injective_std_derive' --glob '**/Cargo.toml'

# 2. Search for the definition of the `CosmwasmExt` macro within the `injective_std_derive` crate.
echo "Searching for the definition of the CosmwasmExt macro..."
rg 'macro_rules! CosmwasmExt' 

# 3. Check the usage of the `CosmwasmExt` macro in the codebase.
echo "Searching for the usage of the CosmwasmExt macro..."
rg 'CosmwasmExt' --glob '**/*.rs'

Length of output: 210158

packages/injective-std/src/types/cosmos/params/module/v1.rs (1)

1-1: Verify the new import path.

Ensure that the injective_std_derive::CosmwasmExt path is correct and that the new macro provides the expected functionality.

Verification successful

Verified the new import path.

The injective_std_derive::CosmwasmExt path is correct and the necessary dependencies are listed in the Cargo.toml file.

  • injective-std-derive is listed in packages/injective-std/Cargo.toml.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive` crate is correctly imported and used.

# Test: Search for the `injective_std_derive` crate. Expect: The crate should be present in the dependencies.
rg --type toml 'injective_std_derive'

Length of output: 37


Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive` crate is correctly imported and used.

# Step 1: Search for the `injective_std_derive` crate in all `Cargo.toml` files.
rg 'injective_std_derive' --glob '**/Cargo.toml'

# Step 2: Check if `CosmwasmExt` is defined within the `injective_std_derive` crate.
fd -t f -e rs | xargs rg 'CosmwasmExt'

# Step 3: Verify that `CosmwasmExt` is used in the codebase.
rg 'CosmwasmExt' --glob '**/*.rs'

Length of output: 419463


Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive` crate is correctly listed in the dependencies.

# Search for any mention of `injective_std_derive` in all `Cargo.toml` files.
rg 'injective_std_derive' --glob '**/Cargo.toml'

Length of output: 48


Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive` crate or any similar pattern is correctly listed in the dependencies.

# Search for any mention of `injective_std_derive` or similar patterns in all `Cargo.toml` files.
rg 'injective[-_]std[-_]derive' --glob '**/Cargo.toml'

Length of output: 214

packages/injective-std/src/types/cosmos/feegrant/module/v1.rs (1)

1-1: Verify the new import path.

Ensure that the injective_std_derive::CosmwasmExt path is correct and that the new macro provides the expected functionality.

packages/injective-std/src/types/cosmos/distribution/module/v1.rs (1)

1-1: LGTM! But verify the impact of the new dependency.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new dependency does not introduce any breaking changes or unexpected behavior.

packages/injective-std/src/types/cosmos/gov/module/v1.rs (1)

1-1: LGTM! But verify the impact of the new dependency.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new dependency does not introduce any breaking changes or unexpected behavior.

packages/injective-std/src/types/cosmos/bank/module/v1.rs (1)

1-1: LGTM! But verify the impact of the new dependency.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new dependency does not introduce any breaking changes or unexpected behavior.

packages/injective-std/src/types/cosmos/auth/module/v1.rs (1)

1-1: Update import statement to use injective_std_derive::CosmwasmExt.

The import statement has been updated to reflect the new dependency, ensuring that the CosmwasmExt derive macro is sourced from injective_std_derive instead of osmosis_std_derive.

packages/injective-std/src/types/cosmos/base/node/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive::CosmwasmExt.

The import statement has been updated to reflect the new dependency, ensuring that the CosmwasmExt derive macro is sourced from injective_std_derive instead of osmosis_std_derive.

packages/injective-std/src/types/cosmos/base/query/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive::CosmwasmExt.

The import statement has been updated to reflect the new dependency, ensuring that the CosmwasmExt derive macro is sourced from injective_std_derive instead of osmosis_std_derive.

packages/injective-std/src/types/cosmos/params/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new library provides the same functionality as the old one.

packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new library provides the same functionality as the old one.

packages/injective-std/src/types/injective/auction/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new library provides the same functionality as the old one.

packages/injective-std/src/types/cosmos/authz/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive instead of osmosis_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new library provides the same or enhanced functionality as the previous one.

Verification successful

Import statement correctly updated

The import statement has been correctly updated to use injective_std_derive::CosmwasmExt. The CosmwasmExt macro is defined and used extensively within the codebase, confirming its functionality.

  • packages/injective-std-derive/src/lib.rs: Definition of CosmwasmExt macro.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive::CosmwasmExt` macro is correctly imported and used.

# Test: Search for the definition of the `CosmwasmExt` macro in the `injective_std_derive` crate.
rg --type rust --pattern 'macro_rules! CosmwasmExt' --files-with-matches

Length of output: 486


Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive::CosmwasmExt` macro is correctly imported and used.

# Test: Search for the definition of the `CosmwasmExt` macro in the `injective_std_derive` crate.
rg 'macro_rules! CosmwasmExt' --type rust

Length of output: 43


Script:

#!/bin/bash
# Description: Verify the presence and usage of `CosmwasmExt` in the `injective_std_derive` crate.

# Test: Search for any occurrence of `CosmwasmExt` in the codebase.
rg 'CosmwasmExt' --type rust

Length of output: 209699

packages/injective-std/src/types/injective/tokenfactory/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive instead of osmosis_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new library provides the same or enhanced functionality as the previous one.

Verification successful

Import statement update verified successfully.

The import statement has been correctly updated to use injective_std_derive::CosmwasmExt. The CosmwasmExt macro is defined in the injective_std_derive crate and is extensively used across the codebase, ensuring it provides the required functionality.

  • injective-std/src/types/injective/tokenfactory/v1beta1.rs
  • injective-std/src/types/injective/auction/v1beta1.rs
  • injective-std/src/types/injective/peggy/v1.rs
  • injective-std/src/types/cosmwasm/wasm/v1.rs
  • injective-std/src/types/cosmos/params/v1beta1.rs
  • injective-std/src/types/cosmos/distribution/v1beta1.rs
  • injective-std/src/types/cosmos/gov/v1beta1.rs
  • injective-std/src/types/cosmos/base/v1beta1.rs
  • injective-std/src/types/cosmos/authz/v1beta1.rs
  • injective-std/src/types/injective/permissions/v1beta1.rs
  • injective-std/src/types/cosmos/bank/v1beta1.rs
  • injective-std/src/types/injective/oracle/v1beta1.rs
  • injective-std/src/types/injective/insurance/v1beta1.rs
  • injective-std/src/types/injective/exchange/v1beta1.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive::CosmwasmExt` macro is correctly imported and used.

# Test: Search for the definition of the `CosmwasmExt` macro in the `injective_std_derive` crate.
rg --type rust --pattern 'macro_rules! CosmwasmExt' --files-with-matches

Length of output: 486


Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive::CosmwasmExt` macro is correctly imported and used.

# Test: Search for the definition of the `CosmwasmExt` macro in the `injective_std_derive` crate.
rg 'macro_rules! CosmwasmExt'

# Test: Search for the usage of the `CosmwasmExt` macro in the codebase.
rg 'CosmwasmExt'

Length of output: 209719

packages/injective-std/src/types/cosmos/auth/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive instead of osmosis_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that the new library provides the same or enhanced functionality as the previous one.

Verification successful

The CosmwasmExt proc-macro derive from injective_std_derive is correctly imported and used.

  • The CosmwasmExt proc-macro derive is defined and used extensively throughout the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive::CosmwasmExt` macro is correctly imported and used.

# Test: Search for the definition of the `CosmwasmExt` macro in the `injective_std_derive` crate.
rg --type rust --pattern 'macro_rules! CosmwasmExt' --files-with-matches

Length of output: 486


Script:

#!/bin/bash
# Description: Verify that the `injective_std_derive::CosmwasmExt` macro is correctly imported and used.

# Test: Search for the definition of the `CosmwasmExt` macro in the `injective_std_derive` crate.
rg 'macro_rules! CosmwasmExt' --type rust

Length of output: 43


Script:

#!/bin/bash
# Description: Verify if any macros are defined in the `injective_std_derive` crate and check the usage of `CosmwasmExt` in the codebase.

# Test 1: Search for any macro definitions in the `injective_std_derive` crate.
rg 'macro_rules!' --type rust --glob '*/injective_std_derive/*'

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

Length of output: 209914

packages/injective-std/src/types/injective/permissions/v1beta1.rs (2)

1-1: Verify the correctness of the new import.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality as osmosis_std_derive::CosmwasmExt.


326-326: Verify the correctness of the new import.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality as osmosis_std_derive::CosmwasmExt.

packages/injective-std/src/types/injective/wasmx/v1.rs (1)

1-1: Verify the correctness of the new import.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality as osmosis_std_derive::CosmwasmExt.

packages/injective-std/src/types/injective/insurance/v1beta1.rs (1)

1-1: Verify the correctness of the new import.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality as osmosis_std_derive::CosmwasmExt.

packages/injective-std/src/types/cosmos/gov/v1beta1.rs (1)

1-1: LGTM! But verify the usage of CosmwasmExt in the codebase.

The import statement change is approved.

However, ensure that all usages of CosmwasmExt are compatible with injective_std_derive.

packages/injective-std/src/types/cosmos/staking/v1beta1.rs (1)

1-1: LGTM! But verify the usage of CosmwasmExt in the codebase.

The import statement change is approved.

However, ensure that all usages of CosmwasmExt are compatible with injective_std_derive.

packages/injective-std/src/types/cosmos/bank/v1beta1.rs (1)

1-1: Verify the correctness of the new import.

Ensure that injective_std_derive::CosmwasmExt is correctly defined and used within the codebase.

Verification successful

The import statement is correct and integrates properly with the rest of the code.

The CosmwasmExt macro is correctly defined in the injective_std_derive crate and is used appropriately in the packages/injective-std/src/types/cosmos/bank/v1beta1.rs file.

  • The CosmwasmExt macro is defined in packages/injective-std-derive/src/lib.rs.
  • The macro is applied to multiple struct definitions in the target file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and correctness of the new import.

# Test: Search for the definition of CosmwasmExt in injective_std_derive.
rg --type rust 'CosmwasmExt' --glob 'packages/injective-std-derive/src/**/*.rs'

Length of output: 194


Script:

#!/bin/bash
# Description: Verify the usage of CosmwasmExt in the target file.

# Test: Search for the usage of CosmwasmExt in the target file.
rg 'CosmwasmExt' --glob 'packages/injective-std/src/types/cosmos/bank/v1beta1.rs'

Length of output: 8869

packages/injective-std/src/types/cosmos/distribution/v1beta1.rs (1)

1-1: Verify the impact of the import change.

The import statement has been changed from osmosis_std_derive::CosmwasmExt to injective_std_derive::CosmwasmExt. Ensure that the new dependency is compatible and functions as expected with the existing codebase.

packages/injective-std/src/types/cosmos/gov/v1.rs (1)

1-1: Verify the impact of the import change.

The import statement has been changed from osmosis_std_derive::CosmwasmExt to injective_std_derive::CosmwasmExt. Ensure that the new dependency is compatible and functions as expected with the existing codebase.

packages/injective-std/src/types/injective/oracle/v1beta1.rs (30)

Line range hint 4-8:
LGTM!

The Params struct is correctly defined.


Line range hint 9-16:
LGTM!

The OracleInfo struct is correctly defined.


Line range hint 17-25:
LGTM!

The ChainlinkPriceState struct is correctly defined.


Line range hint 26-36:
LGTM!

The BandPriceState struct is correctly defined.


Line range hint 37-45:
LGTM!

The PriceFeedState struct is correctly defined.


Line range hint 46-51:
LGTM!

The ProviderInfo struct is correctly defined.


Line range hint 52-58:
LGTM!

The ProviderState struct is correctly defined.


Line range hint 59-64:
LGTM!

The ProviderPriceState struct is correctly defined.


Line range hint 65-69:
LGTM!

The PriceFeedInfo struct is correctly defined.


Line range hint 70-73:
LGTM!

The PriceFeedPrice struct is correctly defined.


Line range hint 74-85:
LGTM!

The CoinbasePriceState struct is correctly defined.


Line range hint 86-95:
LGTM!

The StorkPriceState struct is correctly defined.


Line range hint 96-102:
LGTM!

The PriceState struct is correctly defined.


Line range hint 103-113:
LGTM!

The PythPriceState struct is correctly defined.


Line range hint 114-131:
LGTM!

The BandOracleRequest struct is correctly defined.


Line range hint 132-145:
LGTM!

The BandIbcParams struct is correctly defined.


Line range hint 146-152:
LGTM!

The SymbolPriceTimestamp struct is correctly defined.


Line range hint 153-156:
LGTM!

The LastPriceTimestamps struct is correctly defined.


Line range hint 157-164:
LGTM!

The PriceRecords struct is correctly defined.


Line range hint 165-169:
LGTM!

The PriceRecord struct is correctly defined.


Line range hint 170-198:
LGTM!

The OracleType enum is correctly defined.


Line range hint 199-205:
LGTM!

The SetChainlinkPriceEvent struct is correctly defined.


Line range hint 206-214:
LGTM!

The SetBandPriceEvent struct is correctly defined.


Line range hint 215-226:
LGTM!

The SetBandIbcPriceEvent struct is correctly defined.


Line range hint 227-232:
LGTM!

The EventBandIbcAckSuccess struct is correctly defined.


Line range hint 233-238:
LGTM!

The EventBandIbcAckError struct is correctly defined.


Line range hint 239-243:
LGTM!

The EventBandIbcResponseTimeout struct is correctly defined.


Line range hint 244-250:
LGTM!

The SetPriceFeedPriceEvent struct is correctly defined.


Line range hint 251-257:
LGTM!

The SetProviderPriceEvent struct is correctly defined.


1-1: Verify the new dependency.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality as osmosis_std_derive::CosmwasmExt and does not introduce any issues.

Verification successful

Verified the new dependency.

The injective_std_derive::CosmwasmExt provides the required functionality and is correctly implemented across the codebase. The change from osmosis_std_derive::CosmwasmExt to injective_std_derive::CosmwasmExt does not introduce any issues.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the functionality provided by the new dependency.

# Test: Search for the definition of `CosmwasmExt` in the `injective_std_derive` crate.
rg --type rust 'pub trait CosmwasmExt' --context 10

Length of output: 53


Script:

#!/bin/bash
# Description: Verify the functionality provided by the new dependency.

# Test 1: Search for all public traits in the `injective_std_derive` crate.
rg --type rust 'pub trait' --context 10

# Test 2: Search for all occurrences of `CosmwasmExt` in the codebase to verify its usage.
rg 'CosmwasmExt'

Length of output: 230370

packages/injective-std/src/types/injective/peggy/v1.rs (1)

1-1: Verify the impact of changing the import source.

The import statement has been changed from osmosis_std_derive to injective_std_derive. Ensure that all functionalities provided by CosmwasmExt from the new source are compatible with the existing code.

Verification successful

Verified the impact of changing the import source.

The import statement has been changed from osmosis_std_derive to injective_std_derive. The search results indicate that CosmwasmExt is consistently imported from injective_std_derive across the codebase, and there are no compatibility issues found.

  • All instances of CosmwasmExt are correctly using injective_std_derive.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of CosmwasmExt from the new source.

# Test: Search for the usage of CosmwasmExt. Expect: No compatibility issues.
rg --type rust 'CosmwasmExt'

Length of output: 209699

packages/injective-std/src/types/cosmwasm/wasm/v1.rs (1)

1-1: Verify the new import path.

Ensure that the injective_std_derive::CosmwasmExt path is correct and that the injective_std_derive crate is included in the project's dependencies.

Verification successful

Verified the new import path.

The injective_std_derive::CosmwasmExt path is correct and the injective_std_derive crate is properly included in the project's dependencies.

  • packages/injective-std-derive/src/lib.rs: Definition of CosmwasmExt.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new import path for `injective_std_derive::CosmwasmExt`.

# Test: Search for the `injective_std_derive` crate in the project's dependencies. Expect: The crate is listed as a dependency.
rg --type toml 'injective_std_derive'

Length of output: 37


Script:

#!/bin/bash
# Description: Verify the new import path for `injective_std_derive::CosmwasmExt`.

# Test: Search for the `injective_std_derive` crate in the project's dependencies across all relevant files.
rg --type toml 'injective_std_derive' .

# Test: Search for the `CosmwasmExt` within the `injective_std_derive` crate to ensure it exists.
rg 'CosmwasmExt' $(fd -e rs)

Length of output: 217986

packages/injective-std/src/types/injective/exchange/v1beta1.rs (15)

1-1: LGTM!

The import statement has been correctly updated to use injective_std_derive::CosmwasmExt.


332-332: Consider using snake_case for struct fields.

The field isPerpetual should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.

Tools
GitHub Check: Lints

[failure] 332-332:
structure field isPerpetual should have a snake case name

GitHub Check: Test Suite

[warning] 332-332:
structure field isPerpetual should have a snake case name


816-816: Consider using snake_case for struct fields.

The field isReduceOnly should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.

Tools
GitHub Check: Lints

[failure] 816-816:
structure field isReduceOnly should have a snake case name

GitHub Check: Test Suite

[warning] 816-816:
structure field isReduceOnly should have a snake case name


886-886: Consider using snake_case for struct fields.

The field isLong should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.

Tools
GitHub Check: Lints

[failure] 886-886:
structure field isLong should have a snake case name

GitHub Check: Test Suite

[warning] 886-886:
structure field isLong should have a snake case name


905-905: Consider using snake_case for struct fields.

The field isBuy should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.

Tools
GitHub Check: Lints

[failure] 905-905:
structure field isBuy should have a snake case name

GitHub Check: Test Suite

[warning] 905-905:
structure field isBuy should have a snake case name


1472-1472: Consider using snake_case for struct fields.

The field executionType should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.

Tools
GitHub Check: Lints

[failure] 1472-1472:
structure field executionType should have a snake case name


[failure] 1472-1472:
method executionType should have a snake case name

GitHub Check: Test Suite

[warning] 1472-1472:
structure field executionType should have a snake case name


[warning] 1472-1472:
method executionType should have a snake case name


1495-1495: Consider using snake_case for struct fields.

The field executionType should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.


1707-1707: Consider using snake_case for struct fields.

The field isLimitCancel should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.


1758-1758: Consider using snake_case for struct fields.

The field isLimitCancel should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.


1772-1772: Consider using snake_case for struct fields.

The field isLimitTrigger should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.


3180-3180: Consider using snake_case for struct fields.

The field isBuySide should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.


3193-3193: Consider using snake_case for struct fields.

The field isBuySide should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.


3352-3352: Consider using snake_case for struct fields.

The field exchangeType should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.


4861-4861: LGTM!

The import statement has been correctly updated to use injective_std_derive::CosmwasmExt.


5621-5628: Consider using snake_case for struct fields.

The fields triggerPrice, isBuy, and isLimit should ideally follow snake_case naming conventions as per Rust guidelines.

Ensure that this naming convention change is consistent across the codebase and does not introduce any issues.

Comment on lines +176 to +189
pub auctionRound: u64,
/// auctionClosingTime describes auction close time for the round
#[prost(int64, tag = "3")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub auction_closing_time: i64,
pub auctionClosingTime: i64,
/// highestBidder describes highest bidder on current round
#[prost(string, tag = "4")]
pub highest_bidder: ::prost::alloc::string::String,
pub highestBidder: ::prost::alloc::string::String,
/// highestBidAmount describes highest bid amount on current round
#[prost(string, tag = "5")]
pub highest_bid_amount: ::prost::alloc::string::String,
pub highestBidAmount: ::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.

Revert field names to snake_case.

The field names in the QueryCurrentAuctionBasketResponse struct have been changed to camelCase. However, static analysis hints suggest that they should remain in snake_case to follow Rust naming conventions.

-    pub auctionRound: u64,
+    pub auction_round: u64,
-    pub auctionClosingTime: i64,
+    pub auction_closing_time: i64,
-    pub highestBidder: ::prost::alloc::string::String,
+    pub highest_bidder: ::prost::alloc::string::String,
-    pub highestBidAmount: ::prost::alloc::string::String,
+    pub highest_bid_amount: ::prost::alloc::string::String,
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub auctionRound: u64,
/// auctionClosingTime describes auction close time for the round
#[prost(int64, tag = "3")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub auction_closing_time: i64,
pub auctionClosingTime: i64,
/// highestBidder describes highest bidder on current round
#[prost(string, tag = "4")]
pub highest_bidder: ::prost::alloc::string::String,
pub highestBidder: ::prost::alloc::string::String,
/// highestBidAmount describes highest bid amount on current round
#[prost(string, tag = "5")]
pub highest_bid_amount: ::prost::alloc::string::String,
pub highestBidAmount: ::prost::alloc::string::String,
pub auction_round: u64,
/// auctionClosingTime describes auction close time for the round
#[prost(int64, tag = "3")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub auction_closing_time: i64,
/// highestBidder describes highest bidder on current round
#[prost(string, tag = "4")]
pub highest_bidder: ::prost::alloc::string::String,
/// highestBidAmount describes highest bid amount on current round
#[prost(string, tag = "5")]
pub highest_bid_amount: ::prost::alloc::string::String,
Tools
GitHub Check: Lints

[failure] 176-176:
structure field auctionRound should have a snake case name


[failure] 183-183:
structure field auctionClosingTime should have a snake case name


[failure] 186-186:
structure field highestBidder should have a snake case name


[failure] 189-189:
structure field highestBidAmount should have a snake case name

GitHub Check: Test Suite

[warning] 176-176:
structure field auctionRound should have a snake case name


[warning] 183-183:
structure field auctionClosingTime should have a snake case name


[warning] 186-186:
structure field highestBidder should have a snake case name


[warning] 189-189:
structure field highestBidAmount should have a snake case name

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: 1

Outside diff range, codebase verification and nitpick comments (1)
packages/injective-std/src/types/injective/peggy/v1.rs (1)

1311-1311: Update the remaining instance of batch_fees to batchFees in the function definition.

The field batch_fees in the QueryBatchFeeResponse struct has been renamed to batchFees. However, the old field name batch_fees is still used in a function definition. Please update this instance to ensure consistency and prevent potential issues.

  • packages/injective-std/src/types/injective/peggy/v1.rs: pub fn batch_fees(&self) -> Result<QueryBatchFeeResponse, cosmwasm_std::StdError>
Analysis chain

Verify the usage of the new field name and update serialization/deserialization processes.

The field batch_fees in QueryBatchFeeResponse struct has been renamed to batchFees. Ensure that the new field name is correctly used throughout the codebase and update serialization and deserialization processes accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new field name and update serialization/deserialization processes.

# Test: Search for the usage of `batchFees`. Expect: No errors or issues with serialization/deserialization.
rg --type rust -A 5 $'batchFees'

Length of output: 703


Script:

#!/bin/bash
# Search for the usage of `batchFees` throughout the codebase to ensure consistency.
rg --type rust 'batchFees'

# Check for the usage of the old field name `batch_fees` to ensure it has been fully replaced.
rg --type rust 'batch_fees'

Length of output: 308


Script:

#!/bin/bash
# Search for all instances of `batch_fees` in the codebase to ensure they are updated to `batchFees`.
rg --type rust 'batch_fees'

Length of output: 170

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 22f645b and 05a5fc1.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (31)
  • packages/injective-protobuf/src/proto/mod.rs (1 hunks)
  • packages/injective-std-derive/src/lib.rs (1 hunks)
  • packages/injective-std/Cargo.toml (1 hunks)
  • packages/injective-std/src/types/cosmos/auth/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/auth/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/authz/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/authz/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/bank/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/bank/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/base/node/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/base/query/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/base/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/distribution/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/distribution/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/feegrant/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/gov/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/gov/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/gov/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/params/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/params/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/staking/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/cosmwasm/wasm/v1.rs (1 hunks)
  • packages/injective-std/src/types/injective/auction/v1beta1.rs (2 hunks)
  • packages/injective-std/src/types/injective/exchange/v1beta1.rs (15 hunks)
  • packages/injective-std/src/types/injective/insurance/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/injective/oracle/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/injective/peggy/v1.rs (2 hunks)
  • packages/injective-std/src/types/injective/permissions/v1beta1.rs (2 hunks)
  • packages/injective-std/src/types/injective/tokenfactory/v1beta1.rs (1 hunks)
  • packages/injective-std/src/types/injective/wasmx/v1.rs (1 hunks)
Files skipped from review due to trivial changes (9)
  • packages/injective-protobuf/src/proto/mod.rs
  • packages/injective-std/src/types/cosmos/authz/module/v1.rs
  • packages/injective-std/src/types/cosmos/gov/module/v1.rs
  • packages/injective-std/src/types/cosmos/gov/v1beta1.rs
  • packages/injective-std/src/types/cosmos/staking/v1beta1.rs
  • packages/injective-std/src/types/cosmwasm/wasm/v1.rs
  • packages/injective-std/src/types/injective/oracle/v1beta1.rs
  • packages/injective-std/src/types/injective/permissions/v1beta1.rs
  • packages/injective-std/src/types/injective/tokenfactory/v1beta1.rs
Files skipped from review as they are similar to previous changes (3)
  • packages/injective-std-derive/src/lib.rs
  • packages/injective-std/Cargo.toml
  • packages/injective-std/src/types/cosmos/base/v1beta1.rs
Additional context used
GitHub Check: Lints
packages/injective-std/src/types/injective/auction/v1beta1.rs

[failure] 176-176:
structure field auctionRound should have a snake case name


[failure] 183-183:
structure field auctionClosingTime should have a snake case name


[failure] 186-186:
structure field highestBidder should have a snake case name


[failure] 189-189:
structure field highestBidAmount should have a snake case name

packages/injective-std/src/types/injective/exchange/v1beta1.rs

[failure] 332-332:
structure field isPerpetual should have a snake case name


[failure] 816-816:
structure field isReduceOnly should have a snake case name


[failure] 886-886:
structure field isLong should have a snake case name


[failure] 905-905:
structure field isBuy should have a snake case name


[failure] 1472-1472:
structure field executionType should have a snake case name


[failure] 1472-1472:
method executionType should have a snake case name

GitHub Check: Test Suite
packages/injective-std/src/types/injective/auction/v1beta1.rs

[warning] 176-176:
structure field auctionRound should have a snake case name


[warning] 183-183:
structure field auctionClosingTime should have a snake case name


[warning] 186-186:
structure field highestBidder should have a snake case name


[warning] 189-189:
structure field highestBidAmount should have a snake case name

packages/injective-std/src/types/injective/exchange/v1beta1.rs

[warning] 332-332:
structure field isPerpetual should have a snake case name


[warning] 816-816:
structure field isReduceOnly should have a snake case name


[warning] 886-886:
structure field isLong should have a snake case name


[warning] 905-905:
structure field isBuy should have a snake case name


[warning] 1472-1472:
structure field executionType should have a snake case name


[warning] 1472-1472:
method executionType should have a snake case name

Additional comments not posted (36)
packages/injective-std/src/types/cosmos/params/module/v1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt instead of osmosis_std_derive::CosmwasmExt. Ensure that the new macro provides the same or enhanced functionality as the previous one.

packages/injective-std/src/types/cosmos/feegrant/module/v1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt instead of osmosis_std_derive::CosmwasmExt. Ensure that the new macro provides the same or enhanced functionality as the previous one.

packages/injective-std/src/types/cosmos/distribution/module/v1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt instead of osmosis_std_derive::CosmwasmExt. Ensure that the new macro provides the same or enhanced functionality as the previous one.

packages/injective-std/src/types/cosmos/bank/module/v1.rs (2)

Line range hint 2-14: LGTM!

The Module struct definition appears to be correct and follows standard Rust conventions.


1-1: Verify the impact of the new dependency.

The import statement has been changed from osmosis_std_derive to injective_std_derive. Ensure that the new dependency provides the required functionality and does not introduce any breaking changes.

packages/injective-std/src/types/cosmos/auth/module/v1.rs (2)

Line range hint 2-22: LGTM!

The Module and ModuleAccountPermission struct definitions appear to be correct and follow standard Rust conventions.


1-1: Verify the impact of the new dependency.

The import statement has been changed from osmosis_std_derive to injective_std_derive. Ensure that the new dependency provides the required functionality and does not introduce any breaking changes.

packages/injective-std/src/types/cosmos/base/node/v1beta1.rs (2)

Line range hint 2-45: LGTM!

The ConfigRequest, ConfigResponse, StatusRequest, and StatusResponse struct definitions appear to be correct and follow standard Rust conventions.


1-1: Verify the impact of the new dependency.

The import statement has been changed from osmosis_std_derive to injective_std_derive. Ensure that the new dependency provides the required functionality and does not introduce any breaking changes.

packages/injective-std/src/types/cosmos/base/query/v1beta1.rs (1)

1-1: Updated dependency to injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that this change does not introduce any compatibility issues with the rest of the codebase.

packages/injective-std/src/types/cosmos/params/v1beta1.rs (1)

1-1: Updated dependency to injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that this change does not introduce any compatibility issues with the rest of the codebase.

packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs (1)

1-1: Updated dependency to injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt. Ensure that this change does not introduce any compatibility issues with the rest of the codebase.

packages/injective-std/src/types/injective/auction/v1beta1.rs (1)

1-1: Verify compatibility of the new import.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality compared to osmosis_std_derive::CosmwasmExt.

packages/injective-std/src/types/cosmos/authz/v1beta1.rs (1)

1-1: Verify compatibility of the new import.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality compared to osmosis_std_derive::CosmwasmExt.

packages/injective-std/src/types/cosmos/auth/v1beta1.rs (1)

1-1: Verify compatibility of the new import.

Ensure that injective_std_derive::CosmwasmExt provides the same or improved functionality compared to osmosis_std_derive::CosmwasmExt.

packages/injective-std/src/types/injective/peggy/v1.rs (1)

1-1: Verify the compatibility and integration of the new dependency.

The import path for CosmwasmExt was altered from osmosis_std_derive to injective_std_derive. Ensure that the new dependency is compatible and correctly integrated.

packages/injective-std/src/types/injective/exchange/v1beta1.rs (15)

Line range hint 1-5:
LGTM!

The introduction of injective_std_derive::CosmwasmExt is appropriate and aligns with the PR's objective.


Line range hint 332-336:
LGTM!

The renaming of is_perpetual to isPerpetual is consistent with camelCase naming conventions.

Tools
GitHub Check: Lints

[failure] 332-332:
structure field isPerpetual should have a snake case name

GitHub Check: Test Suite

[warning] 332-332:
structure field isPerpetual should have a snake case name


Line range hint 816-820:
LGTM!

The renaming of is_reduce_only to isReduceOnly is consistent with camelCase naming conventions.

Tools
GitHub Check: Lints

[failure] 816-816:
structure field isReduceOnly should have a snake case name

GitHub Check: Test Suite

[warning] 816-816:
structure field isReduceOnly should have a snake case name


Line range hint 886-890:
LGTM!

The renaming of is_long to isLong is consistent with camelCase naming conventions.

Tools
GitHub Check: Lints

[failure] 886-886:
structure field isLong should have a snake case name

GitHub Check: Test Suite

[warning] 886-886:
structure field isLong should have a snake case name


Line range hint 905-909:
LGTM!

The renaming of is_buy to isBuy is consistent with camelCase naming conventions.

Tools
GitHub Check: Lints

[failure] 905-905:
structure field isBuy should have a snake case name

GitHub Check: Test Suite

[warning] 905-905:
structure field isBuy should have a snake case name


Line range hint 1472-1476:
LGTM!

The renaming of execution_type to executionType is consistent with camelCase naming conventions.

Tools
GitHub Check: Lints

[failure] 1472-1472:
structure field executionType should have a snake case name


[failure] 1472-1472:
method executionType should have a snake case name

GitHub Check: Test Suite

[warning] 1472-1472:
structure field executionType should have a snake case name


[warning] 1472-1472:
method executionType should have a snake case name


Line range hint 1495-1499:
LGTM!

The renaming of execution_type to executionType is consistent with camelCase naming conventions.


Line range hint 1707-1711:
LGTM!

The renaming of is_limit_cancel to isLimitCancel is consistent with camelCase naming conventions.


Line range hint 1758-1762:
LGTM!

The renaming of is_limit_cancel to isLimitCancel is consistent with camelCase naming conventions.


Line range hint 1772-1776:
LGTM!

The renaming of is_limit_trigger to isLimitTrigger is consistent with camelCase naming conventions.


Line range hint 3180-3184:
LGTM!

The renaming of is_buy_side to isBuySide is consistent with camelCase naming conventions.


Line range hint 3193-3197:
LGTM!

The renaming of is_buy_side to isBuySide is consistent with camelCase naming conventions.


Line range hint 3352-3356:
LGTM!

The renaming of exchange_type to exchangeType is consistent with camelCase naming conventions.


Line range hint 4861-4866:
LGTM!

The introduction of injective_std_derive::CosmwasmExt in the full_derivative_market module is appropriate and aligns with the PR's objective.


5621-5629: LGTM!

The renaming of trigger_price, is_buy, and is_limit to triggerPrice, isBuy, and isLimit respectively is consistent with camelCase naming conventions.

packages/injective-std/src/types/injective/wasmx/v1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt instead of osmosis_std_derive::CosmwasmExt. Ensure that this change aligns with the overall objectives and does not introduce any unintended side effects.

packages/injective-std/src/types/injective/insurance/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt instead of osmosis_std_derive::CosmwasmExt. Ensure that this change aligns with the overall objectives and does not introduce any unintended side effects.

packages/injective-std/src/types/cosmos/bank/v1beta1.rs (1)

1-1: Update import statement to use injective_std_derive.

The import statement has been updated to use injective_std_derive::CosmwasmExt instead of osmosis_std_derive::CosmwasmExt. Ensure that this change aligns with the overall objectives and does not introduce any unintended side effects.

packages/injective-std/src/types/cosmos/distribution/v1beta1.rs (1)

1-1: Verify the compatibility and functionality of the new dependency.

The import statement has been changed from osmosis_std_derive::CosmwasmExt to injective_std_derive::CosmwasmExt. Ensure that the new dependency provides the same or improved functionality without introducing any issues.

packages/injective-std/src/types/cosmos/gov/v1.rs (1)

1-1: Verify the compatibility and functionality of the new dependency.

The import statement has been changed from osmosis_std_derive::CosmwasmExt to injective_std_derive::CosmwasmExt. Ensure that the new dependency provides the same or improved functionality without introducing any issues.

Comment on lines +176 to +189
pub auctionRound: u64,
/// auctionClosingTime describes auction close time for the round
#[prost(int64, tag = "3")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub auction_closing_time: i64,
pub auctionClosingTime: i64,
/// highestBidder describes highest bidder on current round
#[prost(string, tag = "4")]
pub highest_bidder: ::prost::alloc::string::String,
pub highestBidder: ::prost::alloc::string::String,
/// highestBidAmount describes highest bid amount on current round
#[prost(string, tag = "5")]
pub highest_bid_amount: ::prost::alloc::string::String,
pub highestBidAmount: ::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.

Consider using snake_case for structure fields.

Static analysis tools suggest using snake_case for structure fields to align with Rust conventions.

- pub auctionRound: u64,
- pub auctionClosingTime: i64,
- pub highestBidder: ::prost::alloc::string::String,
- pub highestBidAmount: ::prost::alloc::string::String,
+ pub auction_round: u64,
+ pub auction_closing_time: i64,
+ pub highest_bidder: ::prost::alloc::string::String,
+ pub highest_bid_amount: ::prost::alloc::string::String,
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub auctionRound: u64,
/// auctionClosingTime describes auction close time for the round
#[prost(int64, tag = "3")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub auction_closing_time: i64,
pub auctionClosingTime: i64,
/// highestBidder describes highest bidder on current round
#[prost(string, tag = "4")]
pub highest_bidder: ::prost::alloc::string::String,
pub highestBidder: ::prost::alloc::string::String,
/// highestBidAmount describes highest bid amount on current round
#[prost(string, tag = "5")]
pub highest_bid_amount: ::prost::alloc::string::String,
pub highestBidAmount: ::prost::alloc::string::String,
pub auction_round: u64,
/// auctionClosingTime describes auction close time for the round
#[prost(int64, tag = "3")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub auction_closing_time: i64,
/// highestBidder describes highest bidder on current round
#[prost(string, tag = "4")]
pub highest_bidder: ::prost::alloc::string::String,
/// highestBidAmount describes highest bid amount on current round
#[prost(string, tag = "5")]
pub highest_bid_amount: ::prost::alloc::string::String,
Tools
GitHub Check: Lints

[failure] 176-176:
structure field auctionRound should have a snake case name


[failure] 183-183:
structure field auctionClosingTime should have a snake case name


[failure] 186-186:
structure field highestBidder should have a snake case name


[failure] 189-189:
structure field highestBidAmount should have a snake case name

GitHub Check: Test Suite

[warning] 176-176:
structure field auctionRound should have a snake case name


[warning] 183-183:
structure field auctionClosingTime should have a snake case name


[warning] 186-186:
structure field highestBidder should have a snake case name


[warning] 189-189:
structure field highestBidAmount should have a snake case name

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 05a5fc1 and 01a4748.

Files selected for processing (4)
  • packages/injective-std/src/types/injective/auction/mod.rs (1 hunks)
  • packages/injective-std/src/types/injective/exchange/mod.rs (1 hunks)
  • packages/injective-std/src/types/injective/peggy/mod.rs (1 hunks)
  • packages/injective-std/src/types/injective/peggy/v1.rs (2 hunks)
Files skipped from review due to trivial changes (4)
  • packages/injective-std/src/types/injective/auction/mod.rs
  • packages/injective-std/src/types/injective/exchange/mod.rs
  • packages/injective-std/src/types/injective/peggy/mod.rs
  • packages/injective-std/src/types/injective/peggy/v1.rs

@jbernal87 jbernal87 self-requested a review July 31, 2024 10:16
Copy link
Member

@gorgos gorgos left a comment

Choose a reason for hiding this comment

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

Obviously LGMT, but I wonder if some of these changes we will have to do manually now for every chain upgrade?

@gorgos gorgos merged commit feabd33 into dev Jul 31, 2024
4 checks passed
@gorgos gorgos deleted the f/injective-tooling branch July 31, 2024 10:19
}

#[proc_macro_derive(CosmwasmExt, attributes(proto_message, proto_query))]
pub fn derive_cosmwasm_ext(input: TokenStream) -> TokenStream {
Copy link
Contributor

Choose a reason for hiding this comment

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

brake into smaller functions could make sense

Copy link
Contributor

@jbernal87 jbernal87 left a comment

Choose a reason for hiding this comment

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

LGTM

@coderabbitai coderabbitai bot mentioned this pull request Feb 12, 2025
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.

3 participants