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

Removed Rates module from Point ADO #761

Merged
merged 3 commits into from
Jan 14, 2025
Merged

Removed Rates module from Point ADO #761

merged 3 commits into from
Jan 14, 2025

Conversation

mdjakovic0920
Copy link
Contributor

@mdjakovic0920 mdjakovic0920 commented Jan 13, 2025

The Rates module is not needed, so I removed that from the contract.

Summary by CodeRabbit

  • Refactor

    • Simplified point management functionality by removing tax and rate-related logic.
    • Streamlined set_point method signature.
    • Removed complex tax and fund transfer calculations.
  • Tests

    • Updated test suite to remove tax-related test cases.
    • Enhanced test coverage by adding a new ADO version in the ADO contract tests.
  • Chores

    • Cleaned up mock and testing implementations.
    • Removed unnecessary functions and imports related to rates and tax handling.
    • Updated dependency configuration for andromeda-std.

Copy link
Contributor

coderabbitai bot commented Jan 13, 2025

Walkthrough

The pull request introduces significant changes to the Andromeda Point contract, primarily focusing on simplifying the execution flow. The modifications involve removing rate and tax-related functionalities from the execute.rs, mock.rs, and testing files. The set_point function's signature has been altered, eliminating the action parameter and associated complexity. Test cases have been updated to reflect these changes, removing tax-related test scenarios while maintaining core point management functionality.

Changes

File Change Summary
contracts/math/andromeda-point/src/execute.rs - Removed RatesMessage and rate handling logic
- Modified set_point function signature
- Simplified response generation
contracts/math/andromeda-point/src/mock.rs - Removed execute_add_rate method
- Deleted mock_set_rate_msg function
contracts/math/andromeda-point/src/testing/mock.rs - Removed set_point_with_funds function
contracts/math/andromeda-point/src/testing/tests.rs - Deleted test_set_point_with_tax test
- Removed tax-related imports
contracts/os/andromeda-adodb/src/tests.rs - Added new ADOVersion for [email protected]
contracts/os/andromeda-kernel/src/testing/test_handler.rs - Minor formatting improvements
CHANGELOG.md - Added entry for removal of Rates module from Point ADO contract
contracts/math/andromeda-point/Cargo.toml - Updated andromeda-std dependency to remove rates feature

Possibly related PRs

  • refactor: Primitive Improvements #476: The changes in this PR involve the addition and handling of RatesMessage and tax calculations, which were removed in the main PR, indicating a direct relationship in the context of rate management and execution flow simplification.
  • Bump version #700: This PR includes updates to the Cargo.toml for the andromeda-point package, which is directly related to the main PR as it reflects the removal of the rates feature in the andromeda-point package.
  • feat: IBC packet tracking adjustments #748: This PR discusses changes related to IBC packet tracking and includes modifications to the handling of rates recipients, which connects to the main PR's focus on simplifying rate management and execution flow.

Suggested Labels

ci: skip-changelog

Suggested Reviewers

  • joemonem

Poem

🐰 Hop, hop, through code so bright,
Rates and taxes take flight!
Simplicity now reigns supreme,
Our point contract's a leaner dream
Refactored with bunny delight! 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2483dcf and 5a70175.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • contracts/math/andromeda-point/Cargo.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Contract Tests (ubuntu-latest, unit-test)
  • GitHub Check: Contract Tests (ubuntu-latest, integration-test)
  • GitHub Check: Contract Tests (ubuntu-latest, unit-test)
  • GitHub Check: Contract Tests (ubuntu-latest, integration-test)
  • GitHub Check: Contracts
  • GitHub Check: Schemas
  • GitHub Check: Summary
🔇 Additional comments (2)
contracts/math/andromeda-point/Cargo.toml (1)

32-32: LGTM! Rates feature correctly removed.

The removal of the rates feature from andromeda-std dependency aligns with the PR objective of removing the Rates module from Point ADO.

CHANGELOG.md (1)

32-32: LGTM! Changelog entry properly documented.

The changelog entry is well-formatted, placed in the correct section, and clearly documents the removal of the Rates module from Point ADO.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@mdjakovic0920 mdjakovic0920 added the ci: skip-changelog Skips the changelog check in CI label Jan 13, 2025
@joemonem
Copy link
Contributor

We can remove the rates feature from here: andromeda-std = { workspace = true, features = ["rates"] }.
Also we should add a changelog entry

@mdjakovic0920 mdjakovic0920 removed the ci: skip-changelog Skips the changelog check in CI label Jan 13, 2025
Copy link
Contributor

@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

🧹 Nitpick comments (4)
contracts/math/andromeda-point/src/execute.rs (2)

24-29: Avoid unnecessary cloning of msg

The msg.clone() in the match statement may be redundant. If ExecuteMsg implements the Copy trait or if ownership transfer is acceptable, consider removing the clone to improve efficiency.

Apply this diff to eliminate the cloning:

-let res = match msg.clone() {
+let res = match msg {

59-59: Avoid unnecessary cloning of point when saving to storage

Cloning point before saving may be unnecessary. If DATA.save accepts a reference to point, you can avoid the clone to enhance performance.

Apply this diff to remove the clone:

-    DATA.save(ctx.deps.storage, &point.clone())?;
+    DATA.save(ctx.deps.storage, &point)?;
contracts/math/andromeda-point/src/testing/mock.rs (1)

Line range hint 27-29:
Consider passing point by value to avoid cloning

In the set_point function, cloning point may be unnecessary. Passing point by value can eliminate the need for cloning and improve efficiency.

Apply this diff to modify the function signature and usage:

-pub fn set_point(
-    deps: DepsMut<'_>,
-    point: &PointCoordinate,
-    sender: &str,
-) -> Result<Response, ContractError> {
-    let msg = ExecuteMsg::SetPoint {
-        point: point.clone(),
-    };
+pub fn set_point(
+    deps: DepsMut<'_>,
+    point: PointCoordinate,
+    sender: &str,
+) -> Result<Response, ContractError> {
+    let msg = ExecuteMsg::SetPoint {
+        point,
+    };
contracts/os/andromeda-adodb/src/tests.rs (1)

721-725: LGTM! Consider expanding test coverage.

The test correctly verifies handling of multiple versions of the same ADO type. However, consider adding test cases for:

  • Pre-release versions (e.g., 0.1.0-alpha.1)
  • Major version changes (e.g., 1.0.0)
  • Invalid version formats
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3000a5a and 2483dcf.

📒 Files selected for processing (6)
  • contracts/math/andromeda-point/src/execute.rs (3 hunks)
  • contracts/math/andromeda-point/src/mock.rs (0 hunks)
  • contracts/math/andromeda-point/src/testing/mock.rs (1 hunks)
  • contracts/math/andromeda-point/src/testing/tests.rs (1 hunks)
  • contracts/os/andromeda-adodb/src/tests.rs (1 hunks)
  • contracts/os/andromeda-kernel/src/testing/test_handler.rs (3 hunks)
💤 Files with no reviewable changes (1)
  • contracts/math/andromeda-point/src/mock.rs
✅ Files skipped from review due to trivial changes (1)
  • contracts/os/andromeda-kernel/src/testing/test_handler.rs
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Contracts
  • GitHub Check: Summary
🔇 Additional comments (7)
contracts/math/andromeda-point/src/execute.rs (5)

4-4: Imports of call_action and ExecuteContext are appropriate

The addition of call_action and ExecuteContext to the imports aligns with their usage in the code and is necessary for the updated functionality.


7-7: Importing ensure and Response from cosmwasm_std

Including ensure and Response is essential for error handling and constructing responses.


16-22: Proper invocation of call_action function

The call_action function is correctly called, and its response is stored in action_response. This integration ensures that actions are appropriately handled.


31-34: Correctly appending action responses to the final result

The response from call_action is properly merged into the final Response using .add_submessages(), .add_attributes(), and .add_events().


53-65: Function signature of set_point updated appropriately

The set_point function now accepts only ctx and point, reflecting the removal of the action parameter and simplifying the function's usage.

contracts/math/andromeda-point/src/testing/mock.rs (1)

11-11: Imports are correctly updated

The inclusion of additional types such as Deps, DepsMut, MessageInfo, OwnedDeps, and Response is appropriate for the testing environment.

contracts/math/andromeda-point/src/testing/tests.rs (1)

1-7: Imports and test setup are updated correctly

The updated imports and test configurations reflect the changes in the codebase, focusing on point management without rate or tax functionalities.

@mdjakovic0920 mdjakovic0920 merged commit 1d75e7e into main Jan 14, 2025
12 checks passed
@mdjakovic0920 mdjakovic0920 deleted the remove-rates branch January 14, 2025 09:35
crnbarr93 pushed a commit that referenced this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants