Coder Social home page Coder Social logo

cardano-foundation / cf-java-rewards-calculation Goto Github PK

View Code? Open in Web Editor NEW
18.0 13.0 1.0 4.75 MB

This java project is used to calculate the rewards of the Cardano blockchain. It aims to be both an edge case documentation and formula implementation.

License: MIT License

Java 93.81% JavaScript 4.06% HTML 2.13%
calculation cardano java pool reserve rewards treasury

cf-java-rewards-calculation's People

Contributors

cleanerm5 avatar fabianbormann avatar github-actions[bot] avatar nemo83 avatar satran004 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

satran004

cf-java-rewards-calculation's Issues

[๐Ÿš€ Feature]: Make the calculation accessible via maven central

๐Ÿš€ The feature and your motivation

Currently it is not possible to use this repository within other java-based projects like yaci-store or ledger-sync.

To overcome this situation, the rewards calculation part should be put on maven central allowing other java-based projects to reuse the calculation methods. We need to make sure not to include all the codebase, as this could bring unnecessary overhead to those projects.

Alternatives

Providing an API would also allow other projects to make use of the rewards calculation, but they would need to run the project somewhere aside to their application, which is maybe not wanted. We should anyways wrap this service in an api.

Additional context

No response

[๐Ÿš€ Feature]: Add reserves pot calculation

๐Ÿš€ The feature and your motivation

The reserves pot calculation is currently still missing and needs to be implemented for all epochs, to implement eventually all ada pots calculations.

Alternatives

No response

Additional context

No response

[๐Ÿž Bug]: UTXO pot calculation is sometimes 4 Lovelace off

Is there an existing issue for this?

  • I have searched the existing issues

Current (incorrect ๐Ÿ™ˆ) Behavior

For some epochs the UTXO pot calculation is 4 or -4 Lovelace off.
image

For the other epochs the formula utxoPot = utxoFromPreviousEpochPot - deposits - fees + withdrawals; seems to work pretty well.

With the other pot calculations we already prove that deposits and fee are aligned with their adapots table. So the issue must most probably come from the withdrawals table or some rule from the protocol that hasn't been implemented yet.

Expected Behavior (what you should have seen ๐ŸŽ‰)

No response

Steps To Reproduce

  1. Run the UTXO test in the tests folder

Environment

- OS:all
- Java JDK: all

Anything else?

No response

[๐Ÿ‘ท Task]: Add a report for the utxo, fees and deposits pot as well

Is there an existing issue for this?

  • I have searched the existing issues

Task description ๐Ÿ”จ๐Ÿ”ง

Currently we only provide a report for the treasury calculation, but with finishing the utxo, deposits and fees pot calculation, we should also provide a report for them as well.

Anything else?

No response

[๐Ÿ‘ท Task]: Move the test data to an S3 bucket and remove it from the actual repository

Is there an existing issue for this?

  • I have searched the existing issues

Task description ๐Ÿ”จ๐Ÿ”ง

Even if the data used by the JSON data provider is aggregated and less than the data in DB Sync, it is growing and growing over time. It makes sense to remove this test data from the repository.

  • Move the test data to an S3 bucket
  • Provide a how to fetch the data
  • Include the data folder in the .gitignore
  • Remove those folders from the git history as well to reduce the disk size of this project
  • Change the report generation and test pipeline to fetch the data on-the-fly from the bucket

Anything else?

No response

[๐Ÿš€ Feature]: Provide information about the actual percentage of the total rewards pot going into the treasury per epoch

๐Ÿš€ The feature and your motivation

With the current report, we provide the information about the calculated and the actual treasury value. Another interesting measure would be including the actual treasury cut 0.2 * totalRewardsPot and the amount of Lovelace being added on top of this value due to ledger rules such as PoolReap etc.

Alternatives

No response

Additional context

No response

[๐Ÿž Bug]: The treasury calculation output is different from the actual treasury value starting at epoch 350 (close before Babbage era)

Is there an existing issue for this?

  • I have searched the existing issues

Current (incorrect ๐Ÿ™ˆ) Behavior

With the beginning of epoch 215, it seems that more ADA has been added to the treasury than calculated by the current treasury calculation. It probably comes from the fact, that (from the spec) remainders from the rewards pot should go into the treasury as well as member rewards going to unregistered stake accounts.

Expected Behavior (what you should have seen ๐ŸŽ‰)

0 Lovelace difference between calculation and the actual treasury value provided by the ada_pots table from dbsync.

Steps To Reproduce

  1. Run the TreasuryCalculationTest in the test folder with a range from 208-460 (epochs)

Environment

- OS: any
- Java JDK: any

Anything else?

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.