feat(contracts): fix FIFO withdrawal queue persistence on-chain by returning Ok(0) instead of reverting Err#870
Open
Amas-01 wants to merge 2 commits into
Open
Conversation
…turning Ok(0) instead of reverting Err
|
@Amas-01 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.
Pull Request Description
Overview
This PR implements Cross-Strategy Exposure Cap Validation (#741) and the Emergency Guardian Role (#739) for the
YieldVault-RWAcontract suite. It also resolves critical regressions in the FIFO withdrawal queue integration tests, ensuring all state transitions and storage modifications are safely persisted on-chain.Closes
Changes Made
1. Core Contract Changes (
contracts/vault/src/lib.rs)enqueue_withdrawal_for_liquidityto returnOk(0)instead ofErr(VaultError::WithdrawalQueued). Returning anErrin Soroban causes a full transaction rollback, which was discarding the enqueued queue state. ReturningOk(0)successfully persists the queue entry to storage.no_stdCompliance: Cleaned up internal debugstd::println!statements from the contract to ensure successful compilation under#![no_std].2. Test Suite Enhancements (
contracts/vault/src/test.rs)test_withdrawal_queue_processes_fifo_when_liquidity_returnsandtest_withdrawal_queue_stops_when_liquidity_insufficient_for_headto expectOk(Ok(0))on queueing.450USDC to ensure exactly enough liquidity (500USDC) is available to process the first queued withdrawal while blocking the second, successfully verifying the strict FIFO queue termination behavior.Verification & Testing
All integration and unit tests built and ran successfully.
cargo testOutput summary: