Skip to content

Fix/issues 1685 1688 - #1822

Merged
sanmipaul merged 4 commits into
astera-hq:mainfrom
Alaka-ibr:fix/issues-1685-1688
Nov 25, 2026
Merged

sanmipaul merged 4 commits into
astera-hq:mainfrom
Alaka-ibr:fix/issues-1685-1688

Conversation

@Alaka-ibr

Copy link
Copy Markdown

Fix issues #1685, #1686, #1687, #1688

This PR addresses four open issues related to test coverage gaps and a frontend bug preventing deposits.

Issue #1688: Fix frontend buildDepositTx missing min_rate argument

Closes #1688

Problem: The pool's deposit function now requires four arguments including min_rate, but buildDepositTx in frontend/lib/contracts.ts was still passing only three arguments. This caused simulation failures preventing investors from depositing from the invest page.

Solution: Updated buildDepositTx to pass xdr.ScVal.scvVoid() as the fourth argument to match the pool contract's signature.

Files changed:

  • frontend/lib/contracts.ts

Issue #1685: Add test coverage for referral contract functions

Closes #1685

Problem: set_pool, set_deposit_reward_bps, is_activated, and get_lifetime_reward_cap had no test coverage in contracts/referral/tests.

Solution: Created contracts/referral/tests/admin_tests.rs with comprehensive tests covering:

  • Authorization requirements for set_pool and set_deposit_reward_bps
  • BPS upper bounds validation (rejection of values > 10,000)
  • Activation state checks before and after first qualifying activity
  • Lifetime reward cap getter for both configured and unconfigured tokens

Files changed:

  • contracts/referral/tests/admin_tests.rs (new)
  • contracts/referral/Cargo.toml

Issue #1686: Add test coverage for access_control and share contracts

Closes #1686

Problem: Three functions lacked test coverage:

  • access_control::prune_proposal (pruning terminal vs pending proposals)
  • share::get_allowance_expiration (after approve with expiration and after expiry)
  • share::is_paused (pause state getter)

Solution: Added tests covering all three functions:

  • prune_proposal: tests for removing terminal proposals, rejecting pending proposals before expiry, and removing expired pending proposals
  • get_allowance_expiration: tests for retrieving expiration after approve and after ledger advances past expiry
  • is_paused: tests for default state and after pause/unpause operations

Files changed:

  • contracts/access_control/tests/lifecycle_tests.rs
  • contracts/share/tests/lib.rs

Issue #1687: Add integration test for full default pipeline

Closes #1687

Problem: No integration test exercised the complete permissionless default handling flow: pool.liquidate_invoice → insurance.file_claim → auction clearing.

Solution: Created contracts/tests/tests/liquidation_tests.rs with an end-to-end test covering:

  1. Invoice funding and default
  2. Liquidation via pool.liquidate_invoice
  3. Insurance claim filing via insurance.file_claim
  4. Insurance claim processing
  5. Auction creation and bidding
  6. Auction finalization
  7. Assertions on LP NAV, insurance reserve balance, and SME credit score at each step

Files changed:

  • contracts/tests/tests/liquidation_tests.rs (new)
  • contracts/tests/Cargo.toml

Testing

All new tests follow existing patterns and conventions. The referral, access_control, and share tests use the standard test setup helpers. The integration test uses the imported WASM artifacts approach consistent with other integration tests.

Alaka-ibr added 4 commits November 24, 2026 01:40
The pool's deposit now takes four arguments including min_rate, but
buildDepositTx was still sending three. This caused simulation failures
preventing investors from depositing from the invest page.
…activated, get_lifetime_reward_cap

Add tests for auth requirements, bps upper bounds validation,
and activation state after the first deposit.
…nce expiration and pause state

Cover terminal and pending proposal pruning, allowance expiration
after approve with expiration ledger and after expiry, and pause state
getter.
Cover the complete flow from funded invoice to default through
liquidation, insurance claim, and auction clearing. Asserts LP NAV,
insurance reserve, and SME credit score at each step.
@Alaka-ibr
Alaka-ibr requested a review from sanmipaul as a code owner November 24, 2026 05:41
@drips-wave

drips-wave Bot commented Nov 24, 2026

Copy link
Copy Markdown

@Alaka-ibr 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! 🚀

Learn more about application limits

@Alaka-ibr
Alaka-ibr force-pushed the fix/issues-1685-1688 branch from c352ff9 to c68c110 Compare November 24, 2026 05:44
@sanmipaul
sanmipaul merged commit 35261ad into astera-hq:main Nov 25, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants