Skip to content

feat: Privacy-Preserving AI Bounty Judge — Commit-Reveal with Ritual LLM Precompile - #1

Open
Babasss-hub wants to merge 3 commits into
cozfuttu:mainfrom
Babasss-hub:main
Open

feat: Privacy-Preserving AI Bounty Judge — Commit-Reveal with Ritual LLM Precompile#1
Babasss-hub wants to merge 3 commits into
cozfuttu:mainfrom
Babasss-hub:main

Conversation

@Babasss-hub

@Babasss-hub Babasss-hub commented Jun 24, 2026

Copy link
Copy Markdown

🔐 Privacy-Preserving AI Bounty Judge

Commit-reveal pattern smart contract for hidden bounty submissions with AI judging via Ritual Chain LLM precompile.

What's included:

  • PrivacyBounty.sol — Full commit-reveal flow with:
    • Sealed bounty submissions (hashed proposals)
    • Reveal phase with hash verification
    • AI judging via Ritual LLM precompile
    • Privacy-preserving: submissions hidden until reveal phase
  • PrivacyBounty.t.sol — 10/10 Foundry tests passing
  • ARCHITECTURE.md — System design documentation
  • REFLECTION.md — Design reflections
  • DEPLOYMENT.md — Ritual Chain testnet deployment info

Deployed to Ritual Chain Testnet:

  • Contract: 0xe15195d08763076f3FE74884507A559C1b4d23f8
  • Deployer: 0xb31bc7f5c2e1C11308237EB325248336a9cf4617
  • Chain ID: 1979
  • Tx Hash: 0xc464e6bc267a4606cf30527f5bfb386b10590abc03770820db31fa5ed27ab870

Design:

The contract implements a two-phase commit-reveal pattern:

  1. Commit Phase: Users submit SHA-256 hashes of their bounty proposals
  2. Reveal Phase: Users reveal their actual proposals, hash is verified
  3. Judging Phase: AI judge evaluates proposals using Ritual LLM precompile

This ensures fair judging — proposals are hidden until all submissions are in, preventing copycat submissions.


Built for the Ritual Chain Workshop

Babasss-hub added 3 commits June 24, 2026 19:58
- PrivacyBounty.sol: commit-reveal pattern with Ritual LLM precompile 0x0802
- PrivacyBounty.t.sol: 10/10 Foundry tests passing
- ARCHITECTURE.md: system design documentation
- REFLECTION.md: design reflections
- DEPLOYMENT.md: Ritual Chain testnet deployment info

Deployed to Ritual Chain Testnet:
- Contract: 0xFede5f85E239F8e2FB5f4cd55d8Eff905F42109C
- Deployer: 0x8f8E6a010e8A8eB76be350FDF2bB8A3CEDa42De8
- Chain ID: 1979
Aphelios01-sdk added a commit to Aphelios01-sdk/ritual-chain-workshop that referenced this pull request Jun 26, 2026
…proof + doc polish

- Removed unused IRitualWallet interface and LLM_INFERENCE_PRECOMPILE constant
  (dead code — judgeAll uses configurable LLM_PRECOMPILE immutable).
- Added MAX_ANSWER_LENGTH edge case to honesty notes (checked at reveal only;
  self-correcting with v3 refund).
- Updated honesty notes: dropped obsolete cozfuttu#1 (dead constant) and cozfuttu#2 (wallet).
- Root README: clarified workshop vs homework structure with verified
  contract addresses + deploy notes.
- Flow status table: replaced v2 proof references with live v3 proof
  (bounty 1, two participants, 5 tx hashes on 0x97e19070...).
- .deploy-info.txt: added commit-reveal live proof entries (v3, bounty 1).
- 52/52 tests passing.
Aphelios01-sdk added a commit to Aphelios01-sdk/ritual-chain-workshop that referenced this pull request Jun 27, 2026
CRITICAL cozfuttu#1: judgeAll now decodes the LLM precompile envelope and reverts
atomically on hasError — judged stays false so the owner can retry once the
LLM recovers (no permanent lock, no reset mechanism needed). Decode is guarded
for empty payloads to preserve Ritual async-delivery compatibility.
- Added ConvoHistory struct + 5-tuple decode.
- MockLLMPrecompile: setShouldError toggle (returns hasError envelope).
- testRevertJudgeAllOnLLMError: asserts revert + judged==false + successful retry.
- Renamed 2 mislabeled invariant_ functions to test* (they were single-flow).
- 79/79 tests passing.

NOTE on reviewer's cozfuttu#2 (force winnerIndex == AI verdict): intentionally NOT
applied — the assignment explicitly forbids auto-paying from AI output and
requires human-in-the-loop. answersHash/inputHash already make the judging
auditable; the owner veto is by-design.
Trevor00s added a commit to Trevor00s/ritual-chain-workshop that referenced this pull request Jun 28, 2026
- live bounty cozfuttu#1: createBounty + submitSealed (ECIES ciphertext, no plaintext) + escrow-funded judgeAll + finalize, all confirmed on-chain

- judgeAll returned a real GLM-4.7-FP8 verdict {"winnerIndex":0,"summary":"ok"} via executor 0xB42e...c91B (tx 0x336bc233...)

- scripts/live-sealed-demo.mjs + judge-now.mjs + diag.mjs; ADVANCED.md records the live tx hashes + honest scope (inline judge path used for the verdict)
stevan-99 pushed a commit to stevan-99/ritual-chain-workshop that referenced this pull request Jul 1, 2026
…uttu#7 — commit-reveal + parseBounty + Disputable bounty + privacy-preserving
HadesDev99 pushed a commit to HadesDev99/ritual-chain-workshop that referenced this pull request Jul 5, 2026
reclaimReward sets bounty.finalized but never touches winnerIndex, which
stays at its uint256-max sentinel from createBounty. BountyView only checked
bounty.finalized before rendering SettledBanner, so a reclaimed bounty (nobody
revealed) showed "Settled - winner paid" with "Entry cozfuttu#1.157...e+77" -- a
nonsensical winner for a bounty nobody won. Branch on revealedCount to show a
distinct ReclaimedBanner instead, once that count has actually loaded (so we
don't guess "won" while it's still pending).

Separately, both finalizeWinner and reclaimReward zero bounty.reward on-chain
before paying out, so any refetch after either action always reads back 0 --
the Payout/Refunded amount was silently wrong for every settled bounty.
finalizeWinner emits WinnerFinalized with the real amount, so parse that from
the confirming tx's receipt; reclaimReward emits nothing, so capture the
pre-tx bounty.reward snapshot before submitting instead. Both are session-
local: a fresh page load of an already-settled bounty still has no way to
recover the historical amount.

Verified against real on-chain data: a real finalized bounty now shows
"Entry #0" (not garbage), and a real reclaimed bounty shows "Settled -
reclaimed, nobody revealed" instead of a fake winner banner.

Also fixes the same masthead border/heading-size overflow issue described in
the next commit, since it lives in this file.
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.

1 participant