Job registry and proposal scaling validation 392#664
Open
Stanley-Owoh wants to merge 15 commits into
Open
Conversation
… snapshots - Fix badge_level computation in score_from_profile to derive dynamically from score via BadgeLevel::from_score, rather than reading stale stored value - Fix BadgeTier clone in set_badge_metadata to avoid use-after-move - Fix RoleMetrics::new() initial badge_level to match default score (Bronze) - Regenerate all Soroban test snapshots for the updated contract logic All 25 tests passing.
…ity and consistency - Removed unnecessary whitespace and adjusted formatting in `lib.rs` and `profile.rs`. - Consolidated function signatures for better clarity. - Enhanced error handling in arithmetic operations. - Streamlined badge level assignment logic in the `refresh_badges` method. - Updated function calls to maintain consistent formatting across the codebase.
…utation-system-robustness-auditing-403
…ithub.com/Stanley-Owoh/lance into reputation-system-robustness-auditing-403
…lement-exponential-decay-model-for-reputation-scores-395
…-395' of https://github.com/Stanley-Owoh/lance into implement-exponential-decay-model-for-reputation-scores-395
- Created test snapshot for successful job posting without explicit initialization. - Created test snapshot for successful deliverable submission after job acceptance. - Updated ledger entries and event structures to reflect new job and deliverable states.
|
@Stanley-Owoh is attempting to deploy a commit to the mAzI's projects Team on Vercel. A member of the Team first needs to authorize it. |
soomtochukwu
requested changes
May 29, 2026
Contributor
soomtochukwu
left a comment
There was a problem hiding this comment.
- If you could fix the merge conflict(s) ASAP
- see that the CI checks pass
…-registry-and-proposal-scaling-validation-392
|
@Stanley-Owoh 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses bid modification race conditions in multi-threaded state within the
JobRegistrysmart contract. The implementation adds reentrancy guards, duplicate bid prevention, address-based bid acceptance (immune to index manipulation), structured error codes, CID validation, and map-like bid storage. All 57 tests pass and the WASM binary compiles to ~30KB.Changes
contracts/job_registry/src/lib.rsRace Condition Protections
require_not_reentrant()usingDataKey::Locked— prevents reentrant calls duringsubmit_bid,cancel_bid,accept_bid,close_job, andsubmit_deliverableaccept_bidtakes a freelancer address instead of a numeric index — immune to index-shifting race conditions from cancellationsStructured Error Codes
panic!("message")withpanic_with_error!and aJobRegistryErrorenum containing 16 distinct error codes:AlreadyInitialized(1),NotInitialized(2),InvalidJobId(3),InvalidBudget(4),InvalidHash(5)JobAlreadyExists(6),JobNotFound(7),JobNotOpen(8),Unauthorized(9)BidAlreadySubmitted(10),BidNotFound(11),InvalidStateTransition(12)JobExpired(13),Overflow(14),BidIndexOutOfBounds(15),ReentrancyDetected(16)CID Compression & Validation
hash_is_valid()enforces non-empty and bounded-length checks onmetadata_hash,proposal_hash, anddeliverable_hashMap-Like Bid Storage
DataKey::Bids(u64)→Vec<BidRecord>— clean key-value mapping from job ID to a dynamic vector of bidsStrict Ownership Validation
accept_bidrequirescaller == job.client— only the job creator can accept proposalsclose_jobandcancel_expired_jobenforce the same ownership checksubmit_deliverablecheckscaller == assigned freelancermark_disputedallows only the client or the assigned freelancerNew Functions
post_job_autocancel_bidsubmit_deliverablemark_disputedcancel_expired_jobexpires_atset_upgrade_admin/get_upgrade_adminupgradeget_bids_pageget_bid_atget_bids_countStorage Layout
Admin,Locked,UpgradeAdmin,NextJobIdJob(u64),Bids(u64)State Machine
Acceptance Criteria
Open → Assignedafter successful bid acceptanceTests Added/Updated
BidAlreadySubmitted)JobExpired)Closes #392