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

compute node reward based on scheduler time #709

Conversation

tenmoves
Copy link
Contributor

@tenmoves tenmoves commented Nov 23, 2022

Description

Actually the node_reward transaction is sent based on a configurable interval. n production this interval is set to 1 transaction per day.
In the reward calculation we get the number of days of the current month and divide 50 by this number. This fit well for production configuration but if the node_reward transaction are sent in a different interval than once a day, the reward calculation is not accurate.

We should divide the monthly reward amount (currently 50$) by the number of interval in the current month

Note:

I saw that sometimes it can take a little bit of time to compute, so I decided to do he computation in compile time to not slow down the execution.

Fixes #693

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

The function that will provide the number of occurrences per month was tested with doctests, the reward function in itself is already tested I don't think we should test the calculus in itself but more the behaviour (which is already the case).

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@tenmoves tenmoves added bug Something isn't working rewards labels Nov 23, 2022
@tenmoves tenmoves self-assigned this Nov 23, 2022
@samuelmanzanera samuelmanzanera added the core team Assigned to the core team label Nov 28, 2022
@Neylix Neylix merged commit dbe7c59 into archethic-foundation:develop Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core team Assigned to the core team rewards
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calcul node reward based on scheduler time
3 participants