fix: correct feeSource, OperationPriority constants, template versioning, broadcaster order tests - #726
Merged
Kingsman-99 merged 1 commit intoAug 29, 2026
Conversation
…ersioning, broadcaster order tests - fix(sponsorship): set SponsorshipUsed event feeSource to sponsor (tx.source) instead of the submitter. Added SponsorshipUsedEvent interface and submitSponsoredTransaction() which reads the sponsor directly from the transaction envelope with no additional Horizon calls. - feat(operationQueue): introduce OperationPriority constants (LOW=1, NORMAL=5, HIGH=10) replacing magic numbers throughout. The enqueue() method accepts an optional priority (defaults to NORMAL); _drain() sorts the pending queue in descending priority order before execution. OperationPriority is exported for callers. - feat(templateManager): add per-template version history. updateTemplate(id, content) increments an integer version (starting at 1) and retains all previous versions in memory. getTemplate(id, version?) returns a specific version or the latest when omitted. getTemplateHistory(id) exposes the full ordered history. No persistence layer changes. - test(broadcaster): add three message-ordering tests — in-order delivery, late subscribers miss past messages, mid-sequence unsubscribe stops future delivery only. - test: add test/sponsorshipEvent.test.ts, test/operationQueue.test.ts, test/templateManager.test.ts (34 new tests, all passing)
|
@agnesadah3-jpg 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
Four independent fixes across sponsorship, operationQueue, templateManager, and broadcaster.
fix(sponsorship): correct SponsorshipUsed event feeSource attribution
Bug:
feeSourcein theSponsorshipUsedevent was set to the submitter's address rather than the sponsor account.Fix: Added
SponsorshipUsedEventinterface andsubmitSponsoredTransaction(). ThefeeSourcefield is now read directly fromtx.source— whichbuildSponsoredOnboarding()always sets to the sponsor — with no additional Horizon calls required.feat(operationQueue): replace magic numbers with OperationPriority constants
Problem: Numeric literals
1,5,10used as priority levels were opaque and error-prone.Fix: Exported
OperationPriorityconst object (LOW=1,NORMAL=5,HIGH=10).enqueue()accepts an optionalpriorityparam (defaults toNORMAL);_drain()sorts the queue by descending priority before processing. No behaviour change for callers that omit the argument.feat(templateManager): add per-template version history
Problem:
updateTemplateoverwrote the previous version, making rollback and audit impossible.Fix:
updateTemplate(id, content)— increments an integer version (starting at 1), retains all prior versions in memory.getTemplate(id, version?)— returns a specific version or the latest when omitted; returnsnullfor missing/out-of-range.getTemplateHistory(id)— returns the full ordered history.No persistence layer changes; history is in-memory.
test(broadcaster): message ordering and subscriber lifecycle tests
Added three tests to
test/broadcaster.test.ts:Tests
test/sponsorshipEvent.test.tstest/operationQueue.test.tstest/templateManager.test.tstest/broadcaster.test.ts34 new tests passing.
npm test(98 tests) unaffected.closes #694
closes #695
closes #697
closes #696