feat: resolve issues #294, #308, #295, #297 - #393
Open
serverlessdomain-hash wants to merge 1 commit into
Open
Conversation
|
@serverlessdomain-hash 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! 🚀 |
Contributor
|
This PR (and its peer |
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 #294
Closes #308
Closes #295
Closes #297
Summary of Changes
1. Reputation-registry storage unchecked overflow in increment functions (#294)
+ 1arithmetic withsaturating_add(1)inincrement_streak,increment_completions, andincrement_defaultswithinpackages/reputation-registry/src/storage.rs.2. Staking UNBONDING_PERIOD_SECONDS getter and usage clarity (#308)
get_unbonding_period_seconds(&Env) -> u64inpackages/staking/src/contract.rsand exposedget_unbonding_period_seconds(Env) -> u64on theStakingcontract interface inpackages/staking/src/lib.rs.3. Reputation-registry negative payment amount cast protection (#295)
assert!(amount >= 0, "amount must be non-negative");and defensive bounds handlinglet safe_amount = amount.max(0);inrecord_on_time_paymentinpackages/reputation-registry/src/scoring.rs.amountparameters from being cast tou32and producing unexpectedly high volume bonuses.4. Escrow-swap storage refactoring to Map for O(1) performance (#297)
DataKey::SwapRequestsstorage fromVec<SwapRequest>toMap<u64, SwapRequest>inpackages/escrow-swap/src/contract.rs. Updatedcreate_swap,accept_swap,complete_swap,cancel_swap, andget_swapto use direct O(1) key lookups and writes, whileget_swaps()efficiently returnsswaps.values().Testing & Verification
get_unbonding_period_secondsin staking.reputation-registry,staking,escrow-swap) with all 51 tests passing cleanly.