fix: bound chat storage (#655), decimal-safe wallet amounts (#657), raw-body webhook verification (#662), payments constructor integrity (#665) - #732
Merged
MaryammAli merged 2 commits intoAug 27, 2026
Conversation
…lockDash-Studios#665): bound chat storage, decimal-safe wallet amounts, raw-body webhook verification, payments constructor integrity Resolves all four Stellar Wave issues assigned to NickiM84: - BlockDash-Studios#655: Chat rooms/messages now live in bounded, paginated storage with retention and eviction (InMemoryChatRepository), and posting is restricted to room participants. - BlockDash-Studios#657: Wallet transfers and fees use integer minor-unit arithmetic instead of parseFloat, with documented half-up rounding at 5 decimals. - BlockDash-Studios#662: Payment webhook signatures are verified against the raw request bytes (rawBody) with timing-safe comparison before parsing; invalid signatures can never reach payment state mutation. - BlockDash-Studios#665: PaymentsService compiles cleanly — duplicate imports, the malformed constructor, and duplicated methods are removed, and unit tests cover required and optional collaborators. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@NickiM84 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.
Closes #655, closes #657, closes #662, closes #665.
Resolves all four issues assigned to @NickiM84 in the Stellar Wave program, in one PR.
#665 (BA-097) — Fix payment service dependency and constructor integrity
payments.service.ts(the file did not compile).DatabaseServiceis the single required collaborator;IContractAdapterandConfigServiceare injected once as optional collaborators, with declared properties (defaultTimeoutMs,webhookMaxRetries, etc.) and safe defaults.getRedemptionHistory/getAllCouponsmethods.payments.service.spec.tscovering construction with required and optional collaborators, webhook processing outcomes, and transaction-history pagination.#662 (BA-094) — Validate payment webhook signatures against the raw body
rawBody: trueinmain.tssoreq.rawBody(Buffer) is available.POST /payments/webhooknow verifies the HMAC-SHA256 signature over the raw request bytes viaSecurityService.verifyWebhookSignatureRaw(timing-safe) before any JSON parsing; invalid signatures throw 401 and never reachprocessPaymentWebhookEvent, so they can never mutate state.PaymentsModulenow importsSecurityModuleandMonitoringModuleso the controller's collaborators resolve.main.ts(useStaticCassets→useStaticAssets,PUTP→PUT) so the app can actually start.#657 (BA-089) — Use decimal-safe amount arithmetic
wallet.service.tsnow performs all transfers/fees/reconciliation in integer minor units (scale 1e-5, matching the existing 5-decimal display).parseFloatand float arithmetic removed; inputs with more than 5 decimals are rounded half-up; precision and rounding rules documented in the file header.wallet.service.spec.tsverifying drift-free addition (0.1 + 0.2 = 0.30000), fee accounting, half-up rounding, insufficient-balance rejection, and exact reconciliation differences.#655 (BA-087) — Bound chat room and message storage
ChatServicenow delegates storage toIChatRepository/InMemoryChatRepository, which enforcesmaxRooms,maxMessagesPerRoom, retention TTLs (roomTtlMs,messageTtlMs) with lazy pruning and oldest-first eviction.findMessagesByRoom/findAllRoomsare paginated (limit+ opaquecursor, newest-first for rooms); the controller passes query params through.chat.service.ts(brokencleanupIncompleteMessages/missing brace) that prevented compilation.chat.service.spec.tswith pagination, bounded-storage/eviction, retention, and authorization coverage.Verification
tsc --noEmitis clean for all touched files (remaining errors are pre-existing in unrelated modules owned by other issues).