Repository navigation
[CRITICAL] referral_registry/src/lib.rs and tests.rs are empty on main — entire contract deleted by a bad merge #190
Description
Summary
referral_registry/src/lib.rs and referral_registry/src/tests.rs are both 0 bytes on main right now — confirmed via the GitHub API directly against the default branch, independent of any local checkout:
$ gh api repos/SPulse-Org/SPulse-Contract/contents/referral_registry/src/lib.rs?ref=main -q '.size, .name'
0
lib.rs
$ gh api repos/SPulse-Org/SPulse-Contract/contents/referral_registry/src/tests.rs?ref=main -q '.size, .name'
0
tests.rs
The entire referral-registry contract — referrer registration, welcome bonuses, lifetime-earnings caps, admin-withdrawable surplus, pause circuit breaker, TTL lifecycle — is gone. Any contract that depends on referral_registry (e.g. prediction_market's test suite, which imports referral_registry::ReferralRegistryContract) cannot build.
Root cause
Commit 670ed9b ("Merge branch 'main' into fix/issue-77", 2026-08-22 15:15:28 +0100) deleted all 704 lines of lib.rs:
$ git show 670ed9b --stat -- referral_registry/src/lib.rs
referral_registry/src/lib.rs | 704 -------------------------------------------
Both merge parents (947a306's descendant 28a3e95, and ef7e77b) had byte-for-byte identical, non-empty (689-line) content for this file — confirmed with a direct diff. There was no actual conflict on this file to resolve; the deletion was a pure mistake in how the merge was carried out (likely an ours/theirs/git rm misstep), not a judgment call between two diverging versions.
Why this isn't a simple git-revert
I attempted to restore the pre-deletion content (from 28a3e95/ef7e77b, 689 lines) as a fix. It doesn't compile either — the corruption predates the deletion:
require_not_pausedhas no closing brace and runs directly into an immediately-followingpub fn is_paused, with no separation.register_referralcontains two overlapping, half-duplicatedvec![...]blocks for the welcome-bonus cross-contract call — one callingadd_bonus_ptsviainvoke_contract, another callingqueue_bonus_rewardviatry_invoke_contract, tangled together.
Tracing further: the "pause / circuit breaker" feature was implemented independently in two separate efforts — issue #83 ("Add emergency pause/circuit-breaker to all four contracts") and issue #95 ("feat: add emergency pause / circuit breaker to market, registry and token") — and merged together badly, well before the later 670ed9b deletion compounded the damage.
What this needs
A real, careful manual reconciliation:
- Figure out the intended final behavior of the pause feature (likely: keep one clean
is_paused/require_not_pausedpair, drop the duplicate). - Figure out which welcome-bonus call path (
add_bonus_ptsdirect invoke vs.queue_bonus_rewardqueued) is the intended current design — they may both be legitimate at different points in history, only one should remain. - Once a clean, compiling version is reconstructed, restore it, verify
cargo test -p referral_registrypasses, then verifycargo test --workspace(which currently cannot even attempt to compile past this).
This is a bigger, riskier task than a merge repair — it's real contract-logic reconciliation in a contract that handles referrer earnings and token minting, and deserves focused review rather than being rushed alongside an unrelated PR. I ran into this while working on #24 (PR #185) and am flagging it separately rather than trying to fix it there.
Impact
Every contract depending on referral_registry is currently unbuildable in its test form. This blocks verifying prediction_market, and by extension any change that needs the full workspace test suite to pass.
Activity
francischika037-blip commentedon Aug 24, 2026
Pls i would like to fix this issue urgently
francischika037-blip commentedon Aug 24, 2026
Pls i would like to fix this issue urgently
grantfox-oss commentedon Aug 26, 2026
🦊 GrantFox — @francischika037-blip has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #190)Good luck! Track your progress on GrantFox.