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

ref: Fixed Amount Splitter rename #754

Merged
merged 3 commits into from
Jan 9, 2025
Merged

Conversation

joemonem
Copy link
Contributor

@joemonem joemonem commented Jan 9, 2025

Motivation

Rename the Set Amount Splitter to Fixed Amount Splitter.
Fixed its schema.

Implementation

Standard rename across the project.
Schema was using the regular splitter's messages instead of the Fixed Amount splitter.

Testing

None

Version Changes

None

Notes

None

Future work

None

Summary by CodeRabbit

  • Refactor

    • Renamed "Set Amount Splitter" contract to "Fixed Amount Splitter"
    • Updated module names, imports, and references across multiple files
    • Maintained existing contract functionality during renaming process
  • Documentation

    • Updated test function names to reflect new contract naming
    • Adjusted integration test references
  • Chores

    • Updated dependencies and Cargo configuration files
    • Removed old module references
    • Renamed test modules and integration test files

@joemonem joemonem requested a review from crnbarr93 January 9, 2025 09:24
Copy link
Contributor

coderabbitai bot commented Jan 9, 2025

Warning

Rate limit exceeded

@joemonem has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2fde1c1 and 33ea253.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)

Walkthrough

This pull request involves a comprehensive renaming and refactoring of the Set Amount Splitter contract to Fixed Amount Splitter across multiple files and packages. The changes include updating package names, module paths, import statements, contract interfaces, mock implementations, and test cases. The core functionality remains unchanged, with the primary focus being on consistent naming and module organization within the Andromeda finance ecosystem.

Changes

File/Path Change Summary
contracts/finance/andromeda-fixed-amount-splitter/Cargo.toml Package name changed from "andromeda-set-amount-splitter" to "andromeda-fixed-amount-splitter"
contracts/finance/andromeda-fixed-amount-splitter/src/* Updated module paths, contract names, and references from "set_amount_splitter" to "fixed_amount_splitter"
packages/andromeda-finance/src/lib.rs Removed set_amount_splitter module, added fixed_amount_splitter module
packages/deploy/Cargo.toml Replaced dependency from andromeda-set-amount-splitter to andromeda-fixed-amount-splitter
packages/deploy/src/contracts.rs Updated contract imports and deployment configuration
tests-integration/Cargo.toml Updated dependency and test entry names
tests-integration/tests/* Renamed test files, functions, and mock implementations

Suggested Labels

ci: skip-changelog

Poem

🐰 A Splitter's Tale of Renaming Delight

From Set to Fixed, our contract takes flight
Modules dancing, paths realigned
With precision, code redesigned
A rabbit's hop of refactoring might! 🚀

Possibly related PRs

Finishing Touches

  • 📝 Generate Docstrings

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.

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 (3)
contracts/finance/andromeda-fixed-amount-splitter/src/mock.rs (1)

Line range hint 29-35: Update the app name in instantiation.

The app name still uses "Andromeda Splitter" which could be more specific. Consider updating it to "Andromeda Fixed Amount Splitter" for consistency with the new naming convention.

-        let res = app.instantiate_contract(code_id, sender, &msg, &[], "Andromeda Splitter", None);
+        let res = app.instantiate_contract(code_id, sender, &msg, &[], "Andromeda Fixed Amount Splitter", None);
tests-integration/tests/fixed_amount_splitter.rs (2)

Line range hint 124-124: Update app name in instantiation.

The app name still uses the old naming convention "Set Amount Splitter App".

-        "Set Amount Splitter App",
+        "Fixed Amount Splitter App",

Line range hint 165-197: Enhance test assertions with descriptive messages.

The test assertions could be more descriptive to better explain the expected behavior.

     assert_eq!(
         router
             .wrap()
             .query_balance(andr.get_wallet("recipient1"), "uandr")
             .unwrap()
             .amount,
-        Uint128::from(100u128)
+        Uint128::from(100u128),
+        "Recipient1 should receive exactly 100 uandr from the fixed amount split"
     );
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5a371f2 and 2fde1c1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • contracts/finance/andromeda-fixed-amount-splitter/Cargo.toml (1 hunks)
  • contracts/finance/andromeda-fixed-amount-splitter/examples/schema.rs (1 hunks)
  • contracts/finance/andromeda-fixed-amount-splitter/src/contract.rs (2 hunks)
  • contracts/finance/andromeda-fixed-amount-splitter/src/interface.rs (1 hunks)
  • contracts/finance/andromeda-fixed-amount-splitter/src/lib.rs (1 hunks)
  • contracts/finance/andromeda-fixed-amount-splitter/src/mock.rs (5 hunks)
  • contracts/finance/andromeda-fixed-amount-splitter/src/state.rs (1 hunks)
  • contracts/finance/andromeda-fixed-amount-splitter/src/testing/tests.rs (1 hunks)
  • contracts/finance/andromeda-set-amount-splitter/src/interface.rs (0 hunks)
  • contracts/finance/andromeda-set-amount-splitter/src/state.rs (0 hunks)
  • packages/andromeda-finance/src/lib.rs (1 hunks)
  • packages/deploy/Cargo.toml (1 hunks)
  • packages/deploy/src/contracts.rs (2 hunks)
  • tests-integration/Cargo.toml (2 hunks)
  • tests-integration/tests/fixed_amount_splitter.rs (8 hunks)
  • tests-integration/tests/mod.rs (1 hunks)
  • tests-integration/tests/splitter.rs (4 hunks)
💤 Files with no reviewable changes (2)
  • contracts/finance/andromeda-set-amount-splitter/src/interface.rs
  • contracts/finance/andromeda-set-amount-splitter/src/state.rs
✅ Files skipped from review due to trivial changes (5)
  • tests-integration/tests/mod.rs
  • contracts/finance/andromeda-fixed-amount-splitter/Cargo.toml
  • contracts/finance/andromeda-fixed-amount-splitter/src/testing/tests.rs
  • contracts/finance/andromeda-fixed-amount-splitter/src/contract.rs
  • tests-integration/tests/splitter.rs
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Contract Tests (ubuntu-latest, unit-test)
  • GitHub Check: Contract Tests (ubuntu-latest, integration-test)
  • GitHub Check: Schemas
  • GitHub Check: Contracts
  • GitHub Check: Summary
🔇 Additional comments (10)
contracts/finance/andromeda-fixed-amount-splitter/src/state.rs (1)

1-4: LGTM! Clean implementation of the state storage.

The storage implementation correctly uses the new module path and follows the naming convention.

packages/andromeda-finance/src/lib.rs (1)

3-3: LGTM! Module declaration follows the package structure.

The new module is correctly placed and maintains the alphabetical ordering.

contracts/finance/andromeda-fixed-amount-splitter/examples/schema.rs (1)

1-1: Verify schema generation with new imports.

The import path has been correctly updated. Please ensure the schema generation produces the expected output.

Run this script to verify the schema generation:

✅ Verification successful

Schema generation code is correctly structured

The schema.rs file is properly configured with:

  • Correct import path from andromeda-finance workspace dependency
  • Standard schema generation using write_api! macro
  • All necessary message types (InstantiateMsg, QueryMsg, ExecuteMsg)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify schema generation and check for any breaking changes

# Find and check schema files
fd -e json -e schema 'schema' contracts/finance/andromeda-fixed-amount-splitter/schema/ \
  --exec sh -c 'echo "Checking {}" && cat {} | jq -r ".[\"title\"] // .title"'

Length of output: 309


Script:

#!/bin/bash
# First, let's understand the project structure
echo "Project structure:"
fd . contracts/finance/andromeda-fixed-amount-splitter/ -t d

echo -e "\nLooking for schema files:"
fd schema contracts/finance/andromeda-fixed-amount-splitter/ -t f

echo -e "\nChecking examples directory content:"
ls -la contracts/finance/andromeda-fixed-amount-splitter/examples/

Length of output: 816


Script:

#!/bin/bash
echo "Content of schema.rs:"
cat contracts/finance/andromeda-fixed-amount-splitter/examples/schema.rs

echo -e "\nVerifying imports exist in source:"
rg "pub (struct|enum) (ExecuteMsg|InstantiateMsg|QueryMsg)" contracts/finance/andromeda-fixed-amount-splitter/src/

Length of output: 577


Script:

#!/bin/bash
# Check Cargo.toml for dependencies and workspace structure
echo "Checking Cargo.toml:"
cat contracts/finance/andromeda-fixed-amount-splitter/Cargo.toml

echo -e "\nChecking for message type definitions:"
rg -g '!target/' -g '!examples/' "mod fixed_amount_splitter" contracts/finance/

Length of output: 1219

contracts/finance/andromeda-fixed-amount-splitter/src/lib.rs (1)

13-13: Verify the interface usage across the codebase.

The interface export has been correctly renamed. Let's verify its usage to ensure no references to the old interface remain.

Run this script to check for any remaining references:

✅ Verification successful

Interface rename verification completed successfully

The interface has been properly renamed across the codebase. The only reference to the old name appears in the CHANGELOG.md, which is expected as it documents historical changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to SetAmountSplitter

# Search for old naming references
echo "Checking for old interface references..."
rg -l "SetAmount(Splitter|Contract)"

echo "Checking for potential missed renames..."
rg -l "set.?amount.?splitter" -i

Length of output: 353


Script:

#!/bin/bash
# Check content of matched files
echo "=== Checking test file content ==="
rg "SetAmount(Splitter|Contract)" tests-integration/tests/splitter.rs tests-integration/tests/fixed_amount_splitter.rs -C 2

echo -e "\n=== Checking CHANGELOG.md content ==="
rg "set.?amount.?splitter" CHANGELOG.md -i -C 2

Length of output: 871

contracts/finance/andromeda-fixed-amount-splitter/src/interface.rs (1)

1-10: LGTM! Clean interface implementation.

The contract interface is well-defined with proper imports and a clear contract ID that matches the new naming convention.

packages/deploy/src/contracts.rs (1)

74-74: LGTM! Proper contract deployment update.

The FixedAmountSplitterContract is correctly integrated into the deployment list, maintaining the existing deployment order.

tests-integration/tests/fixed_amount_splitter.rs (1)

Line range hint 165-228: Consider adding more test scenarios.

The current test coverage focuses on basic scenarios. Consider adding tests for:

  • Edge cases with zero amounts
  • Cases with invalid recipient configurations
  • Scenarios with multiple consecutive splits

Let me help you identify any existing test coverage for these scenarios:

packages/deploy/Cargo.toml (1)

52-52: LGTM! Verify dependency update.

The dependency rename from andromeda-set-amount-splitter to andromeda-fixed-amount-splitter aligns with the PR objectives.

Let's verify the dependency path exists and the package name is updated in the target Cargo.toml:

✅ Verification successful

Dependency update verified successfully

The package name and path have been correctly updated to andromeda-fixed-amount-splitter in both the deployment configuration and the target package.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the renamed package exists and is correctly updated
# Test: Check if the package name is updated in the target Cargo.toml
cat contracts/finance/andromeda-fixed-amount-splitter/Cargo.toml | grep -A 2 '^\[package\]'

Length of output: 166

tests-integration/Cargo.toml (2)

71-73: LGTM! Verify testing features.

The dependency rename maintains consistency with the changes in deploy/Cargo.toml and preserves the testing features.

Let's verify the testing features are properly defined in the target Cargo.toml:

✅ Verification successful

Testing features are properly defined

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify testing features are properly defined
# Test: Check if testing features are defined in the target Cargo.toml
cat contracts/finance/andromeda-fixed-amount-splitter/Cargo.toml | grep -A 5 '^\[features\]'

Length of output: 339


180-180: LGTM! Verify test file rename.

The test entry rename aligns with the new package name.

Let's verify the test file is also renamed:

✅ Verification successful

Test file rename verified successfully

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify test file rename
# Test: Check if the test file is renamed from set_amount_splitter.rs to fixed_amount_splitter.rs
ls -la tests-integration/tests/fixed_amount_splitter.rs

Length of output: 155


Script:

#!/bin/bash
# Check if the old file name still exists
ls -la tests-integration/tests/set_amount_splitter.rs

Length of output: 149

@joemonem joemonem merged commit 106b2fc into main Jan 9, 2025
11 of 12 checks passed
@joemonem joemonem deleted the fixed-amount-splitter-rename branch January 9, 2025 13:16
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