Closes #542 - #1025
Merged
greatest0fallt1me merged 1 commit intoJul 30, 2026
Merged
Conversation
|
@mansur-codes 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! 🚀 |
4 tasks
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 #542
Adds a write rate limit to
price_registry.rsso admins can't spam price updates faster than the configured cooldown. The limit kicks in after the first write; subsequent writes check the ledger sequence gap againstPRICE_WRITE_RATE_LIMITand reject withWriteRateLimitExceededif it's too soon.What changed
price_registry.rsholds the core logic:set_pricenow readsPriceRegistryLastWritefrom storage before writing, computes the sequence delta, and short-circuits if the gap is under the threshold. First write skips the check.get_priceandremove_priceare unchanged functionally;remove_priceclears the last-write entry alongside the price itself so a removal doesn't ghost-lock the registry.The other files were mostly cleanup that the implementation forced: duplicate
SettlementError,StorageKey, andPricevariants scattered acrosslib.rs,errors.rs, andtypes.rsgot consolidated.ClaimSimulationwas missing fromtypes.rsentirely.lib.rsnow exposes the three entrypoints viapub mod price_registryinstead of inlining them.Tests
All rate-limit behaviour is covered in
price_registry.rs: first write allowed, second write within cooldown rejected, write after cooldown passes, and the sequence-number edge at exactly the boundary. 126 tests pass. The 17 failures are pre-existing and unrelated to this issue; 16 aretest_ttl_bumpvariants blocked by soroban-sdk's newer contract-context restriction onextend_ttl(), and one is a Wasm-hash issue intest_upgrade_emits_upgraded_event.Notes
require_authis on every state-changing entrypoint. Math is overflow-safe throughout. Nounwrap()in production paths.