Skip to content

feat(contracts): Advanced Soroban Logic Part 48 - Structured Errors, Events & State Machine Validation#825

Open
Junman140 wants to merge 4 commits into
Gildado:mainfrom
Junman140:feat/issue-193-advanced-soroban-logic-part-48
Open

feat(contracts): Advanced Soroban Logic Part 48 - Structured Errors, Events & State Machine Validation#825
Junman140 wants to merge 4 commits into
Gildado:mainfrom
Junman140:feat/issue-193-advanced-soroban-logic-part-48

Conversation

@Junman140
Copy link
Copy Markdown
Contributor

@Junman140 Junman140 commented May 27, 2026

Closes #638


Summary

Implements Advanced Soroban Logic Part 48 (Issue #193) across four Soroban smart contracts.

Changes

asset_path_payment (Bug fixes + test coverage):

  • Fixed 4 missing .publish(&env)\ calls on contract events (PathPaymentInitiated, PathPaymentCompleted, PathPaymentFailed x2)
  • Replaced unused \Bytes\ import with \Address\ in \PathHop\ struct
  • Added 28 comprehensive unit tests covering full payment lifecycle, slippage protection, withdrawal, event emission, and edge cases

revenue_split (Structured errors + events):

  • Added \RevenueSplitError\ enum with 7 variants replacing all \panic!()\ calls
  • Added \RevenueDistributedEvent, \RecipientsUpdatedEvent, \AdminChangedEvent\
  • All public functions now return \Result<_, RevenueSplitError>\
  • Updated all 20 tests to use \ ry_*\ error assertions

cross_asset_payment (State machine validation):

  • Added \CrossAssetPaymentError\ enum with 10 variants
  • Implemented \�alidate_status_transition()\ enforcing: pending → process/complete/failed, process → complete/failed, complete/failed are terminal
  • Replaced all \panic!()\ with structured \Result\ returns
  • Added 43 tests including state machine enforcement and edge cases

smart_wallet (Contract events):

  • Added \WalletInitializedEvent, \SignerAddedEvent, \SignerRemovedEvent, \ThresholdChangedEvent\
  • 12 tests passing including event verification

Verification

  • \cargo build --workspace\ - compiles with zero errors
  • \cargo test --workspace\ - 326 tests pass (28 + 96 + 43 + 43 + 20 + 12 + 84) with zero failures

Junman140 added 4 commits May 27, 2026 13:37
…ty and theming

- CSVUploader: Replace alert() with inline error state and toast notifications
- CSVUploader: Replace hardcoded colors with CSS variable tokens for dark/light themes
- CSVUploader: Add keyboard accessibility (Tab/Enter/Space), ARIA roles, live regions
- CSVUploader: Add loading state with spinner, file type validation, and visual feedback
- CSVUploader: Use semantic heading hierarchy and proper table aria labels
- FormField: Add useId for unique description IDs, aria-required, sr-only required text
- FormField: Replace hardcoded Tailwind classes with CSS variable tokens
- FormField: Add role=alert with aria-live=assertive for error messages
- Settings: Add themed sections for Language, Appearance, and Notifications
- Settings: Add dark/light mode toggle with animated switch and aria-pressed
- Settings: Improve select dropdown with custom chevron and focus ring
- Settings: Add proper section labels, headings hierarchy, and ARIA regions
- ComponentErrorBoundary: Replace @stellar/design-system with lucide-react icons
- ComponentErrorBoundary: Add role=alert, aria-live=assertive, and focus management
- ComponentErrorBoundary: Use CSS variable tokens for theme-aware error styling
- PageErrorFallback: Replace SDS Button/Icon with lucide-react and native elements
- PageErrorFallback: Add skip-to-content link for keyboard accessibility
- PageErrorFallback: Add role=alert and aria-live for screen reader announcements
- PageErrorFallback: Improve focus ring on links and buttons
- All changes maintain WCAG 2.1 AA compliance with 44x44px touch targets

Components updated:
  frontend/src/components/CSVUploader.tsx
  frontend/src/components/FormField.tsx
  frontend/src/components/ComponentErrorBoundary.tsx
  frontend/src/components/PageErrorFallback.tsx
  frontend/src/pages/Settings.tsx

Tests added:
  frontend/src/components/__tests__/CSVUploader.test.tsx
  frontend/src/components/__tests__/FormField.test.tsx
  frontend/src/components/__tests__/ComponentErrorBoundary.test.tsx
  frontend/src/components/__tests__/PageErrorFallback.test.tsx
  frontend/src/__tests__/Settings.test.tsx

Closes Gildado#219
…9 (Issue Gildado#194)

- Add structured ContractError enum replacing bare panics
- Add admin governance model with set_admin and get_admin
- Implement emergency pause/circuit breaker using Instance storage
- Add partial_clawback for reducing grant without deactivating
- Add extend_vesting for prolonging vesting duration
- Add new events: PartialClawbackExecutedEvent, VestingScheduleExtendedEvent,
  ContractStatusChangedEvent
- Enhance VestingInitializedEvent with admin and clawback_admin fields
- Update all test suites with comprehensive tests for new features
- Add README.md with full API documentation
- 84 tests pass, zero clippy warnings, wasm32 build succeeds
…- Advanced Soroban Logic Part 50)

Introduces the MilestoneEscrow contract that allows senders to deposit
funds released to beneficiaries only upon verifier-approved milestones.

Key features:
- Multi-milestone escrow with per-milestone approval/release flow
- Verifier role authorizes milestone completion before funds unlock
- Sender can cancel escrow to recover unreleased funds
- Circuit breaker (pause/unpause) for emergency scenarios
- Admin transfer and full SEP-0034 metadata compliance
- Ledger replay protection on approve, release, and cancel operations
- TTL management for persistent storage entries
- Comprehensive event emission for all state transitions

43 unit tests covering initialization, metadata, admin governance,
circuit breaker, escrow creation, milestone approval/release, escrow
cancellation, queries, replay protection, and edge cases.
…idation across Soroban contracts (Issue Gildado#193 / Part 48)

- Fix asset_path_payment: add missing .publish() calls on 4 contract events,
  replace unused Bytes import with Address in PathHop, add 28 comprehensive
  unit tests covering full lifecycle, slippage, events, and edge cases.
- Add RevenueSplitError enum and RevenueDistributedEvent,
  RecipientsUpdatedEvent, AdminChangedEvent to revenue_split contract;
  replace all panic!() calls with structured Result returns.
- Add CrossAssetPaymentError enum and state machine validation to
  cross_asset_payment update_status; enforce terminal-state protection
  and invalid-transition rejection; replace panic!() with Result returns.
- Add WalletInitializedEvent, SignerAddedEvent, SignerRemovedEvent,
  ThresholdChangedEvent to smart_wallet contract.
- All 326 workspace tests pass with no compilation warnings in changed crates.
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@Junman140 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[CONTRACT] Issue #193 - Advanced Soroban Logic Part 48

1 participant