Skip to content

SDP-1615: Add sponsored type to TSS transactions - #703

Merged
philipliu merged 5 commits into
feature/c-accountsfrom
philip/sdp-1615-sponsored-transactions-model
Jun 11, 2025
Merged

SDP-1615: Add sponsored type to TSS transactions#703
philipliu merged 5 commits into
feature/c-accountsfrom
philip/sdp-1615-sponsored-transactions-model

Conversation

@philipliu

Copy link
Copy Markdown
Contributor

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

  • Title follows SDP-1234: Add new feature or Chore: Refactor package xyz format. The Jira ticket code was included if available.
  • PR has a focused scope and doesn't mix features with refactoring
  • Tests are included (if applicable)
  • CHANGELOG.md is updated (if applicable)
  • CONFIG/SECRETS changes are updated in helmcharts and deployments (if applicable)
  • Preview deployment works as expected
  • Ready for production

@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 10, 2025 18:00 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Anchor Integration Tests June 10, 2025 18:00 — with GitHub Actions Inactive
@stellar-jenkins

This comment was marked as duplicate.

@philipliu
philipliu force-pushed the philip/sdp-1615-sponsored-transactions-model branch from 10f368a to 60fc810 Compare June 10, 2025 18:12
@philipliu
philipliu temporarily deployed to Anchor Integration Tests June 10, 2025 18:12 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 10, 2025 18:12 — with GitHub Actions Inactive
@stellar-jenkins

This comment was marked as duplicate.

@philipliu
philipliu requested a review from Copilot June 10, 2025 18:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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,

Comment thread internal/transactionsubmission/store/transactions_test.go Outdated
Comment thread internal/transactionsubmission/store/transactions_test.go Outdated
@philipliu
philipliu temporarily deployed to Anchor Integration Tests June 10, 2025 18:22 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 10, 2025 18:22 — with GitHub Actions Inactive
@philipliu
philipliu marked this pull request as ready for review June 10, 2025 18:28

@marwen-abid marwen-abid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

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,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

❓Is there a reason why this column has the type VARCHAR(32) instead of transaction_type ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops!

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),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

❓ 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) .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 ?

@philipliu
philipliu temporarily deployed to Anchor Integration Tests June 11, 2025 20:56 — with GitHub Actions Inactive
@philipliu
philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 11, 2025 20:56 — with GitHub Actions Inactive
@philipliu
philipliu merged commit 8ec0acc into feature/c-accounts Jun 11, 2025
@philipliu
philipliu deleted the philip/sdp-1615-sponsored-transactions-model branch June 11, 2025 21:32
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.

4 participants