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: updated to latest protos #248

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

maxrobot
Copy link
Contributor

@maxrobot maxrobot commented Oct 14, 2024

Summary by CodeRabbit

  • New Features
    • Introduced new fields and structs in various modules to enhance functionality, including new querying capabilities for order books and auction parameters.
  • Improvements
    • Updated several structs to allow copying instead of cloning, improving memory handling and performance.
    • Enforced consistent naming conventions across modules by removing non-standard naming allowances.
  • Bug Fixes
    • Fixed inconsistencies in struct definitions and naming conventions to align with Rust standards.

Copy link

coderabbitai bot commented Oct 14, 2024

Walkthrough

The pull request introduces multiple changes across various modules in the injective-std package. The primary modifications involve updating derive attributes for numerous structs to include the Copy trait, allowing instances to be copied rather than cloned. Additionally, several modules have undergone structural changes, such as renaming fields to adhere to Rust naming conventions and adding new fields and structs for enhanced functionality. The overall focus is on improving memory handling and code consistency across the affected modules.

Changes

Affected Files Change Summary
packages/injective-std/src/types/cosmos/auth/v1beta1.rs
.../authz/module/v1.rs
.../authz/v1beta1.rs
.../bank/v1beta1.rs
.../base/node/v1beta1.rs
Updated derive attributes from Clone, PartialEq, Eq to Clone, Copy, PartialEq, Eq for several structs, allowing them to be copied.
packages/injective-std/src/types/cosmos/base/v1beta1.rs Modified type_url attributes in proto_message annotations for Coin, DecCoin, IntProto, and DecProto structs.
packages/injective-std/src/types/cosmos/distribution/v1beta1.rs Updated derive attributes for several structs to include Copy, allowing them to be copied.
packages/injective-std/src/types/cosmos/feegrant/module/v1.rs
.../feegrant/v1beta1.rs
Updated derive attributes for Module, MsgGrantAllowanceResponse, MsgRevokeAllowanceResponse, and MsgPruneAllowancesResponse to include Copy.
packages/injective-std/src/types/cosmos/gov/v1.rs
.../gov/v1beta1.rs
Updated derive attributes for multiple structs to include Copy, allowing them to be copied.
packages/injective-std/src/types/cosmos/params/module/v1.rs
.../params/v1beta1.rs
Updated derive attributes for Module and QuerySubspacesRequest structs to include Copy.
packages/injective-std/src/types/cosmos/staking/v1beta1.rs Updated derive attributes for several structs to include Copy, allowing them to be copied.
packages/injective-std/src/types/cosmwasm/wasm/v1.rs Updated several structs to derive Copy and added new structs for enhanced functionality.
packages/injective-std/src/types/injective/auction/mod.rs
.../auction/v1beta1.rs
Removed #![allow(non_snake_case)], added inj_basket_max_cap field, updated various structs to use optional message type for Coin, modified derive attributes to include Copy, and renamed fields to snake_case.
packages/injective-std/src/types/injective/exchange/mod.rs
.../exchange/v1beta1.rs
Removed #![allow(non_snake_case)], renamed fields to snake_case, added new fields and structs, and introduced new methods to ExchangeQuerier.
packages/injective-std/src/types/injective/insurance/v1beta1.rs Updated derive attributes for several structs to include Copy, allowing them to be copied.
packages/injective-std/src/types/injective/oracle/v1beta1.rs Updated derive attributes for multiple structs to include Copy, allowing them to be copied.
packages/injective-std/src/types/injective/peggy/mod.rs
.../peggy/v1.rs
Removed #![allow(non_snake_case)], enforcing Rust naming conventions.

Poem

🐇 In the land of code, where rabbits play,
Changes hop in, brightening the day.
With structs now copied, not just cloned,
Memory dances, efficiency honed.
Fields renamed, conventions embraced,
A whimsical world, where progress is paced! 🐇✨


🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

🧹 Outside diff range and nitpick comments (31)
packages/injective-std/src/types/cosmos/authz/module/v1.rs (1)

4-4: Approved: Appropriate use of Copy trait for zero-sized type.

The change from Clone to Copy for the Module struct is appropriate and aligns with Rust best practices for zero-sized types. This modification allows for implicit copying of Module instances, which can lead to more ergonomic code usage.

Consider adding a brief comment explaining why Copy is implemented for this empty struct. This can help future maintainers understand the rationale behind this design choice. For example:

/// Module is the config object of the authz module.
/// 
/// This is an empty struct implementing `Copy` as it's a zero-sized type,
/// allowing for efficient implicit copying.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.authz.module.v1.Module")]
pub struct Module {}
packages/injective-std/src/types/cosmos/base/v1beta1.rs (1)

Confirmed: Incorrect type_url modifications in cosmos/base/v1beta1.rs

The verification process has confirmed the issue raised in the initial review comment. The file packages/injective-std/src/types/cosmos/base/v1beta1.rs contains four instances of incorrectly modified type_url attributes:

  1. CoinCoinCoin
  2. DecCoinDecCoinDecCoin
  3. IntProtoIntProtoIntProto
  4. DecProtoDecProtoDecProto

These modifications are erroneous and need to be reverted. No other files in the codebase exhibit this particular issue.

Action items:

  1. Revert the changes in packages/injective-std/src/types/cosmos/base/v1beta1.rs to correct the type_url attributes.
  2. Conduct a thorough review of the change that introduced this error to understand how it occurred.
  3. Consider implementing a lint rule or automated check to validate type_url attributes and prevent similar issues in future commits.
  4. Add a test case that verifies the correctness of type_url attributes in the affected file.
🔗 Analysis chain

Line range hint 8-41: Systematic error in type_url modifications across all structs

There appears to be a systematic error in the modification of type_url attributes for all structs in this file. Each type_url has been changed to repeat the struct name three times, which is incorrect and could lead to serious compatibility issues.

Please revert all these changes to maintain the correct type_url format. Additionally, I recommend the following actions:

  1. Review the entire codebase for similar incorrect modifications.
  2. If this was due to an automated process, please check and correct the script or tool used.
  3. Add tests to verify the correctness of type_url attributes to prevent such issues in the future.

To help verify the extent of this issue, please run the following script:

This script will help identify any other instances of this issue and list all type_url attributes for manual verification.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for incorrect type_url patterns across the codebase

echo "Searching for incorrect type_url patterns..."
rg --type rust 'type_url\s*=\s*"/[^"]+(\w+)\1\1"'

echo "Listing all type_url attributes for manual verification..."
rg --type rust 'type_url\s*=\s*"[^"]+"'

Length of output: 155665


Script:

#!/bin/bash
# Description: Search for incorrect type_url patterns across the codebase using PCRE2

echo "Searching for incorrect type_url patterns with repeated struct names..."
rg --pcre2 --type rust 'type_url\s*=\s*"/cosmos\.base\.v1beta1\.(\w+)\1\1"'

echo "Listing all type_url attributes for manual verification..."
rg --type rust 'type_url\s*=\s*"[^"]+"'

Length of output: 156035

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

Inconsistent Implementation of Copy Trait in Response Structs

The verification reveals that numerous response structs across various files do not implement the Copy trait. This inconsistency may lead to inefficiencies in handling these types throughout the codebase.

  • Example files lacking the Copy trait:
    • packages/injective-std/src/types/injective/permissions/v1beta1.rs
    • packages/injective-std/src/types/injective/wasmx/v1.rs
    • packages/injective-std/src/types/injective/tokenfactory/v1beta1.rs
    • (and many others as per the provided output)

🔗 Analysis chain

Line range hint 179-216: Summary: Consistent implementation of Copy trait for response types

The changes in this file consistently add the Copy trait to all response structs (MsgGrantAllowanceResponse, MsgRevokeAllowanceResponse, and MsgPruneAllowancesResponse). This modification is appropriate for these zero-sized types and will allow for more efficient handling throughout the codebase.

To ensure project-wide consistency, it may be beneficial to verify if similar changes should be applied to response types in other files within the project.

To check for consistency across the project, you can run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for response types without the Copy trait in other files

# Search for response types without the Copy trait
rg --type rust 'struct \w+Response' | rg -v 'Copy' | rg -v 'packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs'

# Note: If this command returns results, it indicates other response types that might benefit from adding the Copy trait for consistency.

Length of output: 39065

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

189-191: Summary: Beneficial changes with a suggestion for consistency.

The addition of the Copy trait to MsgGrantResponse and MsgRevokeResponse is a positive change. These modifications can potentially improve performance and provide more flexibility in using these types throughout the codebase. The changes are safe, as both structs are empty, and they don't introduce any breaking changes.

For maintaining consistency across the codebase, it might be worth considering applying similar changes to other empty response structs, if any exist in related modules.

Consider reviewing other empty response structs in related modules and apply the Copy trait consistently where appropriate. This will ensure a uniform approach across the codebase.

Also applies to: 230-232

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

163-163: LGTM with a suggestion: Consider performance impact of Copy trait

The addition of the Copy trait to the QueryParamsResponse struct is safe, as the Params struct it contains is also Copy. However, since this struct contains an Option<Params>, the performance benefit of making it Copy might be minimal.

Consider profiling the code to ensure this change provides a measurable performance improvement. If not, it might be more idiomatic to leave it as Clone only.


284-284: LGTM with a suggestion: Consider future improvements

The addition of the Copy trait to the QueryAccountAddressByIdRequest struct is appropriate and can potentially improve performance. The struct contains only primitive types (i64 and u64), making it safe to implement Copy.

However, it's worth noting that this struct contains a deprecated field (id). In a future update, consider removing this deprecated field and updating all related code to use the account_id field exclusively. This would simplify the struct and remove potential confusion for users of this API.

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

Line range hint 192-196: Remove Copy trait from QueryInsuranceParamsResponse.

The Copy trait has been added to QueryInsuranceParamsResponse, but this struct contains a field of type Option<Params>. Since Params is not Copy (as discussed earlier), this struct cannot implement Copy.

Remove the Copy trait from the derive attribute list:

-#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
+#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
packages/injective-std/src/types/cosmos/gov/v1beta1.rs (1)

Line range hint 1-680: Summary of Copy trait additions

The changes in this file primarily involve adding the Copy trait to various structs. This can potentially improve performance in scenarios where these types are frequently copied. However, it's crucial to ensure that all fields within structs deriving Copy also implement Copy.

For future changes:

  1. Always verify that all fields in a struct implement Copy before deriving it for the struct.
  2. Consider the implications of making a type Copy on the broader system design, especially for larger or more complex structs.
  3. Be cautious with types that contain or might contain heap-allocated data, as deriving Copy for these can lead to unexpected behavior.
🧰 Tools
🪛 GitHub Check: Lints

[failure] 164-164:
the trait std::marker::Copy cannot be implemented for this type

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

Line range hint 537-682: Summary of Copy trait implementations

The changes in this file primarily involve adding the Copy trait to several response structs in the staking module. This can lead to more efficient operations when these structs are used, as they can be copied instead of cloned.

However, please note the following:

  1. Ensure that implementing Copy for these structs doesn't violate any invariants or lead to unexpected behavior in the rest of the codebase.
  2. Pay special attention to MsgBeginRedelegateResponse, as it may not be suitable for Copy due to its Option<Timestamp> field.
  3. Verify that all usages of these structs are still correct with the new Copy implementation.

Consider creating a test suite that verifies the correct behavior of these structs with their new Copy implementations, especially in scenarios where they are passed between functions or stored in collections.

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

Line range hint 1-897: Summary of changes and recommendations

The main change in this file is the systematic addition of the Copy trait to several structs related to governance. While this change might be part of a broader refactoring effort to improve performance or simplify usage, it has introduced potential issues:

  1. Some structs, like VotingParams and MsgCancelProposalResponse, may not be able to implement Copy due to their field types.
  2. The blanket addition of Copy to multiple structs without considering their individual compositions could lead to compilation errors or unexpected runtime behavior.

Recommendations:

  1. Review each struct individually to determine if Copy is appropriate and necessary.
  2. Remove Copy from structs that contain fields not implementing Copy.
  3. Consider the implications of making these types Copy on the overall system design and performance.
  4. Update documentation to reflect any changes in the behavior of these types.
  5. If performance is a concern, consider alternative optimizations that don't require making potentially incompatible types Copy.

Consider creating a comprehensive guide or checklist for adding Copy to structs in this codebase, ensuring that developers understand the implications and requirements for making a type Copy.

🧰 Tools
🪛 GitHub Check: Lints

[failure] 172-172:
the trait std::marker::Copy cannot be implemented for this type

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

733-736: LGTM: Adding Copy trait to MsgSetOrchestratorAddressesResponse

The addition of the Copy trait to MsgSetOrchestratorAddressesResponse is acceptable. However, it's worth noting that this struct appears to be empty (unit struct). In Rust, empty structs are already optimized and have a size of 0 bytes. While adding the Copy trait doesn't harm anything, it may not provide significant benefits in this case.

Consider whether adding Copy to this empty struct provides any tangible benefits in the codebase usage.


769-772: LGTM: Adding Copy trait to MsgValsetConfirmResponse

The addition of the Copy trait to MsgValsetConfirmResponse is acceptable. However, as with the previous struct, this appears to be an empty (unit) struct. While adding the Copy trait is harmless, it may not provide significant benefits for an empty struct, which is already optimized in Rust.

Consider whether adding Copy to this empty struct provides any tangible benefits in the codebase usage. If this is done for consistency with other response types, ensure this approach is documented in the project's coding guidelines.


798-801: LGTM: Adding Copy trait to MsgSendToEthResponse

The addition of the Copy trait to MsgSendToEthResponse is consistent with the changes made to other response structs. However, as this appears to be another empty (unit) struct, the benefits of adding Copy are minimal.

Given that this is the third empty response struct with Copy added, consider having a broader discussion about the approach to empty response structs in the project. If this is intentional for consistency or future-proofing, it might be worth documenting this decision in the project's design docs or coding guidelines.


820-823: LGTM: Adding Copy trait to MsgRequestBatchResponse

The addition of the Copy trait to MsgRequestBatchResponse maintains consistency with other response structs in this file. While the benefit for an empty struct is minimal, this approach ensures uniform treatment of response types.

As this pattern of adding Copy to empty response structs is consistent throughout the file, consider adding a comment at the top of the file or in the module documentation explaining this design decision. This will help future maintainers understand the reasoning behind these traits on empty structs.


851-854: LGTM: Adding Copy trait to MsgConfirmBatchResponse

The addition of the Copy trait to MsgConfirmBatchResponse is consistent with the treatment of other response structs in this file. This maintains a uniform approach to these types.

Given the repetitive nature of these empty response structs with the Copy trait, consider if a macro could be used to generate these structs. This could reduce code duplication and make it easier to maintain consistency. For example:

macro_rules! empty_response {
    ($name:ident) => {
        #[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
        #[proto_message(type_url = concat!("/injective.peggy.v1.", stringify!($name)))]
        pub struct $name {}
    };
}

empty_response!(MsgConfirmBatchResponse);
empty_response!(MsgRequestBatchResponse);
// ... other empty response structs

This approach would centralize the definition of these structs and make it easier to modify them uniformly in the future if needed.


889-892: LGTM: Adding Copy trait to MsgDepositClaimResponse

The addition of the Copy trait to MsgDepositClaimResponse maintains consistency with other response structs in this file. This uniform treatment of response types is good for maintaining a consistent API.

As suggested in the previous comment, the repetitive nature of these empty response structs with identical derive attributes strongly indicates that a macro-based approach could significantly reduce code duplication and improve maintainability. If you haven't already, please consider implementing the macro suggestion provided earlier for all these similar response structs.


922-925: LGTM: Adding Copy trait to MsgWithdrawClaimResponse

The addition of the Copy trait to MsgWithdrawClaimResponse is consistent with the treatment of other response structs in this file. This maintains a uniform approach to these types.

The continued repetition of nearly identical struct definitions strongly reinforces the need for a more efficient code structure. As suggested previously, a macro-based approach could significantly reduce this repetition. Additionally, consider creating a trait or a generic struct for these response types if they share common behavior or if you anticipate adding methods to them in the future. This could look like:

trait EmptyResponse: Clone + Copy + PartialEq + Eq + prost::Message + serde::Serialize + serde::Deserialize {}

#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/injective.peggy.v1.EmptyResponse")]
struct EmptyResponseStruct {}

impl EmptyResponse for EmptyResponseStruct {}

type MsgWithdrawClaimResponse = EmptyResponseStruct;
type MsgDepositClaimResponse = EmptyResponseStruct;
// ... other empty response types

This approach would centralize the logic and make it easier to modify or extend these types in the future.


962-965: LGTM: Adding Copy trait to MsgERC20DeployedClaimResponse

The addition of the Copy trait to MsgERC20DeployedClaimResponse maintains consistency with other response structs in this file.

The excessive repetition of nearly identical struct definitions has reached a point where an immediate refactor is strongly recommended. This repetition increases the risk of inconsistencies and makes the code harder to maintain. Please prioritize implementing one of the previously suggested solutions (macro-based approach or generic struct with trait) to address this issue. This refactor will significantly improve code quality, readability, and maintainability.

Additionally, it may be beneficial to create a tracking issue in your project management system to ensure this refactor is prioritized and completed in the near future.


983-986: LGTM: Adding Copy trait to MsgCancelSendToEthResponse

The addition of the Copy trait to MsgCancelSendToEthResponse is consistent with other response structs in this file.

While this change maintains consistency, the continued repetition of nearly identical struct definitions has become a critical issue that needs immediate attention. At this point, it's strongly recommended to:

  1. Halt any further similar changes to response structs.
  2. Implement the previously suggested refactoring solutions (macro-based approach or generic struct with trait) as a matter of priority.
  3. Once the refactor is complete, apply it to all existing response structs in a single, comprehensive pull request.

This approach will prevent further accumulation of technical debt and ensure a more maintainable codebase going forward. Consider creating a high-priority task in your project management system to track this refactor and ensure it's addressed promptly.


1001-1004: LGTM: Adding Copy trait to MsgSubmitBadSignatureEvidenceResponse

The addition of the Copy trait to MsgSubmitBadSignatureEvidenceResponse maintains consistency with other response structs in this file.

The repetition of nearly identical struct definitions has reached a critical level, severely impacting code quality and maintainability. At this point, it's crucial to:

  1. Immediately halt all further additions of Copy traits to empty response structs.
  2. Initiate a comprehensive refactor as the highest priority task. This should implement either the macro-based approach or the generic struct with trait solution previously suggested.
  3. Apply the refactored solution to all existing response structs in a single, well-reviewed pull request.
  4. Update the project's coding guidelines to reflect the new approach for handling these types of response structs.

This situation highlights the importance of addressing code duplication early. Please treat this refactor as a critical task to prevent further degradation of code quality. Consider involving the entire team in a brief design discussion to ensure the chosen solution meets all current and foreseeable future requirements.


1038-1041: Consistency maintained, but refactor urgently needed

While the addition of the Copy trait to MsgValsetUpdatedClaimResponse maintains consistency with other response structs, the level of repetition has become unsustainable.

Given the critical level of code duplication, I strongly recommend the following course of action:

  1. Revert this change along with all similar recent changes adding the Copy trait to empty response structs.
  2. Implement a comprehensive refactor using either the macro-based approach or the generic struct with trait solution as previously suggested.
  3. Once the refactor is complete and well-tested, reintroduce the Copy trait functionality through the new, DRY (Don't Repeat Yourself) approach.
  4. Update all affected structs in a single, carefully reviewed pull request.

This approach will immediately reduce the duplication in the codebase and provide a cleaner slate for implementing a more maintainable solution. It will also prevent any potential issues that might arise from the current repetitive structure.

Please prioritize this refactor as a matter of urgency to improve code quality and maintainability.


1055-1058: Halt further changes and prioritize refactor

The addition of the Copy trait to MsgUpdateParamsResponse continues the pattern of excessive repetition seen in previous structs.

At this point, it's crucial to:

  1. Immediately halt this change and any similar pending changes.
  2. Do not merge this particular modification or any others like it.
  3. Prioritize the implementation of the comprehensive refactor discussed in previous comments.
  4. Once the refactor is complete, reintroduce the Copy trait functionality through the new, DRY approach.

The continued addition of these repetitive traits is exacerbating an already significant maintenance issue. Focus all efforts on the refactor to improve overall code quality and maintainability. This will provide a much better foundation for any future changes or additions to these response types.

Consider creating a high-priority, blocking issue in your project management system to ensure this refactor is addressed before any further changes to these response structs are made.


1074-1077: Stop further changes, focus on refactor

The addition of the Copy trait to MsgBlacklistEthereumAddressesResponse perpetuates the pattern of excessive repetition.

I strongly advise against proceeding with this change. Instead:

  1. Abandon this change and any similar pending changes.
  2. Place an immediate moratorium on any further modifications to these response structs.
  3. Dedicate all available resources to implementing the comprehensive refactor discussed in previous comments.
  4. Only after the refactor is complete and thoroughly tested should you consider reintroducing these traits through the new, DRY approach.

Continuing to add these repetitive traits is actively harmful to the codebase's maintainability and quality. The focus now should be entirely on implementing a solution that eliminates this repetition and provides a sustainable way to handle these response types.

Consider holding a team meeting to discuss the importance of this refactor and to ensure that all team members are aligned on the approach and the moratorium on further changes to these structs.


1093-1096: Strongly oppose this change - Critical refactor needed

The addition of the Copy trait to MsgRevokeEthereumBlacklistResponse further exacerbates the severe code duplication issue.

I strongly oppose proceeding with this change. The situation has become critical, and immediate action is required:

  1. Reject this change and any similar pending changes outright.
  2. Implement an immediate and total freeze on any modifications to these response structs.
  3. Escalate the priority of the comprehensive refactor to the highest level.
  4. Consider this refactor a blocker for any further development in this area of the codebase.

The level of repetition has reached a point where it poses a significant risk to code maintainability, readability, and the overall health of the project. Continuing to add these repetitive traits is actively harmful and goes against best practices in software development.

Recommend calling an emergency team meeting to:

  1. Communicate the severity of this issue to all team members.
  2. Assign dedicated resources to implement the refactor immediately.
  3. Establish a clear timeline for completing the refactor.
  4. Set up a code review process specifically for the refactored solution to ensure it meets all requirements and best practices.

Only after the refactor is complete, tested, and approved should you consider reintroducing any traits to these response types, and then only through the new, DRY approach.


Line range hint 1168-1174: Oppose change - Extend refactor to include request structs

While this change shifts from response to request structs, the addition of the Copy trait to QueryParamsRequest continues the pattern of potential over-application to empty structs.

I recommend against proceeding with this change. Instead:

  1. Reject this change and pause any similar modifications to request structs.
  2. Extend the scope of the previously discussed refactor to include both response and request structs.
  3. Implement a unified approach that handles both types of structs efficiently and without repetition.

The shift to request structs highlights that this issue may be more widespread than initially thought. This reinforces the critical need for a comprehensive refactor. Consider the following approach:

macro_rules! define_empty_struct {
    ($name:ident, $type:expr) => {
        #[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
        #[proto_message(type_url = concat!("/injective.peggy.v1.", stringify!($name)))]
        pub struct $name {}
    };
}

define_empty_struct!(QueryParamsRequest, "Request");
define_empty_struct!(MsgRevokeEthereumBlacklistResponse, "Response");
// ... other empty request and response structs

This approach would handle both request and response structs uniformly, reducing duplication and improving maintainability. Ensure that the refactor task in your project management system includes both request and response structs in its scope.


Line range hint 1183-1189: Halt change - Prioritize comprehensive refactor

The addition of the Copy trait to QueryCurrentValsetRequest continues the pattern we've seen with both response and request structs.

I strongly advise against proceeding with this change. Instead:

  1. Halt this change and any similar pending changes to both request and response structs.
  2. Prioritize the implementation of a comprehensive refactor that addresses both types of structs.
  3. Ensure that the refactor solution can handle potential future additions to these structs efficiently.

The continued addition of these traits to empty structs across different types (requests and responses) further emphasizes the need for a unified, DRY solution. Consider expanding the previously suggested macro approach to include a type parameter:

macro_rules! define_empty_struct {
    ($name:ident, $type:expr) => {
        #[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
        #[proto_message(type_url = concat!("/injective.peggy.v1.", stringify!($name)))]
        pub struct $name {}
    };
}

define_empty_struct!(QueryCurrentValsetRequest, "Request");
define_empty_struct!(MsgRevokeEthereumBlacklistResponse, "Response");
// ... other empty request and response structs

This approach would provide a flexible and maintainable solution for both request and response structs. Emphasize to the team the importance of addressing this issue holistically rather than continuing with piecemeal changes.

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

844-844: Add Documentation for is_reduce_only Field

The is_reduce_only field in SubaccountOrder lacks documentation. Adding a comment will enhance code readability and maintainability.

Add a comment:

/// Indicates whether the order is reduce-only
pub is_reduce_only: bool,

914-914: Consider Clarifying the Purpose of is_long

While is_long is descriptive, providing a comment can help others understand its role in the Position struct.

Add a comment:

/// True if the position is long, false if short
pub is_long: bool,

1500-1500: Consistency in Enum Variant Naming

In the ExecutionType enum, the variant UnspecifiedExecutionType could be shortened to Unspecified for consistency and brevity with other variants.

Consider renaming:

UnspecifiedExecutionType = 0,

To:

Unspecified = 0,

Ensure to update all usages accordingly.


2102-2115: Add Missing Documentation for MsgInstantSpotMarketLaunch Fields

The fields base_decimals and quote_decimals are added to MsgInstantSpotMarketLaunch but lack documentation. Providing comments improves code comprehension.

Add comments:

/// Base token decimals
pub base_decimals: u32,

/// Quote token decimals
pub quote_decimals: u32,

3478-3491: Add Documentation for Decimal Fields in SpotMarketLaunchProposal

The new fields base_decimals and quote_decimals lack documentation comments. Adding explanations will aid understanding for future maintainers.

Include comments:

/// Base token decimals
pub base_decimals: u32,

/// Quote token decimals
pub quote_decimals: u32,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 78f9ab9 and 1a9c24b.

📒 Files selected for processing (26)
  • packages/injective-std/src/types/cosmos/auth/v1beta1.rs (7 hunks)
  • packages/injective-std/src/types/cosmos/authz/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/authz/v1beta1.rs (2 hunks)
  • packages/injective-std/src/types/cosmos/bank/v1beta1.rs (5 hunks)
  • packages/injective-std/src/types/cosmos/base/node/v1beta1.rs (2 hunks)
  • packages/injective-std/src/types/cosmos/base/v1beta1.rs (4 hunks)
  • packages/injective-std/src/types/cosmos/distribution/v1beta1.rs (7 hunks)
  • packages/injective-std/src/types/cosmos/feegrant/module/v1.rs (1 hunks)
  • packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs (3 hunks)
  • packages/injective-std/src/types/cosmos/gov/v1.rs (11 hunks)
  • packages/injective-std/src/types/cosmos/gov/v1beta1.rs (7 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 (6 hunks)
  • packages/injective-std/src/types/cosmwasm/wasm/v1.rs (18 hunks)
  • packages/injective-std/src/types/injective/auction/mod.rs (0 hunks)
  • packages/injective-std/src/types/injective/auction/v1beta1.rs (7 hunks)
  • packages/injective-std/src/types/injective/exchange/mod.rs (0 hunks)
  • packages/injective-std/src/types/injective/exchange/v1beta1.rs (61 hunks)
  • packages/injective-std/src/types/injective/insurance/v1beta1.rs (9 hunks)
  • packages/injective-std/src/types/injective/oracle/v1beta1.rs (22 hunks)
  • packages/injective-std/src/types/injective/peggy/mod.rs (0 hunks)
  • packages/injective-std/src/types/injective/peggy/v1.rs (27 hunks)
  • packages/injective-std/src/types/injective/permissions/v1beta1.rs (11 hunks)
  • packages/injective-std/src/types/injective/tokenfactory/v1beta1.rs (7 hunks)
  • packages/injective-std/src/types/injective/wasmx/v1.rs (7 hunks)
💤 Files with no reviewable changes (3)
  • 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
🧰 Additional context used
🪛 GitHub Check: Lints
packages/injective-std/src/types/cosmos/gov/v1.rs

[failure] 172-172:
the trait std::marker::Copy cannot be implemented for this type


[failure] 880-880:
the trait std::marker::Copy cannot be implemented for this type

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

[failure] 164-164:
the trait std::marker::Copy cannot be implemented for this type

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

[failure] 598-598:
the trait std::marker::Copy cannot be implemented for this type

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

[failure] 3-3:
the trait std::marker::Copy cannot be implemented for this type

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

4-4: LGTM: Adding Copy trait is appropriate for this empty struct.

The addition of the Copy trait to the Module struct is a good optimization. Since Module is an empty struct, implementing Copy is appropriate and can lead to more efficient code by allowing bit-wise copying instead of cloning.

Some implications to keep in mind:

  1. This change may slightly improve performance in scenarios where Module instances are frequently copied.
  2. The struct can no longer implement Drop, which is fine for now given its empty state.
  3. If fields are added to Module in the future, ensure they also implement Copy, or consider removing the Copy trait at that time.
packages/injective-std/src/types/cosmos/feegrant/module/v1.rs (1)

4-4: Approved: Addition of Copy trait is appropriate for this empty struct.

The addition of the Copy trait to the Module struct is a good optimization. Since Module is an empty struct, implementing Copy allows for more efficient passing and assignment of Module instances. This change enables bit-wise copying instead of moving or cloning, which can lead to performance improvements in certain scenarios.

A few points to note:

  1. The Copy trait is compatible with all other derived traits.
  2. For empty structs like this, Copy is particularly beneficial and carries no drawbacks.
  3. The redundancy of Clone and Copy is harmless; Copy implies Clone.

This change adheres to Rust best practices for small, stack-allocated types.

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

4-6: LGTM: Adding Copy trait to ConfigRequest is beneficial.

The addition of the Copy trait to ConfigRequest is a good improvement. Since ConfigRequest is an empty struct, implementing Copy is safe and can potentially improve performance by allowing implicit copying instead of cloning when passing this struct around.


27-29: LGTM: Adding Copy trait to StatusRequest is consistent and beneficial.

The addition of the Copy trait to StatusRequest is a good improvement, consistent with the change made to ConfigRequest. As StatusRequest is also an empty struct, implementing Copy is safe and can potentially improve performance by allowing implicit copying instead of cloning when passing this struct around.


Line range hint 1-58: Summary: Beneficial updates to request structs, maintaining consistency.

The changes in this file are focused on adding the Copy trait to the empty request structs (ConfigRequest and StatusRequest). These modifications are beneficial for performance and align with Rust best practices for small, copyable types. The response structs (ConfigResponse and StatusResponse) were correctly left unchanged, as they contain fields that may not be suitable for Copy.

These updates are consistent with the PR objective of updating to the latest protos and improve the efficiency of handling these request types in the codebase.

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

57-57: LGTM: Adding Copy trait is beneficial.

Adding the Copy trait to the QuerySubspacesRequest struct is a good improvement. Since the struct is empty, implementing Copy is safe and can potentially improve performance by allowing the struct to be copied instead of cloned. This change adheres to Rust's best practices for small, stack-allocated types and doesn't introduce any breaking changes.

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

179-181: LGTM: Addition of Copy trait is appropriate

The addition of the Copy trait to MsgGrantAllowanceResponse is a good improvement. Since this struct has no fields, implementing Copy allows for more efficient handling of this type in the codebase.


196-198: LGTM: Consistent addition of Copy trait

The addition of the Copy trait to MsgRevokeAllowanceResponse is consistent with the previous change and appropriate for this zero-sized struct. This modification will allow for more efficient handling of this type throughout the codebase.


214-216: LGTM: Consistent Copy trait implementation across response types

The addition of the Copy trait to MsgPruneAllowancesResponse completes the consistent implementation across all response types in this file. This change is appropriate for the zero-sized struct and aligns with best practices for efficient type handling in Rust.

The comment indicating availability since cosmos-sdk 0.50 has been preserved, which is good for maintaining important metadata.

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

189-191: LGTM: Adding Copy trait to MsgGrantResponse is beneficial.

The addition of the Copy trait to MsgGrantResponse is a good improvement. Since this struct is empty, implementing Copy is safe and can potentially improve performance by allowing the struct to be copied instead of moved. This is particularly useful for small, stateless types like response messages.


230-232: LGTM: Consistent addition of Copy trait to MsgRevokeResponse.

The addition of the Copy trait to MsgRevokeResponse is appropriate and consistent with the change made to MsgGrantResponse. This empty struct will benefit from the same performance improvements and increased flexibility in usage. The change maintains consistency across similar types in the module.

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

Line range hint 101-105: LGTM: Appropriate use of Copy trait for QueryParamsRequest

The addition of the Copy trait to QueryParamsRequest is appropriate as it's an empty struct. This change allows for more efficient passing of this type in the codebase.


Line range hint 166-171: LGTM: Appropriate use of Copy trait for QueryModuleStateRequest

The addition of the Copy trait to QueryModuleStateRequest is appropriate as it's an empty struct. This change allows for more efficient passing of this type in the codebase.


232-234: LGTM: Appropriate use of Copy trait for MsgMintResponse

The addition of the Copy trait to MsgMintResponse is appropriate as it's an empty struct. This change allows for more efficient passing of this type in the codebase.


247-249: LGTM: Appropriate use of Copy trait for MsgBurnResponse

The addition of the Copy trait to MsgBurnResponse is appropriate as it's an empty struct. This change allows for more efficient passing of this type in the codebase.


266-268: LGTM: Appropriate use of Copy trait for MsgChangeAdminResponse

The addition of the Copy trait to MsgChangeAdminResponse is appropriate as it's an empty struct. This change allows for more efficient passing of this type in the codebase.


283-285: LGTM: Appropriate use of Copy trait for MsgSetDenomMetadataResponse

The addition of the Copy trait to MsgSetDenomMetadataResponse is appropriate as it's an empty struct. This change allows for more efficient passing of this type in the codebase.


300-302: LGTM: Consistent and appropriate use of Copy trait

The addition of the Copy trait to MsgUpdateParamsResponse is appropriate as it's an empty struct. This change allows for more efficient passing of this type in the codebase.

Overall, the changes in this file consistently add the Copy trait to empty response structs, which is a good practice for improving performance and usability of these types throughout the codebase.

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

55-55: LGTM: Beneficial addition of the Copy trait

The addition of the Copy trait to the Params struct is a positive change. It allows for more efficient passing of this struct in function calls, which can lead to performance improvements. Since the struct contains only u64 fields, which are already Copy, this change is safe and consistent with Rust best practices.


154-154: LGTM: Appropriate addition of the Copy trait

The addition of the Copy trait to the QueryParamsRequest struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitly Copy can lead to more efficient code in certain scenarios. This change aligns well with the PR objectives and Rust best practices.


174-174: LGTM: Appropriate addition of the Copy trait

The addition of the Copy trait to the QueryModuleAccountsRequest struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitly Copy can lead to more efficient code in certain scenarios. This change aligns well with the PR objectives and Rust best practices.


215-215: LGTM: Appropriate addition of the Copy trait

The addition of the Copy trait to the Bech32PrefixRequest struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitly Copy can lead to more efficient code in certain scenarios. This change aligns well with the PR objectives and Rust best practices.


372-372: LGTM: Appropriate addition of the Copy trait

The addition of the Copy trait to the MsgUpdateParamsResponse struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitly Copy can lead to more efficient code in certain scenarios. This change aligns well with the PR objectives and Rust best practices.


Line range hint 1-424: Overall assessment: Positive changes with minor suggestions for future improvements

The changes in this file consistently add the Copy trait to various structs, which aligns well with the PR objectives of updating to the latest protos. These modifications generally improve the efficiency of struct handling in the codebase.

Most of the changes are straightforward and beneficial. A few suggestions were made for future improvements:

  1. Consider profiling the QueryParamsResponse struct to ensure the Copy trait provides measurable performance benefits.
  2. In a future update, consider removing the deprecated id field from the QueryAccountAddressByIdRequest struct.

These suggestions are for future consideration and do not block the current changes. The overall impact of these changes is positive, potentially leading to more efficient code.

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

Line range hint 290-297: Approve the addition of Copy trait and #[proto_query] attribute.

The changes to QueryWasmxParamsRequest look good:

  1. Adding the Copy trait is appropriate for this zero-sized struct, allowing for more efficient copying instead of cloning.
  2. The new #[proto_query] attribute correctly specifies the query path and response type, which will improve type safety and make the API more self-documenting.

Line range hint 309-316: Approve the addition of Copy trait and #[proto_query] attribute.

The changes to QueryModuleStateRequest are similar to the previous struct and are also appropriate:

  1. The Copy trait addition is beneficial for this zero-sized struct.
  2. The #[proto_query] attribute correctly specifies the query path and response type.

These changes will improve performance and type safety.


400-402: Approve the addition of Copy trait.

The change to MsgUpdateContractResponse is appropriate:

  1. Adding the Copy trait to this zero-sized struct allows for more efficient copying instead of cloning.

This change will slightly improve performance when working with this type.


414-416: Approve the addition of Copy trait.

The change to MsgActivateContractResponse is appropriate:

  1. Adding the Copy trait to this zero-sized struct allows for more efficient copying instead of cloning.

This change will slightly improve performance when working with this type.


428-430: Approve the addition of Copy trait.

The change to MsgDeactivateContractResponse is appropriate:

  1. Adding the Copy trait to this zero-sized struct allows for more efficient copying instead of cloning.

This change will slightly improve performance when working with this type.


445-447: Approve the addition of Copy trait.

The change to MsgUpdateParamsResponse is appropriate:

  1. Adding the Copy trait to this zero-sized struct allows for more efficient copying instead of cloning.

This change will slightly improve performance when working with this type.


458-460: Approve the addition of Copy trait.

The change to MsgRegisterContractResponse is appropriate:

  1. Adding the Copy trait to this zero-sized struct allows for more efficient copying instead of cloning.

This change will slightly improve performance when working with this type.


Line range hint 290-460: Overall assessment: Improvements in efficiency and type safety

The changes in this file consistently improve the codebase in two main ways:

  1. Addition of the Copy trait to zero-sized structs (response types) allows for more efficient copying instead of cloning. This can lead to small performance improvements when working with these types.

  2. Addition of #[proto_query] attributes to query request structs improves type safety and makes the API more self-documenting. This can help prevent errors and improve developer experience when working with these queries.

These changes align well with Rust best practices and should make the code more robust and slightly more efficient.

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

Line range hint 182-188: LGTM: Copy trait addition is appropriate.

The addition of the Copy trait to QueryInsuranceParamsRequest is appropriate as it's an empty struct. This change can potentially improve performance when passing this type around.


Line range hint 225-231: LGTM: Copy trait addition is appropriate.

The addition of the Copy trait to QueryInsuranceFundsRequest is appropriate as it's an empty struct. This change can potentially improve performance when passing this type around.


Line range hint 294-300: LGTM: Copy trait addition is appropriate.

The addition of the Copy trait to QueryModuleStateRequest is appropriate as it's an empty struct. This change can potentially improve performance when passing this type around.


353-353: LGTM: Copy trait additions are appropriate for empty response structs.

The addition of the Copy trait to MsgCreateInsuranceFundResponse, MsgUnderwriteResponse, MsgRequestRedemptionResponse, and MsgUpdateParamsResponse is appropriate as they are all empty structs. This change can potentially improve performance when passing these types around.

Also applies to: 374-374, 395-395, 412-412


Line range hint 1-450: Overall assessment: Careful review of Copy trait additions needed.

The changes in this file primarily involve adding the Copy trait to various structs. While this is appropriate and beneficial for empty structs, it has led to potential issues with structs containing non-Copy fields.

Here's a summary of the findings:

  1. Params and QueryInsuranceParamsResponse should not implement Copy due to non-Copy fields.
  2. Empty structs like QueryInsuranceParamsRequest, QueryInsuranceFundsRequest, QueryModuleStateRequest, and various response types can safely implement Copy.

I recommend a careful review of all structs where Copy has been added, ensuring that:

  1. All fields in the struct implement Copy if the struct itself is to implement Copy.
  2. For structs that can't implement Copy, consider if there's a way to redesign them to allow for Copy, or if Clone is sufficient for your use case.
  3. Document the rationale for adding Copy to help maintain consistency in future development.

To help identify other potential issues with Copy implementations, you can run the following script:

This script will help you review all structs implementing Copy and their fields, allowing for a comprehensive check of Copy implementations across the codebase.

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

Line range hint 315-326: LGTM: Copy derivation for QueryProposalRequest

The addition of the Copy trait to QueryProposalRequest is appropriate. Since the struct only contains a u64 field, which implements Copy, this derivation is safe and can improve performance in certain usage scenarios.


Line range hint 535-546: LGTM: Copy derivation for QueryTallyResultRequest

The addition of the Copy trait to QueryTallyResultRequest is appropriate. The struct only contains a u64 field, which implements Copy, making this derivation safe and potentially beneficial for performance in certain scenarios.


Line range hint 578-587: LGTM: Copy derivation for MsgSubmitProposalResponse

The addition of the Copy trait to MsgSubmitProposalResponse is appropriate. The struct only contains a u64 field, which implements Copy, making this derivation safe and potentially beneficial for performance in certain usage patterns.


616-618: LGTM: Copy derivation for MsgVoteResponse

The addition of the Copy trait to MsgVoteResponse is appropriate. As this is an empty struct, deriving Copy is safe and can be beneficial in certain usage scenarios without any drawbacks.


645-647: LGTM: Copy derivation for MsgVoteWeightedResponse

The addition of the Copy trait to MsgVoteWeightedResponse is appropriate. As this is an empty struct, deriving Copy is safe and can be beneficial in certain usage scenarios without any drawbacks.

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

Line range hint 598-603: Reconsider implementing Copy for MsgBeginRedelegateResponse.

The MsgBeginRedelegateResponse struct has been updated to derive the Copy trait. However, this struct contains a field of type Option<Timestamp>, which may not be Copy. The static analysis tool has flagged this as a potential issue.

Consider removing the Copy trait from this struct or ensure that all fields implement Copy. If Timestamp doesn't implement Copy, you may need to use Clone instead. Here's a suggested fix:

- #[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
+ #[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse")]
pub struct MsgBeginRedelegateResponse {
    #[prost(message, optional, tag = "1")]
    pub completion_time: ::core::option::Option<crate::shim::Timestamp>,
}

To check if Timestamp implements Copy, run:

rg --type rust "impl Copy for Timestamp" -C 5

If it doesn't return any results, Timestamp likely doesn't implement Copy, and you should remove Copy from MsgBeginRedelegateResponse.

🧰 Tools
🪛 GitHub Check: Lints

[failure] 598-598:
the trait std::marker::Copy cannot be implemented for this type


560-562: Verify the implications of implementing Copy for MsgEditValidatorResponse.

The MsgEditValidatorResponse struct has been updated to derive the Copy trait. This change allows for more efficient copying of the struct, but it's crucial to verify that this doesn't lead to unexpected behavior in other parts of the codebase.

To ensure this change doesn't introduce any issues, please run the following command to check for any uses of this struct that might be affected:

rg --type rust "MsgEditValidatorResponse" -C 5

680-682: Verify the implications of implementing Copy for MsgUpdateParamsResponse.

The MsgUpdateParamsResponse struct has been updated to derive the Copy trait. This change allows for more efficient copying of the struct, but it's crucial to verify that this doesn't lead to unexpected behavior in other parts of the codebase.

To ensure this change doesn't introduce any issues, please run the following command to check for any uses of this struct that might be affected:

rg --type rust "MsgUpdateParamsResponse" -C 5

656-658: Verify the implications of implementing Copy for MsgCancelUnbondingDelegationResponse.

The MsgCancelUnbondingDelegationResponse struct has been updated to derive the Copy trait. This change allows for more efficient copying of the struct, but it's important to ensure that this doesn't lead to unexpected behavior elsewhere in the codebase.

To ensure this change doesn't introduce any issues, please run the following command to check for any uses of this struct that might be affected:

rg --type rust "MsgCancelUnbondingDelegationResponse" -C 5

537-539: Verify the implications of implementing Copy for MsgCreateValidatorResponse.

The MsgCreateValidatorResponse struct has been updated to derive the Copy trait. While this change allows for more efficient copying of the struct, it's important to ensure that this doesn't lead to unexpected behavior elsewhere in the codebase.

To ensure this change doesn't introduce any issues, please run the following command to check for any uses of this struct that might be affected:

✅ Verification successful

Verified: Implementing Copy for MsgCreateValidatorResponse is safe and does not impact other parts of the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

rg --type rust "MsgCreateValidatorResponse" -C 5

Length of output: 22178


Script:

#!/bin/bash
rg --type rust "MsgCreateValidatorResponse" -C 5

Length of output: 1892


578-580: Verify the implications of implementing Copy for MsgDelegateResponse.

The MsgDelegateResponse struct has been updated to derive the Copy trait. This change allows for more efficient copying of the struct, but it's important to ensure that this doesn't lead to unexpected behavior elsewhere in the codebase.

To ensure this change doesn't introduce any issues, please run the following command to check for any uses of this struct that might be affected:

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

388-388: LGTM: Added Copy trait to QueryParamsRequest

Adding the Copy trait to QueryParamsRequest is appropriate as this struct doesn't contain any fields. This change allows for more efficient copying of instances and is consistent with the overall update described in the summary.


604-604: LGTM: Added Copy trait to MsgSendResponse

Adding the Copy trait to MsgSendResponse is appropriate as this struct doesn't contain any fields. This change allows for more efficient copying of instances and is consistent with the overall update described in the summary.


621-621: LGTM: Added Copy trait to multiple response structs

The Copy trait has been appropriately added to MsgMultiSendResponse, MsgUpdateParamsResponse, and MsgSetSendEnabledResponse. This change is consistent with the overall update described in the summary and follows the pattern of adding the Copy trait to response structs throughout this file. These modifications allow for more efficient copying of instances, which is beneficial as these structs don't contain any fields that own heap-allocated data.

Also applies to: 645-645, 676-676


388-388: Summary: Consistent addition of Copy trait to improve efficiency

The changes in this file demonstrate a consistent pattern of adding the Copy trait to various structs, particularly request and response types. This modification enhances the efficiency of operations involving these structs by allowing them to be copied rather than cloned. The change is appropriate for these structs as they don't contain fields with owned heap data.

These updates align with the pull request's objective of improving memory handling in the injective-std package. The consistent application of this change across multiple structs indicates a thoughtful and systematic approach to the optimization.

Also applies to: 604-604, 621-621, 645-645, 676-676

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

339-339: LGTM: Added Copy trait to QueryParamsRequest.

The addition of the Copy trait to QueryParamsRequest is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.


579-579: LGTM: Added Copy trait to QueryCommunityPoolRequest.

The addition of the Copy trait to QueryCommunityPoolRequest is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.


610-610: LGTM: Added Copy trait to MsgSetWithdrawAddressResponse.

The addition of the Copy trait to MsgSetWithdrawAddressResponse is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.


666-666: LGTM: Added Copy trait to MsgFundCommunityPoolResponse.

The addition of the Copy trait to MsgFundCommunityPoolResponse is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.


690-690: LGTM: Added Copy trait to MsgUpdateParamsResponse.

The addition of the Copy trait to MsgUpdateParamsResponse is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.


715-715: LGTM: Added Copy trait to MsgCommunityPoolSpendResponse.

The addition of the Copy trait to MsgCommunityPoolSpendResponse is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.


738-738: LGTM: Added Copy trait to MsgDepositValidatorRewardsPoolResponse.

The addition of the Copy trait to MsgDepositValidatorRewardsPoolResponse is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.


Line range hint 339-738: Consistent addition of Copy trait across multiple structs.

The changes in this file consistently add the Copy trait to several structs related to queries and message responses. This uniform approach suggests a deliberate design decision to allow these structs to be copied more efficiently. The consistency is commendable and aligns with good coding practices.

However, it's worth noting that making these structs Copy might have implications on how they're used throughout the codebase. Ensure that this change doesn't introduce any unexpected behavior in other parts of the system that may have been relying on move semantics.

To verify the impact of these changes, we can search for usages of these structs:

✅ Verification successful

Verified: Consistent Addition of Copy Trait

The addition of the Copy trait to the specified structs is consistent across the codebase and does not introduce any evident issues. The usage contexts support the appropriateness of this change, ensuring efficient value semantics without unexpected behavior.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of the modified structs
for struct in QueryParamsRequest QueryCommunityPoolRequest MsgSetWithdrawAddressResponse MsgFundCommunityPoolResponse MsgUpdateParamsResponse MsgCommunityPoolSpendResponse MsgDepositValidatorRewardsPoolResponse
do
  echo "Usages of $struct:"
  rg "\b$struct\b" --type rust
  echo
done

Length of output: 13647

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

Line range hint 653-663: LGTM: Addition of Copy trait to EventBandIbcResponseTimeout

The addition of the Copy trait to EventBandIbcResponseTimeout is appropriate. This change allows instances of this struct to be efficiently copied rather than moved or cloned, which can improve performance in certain scenarios.

Ensure that this struct doesn't contain any fields that shouldn't be copied (e.g., file handles, mutexes) now or in future modifications.


Line range hint 943-950: LGTM: Addition of Copy trait to QueryParamsRequest

The addition of the Copy trait to QueryParamsRequest is appropriate. As this is an empty struct used for querying oracle parameters, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 962-969: LGTM: Addition of Copy trait to QueryBandRelayersRequest

The addition of the Copy trait to QueryBandRelayersRequest is appropriate. As this is an empty struct used for querying Band relayers, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 981-988: LGTM: Addition of Copy trait to QueryBandPriceStatesRequest

The addition of the Copy trait to QueryBandPriceStatesRequest is appropriate. As this is an empty struct used for querying Band price states, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 1000-1007: LGTM: Addition of Copy trait to QueryBandIbcPriceStatesRequest

The addition of the Copy trait to QueryBandIbcPriceStatesRequest is appropriate. As this is an empty struct used for querying Band IBC price states, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 1019-1026: LGTM: Addition of Copy trait to QueryPriceFeedPriceStatesRequest

The addition of the Copy trait to QueryPriceFeedPriceStatesRequest is appropriate. As this is an empty struct used for querying price feed price states, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 1038-1045: LGTM: Addition of Copy trait to QueryCoinbasePriceStatesRequest

The addition of the Copy trait to QueryCoinbasePriceStatesRequest is appropriate. As this is an empty struct used for querying Coinbase price states, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 1057-1064: LGTM: Addition of Copy trait to QueryPythPriceStatesRequest

The addition of the Copy trait to QueryPythPriceStatesRequest is appropriate. As this is an empty struct used for querying Pyth price states, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 1076-1083: LGTM: Addition of Copy trait to QueryStorkPriceStatesRequest

The addition of the Copy trait to QueryStorkPriceStatesRequest is appropriate. As this is an empty struct used for querying Stork price states, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 1095-1102: LGTM: Addition of Copy trait to QueryStorkPublishersRequest

The addition of the Copy trait to QueryStorkPublishersRequest is appropriate. As this is an empty struct used for querying Stork publishers, implementing Copy is safe and can potentially improve performance when passing this struct around.


Line range hint 1138-1150: LGTM: Addition of Copy trait to QueryHistoricalPriceRecordsRequest

The addition of the Copy trait to QueryHistoricalPriceRecordsRequest is appropriate. This struct contains only simple types (an enum and a string) that are already Copy, so implementing Copy for the entire struct is safe and can potentially improve performance when passing this struct around.


Line range hint 1180-1200: LGTM: Addition of Copy trait to OracleHistoryOptions

The addition of the Copy trait to OracleHistoryOptions is appropriate. This struct contains only simple types (a u64 and two bools) that are already Copy, so implementing Copy for the entire struct is safe and can potentially improve performance when passing this struct around.


1359-1362: LGTM: Addition of Copy trait to MsgRelayProviderPricesResponse

The addition of the Copy trait to MsgRelayProviderPricesResponse is appropriate. As this is an empty struct used as a response for relaying provider prices, implementing Copy is safe and can potentially improve performance when passing this struct around.


1379-1382: LGTM: Addition of Copy trait to MsgRelayPriceFeedPriceResponse

The addition of the Copy trait to MsgRelayPriceFeedPriceResponse is appropriate. As this is an empty struct used as a response for relaying price feed prices, implementing Copy is safe and can potentially improve performance when passing this struct around.


1398-1401: LGTM: Addition of Copy trait to MsgRelayBandRatesResponse

The addition of the Copy trait to MsgRelayBandRatesResponse is appropriate. As this is an empty struct used as a response for relaying Band rates, implementing Copy is safe and can potentially improve performance when passing this struct around.


1415-1418: LGTM: Addition of Copy trait to MsgRelayCoinbaseMessagesResponse

The addition of the Copy trait to MsgRelayCoinbaseMessagesResponse is appropriate. As this is an empty struct used as a response for relaying Coinbase messages, implementing Copy is safe and can potentially improve performance when passing this struct around.


1430-1433: LGTM: Addition of Copy trait to MsgRelayStorkPricesResponse

The addition of the Copy trait to MsgRelayStorkPricesResponse is appropriate. As this is an empty struct used as a response for relaying Stork prices, implementing Copy is safe and can potentially improve performance when passing this struct around.


1451-1454: LGTM: Addition of Copy trait to MsgRequestBandIbcRatesResponse

The addition of the Copy trait to MsgRequestBandIbcRatesResponse is appropriate. As this is an empty struct used as a response for requesting Band IBC rates, implementing Copy is safe and can potentially improve performance when passing this struct around.


1466-1469: LGTM: Addition of Copy trait to MsgRelayPythPricesResponse

The addition of the Copy trait to MsgRelayPythPricesResponse is appropriate. As this is an empty struct used as a response for relaying Pyth prices, implementing Copy is safe and can potentially improve performance when passing this struct around.


1483-1486: LGTM: Addition of Copy trait to MsgUpdateParamsResponse

The addition of the Copy trait to MsgUpdateParamsResponse is appropriate. As this is an empty struct used as a response for updating parameters, implementing Copy is safe and can potentially improve performance when passing this struct around.

Overall, the changes in this file consistently add the Copy trait to various request and response structs. This modification is beneficial as it allows these structs to be efficiently copied rather than moved or cloned, potentially improving performance in scenarios where these structs are frequently passed around. The change is safe for all the affected structs as they either contain no fields or only contain fields that are already Copy.

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

Line range hint 214-220: LGTM: Adding Copy trait to LastObservedEthereumBlockHeight

The addition of the Copy trait to LastObservedEthereumBlockHeight is appropriate. This change allows for more efficient handling of this struct, as it can now be copied instead of moved or cloned. This is particularly useful for small, simple structs like this one, which likely contains only primitive types such as integers for block heights.


Line range hint 232-244: LGTM: Adding Copy trait to LastClaimEvent

The addition of the Copy trait to LastClaimEvent is a good optimization. This change allows LastClaimEvent instances to be copied efficiently, which can be beneficial in scenarios where the struct needs to be duplicated or passed by value. This suggests that the struct contains only simple, copyable types (likely u64 for the event nonces and heights).


Line range hint 582-592: LGTM: Adding Copy trait to EventCancelSendToEth

The addition of the Copy trait to EventCancelSendToEth is appropriate. This change allows for more efficient handling of this event struct, as it can now be copied instead of moved or cloned. This is particularly useful for event structs that are frequently created or passed around in the system. It suggests that the struct contains only simple, copyable types (likely a u64 for the transaction ID).


Line range hint 1198-1209: Caution: Adding Copy to non-empty struct

The addition of the Copy trait to `Query

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

139-139: Reviewing addition of Copy trait to empty structs

The Copy trait has been added to several empty structs:

  • QueryAuctionParamsRequest (line 139)
  • QueryCurrentAuctionBasketRequest (line 158)
  • QueryModuleStateRequest (line 198)
  • QueryLastAuctionResultRequest (line 215)
  • MsgBidResponse (line 248)
  • MsgUpdateParamsResponse (line 265)

Since these structs have no fields, deriving Copy is acceptable and can enhance usability by allowing these types to be copied rather than moved.

Also applies to: 158-158, 198-198, 215-215, 248-248, 265-265

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

13-13: LGTM

The Params struct now derives Copy, and all its fields implement the Copy trait (u64 is Copy). This change is acceptable.


141-141: LGTM

The QueryParamsRequest struct is empty and now derives Copy. This is acceptable as there are no fields that could prevent it from being Copy.


150-150: LGTM

The QueryParamsResponse struct now derives Copy. Its field params is of type Option<Params>, and since Params is Copy, Option<Params> is also Copy. This change is acceptable.


160-160: LGTM

The QueryAllNamespacesRequest struct is empty and now derives Copy. This is acceptable as there are no fields that could prevent it from being Copy.


276-276: LGTM

The MsgUpdateParamsResponse struct now derives Copy. It is an empty struct, so this is acceptable.


289-289: LGTM

The MsgCreateNamespaceResponse struct now derives Copy. As it is an empty struct, deriving Copy is acceptable.


302-302: LGTM

The MsgDeleteNamespaceResponse struct now derives Copy. This is acceptable since it is an empty struct.


342-344: LGTM

The MsgSetSendsPaused struct now derives Copy. Its field new_value is of type bool, which implements Copy. This change is acceptable.


349-351: LGTM

The MsgSetBurnsPaused struct now derives Copy. The field new_value is a bool, which is Copy. This is acceptable.


357-357: LGTM

The MsgUpdateNamespaceResponse struct now derives Copy. As it is an empty struct, this is acceptable.


377-377: LGTM

The MsgUpdateNamespaceRolesResponse struct now derives Copy. This is acceptable since the struct is empty.


394-394: LGTM

The MsgRevokeNamespaceRolesResponse struct now derives Copy. As it's an empty struct, deriving Copy is acceptable.


407-407: LGTM

The MsgClaimVoucherResponse struct now derives Copy. This is acceptable because the struct is empty.


335-337: ⚠️ Potential issue

Cannot derive Copy for structs containing String fields

The MsgSetWasmHook struct contains a String field new_value, which does not implement the Copy trait. Therefore, the struct cannot derive Copy. Attempting to do so will result in a compilation error.

To fix this issue, remove the Copy derive from the struct:

-#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
+#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
 pub struct MsgSetWasmHook {
     #[prost(string, tag = "1")]
     pub new_value: ::prost::alloc::string::String,
 }

Likely invalid or redundant comment.

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

4-4: Adding Copy trait to AccessTypeParam is appropriate

The AccessTypeParam struct contains a single i32 field (value), making it safe and efficient to derive the Copy trait.


118-118: Deriving Copy for AbsoluteTxPosition

The AbsoluteTxPosition struct comprises two u64 fields (block_height and tx_index), which are Copy types. Adding the Copy trait is appropriate and enhances usability.


366-366: Adding Copy trait to MaxCallsLimit

The MaxCallsLimit struct contains a single u64 field (remaining), allowing it to safely derive the Copy trait.


409-409: Deriving Copy for AllowAllMessagesFilter

AllowAllMessagesFilter is an empty struct. Deriving Copy is appropriate and has no negative impact.


527-527: Adding Copy trait to MsgIBCSendResponse

The MsgIBCSendResponse struct includes a single u64 field (sequence). Deriving Copy is suitable and improves efficiency.


540-542: Deriving Copy for MsgIBCWriteAcknowledgementResponse

As an empty struct, it's acceptable and safe to derive the Copy trait for MsgIBCWriteAcknowledgementResponse.


1478-1478: Deriving Copy for MsgUpdateAdminResponse

Adding the Copy trait to this empty struct is appropriate.


1495-1495: Deriving Copy for MsgClearAdminResponse

It's suitable to derive Copy for this empty struct, enhancing its usability.


1520-1520: Deriving Copy for MsgUpdateInstantiateConfigResponse

The MsgUpdateInstantiateConfigResponse struct is empty. Deriving Copy is appropriate.


1544-1544: Deriving Copy for MsgUpdateParamsResponse

Adding the Copy trait to this empty struct is acceptable and aligns with Rust best practices.


1596-1596: Deriving Copy for MsgPinCodesResponse

As an empty struct, deriving Copy is appropriate.


1619-1619: Deriving Copy for MsgUnpinCodesResponse

It's suitable to derive Copy for this empty struct.


1698-1698: Deriving Copy for MsgAddCodeUploadParamsAddressesResponse

Adding the Copy trait to this empty struct is appropriate.


1716-1716: Deriving Copy for MsgRemoveCodeUploadParamsAddressesResponse

Deriving Copy for this empty struct is suitable.


1783-1783: Deriving Copy for MsgUpdateContractLabelResponse

Adding the Copy trait to this empty struct is acceptable.


1101-1101: Deriving Copy for QueryCodeRequest

The QueryCodeRequest struct contains a single u64 field (code_id). Deriving Copy is appropriate and enhances efficiency.


1197-1197: Deriving Copy for QueryParamsRequest

As an empty struct, it's acceptable to derive the Copy trait for QueryParamsRequest.


157-160: ⚠️ Potential issue

Fix incorrect serde path in deserialize_with attribute

The deserialize_with path is missing the serde module. It should be corrected to ensure proper deserialization.

Apply this diff to fix the attribute path:

 #[serde(
     serialize_with = "crate::serde::as_str::serialize",
-    deserialize_with = "crate::as_str::deserialize"
+    deserialize_with = "crate::serde::as_str::deserialize"
 )]

Likely invalid or redundant comment.


204-206: ⚠️ Potential issue

Fix incorrect serde path in deserialize_with attribute

The deserialize_with attribute is missing the serde module in its path. Correcting this ensures proper deserialization functionality.

Apply this diff to fix the attribute path:

 #[serde(
     serialize_with = "crate::serde::as_str::serialize",
-    deserialize_with = "crate::as_str::deserialize"
+    deserialize_with = "crate::serde::as_str::deserialize"
 )]

Likely invalid or redundant comment.

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

1124-1124: Check Serialization of FeeDiscountTierTtl

The FeeDiscountTierTtl struct uses custom serialization for its fields. Verify that serialization and deserialization behave as expected, especially when interfacing with external systems or storing data persistently.

Consider adding unit tests for serialization and deserialization of FeeDiscountTierTtl.


2661-2661: Check Order Mask Serialization

The order_mask field in MsgCancelDerivativeOrder uses custom serialization. Ensure that the serialization aligns with how this field is used when communicating with other services or persisting data.

Add tests to confirm correct serialization and deserialization of order_mask.


3380-3393: Ensure Correct Usage of Custom Serialization Attributes

For the fields base_decimals and quote_decimals in SpotMarketParamUpdateProposal, custom serialization attributes are used. Ensure that these fields serialize to strings correctly, especially when interfacing with components expecting this format.

Test serialization and deserialization paths for these fields.


1735-1735: Verify Field Renaming to is_limit_cancel

The field is_limit_cancel was updated from isLimitCancel. Confirm that all references have been updated throughout the codebase.

Run the following script to find any remaining instances of isLimitCancel:

#!/bin/bash
# Description: Find any remaining references to `isLimitCancel` in Rust files.

# Expectation: No occurrences of `isLimitCancel` should be found.
rg 'isLimitCancel' --type rust

933-933: Verify Field Renaming to is_buy

The field is_buy replaces isBuy to adhere to naming conventions. Ensure all references to isBuy are updated to prevent runtime errors.

Run the following script to identify any lingering uses of isBuy:

#!/bin/bash
# Description: Find any remaining references to `isBuy` in Rust files.

# Expectation: No occurrences of `isBuy` should be found.
rg 'isBuy' --type rust

@@ -5,7 +5,7 @@ use injective_std_derive::CosmwasmExt;
/// signatures required by gogoproto.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.base.v1beta1.Coin")]
#[proto_message(type_url = "/cosmos.base.v1beta1.CoinCoinCoin")]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incorrect modification of type_url for Coin struct

The type_url for the Coin struct has been incorrectly modified. The repetition of "Coin" three times in the URL doesn't follow any known convention and could lead to serialization/deserialization issues.

Please revert this change to maintain compatibility:

-#[proto_message(type_url = "/cosmos.base.v1beta1.CoinCoinCoin")]
+#[proto_message(type_url = "/cosmos.base.v1beta1.Coin")]
📝 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
#[proto_message(type_url = "/cosmos.base.v1beta1.CoinCoinCoin")]
#[proto_message(type_url = "/cosmos.base.v1beta1.Coin")]

@@ -18,7 +18,7 @@
/// signatures required by gogoproto.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoin")]
#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoinDecCoinDecCoin")]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incorrect modification of type_url for DecCoin struct

The type_url for the DecCoin struct has been incorrectly modified. The repetition of "DecCoin" three times in the URL doesn't follow any known convention and could lead to serialization/deserialization issues.

Please revert this change to maintain compatibility:

-#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoinDecCoinDecCoin")]
+#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoin")]
📝 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
#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoinDecCoinDecCoin")]
#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoin")]

@@ -29,7 +29,7 @@
/// Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.base.v1beta1.IntProto")]
#[proto_message(type_url = "/cosmos.base.v1beta1.IntProtoIntProtoIntProto")]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incorrect modification of type_url for IntProto struct

The type_url for the IntProto struct has been incorrectly modified. The repetition of "IntProto" three times in the URL doesn't follow any known convention and could lead to serialization/deserialization issues.

Please revert this change to maintain compatibility:

-#[proto_message(type_url = "/cosmos.base.v1beta1.IntProtoIntProtoIntProto")]
+#[proto_message(type_url = "/cosmos.base.v1beta1.IntProto")]
📝 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
#[proto_message(type_url = "/cosmos.base.v1beta1.IntProtoIntProtoIntProto")]
#[proto_message(type_url = "/cosmos.base.v1beta1.IntProto")]

@@ -38,7 +38,7 @@
/// Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.base.v1beta1.DecProto")]
#[proto_message(type_url = "/cosmos.base.v1beta1.DecProtoDecProtoDecProto")]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incorrect modification of type_url for DecProto struct

The type_url for the DecProto struct has been incorrectly modified. The repetition of "DecProto" three times in the URL doesn't follow any known convention and could lead to serialization/deserialization issues.

Please revert this change to maintain compatibility:

-#[proto_message(type_url = "/cosmos.base.v1beta1.DecProtoDecProtoDecProto")]
+#[proto_message(type_url = "/cosmos.base.v1beta1.DecProto")]
📝 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
#[proto_message(type_url = "/cosmos.base.v1beta1.DecProtoDecProtoDecProto")]
#[proto_message(type_url = "/cosmos.base.v1beta1.DecProto")]

@@ -1,6 +1,6 @@
use injective_std_derive::CosmwasmExt;
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Reconsider adding the Copy trait to Params.

The Copy trait has been added to the Params struct. However, the static analysis tool suggests that this trait cannot be implemented for this type. This is likely because Params contains a field of type Option<Duration>, which is not Copy.

Consider removing the Copy trait from the derive attribute list for Params. If Copy is necessary, you may need to implement it manually, ensuring all fields are Copy as well.

-#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
+#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
📝 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
#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
🧰 Tools
🪛 GitHub Check: Lints

[failure] 3-3:
the trait std::marker::Copy cannot be implemented for this type

Comment on lines +460 to +466
/// quote token decimals
#[prost(uint32, tag = "20")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub quote_decimals: u32,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Initialize New Field quote_decimals in BinaryOptionsMarket

Similar to DerivativeMarket, quote_decimals has been added to BinaryOptionsMarket. Verify that this field is correctly set during the creation or modification of BinaryOptionsMarket instances to prevent potential issues with decimal calculations.

Review the code paths where BinaryOptionsMarket instances are instantiated or modified.

Comment on lines +646 to +659
/// base token decimals
#[prost(uint32, tag = "14")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub base_decimals: u32,
/// quote token decimals
#[prost(uint32, tag = "15")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub quote_decimals: u32,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Ensure Proper Initialization of base_decimals and quote_decimals in SpotMarket

The fields base_decimals and quote_decimals have been added to SpotMarket. Confirm that these fields are properly initialized in all constructors and factory methods to ensure accurate decimal handling for base and quote tokens.

Check all places where SpotMarket is instantiated to include the new decimal fields.

@@ -2144,7 +2186,7 @@
/// MsgInstantPerpetualMarketLaunchResponse defines the
/// Msg/InstantPerpetualMarketLaunchResponse response type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[derive(Clone, Copy, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing Initialization of min_notional Field

In MsgInstantPerpetualMarketLaunch, ensure that the min_notional field is appropriately initialized and validated. An uninitialized min_notional can lead to incorrect order validations.

Verify that min_notional is set and properly handled during market launch.

Comment on lines +5757 to +5771
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/injective.exchange.v1beta1.TrimmedLimitOrder")]
pub struct TrimmedLimitOrder {
#[prost(string, tag = "1")]
pub price: ::prost::alloc::string::String,
/// quantity of the order
#[prost(string, tag = "2")]
pub quantity: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub order_hash: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
#[serde(alias = "subaccountID")]
pub subaccount_id: ::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.

⚠️ Potential issue

Ensure Correct Data Types in TrimmedLimitOrder Struct

In the TrimmedLimitOrder struct, confirm that the data types for price, quantity, and order_hash are appropriate for their intended use cases. For example, if price and quantity represent numerical values, consider using numeric types for validation and calculation purposes.

Evaluate if price and quantity should use numeric types like Decimal or u64 instead of String to prevent runtime errors and enhance type safety.

@@ -329,7 +329,7 @@
/// true if the market is a perpetual market. false if the market is an expiry
/// futures market
#[prost(bool, tag = "13")]
pub isPerpetual: bool,
pub is_perpetual: bool,
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Inconsistent Renaming of isPerpetual Detected

Several instances of isPerpetual still exist in the codebase:

  • packages/injective-testing/src/mocks.rs: isPerpetual: true,
  • contracts/injective-cosmwasm-stargate-example/src/testing/type_helpers.rs: #[serde(rename = "isPerpetual", default)]
  • packages/injective-cosmwasm/src/exchange_mock_querier.rs: isPerpetual: true,
  • packages/injective-cosmwasm/src/exchange/derivative_market.rs: pub isPerpetual: bool,

Please update these instances to is_perpetual to ensure consistency and adhere to Rust's naming conventions.

🔗 Analysis chain

Ensure Consistency with Field Renaming to is_perpetual

The field is_perpetual has been renamed from isPerpetual to follow Rust's naming conventions. Please verify that all instances of isPerpetual have been updated throughout the codebase to prevent any potential mismatches or bugs.

Run the following script to check for any remaining occurrences of isPerpetual:


Action Required: Re-run Verification Script with Correct Search Term

Please execute the following script to accurately check for any remaining instances of isPerpetual in Rust files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find any remaining references to `isPerpetual` in Rust files.

# Expectation: No occurrences of `isPerpetual` should be found.
rg 'isPerpetual' --type rust

Length of output: 30


Script:

#!/bin/bash
# Description: Accurately find any remaining references to `isPerpetual` in Rust files.

rg 'isPerpetual' --type rust

Length of output: 396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant