feat: harden remittance summary consistency for partial data#421
Open
Miracle656 wants to merge 2 commits intoRemitwise-Org:mainfrom
Open
feat: harden remittance summary consistency for partial data#421Miracle656 wants to merge 2 commits intoRemitwise-Org:mainfrom
Miracle656 wants to merge 2 commits intoRemitwise-Org:mainfrom
Conversation
…stency Resolved conflicts: - Cargo.toml: use pinned soroban-sdk =21.7.7 in dev-dependencies - remitwise-common/Cargo.toml: use pinned soroban-sdk =21.7.7 - reporting/src/lib.rs: remove extraneous blank line before #[contract] - reporting/src/tests.rs: adopt upstream import style (use super::*) and deduplicate create_test_env helper
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.
Provide Graceful Degradation for Remittance Summary Queries (#315)
🎯 Objective
Resolves #315 by hardening the
ReportingContract::get_remittance_summaryquery against partial or missing data from external source contracts.Prior to this PR, get_remittance_summary would result in a hard panic (
panic!()orunwrap()) if any of the target contracts (savings, bills, insurance, or split config) were unconfigured, temporarily unresponsive, or threw an error.🛠️ Changes Implemented
DataAvailabilityEnum: Added a newDataAvailabilityfield (Complete,Partial,Missing) to the RemittanceSummary struct.try_get_splitandtry_calculate_splitfor external cross-contract calls. If a cross-contract request errors out, the summary creation continues and degrades gracefully.DataAvailability::Missingrather than blowing up entirely.remitwise-commonfromsoroban-sdk20.0.0 to 21.0.0 and added explicited25519-dalektrait versions. This fixes previous broken Cargo.lock dependency resolving bottlenecks across the repository.🧪 Testing and Verification
Achieved >95% test coverage for the new feature pathways.
create_test_envtest fixture withEnv::default().env.mock_all_auths()where appropriate to actually reach our inner business layer logic.DataAvailability::Missingstate).DataAvailability::Partialstate).cargo test -p reporting.🛡️ Security Implications
Clients executing summary queries are now responsible for inspecting the
data_availabilityindicator. The presence ofPartialorMissingmeans the returned array is not exhaustively complete. This ensures the frontend doesn't hang or crash entirely if the blockchain RPC stutters, minimizing overall DoS susceptibility for the platform.Closes #315