Skip to content

fix: harden escrow ids and production database safety - #910

Merged
chonilius merged 1 commit into
MergeFi:mainfrom
tonyy-starrk:fix/762-763-765-766
Nov 21, 2026
Merged

chonilius merged 1 commit into
MergeFi:mainfrom
tonyy-starrk:fix/762-763-765-766

Conversation

@tonyy-starrk

@tonyy-starrk tonyy-starrk commented Nov 21, 2026 •

Copy link
Copy Markdown

What this PR does

Prevents on-chain escrow key collisions, atomically persists bounty funding state, and enforces production database safety requirements.

Closes

Closes #762
Closes #763
Closes #765
Closes #766

What changed

  • Namespaced derived escrow IDs by parent type, rejected empty IDs and collisions, and added a unique onChainId index migration.
  • Wrapped bounty escrow creation and bounty status updates in one locked transaction; reject funding if escrowId is already set.
  • Refused production startup with schema synchronization enabled, ignored synchronization outside development, and added required verified PostgreSQL TLS options for app and migration connections.
  • Added regression specs and documented the new database environment variables.

How to test

  1. npm test -- --runInBand src/escrow/escrow.service.spec.ts src/bounties/bounties.service.spec.ts - not run per request.
  2. npm test -- --runInBand src/config/configuration.spec.ts src/config/validate-required-config.spec.ts src/app.module.spec.ts - not run per request.
  3. npm run build - attempted; unavailable because npm is not on PATH in this environment.

Checklist

  • npm run lint passes locally
  • npm run build passes locally
  • npm test passes locally
  • npm run test:e2e passes locally (needs Postgres - see README "Running Tests")
  • New behaviour has a spec, and a fixed bug has a regression test
  • A new environment variable is documented in .env.example
  • A schema change ships with a migration (npm run migration:generate)

Money path

  • New money-moving routes are @Idempotent() and guarded by RolesGuard
  • The module spec (*.module.spec.ts) still covers the providers and
    repositories this change relies on
  • Behaviour is correct in dry-run mode and against a configured contract
    (see README "Dry-run mode")

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Nov 21, 2026

Copy link
Copy Markdown

@Rickyy1017 is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 21, 2026

Copy link
Copy Markdown

@tonyy-starrk 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

@chonilius
chonilius merged commit c362f62 into MergeFi:main Nov 21, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment