-
Notifications
You must be signed in to change notification settings - Fork 24
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
base: dev
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces multiple changes across various modules in the Changes
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 ofCopy
trait for zero-sized type.The change from
Clone
toCopy
for theModule
struct is appropriate and aligns with Rust best practices for zero-sized types. This modification allows for implicit copying ofModule
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 incosmos/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 modifiedtype_url
attributes:
CoinCoinCoin
DecCoinDecCoinDecCoin
IntProtoIntProtoIntProto
DecProtoDecProtoDecProto
These modifications are erroneous and need to be reverted. No other files in the codebase exhibit this particular issue.
Action items:
- Revert the changes in
packages/injective-std/src/types/cosmos/base/v1beta1.rs
to correct thetype_url
attributes.- Conduct a thorough review of the change that introduced this error to understand how it occurred.
- Consider implementing a lint rule or automated check to validate
type_url
attributes and prevent similar issues in future commits.- 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 intype_url
modifications across all structsThere appears to be a systematic error in the modification of
type_url
attributes for all structs in this file. Eachtype_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:
- Review the entire codebase for similar incorrect modifications.
- If this was due to an automated process, please check and correct the script or tool used.
- 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 StructsThe 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 ofCopy
trait for response typesThe changes in this file consistently add the
Copy
trait to all response structs (MsgGrantAllowanceResponse
,MsgRevokeAllowanceResponse
, andMsgPruneAllowancesResponse
). 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 toMsgGrantResponse
andMsgRevokeResponse
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 ofCopy
traitThe addition of the
Copy
trait to theQueryParamsResponse
struct is safe, as theParams
struct it contains is alsoCopy
. However, since this struct contains anOption<Params>
, the performance benefit of making itCopy
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 improvementsThe addition of the
Copy
trait to theQueryAccountAddressByIdRequest
struct is appropriate and can potentially improve performance. The struct contains only primitive types (i64 and u64), making it safe to implementCopy
.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 theaccount_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
: RemoveCopy
trait fromQueryInsuranceParamsResponse
.The
Copy
trait has been added toQueryInsuranceParamsResponse
, but this struct contains a field of typeOption<Params>
. SinceParams
is notCopy
(as discussed earlier), this struct cannot implementCopy
.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 ofCopy
trait additionsThe 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 derivingCopy
also implementCopy
.For future changes:
- Always verify that all fields in a struct implement
Copy
before deriving it for the struct.- Consider the implications of making a type
Copy
on the broader system design, especially for larger or more complex structs.- 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 traitstd::marker::Copy
cannot be implemented for this typepackages/injective-std/src/types/cosmos/staking/v1beta1.rs (1)
Line range hint
537-682
: Summary ofCopy
trait implementationsThe 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:
- Ensure that implementing
Copy
for these structs doesn't violate any invariants or lead to unexpected behavior in the rest of the codebase.- Pay special attention to
MsgBeginRedelegateResponse
, as it may not be suitable forCopy
due to itsOption<Timestamp>
field.- 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 recommendationsThe 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:
- Some structs, like
VotingParams
andMsgCancelProposalResponse
, may not be able to implementCopy
due to their field types.- The blanket addition of
Copy
to multiple structs without considering their individual compositions could lead to compilation errors or unexpected runtime behavior.Recommendations:
- Review each struct individually to determine if
Copy
is appropriate and necessary.- Remove
Copy
from structs that contain fields not implementingCopy
.- Consider the implications of making these types
Copy
on the overall system design and performance.- Update documentation to reflect any changes in the behavior of these types.
- 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 typeCopy
.🧰 Tools
🪛 GitHub Check: Lints
[failure] 172-172:
the traitstd::marker::Copy
cannot be implemented for this typepackages/injective-std/src/types/injective/peggy/v1.rs (16)
733-736
: LGTM: AddingCopy
trait toMsgSetOrchestratorAddressesResponse
The addition of the
Copy
trait toMsgSetOrchestratorAddressesResponse
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 theCopy
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: AddingCopy
trait toMsgValsetConfirmResponse
The addition of the
Copy
trait toMsgValsetConfirmResponse
is acceptable. However, as with the previous struct, this appears to be an empty (unit) struct. While adding theCopy
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: AddingCopy
trait toMsgSendToEthResponse
The addition of the
Copy
trait toMsgSendToEthResponse
is consistent with the changes made to other response structs. However, as this appears to be another empty (unit) struct, the benefits of addingCopy
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: AddingCopy
trait toMsgRequestBatchResponse
The addition of the
Copy
trait toMsgRequestBatchResponse
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: AddingCopy
trait toMsgConfirmBatchResponse
The addition of the
Copy
trait toMsgConfirmBatchResponse
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 structsThis approach would centralize the definition of these structs and make it easier to modify them uniformly in the future if needed.
889-892
: LGTM: AddingCopy
trait toMsgDepositClaimResponse
The addition of the
Copy
trait toMsgDepositClaimResponse
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: AddingCopy
trait toMsgWithdrawClaimResponse
The addition of the
Copy
trait toMsgWithdrawClaimResponse
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 typesThis approach would centralize the logic and make it easier to modify or extend these types in the future.
962-965
: LGTM: AddingCopy
trait toMsgERC20DeployedClaimResponse
The addition of the
Copy
trait toMsgERC20DeployedClaimResponse
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: AddingCopy
trait toMsgCancelSendToEthResponse
The addition of the
Copy
trait toMsgCancelSendToEthResponse
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:
- Halt any further similar changes to response structs.
- Implement the previously suggested refactoring solutions (macro-based approach or generic struct with trait) as a matter of priority.
- 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: AddingCopy
trait toMsgSubmitBadSignatureEvidenceResponse
The addition of the
Copy
trait toMsgSubmitBadSignatureEvidenceResponse
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:
- Immediately halt all further additions of
Copy
traits to empty response structs.- 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.
- Apply the refactored solution to all existing response structs in a single, well-reviewed pull request.
- 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 neededWhile the addition of the
Copy
trait toMsgValsetUpdatedClaimResponse
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:
- Revert this change along with all similar recent changes adding the
Copy
trait to empty response structs.- Implement a comprehensive refactor using either the macro-based approach or the generic struct with trait solution as previously suggested.
- Once the refactor is complete and well-tested, reintroduce the
Copy
trait functionality through the new, DRY (Don't Repeat Yourself) approach.- 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 refactorThe addition of the
Copy
trait toMsgUpdateParamsResponse
continues the pattern of excessive repetition seen in previous structs.At this point, it's crucial to:
- Immediately halt this change and any similar pending changes.
- Do not merge this particular modification or any others like it.
- Prioritize the implementation of the comprehensive refactor discussed in previous comments.
- 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 refactorThe addition of the
Copy
trait toMsgBlacklistEthereumAddressesResponse
perpetuates the pattern of excessive repetition.I strongly advise against proceeding with this change. Instead:
- Abandon this change and any similar pending changes.
- Place an immediate moratorium on any further modifications to these response structs.
- Dedicate all available resources to implementing the comprehensive refactor discussed in previous comments.
- 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 neededThe addition of the
Copy
trait toMsgRevokeEthereumBlacklistResponse
further exacerbates the severe code duplication issue.I strongly oppose proceeding with this change. The situation has become critical, and immediate action is required:
- Reject this change and any similar pending changes outright.
- Implement an immediate and total freeze on any modifications to these response structs.
- Escalate the priority of the comprehensive refactor to the highest level.
- 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:
- Communicate the severity of this issue to all team members.
- Assign dedicated resources to implement the refactor immediately.
- Establish a clear timeline for completing the refactor.
- 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 structsWhile this change shifts from response to request structs, the addition of the
Copy
trait toQueryParamsRequest
continues the pattern of potential over-application to empty structs.I recommend against proceeding with this change. Instead:
- Reject this change and pause any similar modifications to request structs.
- Extend the scope of the previously discussed refactor to include both response and request structs.
- 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 structsThis 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 refactorThe addition of the
Copy
trait toQueryCurrentValsetRequest
continues the pattern we've seen with both response and request structs.I strongly advise against proceeding with this change. Instead:
- Halt this change and any similar pending changes to both request and response structs.
- Prioritize the implementation of a comprehensive refactor that addresses both types of structs.
- 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 structsThis 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 foris_reduce_only
FieldThe
is_reduce_only
field inSubaccountOrder
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 ofis_long
While
is_long
is descriptive, providing a comment can help others understand its role in thePosition
struct.Add a comment:
/// True if the position is long, false if short pub is_long: bool,
1500-1500
: Consistency in Enum Variant NamingIn the
ExecutionType
enum, the variantUnspecifiedExecutionType
could be shortened toUnspecified
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 forMsgInstantSpotMarketLaunch
FieldsThe fields
base_decimals
andquote_decimals
are added toMsgInstantSpotMarketLaunch
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 inSpotMarketLaunchProposal
The new fields
base_decimals
andquote_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
📒 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 traitstd::marker::Copy
cannot be implemented for this type
[failure] 880-880:
the traitstd::marker::Copy
cannot be implemented for this typepackages/injective-std/src/types/cosmos/gov/v1beta1.rs
[failure] 164-164:
the traitstd::marker::Copy
cannot be implemented for this typepackages/injective-std/src/types/cosmos/staking/v1beta1.rs
[failure] 598-598:
the traitstd::marker::Copy
cannot be implemented for this typepackages/injective-std/src/types/injective/insurance/v1beta1.rs
[failure] 3-3:
the traitstd::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: AddingCopy
trait is appropriate for this empty struct.The addition of the
Copy
trait to theModule
struct is a good optimization. SinceModule
is an empty struct, implementingCopy
is appropriate and can lead to more efficient code by allowing bit-wise copying instead of cloning.Some implications to keep in mind:
- This change may slightly improve performance in scenarios where
Module
instances are frequently copied.- The struct can no longer implement
Drop
, which is fine for now given its empty state.- If fields are added to
Module
in the future, ensure they also implementCopy
, or consider removing theCopy
trait at that time.packages/injective-std/src/types/cosmos/feegrant/module/v1.rs (1)
4-4
: Approved: Addition ofCopy
trait is appropriate for this empty struct.The addition of the
Copy
trait to theModule
struct is a good optimization. SinceModule
is an empty struct, implementingCopy
allows for more efficient passing and assignment ofModule
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:
- The
Copy
trait is compatible with all other derived traits.- For empty structs like this,
Copy
is particularly beneficial and carries no drawbacks.- The redundancy of
Clone
andCopy
is harmless;Copy
impliesClone
.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 toConfigRequest
is a good improvement. SinceConfigRequest
is an empty struct, implementingCopy
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 toStatusRequest
is a good improvement, consistent with the change made toConfigRequest
. AsStatusRequest
is also an empty struct, implementingCopy
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
andStatusRequest
). These modifications are beneficial for performance and align with Rust best practices for small, copyable types. The response structs (ConfigResponse
andStatusResponse
) were correctly left unchanged, as they contain fields that may not be suitable forCopy
.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: AddingCopy
trait is beneficial.Adding the
Copy
trait to theQuerySubspacesRequest
struct is a good improvement. Since the struct is empty, implementingCopy
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 ofCopy
trait is appropriateThe addition of the
Copy
trait toMsgGrantAllowanceResponse
is a good improvement. Since this struct has no fields, implementingCopy
allows for more efficient handling of this type in the codebase.
196-198
: LGTM: Consistent addition ofCopy
traitThe addition of the
Copy
trait toMsgRevokeAllowanceResponse
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: ConsistentCopy
trait implementation across response typesThe addition of the
Copy
trait toMsgPruneAllowancesResponse
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: AddingCopy
trait toMsgGrantResponse
is beneficial.The addition of the
Copy
trait toMsgGrantResponse
is a good improvement. Since this struct is empty, implementingCopy
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 ofCopy
trait toMsgRevokeResponse
.The addition of the
Copy
trait toMsgRevokeResponse
is appropriate and consistent with the change made toMsgGrantResponse
. 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 ofCopy
trait forQueryParamsRequest
The addition of the
Copy
trait toQueryParamsRequest
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 ofCopy
trait forQueryModuleStateRequest
The addition of the
Copy
trait toQueryModuleStateRequest
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 ofCopy
trait forMsgMintResponse
The addition of the
Copy
trait toMsgMintResponse
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 ofCopy
trait forMsgBurnResponse
The addition of the
Copy
trait toMsgBurnResponse
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 ofCopy
trait forMsgChangeAdminResponse
The addition of the
Copy
trait toMsgChangeAdminResponse
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 ofCopy
trait forMsgSetDenomMetadataResponse
The addition of the
Copy
trait toMsgSetDenomMetadataResponse
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 ofCopy
traitThe addition of the
Copy
trait toMsgUpdateParamsResponse
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 theCopy
traitThe addition of the
Copy
trait to theParams
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 onlyu64
fields, which are alreadyCopy
, this change is safe and consistent with Rust best practices.
154-154
: LGTM: Appropriate addition of theCopy
traitThe addition of the
Copy
trait to theQueryParamsRequest
struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitlyCopy
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 theCopy
traitThe addition of the
Copy
trait to theQueryModuleAccountsRequest
struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitlyCopy
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 theCopy
traitThe addition of the
Copy
trait to theBech32PrefixRequest
struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitlyCopy
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 theCopy
traitThe addition of the
Copy
trait to theMsgUpdateParamsResponse
struct is appropriate. As an empty struct, it's inherently copyable, and making it explicitlyCopy
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 improvementsThe 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:
- Consider profiling the
QueryParamsResponse
struct to ensure theCopy
trait provides measurable performance benefits.- In a future update, consider removing the deprecated
id
field from theQueryAccountAddressByIdRequest
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 ofCopy
trait and#[proto_query]
attribute.The changes to
QueryWasmxParamsRequest
look good:
- Adding the
Copy
trait is appropriate for this zero-sized struct, allowing for more efficient copying instead of cloning.- 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 ofCopy
trait and#[proto_query]
attribute.The changes to
QueryModuleStateRequest
are similar to the previous struct and are also appropriate:
- The
Copy
trait addition is beneficial for this zero-sized struct.- 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 ofCopy
trait.The change to
MsgUpdateContractResponse
is appropriate:
- 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 ofCopy
trait.The change to
MsgActivateContractResponse
is appropriate:
- 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 ofCopy
trait.The change to
MsgDeactivateContractResponse
is appropriate:
- 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 ofCopy
trait.The change to
MsgUpdateParamsResponse
is appropriate:
- 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 ofCopy
trait.The change to
MsgRegisterContractResponse
is appropriate:
- 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 safetyThe changes in this file consistently improve the codebase in two main ways:
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.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 toQueryInsuranceParamsRequest
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 toQueryInsuranceFundsRequest
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 toQueryModuleStateRequest
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 toMsgCreateInsuranceFundResponse
,MsgUnderwriteResponse
,MsgRequestRedemptionResponse
, andMsgUpdateParamsResponse
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 ofCopy
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:
Params
andQueryInsuranceParamsResponse
should not implementCopy
due to non-Copy
fields.- Empty structs like
QueryInsuranceParamsRequest
,QueryInsuranceFundsRequest
,QueryModuleStateRequest
, and various response types can safely implementCopy
.I recommend a careful review of all structs where
Copy
has been added, ensuring that:
- All fields in the struct implement
Copy
if the struct itself is to implementCopy
.- For structs that can't implement
Copy
, consider if there's a way to redesign them to allow forCopy
, or ifClone
is sufficient for your use case.- 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 ofCopy
implementations across the codebase.packages/injective-std/src/types/cosmos/gov/v1beta1.rs (5)
Line range hint
315-326
: LGTM:Copy
derivation forQueryProposalRequest
The addition of the
Copy
trait toQueryProposalRequest
is appropriate. Since the struct only contains au64
field, which implementsCopy
, this derivation is safe and can improve performance in certain usage scenarios.
Line range hint
535-546
: LGTM:Copy
derivation forQueryTallyResultRequest
The addition of the
Copy
trait toQueryTallyResultRequest
is appropriate. The struct only contains au64
field, which implementsCopy
, making this derivation safe and potentially beneficial for performance in certain scenarios.
Line range hint
578-587
: LGTM:Copy
derivation forMsgSubmitProposalResponse
The addition of the
Copy
trait toMsgSubmitProposalResponse
is appropriate. The struct only contains au64
field, which implementsCopy
, making this derivation safe and potentially beneficial for performance in certain usage patterns.
616-618
: LGTM:Copy
derivation forMsgVoteResponse
The addition of the
Copy
trait toMsgVoteResponse
is appropriate. As this is an empty struct, derivingCopy
is safe and can be beneficial in certain usage scenarios without any drawbacks.
645-647
: LGTM:Copy
derivation forMsgVoteWeightedResponse
The addition of the
Copy
trait toMsgVoteWeightedResponse
is appropriate. As this is an empty struct, derivingCopy
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 implementingCopy
forMsgBeginRedelegateResponse
.The
MsgBeginRedelegateResponse
struct has been updated to derive theCopy
trait. However, this struct contains a field of typeOption<Timestamp>
, which may not beCopy
. The static analysis tool has flagged this as a potential issue.Consider removing the
Copy
trait from this struct or ensure that all fields implementCopy
. IfTimestamp
doesn't implementCopy
, you may need to useClone
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
implementsCopy
, run:rg --type rust "impl Copy for Timestamp" -C 5
If it doesn't return any results,
Timestamp
likely doesn't implementCopy
, and you should removeCopy
fromMsgBeginRedelegateResponse
.🧰 Tools
🪛 GitHub Check: Lints
[failure] 598-598:
the traitstd::marker::Copy
cannot be implemented for this type
560-562
: Verify the implications of implementingCopy
forMsgEditValidatorResponse
.The
MsgEditValidatorResponse
struct has been updated to derive theCopy
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 implementingCopy
forMsgUpdateParamsResponse
.The
MsgUpdateParamsResponse
struct has been updated to derive theCopy
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 implementingCopy
forMsgCancelUnbondingDelegationResponse
.The
MsgCancelUnbondingDelegationResponse
struct has been updated to derive theCopy
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 implementingCopy
forMsgCreateValidatorResponse
.The
MsgCreateValidatorResponse
struct has been updated to derive theCopy
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
forMsgCreateValidatorResponse
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 5Length of output: 1892
578-580
: Verify the implications of implementingCopy
forMsgDelegateResponse
.The
MsgDelegateResponse
struct has been updated to derive theCopy
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: AddedCopy
trait toQueryParamsRequest
Adding the
Copy
trait toQueryParamsRequest
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: AddedCopy
trait toMsgSendResponse
Adding the
Copy
trait toMsgSendResponse
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: AddedCopy
trait to multiple response structsThe
Copy
trait has been appropriately added toMsgMultiSendResponse
,MsgUpdateParamsResponse
, andMsgSetSendEnabledResponse
. This change is consistent with the overall update described in the summary and follows the pattern of adding theCopy
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 ofCopy
trait to improve efficiencyThe 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: AddedCopy
trait toQueryParamsRequest
.The addition of the
Copy
trait toQueryParamsRequest
is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.
579-579
: LGTM: AddedCopy
trait toQueryCommunityPoolRequest
.The addition of the
Copy
trait toQueryCommunityPoolRequest
is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.
610-610
: LGTM: AddedCopy
trait toMsgSetWithdrawAddressResponse
.The addition of the
Copy
trait toMsgSetWithdrawAddressResponse
is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.
666-666
: LGTM: AddedCopy
trait toMsgFundCommunityPoolResponse
.The addition of the
Copy
trait toMsgFundCommunityPoolResponse
is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.
690-690
: LGTM: AddedCopy
trait toMsgUpdateParamsResponse
.The addition of the
Copy
trait toMsgUpdateParamsResponse
is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.
715-715
: LGTM: AddedCopy
trait toMsgCommunityPoolSpendResponse
.The addition of the
Copy
trait toMsgCommunityPoolSpendResponse
is appropriate. This allows for more efficient copying of the struct when needed, which can be beneficial in certain usage scenarios.
738-738
: LGTM: AddedCopy
trait toMsgDepositValidatorRewardsPoolResponse
.The addition of the
Copy
trait toMsgDepositValidatorRewardsPoolResponse
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 ofCopy
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
TraitThe 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 doneLength of output: 13647
packages/injective-std/src/types/injective/oracle/v1beta1.rs (20)
Line range hint
653-663
: LGTM: Addition ofCopy
trait toEventBandIbcResponseTimeout
The addition of the
Copy
trait toEventBandIbcResponseTimeout
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 ofCopy
trait toQueryParamsRequest
The addition of the
Copy
trait toQueryParamsRequest
is appropriate. As this is an empty struct used for querying oracle parameters, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
962-969
: LGTM: Addition ofCopy
trait toQueryBandRelayersRequest
The addition of the
Copy
trait toQueryBandRelayersRequest
is appropriate. As this is an empty struct used for querying Band relayers, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
981-988
: LGTM: Addition ofCopy
trait toQueryBandPriceStatesRequest
The addition of the
Copy
trait toQueryBandPriceStatesRequest
is appropriate. As this is an empty struct used for querying Band price states, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
1000-1007
: LGTM: Addition ofCopy
trait toQueryBandIbcPriceStatesRequest
The addition of the
Copy
trait toQueryBandIbcPriceStatesRequest
is appropriate. As this is an empty struct used for querying Band IBC price states, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
1019-1026
: LGTM: Addition ofCopy
trait toQueryPriceFeedPriceStatesRequest
The addition of the
Copy
trait toQueryPriceFeedPriceStatesRequest
is appropriate. As this is an empty struct used for querying price feed price states, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
1038-1045
: LGTM: Addition ofCopy
trait toQueryCoinbasePriceStatesRequest
The addition of the
Copy
trait toQueryCoinbasePriceStatesRequest
is appropriate. As this is an empty struct used for querying Coinbase price states, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
1057-1064
: LGTM: Addition ofCopy
trait toQueryPythPriceStatesRequest
The addition of the
Copy
trait toQueryPythPriceStatesRequest
is appropriate. As this is an empty struct used for querying Pyth price states, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
1076-1083
: LGTM: Addition ofCopy
trait toQueryStorkPriceStatesRequest
The addition of the
Copy
trait toQueryStorkPriceStatesRequest
is appropriate. As this is an empty struct used for querying Stork price states, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
1095-1102
: LGTM: Addition ofCopy
trait toQueryStorkPublishersRequest
The addition of the
Copy
trait toQueryStorkPublishersRequest
is appropriate. As this is an empty struct used for querying Stork publishers, implementingCopy
is safe and can potentially improve performance when passing this struct around.
Line range hint
1138-1150
: LGTM: Addition ofCopy
trait toQueryHistoricalPriceRecordsRequest
The addition of the
Copy
trait toQueryHistoricalPriceRecordsRequest
is appropriate. This struct contains only simple types (an enum and a string) that are alreadyCopy
, so implementingCopy
for the entire struct is safe and can potentially improve performance when passing this struct around.
Line range hint
1180-1200
: LGTM: Addition ofCopy
trait toOracleHistoryOptions
The addition of the
Copy
trait toOracleHistoryOptions
is appropriate. This struct contains only simple types (a u64 and two bools) that are alreadyCopy
, so implementingCopy
for the entire struct is safe and can potentially improve performance when passing this struct around.
1359-1362
: LGTM: Addition ofCopy
trait toMsgRelayProviderPricesResponse
The addition of the
Copy
trait toMsgRelayProviderPricesResponse
is appropriate. As this is an empty struct used as a response for relaying provider prices, implementingCopy
is safe and can potentially improve performance when passing this struct around.
1379-1382
: LGTM: Addition ofCopy
trait toMsgRelayPriceFeedPriceResponse
The addition of the
Copy
trait toMsgRelayPriceFeedPriceResponse
is appropriate. As this is an empty struct used as a response for relaying price feed prices, implementingCopy
is safe and can potentially improve performance when passing this struct around.
1398-1401
: LGTM: Addition ofCopy
trait toMsgRelayBandRatesResponse
The addition of the
Copy
trait toMsgRelayBandRatesResponse
is appropriate. As this is an empty struct used as a response for relaying Band rates, implementingCopy
is safe and can potentially improve performance when passing this struct around.
1415-1418
: LGTM: Addition ofCopy
trait toMsgRelayCoinbaseMessagesResponse
The addition of the
Copy
trait toMsgRelayCoinbaseMessagesResponse
is appropriate. As this is an empty struct used as a response for relaying Coinbase messages, implementingCopy
is safe and can potentially improve performance when passing this struct around.
1430-1433
: LGTM: Addition ofCopy
trait toMsgRelayStorkPricesResponse
The addition of the
Copy
trait toMsgRelayStorkPricesResponse
is appropriate. As this is an empty struct used as a response for relaying Stork prices, implementingCopy
is safe and can potentially improve performance when passing this struct around.
1451-1454
: LGTM: Addition ofCopy
trait toMsgRequestBandIbcRatesResponse
The addition of the
Copy
trait toMsgRequestBandIbcRatesResponse
is appropriate. As this is an empty struct used as a response for requesting Band IBC rates, implementingCopy
is safe and can potentially improve performance when passing this struct around.
1466-1469
: LGTM: Addition ofCopy
trait toMsgRelayPythPricesResponse
The addition of the
Copy
trait toMsgRelayPythPricesResponse
is appropriate. As this is an empty struct used as a response for relaying Pyth prices, implementingCopy
is safe and can potentially improve performance when passing this struct around.
1483-1486
: LGTM: Addition ofCopy
trait toMsgUpdateParamsResponse
The addition of the
Copy
trait toMsgUpdateParamsResponse
is appropriate. As this is an empty struct used as a response for updating parameters, implementingCopy
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 alreadyCopy
.packages/injective-std/src/types/injective/peggy/v1.rs (4)
Line range hint
214-220
: LGTM: AddingCopy
trait toLastObservedEthereumBlockHeight
The addition of the
Copy
trait toLastObservedEthereumBlockHeight
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: AddingCopy
trait toLastClaimEvent
The addition of the
Copy
trait toLastClaimEvent
is a good optimization. This change allowsLastClaimEvent
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 (likelyu64
for the event nonces and heights).
Line range hint
582-592
: LGTM: AddingCopy
trait toEventCancelSendToEth
The addition of the
Copy
trait toEventCancelSendToEth
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 au64
for the transaction ID).
Line range hint
1198-1209
: Caution: AddingCopy
to non-empty structThe addition of the
Copy
trait to `Querypackages/injective-std/src/types/injective/auction/v1beta1.rs (1)
139-139
: Reviewing addition ofCopy
trait to empty structsThe
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
: LGTMThe
Params
struct now derivesCopy
, and all its fields implement theCopy
trait (u64
isCopy
). This change is acceptable.
141-141
: LGTMThe
QueryParamsRequest
struct is empty and now derivesCopy
. This is acceptable as there are no fields that could prevent it from beingCopy
.
150-150
: LGTMThe
QueryParamsResponse
struct now derivesCopy
. Its fieldparams
is of typeOption<Params>
, and sinceParams
isCopy
,Option<Params>
is alsoCopy
. This change is acceptable.
160-160
: LGTMThe
QueryAllNamespacesRequest
struct is empty and now derivesCopy
. This is acceptable as there are no fields that could prevent it from beingCopy
.
276-276
: LGTMThe
MsgUpdateParamsResponse
struct now derivesCopy
. It is an empty struct, so this is acceptable.
289-289
: LGTMThe
MsgCreateNamespaceResponse
struct now derivesCopy
. As it is an empty struct, derivingCopy
is acceptable.
302-302
: LGTMThe
MsgDeleteNamespaceResponse
struct now derivesCopy
. This is acceptable since it is an empty struct.
342-344
: LGTMThe
MsgSetSendsPaused
struct now derivesCopy
. Its fieldnew_value
is of typebool
, which implementsCopy
. This change is acceptable.
349-351
: LGTMThe
MsgSetBurnsPaused
struct now derivesCopy
. The fieldnew_value
is abool
, which isCopy
. This is acceptable.
357-357
: LGTMThe
MsgUpdateNamespaceResponse
struct now derivesCopy
. As it is an empty struct, this is acceptable.
377-377
: LGTMThe
MsgUpdateNamespaceRolesResponse
struct now derivesCopy
. This is acceptable since the struct is empty.
394-394
: LGTMThe
MsgRevokeNamespaceRolesResponse
struct now derivesCopy
. As it's an empty struct, derivingCopy
is acceptable.
407-407
: LGTMThe
MsgClaimVoucherResponse
struct now derivesCopy
. This is acceptable because the struct is empty.
335-337
:⚠️ Potential issueCannot derive
Copy
for structs containingString
fieldsThe
MsgSetWasmHook
struct contains aString
fieldnew_value
, which does not implement theCopy
trait. Therefore, the struct cannot deriveCopy
. 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
: AddingCopy
trait toAccessTypeParam
is appropriateThe
AccessTypeParam
struct contains a singlei32
field (value
), making it safe and efficient to derive theCopy
trait.
118-118
: DerivingCopy
forAbsoluteTxPosition
The
AbsoluteTxPosition
struct comprises twou64
fields (block_height
andtx_index
), which areCopy
types. Adding theCopy
trait is appropriate and enhances usability.
366-366
: AddingCopy
trait toMaxCallsLimit
The
MaxCallsLimit
struct contains a singleu64
field (remaining
), allowing it to safely derive theCopy
trait.
409-409
: DerivingCopy
forAllowAllMessagesFilter
AllowAllMessagesFilter
is an empty struct. DerivingCopy
is appropriate and has no negative impact.
527-527
: AddingCopy
trait toMsgIBCSendResponse
The
MsgIBCSendResponse
struct includes a singleu64
field (sequence
). DerivingCopy
is suitable and improves efficiency.
540-542
: DerivingCopy
forMsgIBCWriteAcknowledgementResponse
As an empty struct, it's acceptable and safe to derive the
Copy
trait forMsgIBCWriteAcknowledgementResponse
.
1478-1478
: DerivingCopy
forMsgUpdateAdminResponse
Adding the
Copy
trait to this empty struct is appropriate.
1495-1495
: DerivingCopy
forMsgClearAdminResponse
It's suitable to derive
Copy
for this empty struct, enhancing its usability.
1520-1520
: DerivingCopy
forMsgUpdateInstantiateConfigResponse
The
MsgUpdateInstantiateConfigResponse
struct is empty. DerivingCopy
is appropriate.
1544-1544
: DerivingCopy
forMsgUpdateParamsResponse
Adding the
Copy
trait to this empty struct is acceptable and aligns with Rust best practices.
1596-1596
: DerivingCopy
forMsgPinCodesResponse
As an empty struct, deriving
Copy
is appropriate.
1619-1619
: DerivingCopy
forMsgUnpinCodesResponse
It's suitable to derive
Copy
for this empty struct.
1698-1698
: DerivingCopy
forMsgAddCodeUploadParamsAddressesResponse
Adding the
Copy
trait to this empty struct is appropriate.
1716-1716
: DerivingCopy
forMsgRemoveCodeUploadParamsAddressesResponse
Deriving
Copy
for this empty struct is suitable.
1783-1783
: DerivingCopy
forMsgUpdateContractLabelResponse
Adding the
Copy
trait to this empty struct is acceptable.
1101-1101
: DerivingCopy
forQueryCodeRequest
The
QueryCodeRequest
struct contains a singleu64
field (code_id
). DerivingCopy
is appropriate and enhances efficiency.
1197-1197
: DerivingCopy
forQueryParamsRequest
As an empty struct, it's acceptable to derive the
Copy
trait forQueryParamsRequest
.
157-160
:⚠️ Potential issueFix incorrect
serde
path indeserialize_with
attributeThe
deserialize_with
path is missing theserde
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 issueFix incorrect
serde
path indeserialize_with
attributeThe
deserialize_with
attribute is missing theserde
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 ofFeeDiscountTierTtl
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 SerializationThe
order_mask
field inMsgCancelDerivativeOrder
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 AttributesFor the fields
base_decimals
andquote_decimals
inSpotMarketParamUpdateProposal
, 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 tois_limit_cancel
The field
is_limit_cancel
was updated fromisLimitCancel
. 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 tois_buy
The field
is_buy
replacesisBuy
to adhere to naming conventions. Ensure all references toisBuy
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")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
#[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")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
#[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")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
#[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")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
#[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)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
#[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 traitstd::marker::Copy
cannot be implemented for this type
/// 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
/// 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
#[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, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
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
Summary by CodeRabbit