Skip to content

Commit

Permalink
feat(3322-tigerbeetle): bump tb from 0.15.4 to 0.16.29 (#3323)
Browse files Browse the repository at this point in the history
* feat(3322): bump tb from 0.15.4 to 0.16.29

* feat(3322): fix issue related to post vs void.

* feat(3322): formatting.

* feat(3322): remove comment.
  • Loading branch information
koekiebox authored Mar 5, 2025
1 parent cef0726 commit 286f146
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 58 deletions.
2 changes: 1 addition & 1 deletion infrastructure/helm/tigerbeetle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ statefulset:
repository: ghcr.io/tigerbeetle/tigerbeetle
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "0.15.4"
tag: "0.16.29"

proxyImage:
repository: nginx
Expand Down
2 changes: 1 addition & 1 deletion localenv/tigerbeetle/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
tigerbeetle:
image: ghcr.io/tigerbeetle/tigerbeetle:0.15.4
image: ghcr.io/tigerbeetle/tigerbeetle:0.16.29
privileged: true
volumes:
- tigerbeetle-data:/var/lib/tigerbeetle
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"pg": "^8.11.3",
"pino": "^8.19.0",
"raw-body": "^2.5.2",
"tigerbeetle-node": "0.15.4",
"tigerbeetle-node": "0.16.29",
"token-introspection": "workspace:*",
"uuid": "^9.0.1"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/accounting/tigerbeetle/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ describe('TigerBeetle Accounting Service', (): void => {
} else {
await expect(
accountingService.getBalance(sourceAccount.asset.id)
).resolves.toEqual(BigInt(0))
).resolves.toEqual(0n)

await expect(
accountingService.getBalance(destinationAccount.asset.id)
Expand All @@ -481,7 +481,7 @@ describe('TigerBeetle Accounting Service', (): void => {

await expect(
accountingService.getBalance(destinationAccount.id)
).resolves.toEqual(BigInt(0))
).resolves.toEqual(0n)

if (post) {
await expect(trxOrError.post()).resolves.toBeUndefined()
Expand Down
15 changes: 14 additions & 1 deletion packages/backend/src/accounting/tigerbeetle/transfers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type TransfersError = {

export type TransferUserData128 = string | number | bigint

const TB_AMOUNT_MAX = BigInt(2n ** 128n - 1n)
const TB_AMOUNT_MIN = 0n

interface TransferOptions {
transferRef?: TransferUserData128
code?: TigerBeetleTransferCode
Expand Down Expand Up @@ -103,9 +106,15 @@ export async function createTransfers(
if (transfer.postId) {
tbTransfer.flags |= TransferFlags.post_pending_transfer
tbTransfer.pending_id = toTigerBeetleId(transfer.postId)
// We only support setting the posting transfer amount to match the pending transfer:
// https://docs.tigerbeetle.com/reference/transfer/#amount
tbTransfer.amount = TB_AMOUNT_MAX
} else if (transfer.voidId) {
tbTransfer.flags |= TransferFlags.void_pending_transfer
tbTransfer.pending_id = toTigerBeetleId(transfer.voidId)
// We only support setting the void transfer amount to match the pending transfer:
// https://docs.tigerbeetle.com/reference/transfer/#amount
tbTransfer.amount = TB_AMOUNT_MIN
}
}

Expand Down Expand Up @@ -178,7 +187,11 @@ export async function getAccountTransfers(
timestamp_min: 0n,
timestamp_max: 0n,
limit,
flags: AccountFilterFlags.credits | AccountFilterFlags.debits
flags: AccountFilterFlags.credits | AccountFilterFlags.debits,
code: 0, //disabled
user_data_32: 0, //disabled
user_data_64: 0n, //disabled
user_data_128: 0n //disabled
}
const tbAccountTransfers: TbTransfer[] =
await deps.tigerBeetle.getAccountTransfers(filter)
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/tests/tigerbeetle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function startTigerBeetleContainer(clusterId?: number): Promise<{
const tigerBeetleClusterId = clusterId || Config.tigerBeetleClusterId
const { name: tigerBeetleDir } = tmp.dirSync({ unsafeCleanup: true })
const tigerBeetleFile = `cluster_${tigerBeetleClusterId}_replica_0_test.tigerbeetle`
const tigerBeetleContainerVersion = 'ghcr.io/tigerbeetle/tigerbeetle:0.15.4'
const tigerBeetleContainerVersion = 'ghcr.io/tigerbeetle/tigerbeetle:0.16.29'

const tbContFormat = await new GenericContainer(tigerBeetleContainerVersion)
.withExposedPorts(TIGERBEETLE_PORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ services:
- '3005:3005'

tigerbeetle:
image: ghcr.io/tigerbeetle/tigerbeetle:0.15.4
image: ghcr.io/tigerbeetle/tigerbeetle:0.16.29
privileged: true
volumes:
- tigerbeetle-data:/var/lib/tigerbeetle
Expand Down
Loading

0 comments on commit 286f146

Please sign in to comment.