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

fix: fix the false comments at DistributionWrapper.sol #1348

Merged
merged 4 commits into from
Dec 11, 2023

Conversation

ethisscam
Copy link
Contributor

@ethisscam ethisscam commented Dec 11, 2023

The comments of setWithdrawAddress and delegate functions are wrong. I fix them with comments from Distribution.sol and Staking.sol

Summary by CodeRabbit

  • New Features

    • Users can now set a specific address to receive delegation rewards in the DistributionWrapper contract.
    • Enhanced the delegate function to allow users to delegate tokens directly to a validator.
  • Documentation

    • Corrected spelling errors in the documentation comments for the IDistributionModule interface.
  • Refactor

    • Updated function descriptions and comments for clarity in the DistributionWrapper contract.

Signed-off-by: tianqi <58348113+ethisscam@users.noreply.github.com>
Copy link

coderabbitai bot commented Dec 11, 2023

Walkthrough

The DistributionWrapper contract has been updated to refine the delegation process. The setWithdrawAddress function now clearly defines its purpose to set the recipient of delegation rewards, and the delegate function has been modified to allow senders to delegate a specified amount of tokens to a validator. Additionally, minor spelling corrections were made in the Distribution contract to fix the term "delegation."

Changes

Files Summary
.../testing/DistributionWrapper.sol Updated setWithdrawAddress and delegate functions to enhance delegation reward handling and token delegation.
.../cosmos/precompile/Distribution.sol Corrected spelling from "deligation" to "delegation" in comments.

🐇✨
In the code where tokens flow,
A rabbit hopped, and fixed the show.
Delegation's spelled right, at last,
With rewards and delegates cast. 🌟🥕

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 X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5c432b9 and 6ffa9cf.
Files selected for processing (1)
  • contracts/src/testing/DistributionWrapper.sol (2 hunks)
Additional comments: 2
contracts/src/testing/DistributionWrapper.sol (2)
  • 63-64: The updated comment for setWithdrawAddress function now accurately describes its purpose as per the PR objective. It clarifies that the caller can set the address to receive delegation rewards.

  • 80-81: The updated comment for the delegate function correctly describes the new functionality, which aligns with the PR objective and the AI-generated summary.

Signed-off-by: tianqi <58348113+ethisscam@users.noreply.github.com>
@ethisscam
Copy link
Contributor Author

it seems the name of Deploy.sol contract is false too.

@@ -60,8 +60,8 @@ contract DistributionWrapper {
}

/**
* @dev Withdraw the rewrads accumulated by the caller(msg.sender).
* @param _withdrawAddress The address of the delegator.
* @dev The caller (msg.sender) can set the address that will receive the deligation rewards.
Copy link
Member

Choose a reason for hiding this comment

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

delegation**

Copy link
Member

@itsdevbear itsdevbear left a comment

Choose a reason for hiding this comment

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

typo

Signed-off-by: tianqi <58348113+ethisscam@users.noreply.github.com>
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6ffa9cf and 3ec738c.
Files selected for processing (1)
  • contracts/src/testing/DistributionWrapper.sol (2 hunks)
Additional comments: 4
contracts/src/testing/DistributionWrapper.sol (4)
  • 63-64: The updated comments for the setWithdrawAddress function now correctly describe its purpose, which is to allow the caller to set the address that will receive delegation rewards. This aligns with the PR objective to ensure comments accurately describe the functionality.

  • 80-80: The updated comment for the delegate function now specifies that msg.sender delegates the msg.value of tokens to a validator, which aligns with the PR objective to correct inaccuracies in the comments.

  • 66-67: The hunk shows that the setWithdrawAddress function's logic and control flow remain unchanged; only the comments have been updated. This is consistent with the PR objective, which is to update comments for accuracy.

  • 83-83: The hunk shows that the delegate function's logic and control flow remain unchanged; only the comments have been updated. This is consistent with the PR objective, which is to update comments for accuracy.

@ethisscam
Copy link
Contributor Author

wait a minute. I directly copy the comment from Distribution.sol so there must be typo there too. Will submit later.

Signed-off-by: tianqi <58348113+ethisscam@users.noreply.github.com>
@itsdevbear
Copy link
Member

Sg

@itsdevbear itsdevbear added merge me daddy Trigger Beradozer to bulldoze the PR backport/v0.0.2-alpha labels Dec 11, 2023
@itsdevbear itsdevbear merged commit bcf046e into berachain:main Dec 11, 2023
13 checks passed
mergify bot pushed a commit that referenced this pull request Dec 11, 2023
The comments of setWithdrawAddress and delegate functions are wrong. I
fix them with comments from Distribution.sol and Staking.sol

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Users can now set a specific address to receive delegation rewards in
the `DistributionWrapper` contract.
- Enhanced the `delegate` function to allow users to delegate tokens
directly to a validator.

- **Documentation**
- Corrected spelling errors in the documentation comments for the
`IDistributionModule` interface.

- **Refactor**
- Updated function descriptions and comments for clarity in the
`DistributionWrapper` contract.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: tianqi <58348113+ethisscam@users.noreply.github.com>
(cherry picked from commit bcf046e)
itsdevbear pushed a commit that referenced this pull request Dec 12, 2023
… (#1349)

This is an automatic backport of pull request #1348 done by
[Mergify](https://mergify.com).


---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the
[documentation](https://docs.mergify.com/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on
`<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.com) you
can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com
</details>

Co-authored-by: tianqi <58348113+ethisscam@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.0.2-alpha merge me daddy Trigger Beradozer to bulldoze the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants