refactor(stellar): make confirmation polling budget configurable (#359)#501
Open
webthreejunkie-sudo wants to merge 1 commit into
Open
Conversation
- Add confirmationMaxRetries (default 15, clamped [1,300]) and confirmationDelayMs (default 1500ms, clamped [100,30000]) to transactionConfig, driven by VITE_TX_CONFIRMATION_MAX_RETRIES and VITE_TX_CONFIRMATION_DELAY_MS env vars - waitForTransaction reads from transactionConfig instead of hardcoded values; backward-compatible defaults preserved - Add readFiniteNumber helper for correct clamp-on-negative behaviour - Comprehensive tests: 20 config cases + 4 waitForTransaction cases - Document both vars in .env.example and docs/environment.md Closes Fluxora-Org#359
|
@webthreejunkie-sudo 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
Fixes #359.
waitForTransactioninsrc/lib/stellar/tx.tspreviously hardcodedmaxRetries = 15anddelayMs = 1500, causing false timeout failures on slow Testnet. Both values are now driven bytransactionConfigso they can be tuned per environment without code edits.Changes
src/lib/transactionConfig.tsreadFiniteNumberhelper — unlikereadPositiveNumber, it parses any finite number (including negative/zero) so downstream clamping works correctly.confirmationMaxRetries(default15, clamped[1, 300], envVITE_TX_CONFIRMATION_MAX_RETRIES).confirmationDelayMs(default1500ms, clamped[100, 30000], envVITE_TX_CONFIRMATION_DELAY_MS).confirmationMaxRetries × confirmationDelayMs.src/lib/stellar/tx.tswaitForTransactionsignature defaults replaced:15→transactionConfig.confirmationMaxRetries ?? 15,1500→transactionConfig.confirmationDelayMs ?? 1500.src/vite-env.d.tsVITE_TX_CONFIRMATION_MAX_RETRIESandVITE_TX_CONFIRMATION_DELAY_MSas optional string env vars..env.example/docs/environment.mdTests
transactionConfig.test.ts: 20 new cases covering valid reads, decimal floor, clamp-to-min (0 and negative), clamp-to-max, boundary values, and non-numeric fallback for both new fields.tx.test.ts: 4 new cases inwaitForTransaction — configurable confirmation budget: custom retries, custom delay timing, early success within budget, default 15-retry behaviour.Security
closes Make waitForTransaction maxRetries and delay configurable via transactionConfig #359