A failed asynchronous randomness callback must not leave the lottery unable to start another draw.
The answer in 30 seconds
Golden Grid directly engaged Zealynx to audit a Solidity pixel-lottery protocol on ApeChain. Each draw used two transactions: draw() committed isPending = true and requested randomness, while a later VRF callback completed the draw and cleared the flag. The reviewed implementation had no recovery path if that callback reverted, so one failed callback could leave every later draw reverting with DrawRequestPending().[1][2]
Zealynx reviewed the draw as a cross-transaction liveness invariant, not just a randomness request. The report traced a failed callback while the earlier request remained committed and recommended an owner-only reset after a reasonable timeout. Golden Grid confirmed the remediation, and Zealynx recorded the Critical finding as fixed.[1]
This is a direct Zealynx technical engagement narrative based on public provider-authored evidence, not a customer transformation story. It does not claim that the failure occurred in production, that funds were lost or protected, that remediation was deployed, or that later versions remain secure.
The buyer decision: can the lottery recover after callback failure?
The reviewed protocol sold positions in a 98,280-pixel grid and used VRF randomness plus pixel-to-bitmap conversion to determine overlap with player-owned pixels. The public report identifies three in-scope Solidity files, approximately 770 normalized lines, and commit dae05f0a1746d81bf3bc97b461af40310aa03ca3.[1][2]
For a lottery founder or smart contract lead, the release question is: if the asynchronous completion transaction fails, what bounded on-chain action returns the protocol to a usable state without allowing an early or arbitrary reset?
The invariant was:
A failed asynchronous randomness callback must not leave the lottery unable to start another draw.
The dangerous assumption: a requested callback will finish
The vulnerable flow treated a successful randomness request as if it guaranteed successful settlement. But the request and callback were separate transactions with separate failure outcomes.[1]
The report documented this sequence:
draw()setscurrentDrawRequest.isPending = trueand requests randomness;- the first transaction commits;
- the VRF system calls
randomNumberCallback(); - the callback reverts—for example, because an external transfer fails;
- callback atomicity rolls back only the callback transaction;
isPendingremains true from the committed request;- every later
draw()reverts, and no function can clear the stuck request.[1]
The dangerous assumption was not that VRF randomness was predictable. It was that asynchronous delivery and all callback-side work formed one guaranteed state transition.
How Zealynx tested the draw-liveness invariant
1. Split the flow at the transaction boundary
The review modeled draw() and randomNumberCallback() as separate transactions. That exposed the intermediate state—request committed, settlement incomplete—that a single-transaction test would miss.[1]
2. Enumerate callback failure points
The report considered an external transfer revert, callback gas exhaustion, the VRF system becoming unavailable, and an external interface change. Each path had the same security consequence if the callback reverted before clearing the pending state.[1]
3. Trace the persistent lock into the next user action
Zealynx did not stop at “the callback can fail.” The review followed the stale isPending flag into the next draw() and showed that the guard rejected all future attempts with DrawRequestPending().[1]
4. Add a delayed, privileged recovery path
The recommendation was an owner-only emergency reset available only after a reasonable timeout. That design separates ordinary callback completion from exceptional recovery and avoids allowing an immediate reset while a valid request is still in flight.[1]
The pivotal mechanism: atomic callbacks do not undo earlier requests
The liveness failure came from a common asynchronous-state misconception:
Transaction 1: request randomness + set pending = true ✓ committed
Transaction 2: consume randomness + clear pending ✗ reverted
Persistent state: pending remains true
Next draw: rejected
Transaction atomicity protected the callback from partial execution, but it could not roll back the already-finalized request transaction. Without an explicit timeout or cancellation transition, the state machine had no route from “pending but failed” back to “ready.”[1]
The reusable lesson is that every asynchronous workflow needs a terminal failure transition. Success and retry paths are not enough when a stale in-flight marker blocks all future work.
Before, intervention, and report-recorded after-state
| Before the review | Zealynx intervention | After-state recorded in the report |
|---|---|---|
draw() committed isPending = true before callback execution | Separated request and callback into independent failure domains | C-01 is recorded as fixed |
| A reverted callback left the pending flag locked | Traced the stale flag into every later draw() | Golden Grid confirmed the remediation |
| No function could recover a stuck request | Recommended a privileged reset after a reasonable timeout | The report records the timeout-bound emergency reset as the remedy |
“Fixed” is a provider-authored status limited to the remediation record in the November 2025 report. The public evidence does not identify a final remediation commit, expose the resulting implementation for independent inspection, or establish production deployment.[1]
A reusable asynchronous callback review
Before releasing a VRF, oracle, bridge, automation, or cross-chain callback flow:
- Draw the state machine: include requested, fulfilled, failed, expired, cancelled, and recovered states.
- Mark transaction boundaries: identify which state persists before an external system responds.
- Force callback failure: test reverts from transfers, hooks, downstream calls, gas pressure, and malformed responses.
- Retry the initiating action: prove a stale in-flight marker cannot block the protocol indefinitely.
- Define a timeout: base recovery eligibility on an explicit, reviewable delay.
- Constrain reset authority: specify who can reset, which request can be reset, and what evidence the action emits.
- Prevent stale fulfillment: decide what happens if the original callback arrives after timeout recovery.
- Separate settlement from optional effects: keep nonessential external calls from deciding whether core state can progress.
Impact and evidence limits
The strongest supported outcome is control-specific: the report records a Critical liveness defect in which a reverted callback could leave the lottery unable to start future draws, and it records the timeout-bound emergency-reset remediation as fixed.[1]
The wider review reported ten findings: one Critical, three High, one Medium, four Low, and one Informational. The public audit record reports nine fixed and one acknowledged, while the report's summary table marks the listed findings fixed.[1][2] This narrative relies on the finding-specific C-01 status and does not turn aggregate remediation into a guarantee about the complete protocol.
No public source establishes that a callback failed in production, that user assets became inaccessible, that the reviewed contracts were deployed, or that a dated amount of value was exposed. The report's impact analysis describes the technical consequence of the modeled path; this narrative makes no claim about realized loss, funds protected, avoided loss, customer sentiment, or business impact.[1]
Evidence and attribution
- Canonical technical record: the public Zealynx report identifies Golden Grid, Zealynx's audit role, the reviewed commit and scope, the two-transaction draw flow, the callback failure sequence, the missing recovery transition, the timeout-reset recommendation, and the recorded fix.[1]
- Public audit record: Zealynx's engagement page reports the three-file Solidity scope, audit team, finding distribution, and aggregate remediation state.[2]
- Attribution class: direct Zealynx engagement. The report identifies Zealynx as the audit provider and contains no partner-delivery attribution.[1]
- Evidence cutoff: the public report dated November 17, 2025 and the corresponding audit record.
- Limitations: provider-authored evidence supports technical scope and recorded remediation, but not deployment, exploitation, customer sentiment, monetary impact, or later-code assurance.
Shipping a callback-dependent protocol?
Zealynx can map asynchronous state transitions, force failure between transactions, test timeout and cancellation controls, and verify that external systems cannot permanently halt core operations. Explore smart contract security audits, review the security methodology, or request a callback-liveness review.
Frequently asked questions
Was the VRF randomness itself broken?
The pivotal C-01 issue was not predictable randomness. It was liveness: a callback failure could leave the already-committed pending flag set and block every later draw.[1]
Why did callback atomicity not restore the lottery?
Atomicity reverted the failed callback transaction. It did not revert the earlier draw() transaction that had already stored isPending = true.[1]
What could make the callback fail?
The report lists an external transfer revert, gas exhaustion, VRF unavailability, and an external interface change as possible callback failure conditions.[1]
How was the issue remediated?
The report recommended an owner-only emergency reset after a reasonable timeout. Golden Grid confirmed the change and Zealynx recorded C-01 as fixed.[1]
Does an owner reset create a new trust boundary?
Yes. A recovery function trades permanent deadlock risk for privileged recovery authority. Teams should constrain the timeout, request identity, permitted state transition, and emitted evidence, then test late callback arrival.
Does the report prove that the fix was deployed?
No. The report records the finding as fixed, but the public evidence does not identify a remediation commit or independently verify production deployment.[1]
Sources
[1] https://raw.githubusercontent.com/ZealynxSecurity/audits/main/web3/2025-10-zealynx-golden-grid.pdf — Golden Grid Smart Contract Audit [2] https://zealynx.io/audits/golden-grid/pixel-lottery-q4-2025 — Golden Grid Pixel Lottery audit record