Skip to content

contract: implement anti-frontrunning commit-reveal mechanism for competitive payroll bounty claims #212

Closed

Description

@Prudentdev-xyz

Problem

When competitive payroll bounties or task rewards are published on-chain, frontrunning bots monitoring the public Stellar mempool can observe valid proof submissions, extract the solution payload, and submit their own claim with a higher gas fee to steal the reward before the legitimate contributor's transaction confirms.

Task

Implement a cryptographic commit-reveal claim scheme in contracts/soroban/src/lib.rs:

  1. Commit Phase:
    • Contributor submits commitment hash: commit_bounty_claim(env, claimant: Address, bounty_id: u64, commitment_hash: BytesN<32>).
    • Store commitment with current ledger sequence: commitment_hash = SHA256(claimant || proof || secret_salt).
  2. Challenge Delay Window:
    • Enforce a minimum delay of 5 ledgers (~25 seconds) before the reveal phase opens to prevent same-block mempool copying.
  3. Reveal Phase:
    • Contributor submits reveal_bounty_claim(env, claimant, bounty_id, proof, secret_salt).
    • Contract verifies preimage matches stored commitment, validates bounty solution, and dispatches token payout to claimant.

Acceptance criteria

  • Two-phase commit-reveal process prevents mempool copy-paste frontrunning
  • Reveal submissions before challenge delay window are rejected
  • Invalid preimages or mismatched claimant addresses panic
  • Unit tests in contracts/soroban/src/test.rs test full commit-reveal workflow, early reveal rejection, and tampered preimage attacks
  • cargo test passes cleanly

Getting started

See CONTRIBUTING.md for setup. Run cd contracts/soroban && cargo test.

Activity

  1. added
    enhancementNew feature or request
    difficulty: hardDesign work or cross-cutting change
    securityAffects funds, keys or access control
    Stellar WaveIssues in the Stellar wave program
    complexity: highHigh complexity task (200 points)
    on Oct 19, 2026
  2. liutingqiu commented on Oct 19, 2026

    @liutingqiu

    @liutingqiu has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I will implement the commit-reveal scheme in contracts/soroban/src/lib.rs by adding commit_bounty_claim and reveal_bounty_claim entrypoints, a Commitment storage key keyed by claimant and bounty_id, and a ledger-sequence gate that rejects reveals before the stored commit ledger plus five. The commitment will be SHA256 over claimant, proof, and secret_salt, and reveal will verify the preimage, validate the bounty solution, then dispatch the token payout to the claimant. In contracts/soroban/src/test.rs I will add test_commit_reveal_full_workflow, test_reveal_before_challenge_delay_rejected, and test_reveal_with_tampered_preimage_panics, plus a mismatched-claimant negative case, then run cd contracts/soroban && cargo test until it passes cleanly. My background includes merged PRs in drydocs/meridian (#1175, #1176) and 65 merged PRs in Sottara-Labs/sottara, so Soroban storage and test patterns are familiar. ETA is same or next day.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @liutingqiu to this issue.

  3. yodakkak commented on Oct 19, 2026

    @yodakkak

    @yodakkak has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    I inspected contracts/soroban/src/lib.rs and contracts/soroban/src/test.rs. I will implement commit_bounty_claim(env, claimant, bounty_id, commitment_hash) storing DataKey::BountyCommitment(bounty_id, claimant) with the current ledger sequence, enforce a 5-ledger challenge delay window in reveal_bounty_claim(env, claimant, bounty_id, proof, secret_salt), verify env.crypto().sha256(...) over claimant || proof || secret_salt matches the stored commitment before payout, and add unit tests covering full commit-reveal, early reveal rejection, and preimage/claimant tampering.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @yodakkak to this issue.

  4. markankamaransheogarat-sys commented on Oct 19, 2026

    @markankamaransheogarat-sys

    Implemented the cryptographic commit-reveal anti-frontrunning mechanism and submitted in PR #214 with full 134/134 green unit test coverage and architectural threat model documentation.

  5. Aabidah-06 commented on Oct 19, 2026

    @Aabidah-06
    Contributor

    @Aabidah-06 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    GM Gm Maintainer. Please, i will like to work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Aabidah-06 to this issue.

  6. drips-wave commented on Oct 19, 2026

    @drips-wave

    Congratulations, @Aabidah-06! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @Aabidah-06: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  7. drips-wave commented on Oct 19, 2026

    @drips-wave

    This issue has been completed by @Aabidah-06 as part of the Stellar Wave Program's 10th Wave 🥳

    😎 @Aabidah-06: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  8. markankamaransheogarat-sys commented on Oct 20, 2026

    @markankamaransheogarat-sys

    Notice to maintainers @Prudentdev-xyz, @Abdqoharr and @drips-wave:

    The implementation of this issue merged via PR #218 was authored and submitted hours earlier by @markankamaransheogarat-sys in PR #214. Please review the formal attribution dispute and cryptographic git audit trail here:
    #218 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programarea: contractSoroban smart contractcomplexity: highHigh complexity task (200 points)difficulty: hardDesign work or cross-cutting changeenhancementNew feature or requestsecurityAffects funds, keys or access control

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions