fix: resolve assigned issues #599, #600, #785, #786#858
Merged
Wilfred007 merged 1 commit intoJun 24, 2026
Merged
Conversation
[CONTRACT] Issue Gildado#599 - Optimize Storage Footprint for Large Employee Maps: - Add BatchStatusMap with 2-bit-per-status packing (16 statuses per u32) - Add archive_batch_statuses() to compress PaymentEntry keys into single map - Add get_archived_status() for reading from compressed storage - Add reduce_batch_ttl() for tiered TTL on old batch records - Add ARCHIVE_TTL constants for shorter retention of historical data [CONTRACT] Issue Gildado#600 - Implement Automatic Distribution Account Re-funding: - Add RefundConfig storage type and set_refund_config() admin function - Add check_and_refund() that transfers from funding source when below threshold - Add get_refund_config() and remove_refund_config() for config management - Emit AccountRefundedEvent and RefundConfigUpdatedEvent for audit trail - New error codes: AutoRefundFailed(26), RefundThresholdInvalid(27), RefundConfigNotSet(28), RefundNotNeeded(29) [BACKEND] Issue Gildado#785 - Backend Legacy Maintenance & Stability: - Add asyncHandler utility for consistent async error propagation to Express - Add HttpError class with factory methods for standardized error throwing - Standardize timeout error response to use apiErrorResponse format - Replace console.error with structured error messages in balance controller - Add preflightCheckWithAutoRefund to BalanceService for on-chain integration - Add withRetry wrapper around Stellar transaction submission in payroll worker [BACKEND] Issue Gildado#786 - Backend Legacy Maintenance & Stability: - Add stopWorkers() for graceful BullMQ worker shutdown - Integrate worker shutdown into server graceful shutdown sequence - Clear webhook retry interval on shutdown to prevent leaked timers - Add database migrations for auto-refund audit log and batch archive tracking All changes include comprehensive tests: - 121 contract tests pass (including 15 new tests) - 21 new backend unit tests pass Closes Gildado#599 Closes Gildado#600 Closes Gildado#785 Closes Gildado#786
|
@JamesVictor-O 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[CONTRACT] #599 - Optimize Storage Footprint for Large Employee Maps
archive_batch_statuses(): Admin function to compress PaymentEntry records into a BatchStatusMap after batch processing is complete, removing individual temporary storage keysget_archived_status(): Read payment status from compressed storage by batch_id and payment_indexreduce_batch_ttl(): Apply shorter TTL to old batch records for faster archivalARCHIVE_TTL_THRESHOLD(5,000) andARCHIVE_TTL_EXTEND_TO(50,000) for historical data vs active data[CONTRACT] #600 - Implement Automatic Distribution Account Re-funding
set_refund_config(): Admin configures distribution account, funding source, token, threshold, and refund amountcheck_and_refund(): Checks distribution account balance against threshold and automatically transfersrefund_amountfrom funding source when below thresholdget_refund_config()/remove_refund_config(): Config management functionsAccountRefundedEventandRefundConfigUpdatedEventfor on-chain audit trailAutoRefundFailed(26),RefundThresholdInvalid(27),RefundConfigNotSet(28),RefundNotNeeded(29)[BACKEND] #785 - Backend Legacy Issue - Maintenance & Stability
asyncHandlerutility: Wraps async Express handlers to forward rejected promises to the error middleware, eliminating uncaught promise rejections across all controllersHttpErrorclass: Factory methods (badRequest,unauthorized,notFound, etc.) for standardized error throwing that integrates with the centralized error handlerpreflightCheckWithAutoRefund(): New BalanceService method that attempts on-chain auto-refund before failing a preflight check, integrating with Issue [CONTRACT] Implement Automatic Distribution Account Re-funding #600's contract functionalitywithRetry()wrapper (3 attempts, exponential backoff) aroundStellarService.submitTransaction()in the payroll workerapiErrorResponseformat instead of ad-hoc JSON[BACKEND] #786 - Backend Legacy Issue - Maintenance & Stability
stopWorkers()function that cleanly closes all 4 BullMQ workers (payroll, notification, scheduler, tx-verification)clearInterval()on shutdown prevents timer leaks050_auto_refund_audit_log.sqland051_batch_archive_tracking.sqlfor off-chain trackingTest plan
cargo test -p bulk_payment) including 15 new testsCloses #599
Closes #600
Closes #785
Closes #786