Issue 369#608
Merged
Merged
Conversation
|
@sochima2 is attempting to deploy a commit to the mAzI's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@sochima2 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.
close #369
Description
Added funded_ledger_seq: u32 to EscrowJob to record the ledger sequence at deposit time and persisted it in contracts/escrow/src/lib.rs during deposit by setting job.funded_ledger_seq = env.ledger().sequence();.
Implemented fn assert_not_same_ledger_as_funding(env: &Env, job: &EscrowJob) -> Result<(), EscrowError> and integrated this guard into funding-followup flows by calling it from release_milestone, release_funds, open_dispute, raise_dispute, and refund to block same-ledger state changes.
Require admin authentication during initialize via admin.require_auth() to ensure initialization is a strictly authenticated state-modifying action.
Replace naive timestamp arithmetic in create_job with checked operations (checked_mul / checked_add) to prevent overflow when computing expires_at and return an appropriate EscrowError::ArithmeticOverflow on failure.
Added public getters: get_funding_settlement_ledgers, get_remaining_balance, and get_active_escrow_params to expose live escrow parameters and remaining balances for off-chain consumers and indexers.
Kept existing checked arithmetic in milestone summation and release flows (checked_add) and retained reentrancy guards; adjusted small logging call formatting for consistency.
Testing
Ran formatting with cargo fmt --all which completed successfully.
Ran unit tests with cargo test -p escrow and all tests passed: 46 passed; 0 failed (test suite completed successfully).
The modified contract builds and the escrow test binary executed successfully in the test profile during CI-local validation.