Skip to content

feat: add contract and horizon validation#1

Open
abore9769 wants to merge 1 commit intomainfrom
issue-052-implement-contract-address-validation-and-horizo
Open

feat: add contract and horizon validation#1
abore9769 wants to merge 1 commit intomainfrom
issue-052-implement-contract-address-validation-and-horizo

Conversation

@abore9769
Copy link
Copy Markdown
Owner

Overview

Validate contract addresses and verify configured Horizon endpoints are reachable before deployment.

Changes

  • Contract Address Validation: Validates Soroban contract addresses (56-char, 'C' prefix, base32 charset)
  • Horizon Connectivity Checks: Tests Horizon and Soroban RPC endpoints with configurable timeouts
  • Error Classification: Distinguishes validation errors, transient errors, and configuration errors
  • Async Endpoint Validation: Pre-deployment verification with actionable guidance

Implementation

Files Created

  • apps/web/src/lib/stellar/contract-validation.ts
  • apps/web/src/lib/stellar/contract-validation.test.ts (268 lines)
  • apps/web/src/lib/stellar/endpoint-connectivity.ts
  • apps/web/src/lib/stellar/endpoint-connectivity.test.ts (391 lines)
  • apps/web/src/lib/customization/validate-endpoints.test.ts (279 lines)

Files Modified

  • apps/web/src/lib/customization/validate.ts (+94 lines)
  • apps/web/src/lib/customization/validate.test.ts (+64 lines)

Error Types

  • VALIDATION: Invalid URL format (don't retry)
  • TRANSIENT: 408, 429, 500, 502, 503, 504 (retry)
  • CONFIGURATION: 404, 401, 403 (fix config)

Test Coverage

✅ 938 lines of tests (unit, integration, property-based)
✅ Contract validation (format, length, prefix, charset)
✅ Endpoint checks (Horizon, Soroban RPC, combined)
✅ Mock HTTP responses (various status codes)
✅ Timeout and error scenarios
✅ Edge cases and error differentiation

Usage

const result = validateCustomizationConfig(config);
const endpoints = await validateStellarEndpoints(config);

Resolves StellerCraft#52

- Implement Soroban contract address format validation (56-char base32, 'C' prefix)
- Add network connectivity checks with configurable timeouts (default 5s)
- Distinguish between validation errors, transient errors, and configuration errors
- Provide actionable error messages for deployment troubleshooting
- Comprehensive unit and integration tests with property-based testing
- Support async endpoint validation for pre-deployment verification

Resolves issue StellerCraft#52
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.

Issue 052: Implement contract address validation and Horizon connectivity checks

1 participant