rafiki icon indicating copy to clipboard operation
rafiki copied to clipboard

Backend changes for Tigerbeetle LSM Backend

Open koekiebox opened this issue 2 years ago • 0 comments

Overview

The following chores originated from PR https://github.com/interledger/rafiki/pull/452 as part of the review, although not strictly part of the upgrade to the new version, these changes must also be incorporated to Rafiki:

  • [ ] Make use of the LSM Tigerbeetle release for testcontainers (once ready)
  • [ ] Set amount to 0n for void/post
  • [ ] Create functions commitAccountWithdrawal / rollbackAccountWithdrawal with only withdrawalId as parameter
  • [ ] Remove commit and replace pendingId with optional commitId and rollbackId. You can make them mutually exclusive by removing pendingId renaming CreateTransferOptions to CreateTransferOptionsBase and adding something like (See below Snippet 1)
  • [ ] Throw an error when an invalid transfer.id is provided for accounting/transfers.ts#createTransfers()
  • [ ] Do not fetch the original txn when doing a rollback or commit. The debit/credit accounts may be set to 0n, which will allow TB to lookup the original debit/credit accounts.
  • [ ] Enable/Disable TB testcontainer logs via environment variable flag: TIGERBEETLE_CONTAINER_LOG
  • [ ] Update packages/backend/src/accounting/service.ts commit and rollback functions to make use of an enum instead of a boolean for the commit/rollback operations
  • [ ] Rename the commit and rollback operations to suite Tigerbeetle void/post naming convention
  • [ ] Ensure all tasks/comments from https://github.com/interledger/rafiki/pull/452 is addressed

Snippet 1

export interface CommitTransferOptions extends CreateTransferOptionsBase {
  commitId?: string | bigint
  rollbackId?: never
}

export interface RollbackTransferOptions extends CreateTransferOptionsBase {
  commitId?: never
  rollbackId?: string | bigint
}

export type CreateTransferOptions = CommitTransferOptions | RollbackTransferOptions

References

PR:

https://github.com/interledger/rafiki/pull/452

Related Issues:

https://github.com/interledger/rafiki/issues/381 https://github.com/interledger/rafiki/issues/521

koekiebox avatar Aug 23 '22 13:08 koekiebox