SDP-1615: Add sponsored type to TSS transactions - #703
Conversation
This comment was marked as duplicate.
This comment was marked as duplicate.
10f368a to
60fc810
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for a new sponsored transaction type in the TSS transactions model.
- Introduces a new TransactionTypeSponsored and related Sponsored struct fields.
- Updates tests to cover sponsored transactions insertions and status updates.
- Modifies SQL queries and migration scripts to support the additional sponsored transaction columns.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/transactionsubmission/store/transactions_test.go | Adds tests for inserting and updating sponsored transactions. |
| internal/transactionsubmission/store/transactions.go | Implements Sponsored validation and adjusts BulkInsert for new fields. |
| internal/transactionsubmission/store/fixtures.go | Updates fixture creation to include sponsored transaction fields. |
| db/migrations/tss-migrations/2025-05-09.0-add-embedded-wallet-transactions-to-submitter-transactions-table.sql | Adds new enum value and columns for sponsored transactions, but then drops them. |
Comments suppressed due to low confidence (1)
db/migrations/tss-migrations/2025-05-09.0-add-embedded-wallet-transactions-to-submitter-transactions-table.sql:45
- The migration adds new columns ('account', 'transaction_xdr', and an updated 'transaction_type') that are used in the new code, but later drops them. This may lead to a schema mismatch; please review the migration logic to ensure the new columns persist as required by the application.
DROP COLUMN transaction_type,
| CREATE TYPE transaction_type AS ENUM ('PAYMENT', 'WALLET_CREATION', 'SPONSORED'); | ||
|
|
||
| ALTER TABLE submitter_transactions | ||
| ADD COLUMN transaction_type VARCHAR(32) NOT NULL DEFAULT 'PAYMENT'::transaction_type, |
There was a problem hiding this comment.
❓Is there a reason why this column has the type VARCHAR(32) instead of transaction_type ?
| ADD COLUMN wasm_hash VARCHAR(64), | ||
| ADD COLUMN transaction_type VARCHAR(32) NOT NULL DEFAULT 'PAYMENT'::transaction_type; | ||
| -- Add new columns for sponsored transactions | ||
| ADD COLUMN account VARCHAR(56), |
There was a problem hiding this comment.
nit: I think here it makes sense to add a qualifier to the account, so that it's clear if this is the sponsored_account or the sponsor_account
| WHEN transaction_type = 'WALLET_CREATION' THEN | ||
| public_key IS NOT NULL AND | ||
| wasm_hash IS NOT NULL | ||
| WHEN transaction_type = 'SPONSORED' THEN |
There was a problem hiding this comment.
❓ You should double check this, but I believe that it's better if we break these into 3 separate checks, one check per type.
The reason is that the error that comes out when all 3 checks are combined may be ambiguous (doesn't tell us which transaction type is failing the check) .
There was a problem hiding this comment.
Makes sense. Done!
| ADD COLUMN transaction_type VARCHAR(32) NOT NULL DEFAULT 'PAYMENT'::transaction_type; | ||
| -- Add new columns for sponsored transactions | ||
| ADD COLUMN account VARCHAR(56), | ||
| ADD COLUMN transaction_xdr TEXT; |
There was a problem hiding this comment.
If this column is only going to be used for sponsored transactions, maybe it makes sense to add a prefix to the column to indicate that ?
What
This adds the sponsored transaction type to the TSS transactions model.
Why
Sponsored transactions will be submitted by TSS
Known limitations
N/A
Checklist
SDP-1234: Add new featureorChore: Refactor package xyzformat. The Jira ticket code was included if available.CHANGELOG.mdis updated (if applicable)