diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f9029fad..90f69ba23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). None +## [1.1.1](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.1.0...1.1.1) + +### Fixed + +- TSS amount precision [#176](https://github.com/stellar/stellar-disbursement-platform-backend/pull/176) + ## [1.1.0](https://github.com/stellar/stellar-disbursement-platform-backend/compare/1.0.1...1.1.0) ### Changed diff --git a/helmchart/sdp/Chart.yaml b/helmchart/sdp/Chart.yaml index 6fb91c449..f07325ecd 100644 --- a/helmchart/sdp/Chart.yaml +++ b/helmchart/sdp/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: stellar-disbursement-platform description: A Helm chart for the Stellar Disbursement Platform Backend (A.K.A. `sdp`) version: 0.9.4 -appVersion: "1.1.0" +appVersion: "1.1.1" type: application maintainers: - name: Stellar Development Foundation diff --git a/internal/db/migrations/2023-07-05.0-tss-transactions-table-constraints.sql b/internal/db/migrations/2023-07-05.0-tss-transactions-table-constraints.sql index 855b26361..729ea2424 100644 --- a/internal/db/migrations/2023-07-05.0-tss-transactions-table-constraints.sql +++ b/internal/db/migrations/2023-07-05.0-tss-transactions-table-constraints.sql @@ -6,7 +6,7 @@ ALTER TABLE public.submitter_transactions ADD COLUMN xdr_received TEXT UNIQUE, ALTER COLUMN external_id SET NOT NULL, ALTER COLUMN status SET DEFAULT 'PENDING', - ALTER COLUMN amount TYPE numeric(10,7), + ALTER COLUMN amount TYPE NUMERIC(19,7), ADD CONSTRAINT unique_stellar_transaction_hash UNIQUE (stellar_transaction_hash), ADD CONSTRAINT check_retry_count CHECK (retry_count >= 0); diff --git a/internal/db/migrations/2024-02-05.0-tss-transactions-table-amount-constraing.sql b/internal/db/migrations/2024-02-05.0-tss-transactions-table-amount-constraing.sql new file mode 100644 index 000000000..0185ad480 --- /dev/null +++ b/internal/db/migrations/2024-02-05.0-tss-transactions-table-amount-constraing.sql @@ -0,0 +1,6 @@ +-- +migrate Up + +ALTER TABLE public.submitter_transactions + ALTER COLUMN amount TYPE NUMERIC(19,7); + +-- +migrate Down diff --git a/internal/transactionsubmission/store/transactions_test.go b/internal/transactionsubmission/store/transactions_test.go index d0cc52373..8ebd5243c 100644 --- a/internal/transactionsubmission/store/transactions_test.go +++ b/internal/transactionsubmission/store/transactions_test.go @@ -124,14 +124,16 @@ func Test_TransactionModel_BulkInsert(t *testing.T) { ExternalID: "external-id-1", AssetCode: "USDC", AssetIssuer: keypair.MustRandom().Address(), - Amount: 1, + // Lowest number in the Stellar network (ref: https://developers.stellar.org/docs/fundamentals-and-concepts/stellar-data-structures/assets#amount-precision): + Amount: 0.0000001, Destination: keypair.MustRandom().Address(), } incomingTx2 := Transaction{ ExternalID: "external-id-2", AssetCode: "USDC", AssetIssuer: keypair.MustRandom().Address(), - Amount: 2, + // Largest number in the Stellar network (ref: https://developers.stellar.org/docs/fundamentals-and-concepts/stellar-data-structures/assets#amount-precision): + Amount: 922337203685.4775807, Destination: keypair.MustRandom().Address(), } insertedTransactions, err := txModel.BulkInsert(ctx, dbConnectionPool, []Transaction{incomingTx1, incomingTx2}) diff --git a/main.go b/main.go index cee91925c..0bdced276 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( // Version is the official version of this application. Whenever it's changed // here, it also needs to be updated at the `helmchart/Chart.yaml#appVersionā€œ. -const Version = "1.1.0" +const Version = "1.1.1" // GitCommit is populated at build time by // go build -ldflags "-X main.GitCommit=$GIT_COMMIT"