@rolly-dev/witness-core 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -124,6 +124,11 @@ export interface ProcessTxRequest {
124
124
  gameMode?: number
125
125
  predictionLo?: number
126
126
  predictionHi?: number
127
+ /**
128
+ * Blackjack only: base stake (decimal string). The engine replays the round
129
+ * from this to derive the TOTAL staked (recorded as `amount`) and the win.
130
+ */
131
+ baseBet?: string
127
132
  userSecretRandom?: Buffer
128
133
  useGameLock?: boolean
129
134
  maxBlockTimestamp?: string
@@ -233,6 +238,21 @@ export declare class MerkleEngine {
233
238
  * marked dirty — the loaded value already matches the store.
234
239
  */
235
240
  loadServerSeed(userId: number, seed: Buffer): void
241
+ /**
242
+ * Recovery-only: enqueue the next server seeds `next_server_seed` returns
243
+ * (FIFO) instead of drawing from the CSPRNG. Lets the offline block
244
+ * reconstruction tool deterministically replay already-committed blocks
245
+ * from their recorded next-seed chain. No effect on normal operation — the
246
+ * queue is empty unless this is called. Each buffer is 64 LE bytes (8 limbs).
247
+ */
248
+ forceNextSeeds(seeds: Array<Buffer>): void
249
+ /**
250
+ * Recovery-only: recompute one user's leaf hash from its loaded raw balance
251
+ * leaf + pk / address hashes. Call after overwriting those via the `load_*`
252
+ * setters to an earlier state, then `rebuild_nodes_from_leaves`, to roll a
253
+ * touched leaf back without re-running its txs.
254
+ */
255
+ recomputeLeaf(userId: number): void
236
256
  /**
237
257
  * Adopt the persisted block-meta root after the full tree is loaded. The
238
258
  * loaded leaves/nodes must reproduce it — verify with [`Self::verify_root`].
@@ -257,6 +277,17 @@ export declare class MerkleEngine {
257
277
  /** Spendable balance minus all frozen buckets (withdrawal + game locks). */
258
278
  getAvailable(userId: number): bigint
259
279
  getSeedHash(userId: number): Buffer
280
+ /**
281
+ * Read-only reveal of the user's current committed full server seed (64 LE
282
+ * bytes = 8 limbs). The blackjack backend needs it at DEAL time to unfold
283
+ * the fair shoe and run the round off-chain before the single settle
284
+ * `in_house_bet`. This does NOT advance the seed chain: it returns the seed
285
+ * already committed by the previous slot's `next_seed_hash`, and the
286
+ * eventual blackjack settle IHB is the next tx to consume / rotate it (so
287
+ * the backend MUST keep the round the next IHB for this user). Returns an
288
+ * all-zero 64-byte buffer when the user has no initialized seed yet.
289
+ */
290
+ getServerSeed(userId: number): Buffer
260
291
  getPkHash(userId: number): Buffer
261
292
  getAddressHash(userId: number): Buffer
262
293
  getLockedTotal(userId: number): bigint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolly-dev/witness-core",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Authoritative native witness-state engine for Rolly ZK-Rollup (Node-API addon)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
Binary file
Binary file