Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
86 changes: 86 additions & 0 deletions LINTING_FIXES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Linting Fixes Applied

## Issues Found in CI

### Error (1)
**File**: `apps/backend/src/modules/escrow/services/escrow.service.ts`
**Line**: 297
**Issue**: Unsafe argument of type error typed assigned to a parameter of type `EscrowEventType`
**Error Code**: `@typescript-eslint/no-unsafe-argument`

**Root Cause**: Missing closing parenthesis in `logEvent()` method call

**Fix Applied**:
```typescript
// Before (missing closing parenthesis)
await this.logEvent(
id,
EscrowEventType.EXPIRED,
userId,
{
reason: dto.reason || 'Deadline exceeded',
previousStatus: escrow.status,
expiresAt: escrow.expiresAt,
expiredAt: now,
},
ipAddress,

// After (added closing parenthesis)
await this.logEvent(
id,
EscrowEventType.EXPIRED,
userId,
{
reason: dto.reason || 'Deadline exceeded',
previousStatus: escrow.status,
expiresAt: escrow.expiresAt,
expiredAt: now,
},
ipAddress,
);
```

### Warnings (5)
**File**: `apps/backend/src/modules/escrow/services/escrow.service.spec.ts`
**Lines**: 397, 421, 509, 539, 566
**Issue**: Unsafe argument of type `any` assigned to a parameter of type `UpdateResult | Promise<UpdateResult>`
**Error Code**: `@typescript-eslint/no-unsafe-argument`

**Root Cause**: Using `as any` type casting for UpdateResult mocks

**Fix Applied**:
```typescript
// Before
escrowRepository.update.mockResolvedValue({ affected: 1 } as any);

// After
escrowRepository.update.mockResolvedValue({ affected: 1 } as UpdateResult);
```

**Locations Fixed**:
1. Line 393 - `fileDispute` test
2. Line 419 - `fileDispute` by seller test
3. Line 505 - `resolveDispute` with RELEASED_TO_SELLER test
4. Line 530 - `resolveDispute` with CANCELLED test
5. Line 556 - `resolveDispute` with SPLIT test

## Verification

✅ TypeScript diagnostics: No errors
✅ All type casts properly typed
✅ Syntax errors resolved
✅ Code follows TypeScript strict mode rules

## Commit Details

**Commit**: d7bcb27
**Message**: "fix: resolve linting errors in escrow service"
**Files Changed**: 3
- `PR_DETAILS.md` (new)
- `apps/backend/src/modules/escrow/services/escrow.service.spec.ts` (modified)
- `apps/backend/src/modules/escrow/services/escrow.service.ts` (modified)

## CI Status

The fixes have been pushed to the `feature/deadline-enforcement` branch.
CI should now pass the linting checks.
44 changes: 44 additions & 0 deletions PR_MESSAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Add Secure Admin-Controlled Contract Upgrade (Safe Upgrade Pattern)

## Summary

This PR implements a secure, admin-controlled contract upgrade pattern ("Safe Upgrade" / Admin Proxy) for the VaultixEscrow Soroban contract. It allows protocol maintainers to fix bugs or add features without migrating all state and users to a new contract address.

## Key Changes

- **Upgrade Functionality:**
- Added `upgrade(env, new_wasm_hash: [u8; 32])` to the contract, callable only by the admin.
- Emits a `ContractUpgraded` event before performing the upgrade.
- Enforces strict access control (admin-only).
- Documents storage compatibility requirements for future upgrades.

- **Testing:**
- Integration test verifies:
- State is preserved across upgrades.
- Unauthorized users cannot trigger upgrades.
- New contract logic is accessible after upgrade.

## Motivation

Soroban allows contract upgrades via `env.deployer().update_current_contract_wasm`. This PR wraps that capability in a secure, admin-controlled function to ensure only authorized upgrades, protecting user funds and protocol integrity.

## Acceptance Criteria

- [x] `upgrade` function exists and is admin-protected.
- [x] Emits upgrade event.
- [x] Storage compatibility is documented.
- [x] Integration test proves code can be swapped while keeping escrow storage intact.
- [x] Unauthorized users cannot trigger an upgrade.

## Non-Goals

- DAO-voting based upgrades (admin-only for now).

---

**Reviewer Notes:**
- Please review the storage compatibility comment for future upgrade safety.
- All tests pass (`cargo test`).
- No breaking changes to existing escrow logic.

---
84 changes: 0 additions & 84 deletions apps/backend/CONDITION_FULFILLMENT_EXAMPLE.md

This file was deleted.

153 changes: 0 additions & 153 deletions apps/backend/DEADLINE_ENFORCEMENT_CHANGES.md

This file was deleted.

Loading
Loading