Skip to content

Commit

Permalink
Merge pull request #503 from stellar/release/3.1.0
Browse files Browse the repository at this point in the history
Release `3.1.0` to `main`
  • Loading branch information
marcelosalloum authored Jan 16, 2025
2 parents f635986 + f6cf18e commit 4efcd09
Show file tree
Hide file tree
Showing 115 changed files with 5,597 additions and 1,125 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker_image_public_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push to DockerHub (release prd)
uses: docker/build-push-action@v6.9.0
uses: docker/build-push-action@v6.11.0
with:
push: true
build-args: |
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
run: echo "SHA=$(git rev-parse --short ${{ github.sha }} )" >> $GITHUB_OUTPUT

- name: Build and push to DockerHub (develop branch)
uses: docker/build-push-action@v6.9.0
uses: docker/build-push-action@v6.11.0
with:
push: true
build-args: |
Expand Down
51 changes: 45 additions & 6 deletions .github/workflows/e2e_integration_test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Integration Tests

on:
push:
branches:
- main
pull_request:
workflow_call: # allows this workflow to be called from another workflow
workflow_call: # allows this workflow to be called from another workflow, like `docker_image_public_release`

env:
USER_EMAIL: "[email protected]"
Expand All @@ -26,6 +22,7 @@ jobs:
matrix:
platform:
- "Stellar-phone" # Stellar distribution account where receivers are registered with their phone number
- "Stellar-phone-FUTURENET" # Stellar distribution account where receivers are registered with their phone number
- "Stellar-phone-wallet" # Stellar distribution account where receivers are registered with their phone number and wallet address
- "Stellar-email" # Stellar distribution account where receivers are registered with their email
- "Circle-phone" # Circle distribution account where receivers are registered with their email
Expand All @@ -35,26 +32,46 @@ jobs:
DISTRIBUTION_ACCOUNT_TYPE: "DISTRIBUTION_ACCOUNT.STELLAR.ENV"
DISBURSEMENT_CSV_FILE_NAME: "disbursement_instructions_phone.csv"
REGISTRATION_CONTACT_TYPE: "PHONE_NUMBER"
DISBURSED_ASSET_CODE: "USDC"
DISBURSED_ASSET_ISSUER: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
- platform: "Stellar-phone-wallet"
environment: "Receiver Registration - E2E Integration Tests (Stellar)"
DISTRIBUTION_ACCOUNT_TYPE: "DISTRIBUTION_ACCOUNT.STELLAR.ENV"
DISBURSEMENT_CSV_FILE_NAME: "disbursement_instructions_phone_with_wallet.csv"
REGISTRATION_CONTACT_TYPE: "PHONE_NUMBER_AND_WALLET_ADDRESS"
DISBURSED_ASSET_CODE: "USDC"
DISBURSED_ASSET_ISSUER: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
- platform: "Stellar-email"
environment: "Receiver Registration - E2E Integration Tests (Stellar)"
DISTRIBUTION_ACCOUNT_TYPE: "DISTRIBUTION_ACCOUNT.STELLAR.ENV"
DISBURSEMENT_CSV_FILE_NAME: "disbursement_instructions_email.csv"
REGISTRATION_CONTACT_TYPE: "EMAIL"
DISBURSED_ASSET_CODE: "USDC"
DISBURSED_ASSET_ISSUER: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
- platform: "Circle-phone"
environment: "Receiver Registration - E2E Integration Tests (Circle)"
DISTRIBUTION_ACCOUNT_TYPE: "DISTRIBUTION_ACCOUNT.CIRCLE.DB_VAULT"
DISBURSEMENT_CSV_FILE_NAME: "disbursement_instructions_phone.csv"
REGISTRATION_CONTACT_TYPE: "PHONE_NUMBER"
DISBURSED_ASSET_CODE: "USDC"
DISBURSED_ASSET_ISSUER: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
- platform: "Stellar-phone-FUTURENET"
environment: "Receiver Registration - E2E Integration Tests (Stellar)"
DISTRIBUTION_ACCOUNT_TYPE: "DISTRIBUTION_ACCOUNT.STELLAR.ENV"
DISBURSEMENT_CSV_FILE_NAME: "disbursement_instructions_phone.csv"
REGISTRATION_CONTACT_TYPE: "PHONE_NUMBER"
DISBURSED_ASSET_CODE: "XLM"
NETWORK_PASSPHRASE: "Test SDF Future Network ; October 2022"
HORIZON_URL: "https://horizon-futurenet.stellar.org"
environment: ${{ matrix.environment }}
env:
DISTRIBUTION_ACCOUNT_TYPE: ${{ matrix.DISTRIBUTION_ACCOUNT_TYPE }}
DISBURSEMENT_CSV_FILE_NAME: ${{ matrix.DISBURSEMENT_CSV_FILE_NAME }}
REGISTRATION_CONTACT_TYPE: ${{ matrix.REGISTRATION_CONTACT_TYPE }}
DISBURSED_ASSET_CODE: ${{ matrix.DISBURSED_ASSET_CODE }}
DISBURSED_ASSET_ISSUER: ${{ matrix.DISBURSED_ASSET_ISSUER }}
NETWORK_PASSPHRASE: ${{ matrix.NETWORK_PASSPHRASE }}
HORIZON_URL: ${{ matrix.HORIZON_URL }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -73,6 +90,28 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y curl
shell: bash

- name: Wait for the SDP to be up
run: |
wait_for_server() {
local endpoint=$1
local max_wait_time=$2
SECONDS=0
while ! curl -s $endpoint > /dev/null; do
echo "Waiting for server at $endpoint to be up... $SECONDS seconds elapsed"
sleep 4
if [ $SECONDS -ge $max_wait_time ]; then
echo "Server at $endpoint is not up after $max_wait_time seconds."
exit 1
fi
done
echo "Server at $endpoint is up."
}
wait_for_server http://localhost:8000/health 120
wait_for_server http://localhost:8003/health 120
shell: bash

- name: Create integration test data
run: |
docker exec e2e-sdp-api bash -c "./stellar-disbursement-platform integration-tests create-data"
Expand All @@ -83,7 +122,7 @@ jobs:
docker restart e2e-anchor-platform
shell: bash

- name: Wait for Anchor Platform at both localhost:8080/health and localhost:8085/health
- name: Wait for the Anchor Platform to be up
run: |
wait_for_server() {
local endpoint=$1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@ jobs:
docker cp internal/integrationtests/resources/single_tenant_dump.sql e2e-sdp-v2-database:/tmp/single_tenant_dump.sql
docker exec e2e-sdp-v2-database bash -c "psql -d $DATABASE_URL -f /tmp/single_tenant_dump.sql"
- name: Wait for SDP to be up at localhost:8000/health
run: |
wait_for_server() {
local endpoint=$1
local max_wait_time=$2
SECONDS=0
while ! curl -s $endpoint > /dev/null; do
echo "Waiting for server at $endpoint to be up... $SECONDS seconds elapsed"
sleep 4
if [ $SECONDS -ge $max_wait_time ]; then
echo "Server at $endpoint is not up after $max_wait_time seconds."
exit 1
fi
done
echo "Server at $endpoint is up."
}
wait_for_server http://localhost:8000/health 120
shell: bash

- name: Provision New Tenant
run: |
adminAccount="SDP-admin"
Expand Down
57 changes: 54 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,63 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

## Unreleased

## [3.1.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/3.1.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/3.0.0...3.1.0))

Release of the Stellar Disbursement Platform `v3.1.0`. This release introduces key updates, including the migration to
Circle's Payouts API, aligning with Circle's latest recommendations. It also enhances platform functionality by enabling
data export through dedicated endpoints, allowing users to export disbursements, payments, and receivers with filters.
Additionally, users now have the ability to delete disbursements in `DRAFT` or `READY` status, streamlining data
management workflows.

> [!WARNING]
> This version is only compatible with the [stellar/stellar-disbursement-platform-frontend](https://github.com/stellar/stellar-disbursement-platform-frontend) version `3.1.0`.
### Added

- Export functionality, allowing users to export:
- Disbursements with filters. [#490](https://github.com/stellar/stellar-disbursement-platform-backend/pull/490)
- Payments with filters. [#493](https://github.com/stellar/stellar-disbursement-platform-backend/pull/493)
- Receivers with filters. [#496](https://github.com/stellar/stellar-disbursement-platform-backend/pull/496)
- Option to delete a disbursement in `DRAFT` or `READY` status. [#487](https://github.com/stellar/stellar-disbursement-platform-backend/pull/487)
- Add futurenet as one of the e2e tests scenarios applied to the e2e GitHub Action. [#472](https://github.com/stellar/stellar-disbursement-platform-backend/pull/472)

### Changed

- Update Circle API to use Circle payouts, which is the new officially suggested (and supported) API. [#486](https://github.com/stellar/stellar-disbursement-platform-backend/pull/486), [#491](https://github.com/stellar/stellar-disbursement-platform-backend/pull/491)
- Only execute the GitHub e2e tests workflow prior to publishing Docker images, removing it from the pull requests test suite. [#479](https://github.com/stellar/stellar-disbursement-platform-backend/pull/479)
- Simplify docker compose by making Kafka optional and defaulting to scheduled jobs. [#481](https://github.com/stellar/stellar-disbursement-platform-backend/pull/481)
- Make Dashboard User E-mails case insensitive. [#485](https://github.com/stellar/stellar-disbursement-platform-backend/pull/485)

### Fixed

- Fix XLM support on the integration tests. [#470](https://github.com/stellar/stellar-disbursement-platform-backend/pull/470)
- Fix `main.sh` script so that it doesn't kill non-sdp containers. [#480](https://github.com/stellar/stellar-disbursement-platform-backend/pull/480)
- Skip patching transaction in AP for known-wallet address payments. [#482](https://github.com/stellar/stellar-disbursement-platform-backend/pull/482)
- Workaround for Circle's bug where retries are not handled correctly when a trustline is missing. [#504](https://github.com/stellar/stellar-disbursement-platform-backend/pull/504)
- Fix default tenant resolution during SEP24 registration. [#505](https://github.com/stellar/stellar-disbursement-platform-backend/pull/505)

### Security and Dependencies

- Prevent any html (encoded or not) in the invite templates set by staff users. [494](https://github.com/stellar/stellar-disbursement-platform-backend/pull/494)
- Bump dependencies:
- github.com/stretchr/testify from 1.9.0 to 1.10.0. [#471](https://github.com/stellar/stellar-disbursement-platform-backend/pull/471)
- github.com/nyaruka/phonenumbers from 1.4.2 to 1.4.3. [#483](https://github.com/stellar/stellar-disbursement-platform-backend/pull/483)
- minor-and-patch group with 3 updates. [#489](https://github.com/stellar/stellar-disbursement-platform-backend/pull/489)
- golang.org/x/crypto from 0.30.0 to 0.31.0. [#492](https://github.com/stellar/stellar-disbursement-platform-backend/pull/492)
- minor-and-patch group across 1 directory with 5 updates. [#498](https://github.com/stellar/stellar-disbursement-platform-backend/pull/498)
- github.com/twilio/twilio-go from 1.23.8 to 1.23.9. [#500](https://github.com/stellar/stellar-disbursement-platform-backend/pull/500)
- Bump docker/build-push-action from 6.9.0 to 6.11.0 in the all-actions group. [#484](https://github.com/stellar/stellar-disbursement-platform-backend/pull/484), [#501](https://github.com/stellar/stellar-disbursement-platform-backend/pull/501)
- Bump golang from 1.23.3-bullseye to 1.23.4-bullseye in the all-docker group. [#488](https://github.com/stellar/stellar-disbursement-platform-backend/pull/488)

## [3.0.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/3.0.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/2.1.1...3.0.0))

Release of the Stellar Disbursement Platform `v3.0.0`. In this release, receiver registration does not need to be done
exclusively through SMS as it now supports new types. The options are `PHONE_NUMBER`, `EMAIL`,
`EMAIL_AND_WALLET_ADDRESS`, and `PHONE_NUMBER_AND_WALLET_ADDRESS`. If a receiver is registered with a wallet address,
they can receive the payment right away without having to go through the SEP-24 registration flow.

This version is only compatible with the [stellar/stellar-disbursement-platform-frontend] version `3.0.0`.
> [!WARNING]
> This version is only compatible with the [stellar/stellar-disbursement-platform-frontend](https://github.com/stellar/stellar-disbursement-platform-frontend) version `3.0.0`.
### Breaking Changes

Expand Down Expand Up @@ -87,7 +136,8 @@ the option to set different distribution account signers per tenant, as well
as Circle support, so the tenant can choose to run their payments through the
Circle API rather than directly on the Stellar network.

This version is only compatible with the [stellar/stellar-disbursement-platform-frontend] version `2.1.0`.
> [!WARNING]
> This version is only compatible with the [stellar/stellar-disbursement-platform-frontend](https://github.com/stellar/stellar-disbursement-platform-frontend) version `2.1.0`.
### Changed

Expand Down Expand Up @@ -148,7 +198,8 @@ release introduces multi-tenancy support, allowing multiple tenants

Each organization has its own set of users, receivers, disbursements, etc.

This version is only compatible with the [stellar/stellar-disbursement-platform-frontend] version `2.0.0`.
> [!WARNING]
> This version is only compatible with the [stellar/stellar-disbursement-platform-frontend](https://github.com/stellar/stellar-disbursement-platform-frontend) version `2.0.0`.
### Changed

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To push:
# make docker-push

FROM golang:1.23.3-bullseye AS build
FROM golang:1.23.4-bullseye AS build
ARG GIT_COMMIT

WORKDIR /src/stellar-disbursement-platform
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Build the Go application
FROM golang:1.23.3-bullseye AS build
FROM golang:1.23.4-bullseye AS build
ARG GIT_COMMIT

WORKDIR /src/stellar-disbursement-platform
Expand All @@ -9,7 +9,7 @@ COPY . ./
RUN go build -o /bin/stellar-disbursement-platform -ldflags "-X main.GitCommit=$GIT_COMMIT" .

# Stage 2: Setup the development environment with Delve for debugging
FROM golang:1.23.3-bullseye AS development
FROM golang:1.23.4-bullseye AS development

# set workdir according to repo structure so remote debug source code is in sync
WORKDIR /app/github.com/stellar/stellar-disbursement-platform
Expand Down
5 changes: 4 additions & 1 deletion cmd/integration_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/stellar/go/support/config"
"github.com/stellar/go/support/log"

"github.com/stellar/stellar-disbursement-platform-backend/cmd/utils"
cmdUtils "github.com/stellar/stellar-disbursement-platform-backend/cmd/utils"
"github.com/stellar/stellar-disbursement-platform-backend/internal/data"
"github.com/stellar/stellar-disbursement-platform-backend/internal/integrationtests"
Expand All @@ -33,7 +34,7 @@ func (c *IntegrationTestsCommand) Command() *cobra.Command {
Usage: "Issuer if the asset to be disbursed",
OptType: types.String,
ConfigKey: &integrationTestsOpts.DisbursetAssetIssuer,
Required: true,
Required: false,
},
{
Name: "disbursement-name",
Expand Down Expand Up @@ -115,6 +116,8 @@ func (c *IntegrationTestsCommand) Command() *cobra.Command {
ConfigKey: &integrationTestsOpts.RegistrationContactType,
Required: true,
},
utils.HorizonURL(&integrationTestsOpts.HorizonURL),
utils.NetworkPassphrase(&integrationTestsOpts.NetworkPassphrase),
}
integrationTestsCmd := &cobra.Command{
Use: "integration-tests",
Expand Down
20 changes: 12 additions & 8 deletions cmd/utils/shared_config_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,7 @@ func TransactionSubmitterEngineConfigOptions(opts *di.TxSubmitterEngineOptions)
FlagDefault: 100 * txnbuild.MinBaseFee,
Required: true,
},
&config.ConfigOption{
Name: "horizon-url",
Usage: "The URL of the Stellar Horizon server where this application will communicate with.",
OptType: types.String,
ConfigKey: &opts.HorizonURL,
FlagDefault: horizonclient.DefaultTestNetClient.HorizonURL,
Required: true,
},
HorizonURL(&opts.HorizonURL),
)
}

Expand Down Expand Up @@ -341,6 +334,17 @@ func NetworkPassphrase(targetPointer interface{}) *config.ConfigOption {
}
}

func HorizonURL(targetPointer interface{}) *config.ConfigOption {
return &config.ConfigOption{
Name: "horizon-url",
Usage: "The URL of the Stellar Horizon server where this application will communicate with.",
OptType: types.String,
ConfigKey: targetPointer,
FlagDefault: horizonclient.DefaultTestNetClient.HorizonURL,
Required: true,
}
}

func KafkaConfig(opts EventBrokerOptions) events.KafkaConfig {
return events.KafkaConfig{
Brokers: opts.BrokerURLs,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- +migrate Up
UPDATE auth_users
SET
email = LOWER(TRIM(email));

-- +migrate Down
-- No down migration needed as email sanitization cannot be reversed
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-- prepares the database for Circle payouts by adding the new circle_recipients table, and modifying circle_transfers to be used for payouts.

-- +migrate Up
-- circle_recipients
CREATE TYPE circle_recipient_status AS ENUM ('pending', 'active', 'inactive', 'denied');

CREATE TABLE circle_recipients (
receiver_wallet_id VARCHAR(36) PRIMARY KEY,
idempotency_key VARCHAR(36) NOT NULL DEFAULT public.uuid_generate_v4(),
circle_recipient_id VARCHAR(36),
status circle_recipient_status,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
sync_attempts INT NOT NULL DEFAULT 0,
last_sync_attempt_at TIMESTAMPTZ,
response_body JSONB,
CONSTRAINT unique_idempotency_key UNIQUE (idempotency_key)
);

-- Create a partial unique index for circle_recipient_id only when it's NOT NULL
CREATE UNIQUE INDEX unique_circle_recipient_id ON circle_recipients(circle_recipient_id)
WHERE circle_recipient_id IS NOT NULL;

CREATE TRIGGER refresh_circle_recipient_updated_at BEFORE UPDATE ON circle_recipients FOR EACH ROW EXECUTE PROCEDURE update_at_refresh();

-- circle_transfer_requests
ALTER TABLE circle_transfer_requests
ADD COLUMN circle_payout_id VARCHAR(36),
ADD CONSTRAINT circle_transfer_or_payout CHECK (
NOT (circle_transfer_id IS NOT NULL AND circle_payout_id IS NOT NULL)
);

-- status indexes
CREATE INDEX idx_payments_status ON payments(status);
CREATE INDEX idx_disbursements_status ON disbursements(status);
CREATE INDEX idx_receiver_wallets_status ON receiver_wallets(status);

-- +migrate Down
-- status indexes
DROP INDEX IF EXISTS idx_payments_status;
DROP INDEX IF EXISTS idx_disbursements_status;
DROP INDEX IF EXISTS idx_receiver_wallets_status;

-- circle_transfer_requests
ALTER TABLE circle_transfer_requests
DROP CONSTRAINT circle_transfer_or_payout,
DROP COLUMN circle_payout_id CASCADE;

-- circle_recipients
DROP TRIGGER refresh_circle_recipient_updated_at ON circle_recipients;
DROP TABLE circle_recipients CASCADE;
DROP TYPE circle_recipient_status;
Loading

0 comments on commit 4efcd09

Please sign in to comment.