Skip to content

feat(job_registry): implement secure collateral lockup and bid deadli…#594

Merged
soomtochukwu merged 15 commits into
DXmakers:mainfrom
sweetesty:sc-reg-031-secure-collateral-lockup
May 28, 2026
Merged

feat(job_registry): implement secure collateral lockup and bid deadli…#594
soomtochukwu merged 15 commits into
DXmakers:mainfrom
sweetesty:sc-reg-031-secure-collateral-lockup

Conversation

@sweetesty
Copy link
Copy Markdown
Contributor

Closes #385


This PR implements Secure Collateral Lockup for Open-Brief Gigs inside contracts/job_registry/src/lib.rs as specified in SC-REG-031.

What was done:

  • Collateral lockup logic: Implemented escrow-style collateral locking on gig creation; funds are held in persistent contract storage and only released or forfeited upon job state resolution
  • Storage design: Used Soroban persistent storage with clean Job ID → bid structure mappings via map-like storage arrays; heavy text fields (descriptions, briefs) are compressed to IPFS CIDs before any on-chain write to keep the WASM footprint within standard block boundaries
  • Ownership validation: Enforced strict checks ensuring only the original job creator can review and accept proposals; unauthorized calls return a dedicated typed error code
  • State machine: Registry transitions cleanly through Open → Bidding → Assigned on bid acceptance; invalid or out-of-order transitions are rejected with specific error variants
  • Checked math: All arithmetic on collateral amounts uses Rust checked operations (checked_add, checked_sub) to prevent overflow/underflow
  • Error handling: Out-of-bounds inputs, late bid submissions, and missing or insufficient collateral are all caught and return typed error variants rather than panicking
  • Inline annotations: All state variables, entry points, and storage keys carry self-documenting comments per the project's architectural guidelines
  • Unit tests: Comprehensive cargo test suite covering the happy path, rejection flows, ownership violations, late bids, and edge-case collateral amounts

Acceptance criteria met:

  • ✅ Contract compiles and fits within Soroban WASM size limits
  • ✅ State transitions cleanly to Assigned on successful bid acceptance
  • ✅ Invalid inputs and late submissions are blocked and return specific error codes

@sweetesty sweetesty requested a review from soomtochukwu as a code owner May 27, 2026 16:46
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@sweetesty is attempting to deploy a commit to the mAzI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@sweetesty Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Copy link
Copy Markdown
Contributor

@soomtochukwu soomtochukwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could just fix the merge conflicts ASAP

@soomtochukwu soomtochukwu merged commit 9ba324c into DXmakers:main May 28, 2026
1 check failed
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.

[SC-REG-031] Job Registry and Proposal Scaling Validation - Step 31

2 participants