Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added staking denom #245

Merged
merged 6 commits into from
Oct 7, 2024
Merged

Conversation

maxrobot
Copy link
Contributor

@maxrobot maxrobot commented Oct 2, 2024

Summary by CodeRabbit

  • New Features

    • Introduced staking denomination in mocks for enhanced testing capabilities.
    • Added support for a new mock asset in trading functionalities.
    • Implemented a minimum notional requirement for markets.
  • Version Updates

    • Updated package version from 1.1.0 to 1.1.1 for injective-testing.
    • Updated package version from 0.3.0 to 0.3.1 for injective-cosmwasm.
    • Specified version numbers for dependencies to improve stability.
  • Bug Fixes

    • No bug fixes were reported in this release.

Copy link

coderabbitai bot commented Oct 2, 2024

Walkthrough

The changes in this pull request include updates to the changelog, version number, and mock constants for the injective-testing project. The version has been incremented from 1.1.0 to 1.1.1, reflecting the addition of staking denomination features in the mocks. New constants for stake decimals and denomination have been introduced in the mocks.rs file and utilized in the exchange.rs file to enhance trading functionalities.

Changes

File Path Change Summary
packages/injective-testing/CHANGELOG.md Updated changelog with version 1.1.1 entry, noting the addition of staking denomination in mocks.
packages/injective-testing/Cargo.toml Version updated from 1.1.0 to 1.1.1. Dependencies updated to specific versions.
packages/injective-testing/src/mocks.rs Added constants MOCK_STAKE_DECIMALS (18) and MOCK_STAKE_DENOM ("hinj").
packages/injective-testing/src/test_tube/exchange.rs Added MOCK_STAKE_DECIMALS and MOCK_STAKE_DENOM to imports and utilized in order execution functions.
packages/injective-cosmwasm/CHANGELOG.md Updated changelog with version 0.3.1 entry, documenting a fix for minimum notional requirement.
packages/injective-cosmwasm/Cargo.toml Version updated from 0.3.0 to 0.3.1.

Possibly related PRs

  • Feat/stargate tester contract #220: The changes in the Cargo.toml file for the injective-testing package, specifically modifying the dependency declarations for injective-cosmwasm, injective-math, and injective-std, which aligns with the updates made in the main PR's Cargo.toml.
  • Remove unused dependencies #227: This PR also modifies the Cargo.toml for injective-testing, removing the base64 dependency, which is relevant to the changes in the main PR that involve dependency management.
  • Feat/unused deps #244: Similar to Remove unused dependencies #227, this PR addresses the removal of the base64 dependency in injective-testing, indicating a direct connection to the changes made in the main PR regarding dependency updates.

Suggested reviewers

  • jbernal87
  • Kishan-Dhakan

🐇 "In the land of code where changes bloom,
New stakes arise, dispelling gloom.
With mocks in hand, we trade with glee,
A hop, a skip, in harmony!
Version's updated, our spirits soar,
Let's code and play, forevermore!" 🐇


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

🧹 Outside diff range and nitpick comments (4)
packages/injective-testing/src/mocks.rs (1)

12-12: Summary: New staking denomination constants added

The changes in this file introduce two new constants related to a staking denomination:

  1. MOCK_STAKE_DECIMALS: Set to 18, consistent with other decimal constants.
  2. MOCK_STAKE_DENOM: Set to "hinj", representing a new denomination.

These additions align with the PR title "feat: added staking denom". While the changes themselves look good, it would be beneficial to have more context on how these new constants will be used in the broader codebase. This will help ensure that the implementation is consistent with the project's requirements and conventions.

Consider adding a comment above these new constants to explain their purpose and intended usage, which would improve code readability and maintainability.

Also applies to: 18-18

packages/injective-testing/src/test_tube/exchange.rs (3)

557-557: LGTM! Consider adding a comment for clarity.

The addition of MOCK_STAKE_DENOM is consistent with the existing mock denominations. This change enhances the testing capabilities by including a stake denomination.

Consider adding a brief comment explaining the purpose of MOCK_STAKE_DENOM to improve code readability:

+            // Include mock stake denomination for staking-related tests
             str_coin("1000000", MOCK_STAKE_DENOM, MOCK_STAKE_DECIMALS),

641-641: LGTM! Consider adding a comment for consistency.

The addition of MOCK_STAKE_DENOM here is consistent with the change in the execute_spot_limit_order function. This ensures that both spot and derivative order executions include the mock stake denomination.

For consistency with the previous suggestion, consider adding a similar comment here:

+            // Include mock stake denomination for staking-related tests
             str_coin("1000000", MOCK_STAKE_DENOM, MOCK_STAKE_DECIMALS),

557-557: Summary: New mock stake denomination added successfully.

The changes introduce MOCK_STAKE_DENOM to both spot and derivative order execution functions, enhancing the testing capabilities for staking-related scenarios. The modifications are consistent and well-integrated.

Consider reviewing other parts of the codebase that might benefit from this new mock stake denomination. It may be useful to update relevant test cases or add new ones to ensure comprehensive coverage of staking-related functionality.

Also applies to: 641-641

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2d58148 and ed94278.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • packages/injective-testing/CHANGELOG.md (1 hunks)
  • packages/injective-testing/Cargo.toml (1 hunks)
  • packages/injective-testing/src/mocks.rs (1 hunks)
  • packages/injective-testing/src/test_tube/exchange.rs (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/injective-testing/CHANGELOG.md
  • packages/injective-testing/Cargo.toml
🔇 Additional comments (1)
packages/injective-testing/src/mocks.rs (1)

12-12: LGTM: Consistent decimal places for stake denomination

The addition of MOCK_STAKE_DECIMALS with a value of 18 is consistent with other decimal constants in the file, such as MOCK_EXCHANGE_DECIMALS and MOCK_BASE_DECIMALS. This ensures uniformity in decimal precision across different denominations.

pub const MOCK_ATOM_DECIMALS: i32 = 8i32;
pub const MOCK_QUOTE_DECIMALS: i32 = 6i32;

pub const MOCK_ATOM_DENOM: &str = "atom";
pub const MOCK_BASE_DENOM: &str = "inj";
pub const MOCK_STAKE_DENOM: &str = "hinj";
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

MOCK_STAKE_DENOM is defined but not used anywhere in the codebase

The constant MOCK_STAKE_DENOM with the value "hinj" is currently not referenced in any part of the codebase. Please verify whether this constant is intended for future use or remove it if it's unnecessary to maintain a clean and efficient codebase.

🔗 Analysis chain

Please clarify the purpose and usage of MOCK_STAKE_DENOM

The addition of MOCK_STAKE_DENOM with the value "hinj" is noted. However, the purpose and intended usage of this new denomination are not immediately clear from the context. Could you please provide more information on:

  1. What does the "h" prefix in "hinj" represent? (e.g., hashed INJ, staked INJ)
  2. How and where will this new denomination be used in the codebase?
  3. Are there any specific reasons for introducing this new denomination alongside the existing MOCK_BASE_DENOM ("inj")?

This information will help ensure that the new constant aligns with the project's requirements and conventions.

To help understand the usage of this new denomination, let's search for its occurrences in the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for occurrences of "hinj" in the codebase
rg --type rust '"hinj"'

Length of output: 108

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
packages/injective-cosmwasm/CHANGELOG.md (1)

8-12: LGTM! Consider adding more detail to the change description.

The changelog entry is correctly formatted and placed. The version number is appropriately incremented, and the date is in the correct format and chronological order.

Consider expanding the description to provide more context about the change. For example:

- Add min notional to markets to enforce minimum trade size requirements

This gives users a clearer understanding of why this change was made and its implications.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4594df1 and 68dc86c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • packages/injective-cosmwasm/CHANGELOG.md (1 hunks)
  • packages/injective-cosmwasm/Cargo.toml (1 hunks)
  • packages/injective-testing/Cargo.toml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/injective-cosmwasm/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/injective-testing/Cargo.toml

@jbernal87 jbernal87 self-requested a review October 2, 2024 16:00
Copy link
Contributor

@jbernal87 jbernal87 left a comment

Choose a reason for hiding this comment

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

LGTM

@maxrobot maxrobot merged commit fd72a3a into dev Oct 7, 2024
4 checks passed
@maxrobot maxrobot deleted the f/injective-testing-add-staked-assets branch October 7, 2024 08:44
@coderabbitai coderabbitai bot mentioned this pull request Oct 8, 2024
This was referenced Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants