From f53c3e1d2f3b1218c2d9895f731b93d4e1b02de1 Mon Sep 17 00:00:00 2001 From: Yggdrasil Date: Wed, 14 Oct 2026 02:20:29 -0400 Subject: [PATCH] =?UTF-8?q?fix(dto):=20cap=20split-arrays=20at=2050=20reci?= =?UTF-8?q?pients=20=E2=80=94=20bounded=20release=20on-chain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SplitReleaseDto + CreateTeamDto had @ArrayMinSize(1) but no max — the contract's release() iterates every recipient (one token transfer each), so an unbounded split exceeded Soroban's per-transaction resource limits and failed on-chain. Cap at 50. Resolves #581 --- src/escrow/dto/split-release.dto.ts | 6 ++++++ src/teams/dto/create-team.dto.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/escrow/dto/split-release.dto.ts b/src/escrow/dto/split-release.dto.ts index d519a45e..141c9be3 100644 --- a/src/escrow/dto/split-release.dto.ts +++ b/src/escrow/dto/split-release.dto.ts @@ -1,6 +1,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { + ArrayMaxSize, ArrayMinSize, IsNumber, IsOptional, @@ -29,8 +30,13 @@ export class SplitRecipientDto { } export class SplitReleaseDto { + // Unbounded recipients: the contract's `release` iterates every recipient + // (one token transfer each) — a large split exceeds Soroban's + // per-transaction resource limits and fails on-chain (#581, #15). Cap at a + // size that stays within the contract's budget. @ApiProperty({ type: [SplitRecipientDto] }) @ArrayMinSize(1) + @ArrayMaxSize(50) @ValidateNested({ each: true }) @Type(() => SplitRecipientDto) recipients: SplitRecipientDto[]; diff --git a/src/teams/dto/create-team.dto.ts b/src/teams/dto/create-team.dto.ts index e5487c21..60851234 100644 --- a/src/teams/dto/create-team.dto.ts +++ b/src/teams/dto/create-team.dto.ts @@ -1,6 +1,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { Transform, Type } from 'class-transformer'; import { + ArrayMaxSize, ArrayMinSize, IsNotEmpty, IsNumber, @@ -34,6 +35,7 @@ export class TeamMemberSplitDto { export class UpdateTeamSplitsDto { @ApiProperty({ type: [TeamMemberSplitDto] }) @ArrayMinSize(1) + @ArrayMaxSize(50) @ValidateNested({ each: true }) @Type(() => TeamMemberSplitDto) splits: TeamMemberSplitDto[]; @@ -56,6 +58,7 @@ export class CreateTeamDto { @ApiProperty({ type: [TeamMemberSplitDto] }) @ArrayMinSize(1) + @ArrayMaxSize(50) @ValidateNested({ each: true }) @Type(() => TeamMemberSplitDto) members: TeamMemberSplitDto[];