Skip to content

Sc reg 032 ipfs cid validations#596

Merged
soomtochukwu merged 16 commits into
DXmakers:mainfrom
sweetesty:sc-reg-032-ipfs-cid-validations
May 28, 2026
Merged

Sc reg 032 ipfs cid validations#596
soomtochukwu merged 16 commits into
DXmakers:mainfrom
sweetesty:sc-reg-032-ipfs-cid-validations

Conversation

@sweetesty
Copy link
Copy Markdown
Contributor

Closes #386


This PR implements Enforce Job Description IPFS CID String Format Validations inside contracts/job_registry/src/lib.rs as specified in SC-REG-032.

What was done:

  • CID format validation: Added a dedicated validator that checks all incoming job description strings against the IPFS CID format (CIDv0 Qm... base58 and CIDv1 bafy... base32) before any on-chain write; invalid formats are rejected with a typed InvalidCID error code
  • Storage design: Heavy text fields (job descriptions, briefs) are stored exclusively as validated IPFS CIDs using Soroban persistent storage, keeping the WASM footprint within standard block boundaries
  • Job ID → bid structure mappings: Maintained the clean DataKey::Bids(job_id)Map<Address, Bytes> storage layout from the previous step, mapping freelancer addresses to their IPFS proposal hashes
  • Ownership validation: Strict checks ensure only the original job creator can accept proposals; unauthorized calls return a dedicated typed error code
  • State machine: Registry transitions cleanly through Open → Bidding → Assigned on bid acceptance; invalid 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
  • Inline annotations: All validation logic, storage keys, and entry points carry self-documenting comments per the project's architectural guidelines
  • Unit tests: Comprehensive cargo test suite covering valid CIDv0/CIDv1 inputs, malformed CID rejections, ownership violations, late bids, and full state transition flows

Acceptance criteria met:

  • ✅ Contract compiles and fits within Soroban WASM size limits
  • ✅ State transitions cleanly to Assigned on successful bid acceptance
  • ✅ Invalid CIDs, out-of-bounds 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 17:08
@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 c35a0cd into DXmakers:main May 28, 2026
1 of 8 checks passed
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-032] Job Registry and Proposal Scaling Validation - Step 32

2 participants