fix: resolve issues #739 #740 #741 #742 - #840
Open
Ummi-001 wants to merge 1 commit into
Open
Conversation
…aChain#742 MettaChain#742 – Replace production unwrap/expect with graceful error propagation - staking: 8 .unwrap() calls on validators.get/delegations.get replaced with .ok_or(Error::ValidatorNotFound/Unauthorized/DelegationNotFound)? - oracle: first/last().unwrap() in get_history_statistics replaced with .map(...).unwrap_or / .ok_or(OracleError::PropertyNotFound)? - bridge: route.last().unwrap() replaced with .ok_or(Error::InvalidRequest)? - prediction-market: winning_direction.as_ref().unwrap() replaced with .ok_or(Error::MarketNotActive/OracleMarketNotResolved)? MettaChain#740 – Sweep workspace #[allow(unused_*)] band-aids - crowdfunding: removed #[allow(unused_assignments)] by eliminating dead loop; removed #[allow(unused_imports)] (imports are used) - prediction-market: removed blanket #[allow(unused_variables)] from mod tests - identity: removed #![allow(unused_variables)] crate-level attr; prefixed two genuinely-unused 'accounts' bindings with '_' MettaChain#741 – Introduce offset/limit pagination on property-management view messages - Added MAX_PAGE = 50 constant - get_leases_by_owner(owner, offset, limit) + count_leases_by_owner(owner) - get_disputes_paginated(offset, limit) + count_disputes() - get_expenses_paginated(offset, limit) + count_expenses() - get_maintenance_paginated(offset, limit) + count_maintenance() - Legacy single-item views unchanged (backwards-compatible) MettaChain#739 – Reuse price buffer allocations during oracle price ingestion - Added contracts/oracle/src/slot_vec.rs: SlotVec<T> wrapper that clears contents via reuse() while retaining heap allocation (capacity preserved) - collect_prices_batched: 4 intermediate Vec buffers converted to SlotVec - collect_prices_sequential: output Vec converted to SlotVec - Docstring on each function notes the reuse pattern
|
@Ummi-001 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
Resolves four issues in a single batch:
Closes #742
Closes #740
Closes #741
Closes #739
#742 – Replace production
unwrap/expectwith graceful error propagationFiles:
contracts/staking/src/lib.rs,contracts/oracle/src/lib.rs,contracts/bridge/src/lib.rs,contracts/prediction-market/src/lib.rs.unwrap()calls onvalidators.get/delegations.getreplaced with.ok_or(Error::ValidatorNotFound | Unauthorized | DelegationNotFound)?get_history_statistics):first()/last().unwrap()replaced with safe alternativesroute.last().unwrap()→.ok_or(Error::InvalidRequest)?winning_direction.as_ref().unwrap()→.ok_or(...)#740 – Sweep
#[allow(unused_*)]band-aidsFiles:
contracts/crowdfunding/src/lib.rs,contracts/prediction-market/src/lib.rs,contracts/identity/tests/identity_tests.rs#[allow(unused_assignments)]by deleting dead loop; removed#[allow(unused_imports)]#[allow(unused_variables)]frommod tests#![allow(unused_variables)]crate-level attr; prefixed genuinely-unusedaccountsbindings with_#741 – Introduce offset/limit pagination on property-management view messages
File:
contracts/property-management/src/lib.rsAdded
MAX_PAGE = 50bounded list views plus count helpers:get_leases_by_owner,count_leases_by_owner,get_disputes_paginated,count_disputes,get_expenses_paginated,count_expenses,get_maintenance_paginated,count_maintenance. All existing single-item getters unchanged — fully backwards-compatible.#739 – Reuse price buffer allocations during oracle price ingestion
Files:
contracts/oracle/src/slot_vec.rs(new),contracts/oracle/src/lib.rsSlotVec<T>: aVec<T>wrapper withreuse()(clears length, retains capacity) andinto_vec()collect_prices_batched: 4 intermediate buffers converted toSlotVeccollect_prices_sequential: output buffer converted toSlotVec