Skip to content

Conversation

@dnechay
Copy link
Collaborator

@dnechay dnechay commented Dec 20, 2024

Issue tracking

Resolves #2903

Context behind the change

Functionality to create raw transaction and calculate its hash is placed to SDK because it should encapsulate contract interaction, but sending raw transaction can be done manually in the service.

When processing batches, we have to store nonce in the DB in order to handle different edge-cases by providing it for retry.

When running processPaidEscrowCompletion we now have to check also for Partial escrow status because when paying in batches bulkPayOut is called with forceComplete=false, so escrow won't be in Paid and won't autocomplete.

How has this been tested?

TS SDK

  • unit tests
  • create example script and call createBulkPayoutTransaction with testnet credentials, send rawTransaction, verify that real transaction hash matches the one calculated by lib method
  • call createBulkPayoutTransaction with old nonce and make sure that real transaction fails with NONCE_EXPIRED error

Python SDK

  • unit tests
  • e2e test

RepO
Locally, while connecting to local DB and testnet blockchain, implemented "test" endpoint to trigger it and manipulate different parts of the EscrowCompletionService class

  • call createEscrowPayoutsBatch, make sure that entity is created with correct properties
  • call createEscrowPayoutsBatch with replay; make sure that replay fails due to unique index
  • simulate errors in processPayoutsBatch, call processAwaitingPayouts; make sure escrowCompletionEntity gets updated retries count
  • have valid payouts batch in db, call processAwaitingPayouts, make sure that upon successful payout tx escrowCompletionEntity gets PAID status
  • unit tests

Release plan

  • 1. Wait till cron executions finishes on RepO
  • 2. Stop RepO service
  • 3. Run DB migrations
  • 4. Deploy and start new version of RepO service

Note

Maintenance window can be omitted if there are no pending items in escrow_completion_tracking table and if we can block "webhook" endpoint for some time so creating escrow_completion_tracking items is paused

Potential risks; What to monitor; Rollback plan

In case we run a migration w/ service running - it can lead to some jobs get stuck. It can be solved by removing their "lock" in cron-jobs table.

@vercel
Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 11:48am
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 11:48am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
faucet-frontend ⬜️ Ignored (Inspect) Visit Preview Jan 9, 2025 11:48am
faucet-server ⬜️ Ignored (Inspect) Visit Preview Jan 9, 2025 11:48am

@dnechay dnechay marked this pull request as ready for review December 20, 2024 18:03
@dnechay dnechay requested a review from Dzeranov January 3, 2025 12:21
Dzeranov
Dzeranov previously approved these changes Jan 9, 2025
Copy link
Contributor

@Dzeranov Dzeranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, lets wait for @portuu3

Copy link
Collaborator

@portuu3 portuu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS sdk docs missing

Copy link
Collaborator

@portuu3 portuu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dnechay dnechay merged commit 7256ef5 into develop Jan 9, 2025
21 checks passed
@dnechay dnechay deleted the dnechay/2903 branch January 9, 2025 12:12
@dnechay dnechay mentioned this pull request Jan 9, 2025
23 tasks
@dnechay dnechay self-assigned this Mar 12, 2025
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.

[Reputation Oracle] Add support for batched payments when more than 100 escrow recipients

5 participants