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(node): Modify rent reward distributions #3686

Merged
merged 35 commits into from
Feb 28, 2024
Merged

feat(node): Modify rent reward distributions #3686

merged 35 commits into from
Feb 28, 2024

Conversation

gshep
Copy link
Member

@gshep gshep commented Jan 23, 2024

Resolves #3560 . Implements a part of the rent proposal for wait-lists.

  • create rent pool

  • add test runtime with two block producers

  • rent_pool_disbursments_work test case

  • rents for wait-list, mailbox, reservation, delayed sending are transferred to the rent pool

  • create rent pool accounts on the networks before deploying this feature

@gear-tech/dev

@gshep gshep added A1-inprogress Issue is in progress or PR draft is not ready to be reviewed D2-node Gear Node C1-feature Feature request labels Jan 23, 2024
@gshep gshep self-assigned this Jan 23, 2024
@gshep gshep requested review from breathx and ark0f January 23, 2024 10:57
@gshep gshep added A0-pleasereview PR is ready to be reviewed by the team and removed A1-inprogress Issue is in progress or PR draft is not ready to be reviewed labels Jan 23, 2024
pallets/staking-rewards/Cargo.toml Show resolved Hide resolved
pallets/gear-bank/src/tests.rs Show resolved Hide resolved
pallets/gear/src/internal.rs Outdated Show resolved Hide resolved
pallets/gear/src/internal.rs Show resolved Hide resolved
pallets/gear/src/lib.rs Show resolved Hide resolved
pallets/staking-rewards/src/lib.rs Outdated Show resolved Hide resolved
pallets/staking-rewards/src/lib.rs Outdated Show resolved Hide resolved
pallets/staking-rewards/src/mock.rs Show resolved Hide resolved
pallets/staking-rewards/src/tests.rs Outdated Show resolved Hide resolved
runtime/vara/src/lib.rs Outdated Show resolved Hide resolved
@breathx
Copy link
Member

breathx commented Feb 6, 2024

Except comments above, lgtm

@breathx breathx removed the A0-pleasereview PR is ready to be reviewed by the team label Feb 6, 2024
@gshep gshep changed the title feat(node): Modify wait-list rent reward distributions feat(node): Modify rent reward distributions Feb 12, 2024
@gshep gshep added the A0-pleasereview PR is ready to be reviewed by the team label Feb 12, 2024
@gshep gshep requested a review from breathx February 12, 2024 14:07
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

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

Awesome work

pallets/gear/src/internal.rs Outdated Show resolved Hide resolved
pallets/staking-rewards/src/lib.rs Outdated Show resolved Hide resolved
pallets/staking-rewards/src/lib.rs Show resolved Hide resolved
pallets/staking-rewards/src/lib.rs Outdated Show resolved Hide resolved
@breathx
Copy link
Member

breathx commented Feb 14, 2024

@ukint-vs @ekovalev kindly asking for your reviews guys

@breathx
Copy link
Member

breathx commented Feb 14, 2024

Btw, still maybe consider at least migrations (try-runtime) check for pool account existence?

@breathx breathx removed the A3-gotissues PR occurred to have issues after the review label Feb 14, 2024
@ukint-vs
Copy link
Member

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

PR Analysis

  • 🎯 Main theme: Implementing rent reward distributions
  • 📝 PR summary: This PR implements a part of the rent proposal for wait-lists. It creates a rent pool and modifies the test runtime to include two block producers. It also includes the transfer of rents for wait-list, mailbox, reservation, and delayed sending to the rent pool.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: Yes
  • ⏱️ Estimated effort to review [1-5]: 5, because the PR involves changes in multiple files and includes complex logic related to rent reward distributions. The PR also modifies the test runtime, which requires a deep understanding of the system to review effectively.
  • 🔒 Security concerns: No security concerns found

PR Feedback

💡 General suggestions: The PR seems to be well-structured and follows good coding practices. However, it would be beneficial to include more detailed comments explaining the logic behind the changes, especially for complex functions. This would make it easier for other developers to understand the code and contribute in the future.

🤖 Code feedback:
relevant filepallets/staking-rewards/src/mock.rs
suggestion      

It seems like the ExtBuilder struct has been made generic and a lot of code has been added to it. It might be beneficial to split this struct into smaller, more manageable pieces to improve readability and maintainability. [medium]

relevant linepub struct ExtBuilder {

relevant filepallets/gear/src/internal.rs
suggestion      

The spend_gas function has been modified to include an optional destination for the gas. It would be beneficial to include a comment explaining the logic behind this change and how it affects the overall system. [medium]

relevant linepub fn spend_gas(

relevant filepallets/gear/src/internal.rs
suggestion      

The spend_gas function uses unwrap_or_else with unreachable!. It might be better to handle the error more gracefully instead of panicking. [important]

relevant lineresult.unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}"));

relevant filepallets/gear/src/internal.rs
suggestion      

The consume_gas function has been modified to spend gas to the rent pool. It would be beneficial to include a comment explaining the logic behind this change and how it affects the overall system. [medium]

relevant lineSelf::spend_gas(::RentPoolId::get(), id, amount)


✨ Usage guide:

Overview:
The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...

With a configuration file, use the following template:

[pr_reviewer]
some_config1=...
some_config2=...
Utilizing extra instructions

The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

Examples for extra instructions:

[pr_reviewer] # /review #
extra_instructions="""
In the code feedback section, emphasize the following:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
- Is the code logic efficient?
...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

How to enable\disable automation
  • When you first install PR-Agent app, the default mode for the review tool is:
pr_commands = ["/review", ...]

meaning the review tool will run automatically on every PR, with the default configuration.
Edit this field to enable/disable the tool, or to change the used configurations

About the 'Code feedback' section

The review tool provides several type of feedbacks, one of them is code suggestions.
If you are interested only in the code suggestions, it is recommended to use the improve feature instead, since it dedicated only to code suggestions, and usually gives better results.
Use the review tool if you want to get a more comprehensive feedback, which includes code suggestions as well.

Auto-labels

The review tool can auto-generate two specific types of labels for a PR:

  • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
  • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
Extra sub-tools

The review tool provides a collection of possible feedbacks about a PR.
It is recommended to review the possible options, and choose the ones relevant for your use case.
Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
require_score_review, require_soc2_review, enable_review_labels_effort, and more.

More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the review usage page for a comprehensive guide on using this tool.

@gshep gshep requested a review from breathx February 19, 2024 21:12
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

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

As it was said above: awesome

pallets/staking-rewards/src/migrations.rs Show resolved Hide resolved
@breathx
Copy link
Member

breathx commented Feb 26, 2024

@ekovalev still asking for review, please

@breathx breathx added the A2-mergeoncegreen PR is ready to merge after CI passes label Feb 26, 2024
Copy link
Member

@ekovalev ekovalev left a comment

Choose a reason for hiding this comment

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

Looks good enough to me. There is some space for optimization but it can be dealt with separately if becomes to much of a nuisance.

Conflicts:
	pallets/gear/src/lib.rs
	pallets/gear/src/pallet_tests.rs
	pallets/staking-rewards/src/tests.rs
	runtime/vara/src/migrations.rs
@gshep gshep removed the A0-pleasereview PR is ready to be reviewed by the team label Feb 27, 2024
@gshep gshep merged commit fd97f06 into master Feb 28, 2024
10 checks passed
@gshep gshep deleted the gshep/issue-3560 branch February 28, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A2-mergeoncegreen PR is ready to merge after CI passes C1-feature Feature request D2-node Gear Node
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different distribution of wait-lists rewards
5 participants