Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

target/
target/
issue.md
pr.md
11 changes: 5 additions & 6 deletions contracts/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,27 @@ pub fn cancel_session_by_expert(
session_id: u64,
reason_cid: String,
) -> Result<(i128, i128), Error> {
SkillSphereContract::assert_not_locked(env)?;
SkillSphereContract::set_reentrancy_lock(env, true);
crate::security::ReentrancyGuard::non_reentrant(env)?;

expert.require_auth();

if !SkillSphereContract::is_valid_ipfs_cid(&reason_cid) {
SkillSphereContract::set_reentrancy_lock(env, false);
crate::security::ReentrancyGuard::clear(env);
return Err(Error::InvalidCid);
}

let mut session = SkillSphereContract::get_session_or_error(env, session_id)?;

if expert != session.expert {
SkillSphereContract::set_reentrancy_lock(env, false);
crate::security::ReentrancyGuard::clear(env);
return Err(Error::Unauthorized);
}

if !matches!(
session.status,
SessionStatus::Active | SessionStatus::Paused
) {
SkillSphereContract::set_reentrancy_lock(env, false);
crate::security::ReentrancyGuard::clear(env);
return Err(Error::InvalidSessionState);
}

Expand Down Expand Up @@ -151,6 +150,6 @@ pub fn cancel_session_by_expert(
(expert, expert_payout, seeker_refund, reason_cid),
);

SkillSphereContract::set_reentrancy_lock(env, false);
crate::security::ReentrancyGuard::clear(env);
Ok((expert_payout, seeker_refund))
}
8 changes: 5 additions & 3 deletions contracts/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ pub enum Error {
InvalidSplitBps = 17,
DisputeWindowActive = 18,
InvalidFeeConfig = 19,
InsuffTreasuryBal = 20,
InsufficientTreasuryBalance = 20,
AmountBelowMinimum = 21,
ExpertNotRegistered = 22,
ExpertUnavailable = 23,
InvalidReferrer = 24,
Reentrancy = 25,
ReentrantCall = 25,
DepositTooLow = 26,
AlreadyInitialized = 27,
InvalidRating = 28,
Expand Down Expand Up @@ -84,6 +84,8 @@ pub enum Error {
// #277 - Reputation decay / #278 - Session quality score (shared)
InvalidDimensionRating = 65,

// #275 - Idle escrow yield
YieldPoolNotSet = 66,
InsufficientAntiSpamDeposit = 67,
CircuitBreakerActive = 68,
SessionNotExpired = 69,
}
2 changes: 1 addition & 1 deletion contracts/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl IdentityContract {
///
/// # Storage keys touched (in the main contract's persistent storage)
/// * `DataKey::ExpertProfile(address)` — `metadata_cid` field
/// * `DataKey::Session(id)` — `metadata_cid` and `encrypted_notes_hash` for
/// * `DataKey::Session(id)` — `metadata_cid` and `encrypted_notes_cid` for
/// every completed/resolved session where `seeker == address || expert == address`
///
/// Because this module does not have direct access to the main contract's
Expand Down
Loading