Skip to content

Add test snapshots for premium payment scenarios and gas benchmarks#53

Merged
Baskarayelu merged 1 commit intoRemitwise-Org:mainfrom
Obiajulu-gif:feature/gas_optimization
Jan 30, 2026
Merged

Add test snapshots for premium payment scenarios and gas benchmarks#53
Baskarayelu merged 1 commit intoRemitwise-Org:mainfrom
Obiajulu-gif:feature/gas_optimization

Conversation

@Obiajulu-gif
Copy link
Contributor

Closes #49
This pull request introduces significant improvements to gas efficiency and benchmarking for the bill_payments, insurance, and family_wallet contracts. The main changes focus on optimizing how collections are iterated (eliminating unnecessary scans and gap handling), adding deterministic gas benchmark tests, and clarifying documentation for gas measurement methodology.

Gas Efficiency Improvements:

  • Refactored iteration over collections in bill_payments and insurance contracts to use direct map iteration (for (_, item) in map.iter()) instead of scanning by index, eliminating the need to handle gaps and improving performance. [1] [2] [3] [4] [5] [6]

Gas Benchmarking:

  • Added new deterministic gas benchmark tests for bill_payments and family_wallet contracts, providing worst-case scenario measurements and printing CPU/memory usage for key methods. [1] [2]
  • Updated the README.md to document the gas benchmarking methodology and provide instructions for running the new benchmarks.

Family Wallet Multi-Sig Improvements:

  • Refactored multi-signature configuration in family_wallet to improve role checking logic and reduce redundant lookups, introducing the is_owner_or_admin_in_members helper for clarity and efficiency. [1] [2] [3]

Testing:

  • Added a new snapshot test for negative coverage in insurance policy creation to improve test coverage.

- Created test snapshots for paying premiums on inactive and nonexistent policies, capturing expected failures and error handling.
- Added a successful payment test snapshot for active policies, ensuring correct premium processing.
- Implemented gas benchmarks for insurance and remittance split contracts, measuring performance under worst-case scenarios.
- Optimized the retrieval of savings goals by iterating directly over stored goals instead of using an ID range.
@Obiajulu-gif
Copy link
Contributor Author

@Baskarayelu review the code and remember to allocate point. thank you

@Obiajulu-gif
Copy link
Contributor Author

@1nonlypiece review my code and also allocate compliment point to it. thank you

@Baskarayelu Baskarayelu merged commit 82786bf into Remitwise-Org:main Jan 30, 2026
2 checks passed
@Obiajulu-gif
Copy link
Contributor Author

@Baskarayelu thank you so much... Can you help me with compliments please 🥺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gas Optimization

2 participants