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: disable reward functionalities #134

Merged
merged 3 commits into from
Dec 30, 2024

Conversation

adu-web3
Copy link
Collaborator

@adu-web3 adu-web3 commented Dec 30, 2024

Description

Given we have disabled the methods of reward precompiles for exocore, we should also disable reward related functionalities to avoid being blocked for the failure submitReward and other functions

Summary by CodeRabbit

  • New Features

    • None
  • Bug Fixes

    • None
  • Refactor

    • Disabled reward-related functions in the BaseRestakingController contract.
    • Removed the WithdrawReward test file.
  • Chores

    • Updated method signatures for reward-related functions to indicate they are not yet supported.

Copy link
Contributor

coderabbitai bot commented Dec 30, 2024

Warning

Rate limit exceeded

@adu-web3 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 38 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 f0c70df and 0da4a12.

📒 Files selected for processing (1)
  • script/deployedContracts.json (1 hunks)

Walkthrough

The pull request modifies the BaseRestakingController.sol contract by altering three reward-related functions: submitReward, claimRewardFromExocore, and withdrawReward. These functions have been updated to revert with a "not yet supported" error, effectively disabling their current implementation. The method signatures have been slightly modified, with changes to visibility and function type (e.g., adding external payable or external pure). Simultaneously, the test file WithdrawReward.t.sol has been completely removed from the project.

Changes

File Change Summary
src/core/BaseRestakingController.sol - Modified submitReward() to revert with NotYetSupported error
- Modified claimRewardFromExocore() to revert with NotYetSupported error
- Modified withdrawReward() to revert with NotYetSupported error
- Updated method signatures with different visibility modifiers
test/foundry/WithdrawReward.t.sol - Entire test file removed

Possibly related PRs

Suggested Reviewers

  • bwhour
  • leonz789
  • MaxMustermann2

Poem

🐰 Rewards on pause, a rabbit's tale
Functions waiting behind a veil
No claims today, no tokens flow
Just a simple "not yet" to let you know
Coding magic, temporarily still
Patience hops where features will! 🚧


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 or @coderabbitai title 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

github-actions bot commented Dec 30, 2024

✅ The Solhint workflow has completed successfully. Check the workflow run for details. (0da4a12)

Copy link

github-actions bot commented Dec 30, 2024

✅ The Forge CI workflow has completed successfully. Check the workflow run for details. (0da4a12)

Copy link

github-actions bot commented Dec 30, 2024

✅ The Slither Analysis workflow has completed successfully. Check the workflow run for details. (0da4a12)

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 (2)
src/core/BaseRestakingController.sol (2)

86-88: **Unused parameters in disabled function **

Since this function reverts immediately, the parameters (token, avs, amount) are not used. Consider removing or marking them (e.g., prefixing with _) if you want to silence lint warnings.

-function submitReward(address token, address avs, uint256 amount) external payable {
+function submitReward(address /*token*/, address /*avs*/, uint256 /*amount*/) external payable {
    revert Errors.NotYetSupported();
}
🧰 Tools
🪛 GitHub Check: lint

[failure] 87-87:
Variable "token" is unused


[failure] 87-87:
Variable "avs" is unused


[failure] 87-87:
Variable "amount" is unused


92-94: **Recommendation: keep minimal tests for revert logic **

You're disabling reward functionalities by reverting. While removing full test coverage might be intentional, consider retaining a minimal unit test ensuring the function reverts as expected. This helps protect against accidental re-enablement of partial logic without updating tests.

Do you want me to open an issue to track adding minimal revert tests?

🧰 Tools
🪛 GitHub Check: lint

[failure] 93-93:
Variable "token" is unused


[failure] 93-93:
Variable "amount" is unused

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 389fc09 and d4e4463.

📒 Files selected for processing (2)
  • src/core/BaseRestakingController.sol (2 hunks)
  • test/foundry/WithdrawReward.t.sol (0 hunks)
💤 Files with no reviewable changes (1)
  • test/foundry/WithdrawReward.t.sol
🧰 Additional context used
📓 Learnings (1)
src/core/BaseRestakingController.sol (1)
Learnt from: adu-web3
PR: ExocoreNetwork/exocore-contracts#102
File: src/core/BaseRestakingController.sol:102-113
Timestamp: 2024-11-12T10:03:05.536Z
Learning: In the `claimRewardFromExocore` function in `src/core/BaseRestakingController.sol`, reward tokens are intended to be permission-free and should not be checked against a whitelist.
🪛 GitHub Check: lint
src/core/BaseRestakingController.sol

[failure] 87-87:
Variable "token" is unused


[failure] 87-87:
Variable "avs" is unused


[failure] 87-87:
Variable "amount" is unused


[failure] 93-93:
Variable "token" is unused


[failure] 93-93:
Variable "amount" is unused


[failure] 99-99:
Variable "token" is unused


[failure] 99-99:
Variable "recipient" is unused


[failure] 99-99:
Variable "amount" is unused

🔇 Additional comments (2)
src/core/BaseRestakingController.sol (2)

7-8: **Import for Errors library **

Good addition of the Errors library import. This aligns with the code style of reverting using custom errors in place of revert messages.


98-100: **Reward withdrawal fully disabled **

Everything correctly aligns with the objective of disabling reward functionality. The function reverts and indicates that reward handling remains unsupported. The same note about unused parameters applies here.

🧰 Tools
🪛 GitHub Check: lint

[failure] 99-99:
Variable "token" is unused


[failure] 99-99:
Variable "recipient" is unused


[failure] 99-99:
Variable "amount" is unused

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 (2)
src/core/BaseRestakingController.sol (2)

92-94: Remove unnecessary payable modifier

Similar to submitReward, the payable modifier is unnecessary since the function always reverts.

-    function claimRewardFromExocore(address, uint256) external payable {
+    function claimRewardFromExocore(address, uint256) external {
         revert Errors.NotYetSupported();
     }

86-100: Consider using a more explicit approach for disabled features

While the current implementation effectively disables the reward functionality, consider these architectural improvements:

  1. Add an explicit error message indicating when these features will be supported
  2. Consider using a feature flag pattern that would make re-enabling these features easier in the future
  3. Document the rationale for disabling these features in the contract's documentation

This would provide better clarity for users and make future maintenance easier.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d4e4463 and f0c70df.

📒 Files selected for processing (1)
  • src/core/BaseRestakingController.sol (2 hunks)
🧰 Additional context used
📓 Learnings (1)
src/core/BaseRestakingController.sol (2)
Learnt from: adu-web3
PR: ExocoreNetwork/exocore-contracts#102
File: src/core/BaseRestakingController.sol:102-113
Timestamp: 2024-11-12T10:03:05.536Z
Learning: In the `claimRewardFromExocore` function in `src/core/BaseRestakingController.sol`, reward tokens are intended to be permission-free and should not be checked against a whitelist.
Learnt from: adu-web3
PR: ExocoreNetwork/exocore-contracts#102
File: src/core/BaseRestakingController.sol:83-99
Timestamp: 2024-11-12T10:03:05.536Z
Learning: In the `submitReward` function in `src/core/BaseRestakingController.sol`, reward tokens are intended to be permission-free and should not be checked against a whitelist.
🔇 Additional comments (3)
src/core/BaseRestakingController.sol (3)

8-8: LGTM: Import statement correctly added

The Errors library import is appropriately placed and necessary for the NotYetSupported error usage.


98-100: LGTM: Function correctly disabled

The implementation and modifiers are appropriate. Since the test file WithdrawReward.t.sol was removed, let's verify no other test files are referencing these reward functions.

✅ Verification successful

Reward functions correctly disabled and tested

The remaining test reference in Bootstrap.t.sol is actually verifying the expected revert behavior with vm.expectRevert(abi.encodeWithSignature("NotYetSupported()")), which aligns perfectly with the current implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining test files that might be referencing the disabled reward functions
rg -g "*.t.sol" -e "submitReward|claimRewardFromExocore|withdrawReward"

Length of output: 166


Script:

#!/bin/bash
# Let's check the context of the remaining reference to understand if it's a test expecting the revert
rg -g "*.t.sol" -C 5 "claimRewardFromExocore"

Length of output: 812


86-88: Consider removing unnecessary payable modifier

Since the function always reverts, the payable modifier serves no purpose and could be removed. Additionally, let's verify this change doesn't break existing integrations.

Copy link

github-actions bot commented Dec 30, 2024

✅ The Compare Storage Layouts workflow has completed successfully. Check the workflow run for details. (0da4a12)

@adu-web3 adu-web3 added this pull request to the merge queue Dec 30, 2024
Merged via the queue into ExocoreNetwork:main with commit 321a7e2 Dec 30, 2024
15 checks passed
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.

4 participants