Skip to content

Feature/random sc#891

Open
double-k-3033 wants to merge 5 commits into
qubic:developfrom
double-k-3033:feature/randomSC
Open

Feature/random sc#891
double-k-3033 wants to merge 5 commits into
qubic:developfrom
double-k-3033:feature/randomSC

Conversation

@double-k-3033
Copy link
Copy Markdown
Contributor

No description provided.

double-k-3033 and others added 5 commits May 19, 2026 15:56
- BuyEntropy: add missing else branch so invalid inputs (bad tier,
  zero/oversize bits, underpaid fee) refund the full invocation reward
  instead of silently keeping it.
- END_TICK: move reveals.set(..., zeroReveal) out of the
  a no-show aren't permanently locked out.
Change BuyEntropy_output.entropy from Array<bit_4096,32> to a single
bit_4096, copy the first numberOfBits bits, and refund any payment
beyond numberOfBits*100 instead of silently keeping it.

Co-Authored-By: N-010 <N-010@users.noreply.github.com>
Rework the collateral lifecycle so a provider's stake stays locked
from commit until they reveal:
- refund the stake on a valid reveal, slash (burn) it on a no-show
- reject an empty commit before any state change to avoid double refund
- stop paying silent providers from the treasury at END_TICK

Adds lockedCollateralAmounts and revealedThisTickFlags state, and
gtests covering the collateral lifecycle.
@zuaaef
Copy link
Copy Markdown

zuaaef commented May 21, 2026

RANDOM state grew, but padding is not enabled.
This PR appends lockedCollateralAmounts and revealedThisTickFlags to RANDOM::StateData in Random.h, increasing the persisted contract state size. Runtime loading rejects undersized contract files unless the contract is listed in paddableContracts; that list is still empty in contract_def.h, and the loader fails when loadedSize != stateSize in qubic.cpp.
Result: upgraded nodes can fail to load the existing contract0003 RANDOM state file after merge/epoch transition. This is a merge blocker unless RANDOM_CONTRACT_INDEX is explicitly added to the padding list for the deployment epoch.

@double-k-3033
Copy link
Copy Markdown
Contributor Author

RANDOM state grew, but padding is not enabled. This PR appends lockedCollateralAmounts and revealedThisTickFlags to RANDOM::StateData in Random.h, increasing the persisted contract state size. Runtime loading rejects undersized contract files unless the contract is listed in paddableContracts; that list is still empty in contract_def.h, and the loader fails when loadedSize != stateSize in qubic.cpp. Result: upgraded nodes can fail to load the existing contract0003 RANDOM state file after merge/epoch transition. This is a merge blocker unless RANDOM_CONTRACT_INDEX is explicitly added to the padding list for the deployment epoch.

I will ignore your concerns as they are unnecessary. Anyway, Thx for your reply

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