Repository navigation
fix: resolve security, validation, reentrancy, and batching issues (#681, #682, #683, #684) - #716
Merged
nonsobethel0-dev merged 4 commits intoOct 20, 2026
Conversation
…ctions pattern - Protect pool entry points with RAII ReentrancyGuard - Follow Checks-Effects-Interactions (CEI) across token transfer points - Add comprehensive reentrancy tests in test_reentrancy.rs - Document reentrancy protection security pattern in REENTRANCY_GUARD.md Resolves Parashield-Protocol#684
- Maintain an on-chain category registry with default approved categories - Add admin methods to register, unregister, and query categories - Reject product creation with unregistered categories - Add integration tests for category registry and validation - Document category registry and governance in CATEGORY_REGISTRY.md Resolves Parashield-Protocol#682
- Enforce challenge period before stake withdrawal is permitted - Reject early withdrawal attempts before challenge period expiry - Apply slashing deductions to pending withdrawal requests during challenge period - Void withdrawal request on full slash - Add integration tests for stake withdrawal challenge period and slashing - Document staking and slashing rules in SLASHING_RULES.md Resolves Parashield-Protocol#681
- Add batch_verify_fresh to OracleVerifier for single-call multi-reading evaluation - Update IOracleVerifier client interface with batch verification - Implement batch_verify_oracle_readings and process_multi_reading_claim in ClaimsProcessor - Add ReadingsBatchVerified event - Add integration test and benchmark demonstrating instruction cost reduction - Document batch verification architecture in BATCH_ORACLE_VERIFICATION.md Resolves Parashield-Protocol#683
|
@Ultra-Tech-code 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.
Description
This PR resolves 4 assigned issues across
risk-pool,policy-engine,oracle-verifier, andclaims-processorfollowing atomic commits, strict validation, and comprehensive test coverage.Closes #684
Closes #683
Closes #682
Closes #681
Detailed Changes
1. RiskPool: USDC Token Reentrancy Protection (#684)
ReentrancyGuardinrisk-pool/src/lib.rsusingStorageKey::ReentrancyGuardandError::Reentrancy = 47.deposit,withdraw,receive_premium,claim_yield,claim_exit,emergency_withdraw,execute_admin_withdrawal).contracts/risk-pool/src/test_reentrancy.rs.docs/REENTRANCY_GUARD.md.2. PolicyEngine: Product Category Registry Validation (#682)
policy-engine/src/lib.rsinitialized with default categories (crop,flight,disaster,health,defi).register_category,unregister_category,is_category_registered,get_registered_categories.create_product: rejects unregistered categories withError::InvalidCategory = 36.contracts/policy-engine/tests/category_registry.rs.docs/CATEGORY_REGISTRY.md.3. OracleVerifier: Stake Withdrawal Challenge Period & Slashing (#681)
set_challenge_period).request_stake_withdrawalfollowed bywithdraw_stakeafterunlock_at.Error::ChallengePeriodNotElapsed = 33.slash_oracleto deduct penalties directly from pending withdrawal requests during the challenge period.contracts/oracle-verifier/tests/stake_challenge.rs.docs/SLASHING_RULES.md.4. ClaimsProcessor: Batch Oracle Verification for Complex Claims (#683)
batch_verify_freshtoOracleVerifierto evaluate multiple queries in a single invocation.IOracleVerifiertrait and implementedbatch_verify_oracle_readingsandprocess_multi_reading_claiminClaimsProcessor.ReadingsBatchVerifiedevent emission.contracts/claims-processor/tests/batch_oracle_verification.rsconfirming CPU instruction savings.docs/BATCH_ORACLE_VERIFICATION.md.Verification & Testing
All test suites across each contract pass with 0 errors:
cargo test -p parashield-risk-pool test_reentrancy(2/2 passed)cargo test -p parashield-policy-engine --test category_registry(4/4 passed)cargo test -p parashield-oracle-verifier --test stake_challenge(4/4 passed)cargo test -p parashield-claims-processor --test batch_oracle_verification(2/2 passed)