Skip to content

feat(program-escrow): tune MAX_BATCH_SIZE based on Soroban instruction budget#1

Open
levibliz wants to merge 12 commits into
masterfrom
levi/1264-max-batch-size
Open

feat(program-escrow): tune MAX_BATCH_SIZE based on Soroban instruction budget#1
levibliz wants to merge 12 commits into
masterfrom
levi/1264-max-batch-size

Conversation

@levibliz
Copy link
Copy Markdown
Owner

@levibliz levibliz commented May 29, 2026

Description

Tune MAX_BATCH_SIZE in contracts/program-escrow based on Soroban's per-transaction CPU instruction limit of 100M.

Changes

  1. Set MAX_BATCH_SIZE = 100 with a detailed derivation comment in lib.rs.
  2. Add BatchError::BatchTooLarge (code 410) to errors.rs.
  3. Add pre-flight check in batch_payout_internal that fires before any state mutation.
  4. Add test coverage in test_batch_limits.rs and test_batch_operations.rs.
  5. Add CI workflow for program-escrow.
  6. Fix brace-matching bugs in lib.rs, error_recovery.rs, and errors.rs.

Closes Jagadeeshftw#1264

emarc99 and others added 12 commits May 29, 2026 09:31
* Add per-program circuit breaker threshold tuning (Jagadeeshftw#1255)

- Add circuit_breaker_threshold field to ProgramData (Option<u8>)
- Add InvalidCircuitBreakerThreshold error (code 804)
- Add set_program_circuit_breaker_threshold admin setter with validation (1-100)
- Add CircuitBreakerThresholdSetEvent for audit trail
- Update record_failure to accept threshold_override parameter
- Add comprehensive test suite for threshold functionality
- Update documentation with usage examples

* Add re-entrancy guard analysis for issue Jagadeeshftw#205
…agadeeshftw#1332)

- Add circuit_breaker_threshold field to ProgramData (Option<u8>)
- Add InvalidCircuitBreakerThreshold error (code 804)
- Add set_program_circuit_breaker_threshold admin setter with validation (1-100)
- Add CircuitBreakerThresholdSetEvent for audit trail
- Update record_failure to accept threshold_override parameter
- Add comprehensive test suite for threshold functionality
- Update documentation with usage examples
…n budget

- Set MAX_BATCH_SIZE = 100 with derivation comment referencing Soroban's
  100M per-transaction CPU instruction limit.
- Add BatchError::BatchTooLarge (code 410) for typed pre-flight rejection.
- Add pre-flight check in batch_payout_internal that fires before any
  token transfer.
- Add test coverage for boundary values (exact limit, limit+1, 2x limit)
  and balance-invariant verification.
- Add CI workflow for program-escrow unit + integration tests.
- Fix multiple brace-matching bugs that left functions unclosed or
  nested inside other functions.
* test: add HalfOpen transition coverage to circuit breaker test suite

* program-escrow: add query_program_delegates API and delegate audit test

* feat: add query_all_delegates permission audit function via view facade

* program-escrow: add schema_version to PauseStateChangedV2 and set emission schema_version
…de (Jagadeeshftw#1338)

* test: add HalfOpen transition coverage to circuit breaker test suite

* program-escrow: add query_program_delegates API and delegate audit test

* feat: add query_all_delegates permission audit function via view facade
…shftw#1337)

- Replace string panics with panic_with_error! using ContractError::InvalidFeeRate
- Add boundary-value tests for lock_fee_rate and payout_fee_rate in fee_enforcement module
- Create docs/program-escrow/fee-management.md documenting fee configuration and cap

Closes Jagadeeshftw#1280

Co-authored-by: daddygokings-art <daddygokings@gmail.com>
* implemented the publish_program

* fixed errors

* fixed test errors

---------

Co-authored-by: Jagadeesh <jagadeesh26062002@gmail.com>
…agadeeshftw#1336)

* test: add HalfOpen transition coverage to circuit breaker test suite

* program-escrow: add query_program_delegates API and delegate audit test

---------

Co-authored-by: Jagadeesh <jagadeesh26062002@gmail.com>
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.

Tune MAX_BATCH_SIZE constant based on Soroban instruction limit constraints

9 participants