8000 Upgrade Random by N-010 · Pull Request #1052 · qubic/core · GitHub
[go: up one dir, main page]

Skip to content

Upgrade Random - #1052

Open
N-010 wants to merge 3 commits into
qubic:developfrom
N-010:feature/upgrade-Random
Open

N-010 wants to merge 3 commits into
qubic:developfrom
N-010:feature/upgrade-Random

Conversation

@N-010
@N-010 N-010 commented Oct 22, 2026
Copy link
Copy Markdown
Contributor

Summary

Added epoch revenue distribution to RANDOM:

  • 50% to providers, proportional to their contributions recorded through contributedToEntropyFlags.
  • 50% to shareholders through distributeDividends.
  • 0% to burn, configurable through percentage constants.

Added:

  • Public FundReserve procedure to replenish the contract fee reserve through burning.
  • Public GetRevenueInfo function returning burnedAmount, revenueBurnedAmount, distributedAmount, and earnedAmount.
  • A PADDING state transition for the appended accounting fields.

Comment thread src/contracts/Random.h
Array<uint32, RANDOM_MAX_PROVIDERS> lastUpdateTick;

// Append-only state extension. Entries survive slot removal until epoch settlement.
HashMap<id, uint64, RANDOM_MAX_PROVIDERS> epochContributions;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure if this is intended, but is this hash map can be filled capacity easily with cheap QUs, and the honest ones can not become provider ?

Comment thread src/contracts/Random.h
constexpr uint32 RANDOM_STREAM_CAPACITY = 1365;
constexpr uint32 RANDOM_MAX_PROVIDERS = 4096;
constexpr uint64 RANDOM_PROVIDER_REWARD_PERCENT = 50;
constexpr uint64 RANDOM_SHAREHOLDER_REWARD_PERCENT = 50;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I remembered the fee is set as zeros in state file, so those number will not affect the reward (multiply to zero).

Comment thread src/contracts/Random.h
* @param output Amount burned, or -1 for a nonpositive amount or failed burn.
* @note Failed burns are refunded. Funding is excluded from dividend revenue.
*/
PUBLIC_PROCEDURE(FundReserve)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If a contract reserve is <=0. This functions can not be called because the SC is de-active.
May be you want to check BurnQubicForContract of QUtils, I think it work for both empty and non-empty case, when you want to fund the reserve.

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.

2 participants

0