feat: implement metadata security, fund recovery, unfunded escrows and upgrade timelock#216
Merged
Merged
Conversation
…d upgrade timelock
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.
Overview
This PR addresses four critical issues across security, logic, and UX by enhancing the
EscrowContractcore logic and storage schema.1. Metadata Security & Authorization
Updated the metadata reveal functions to require explicit authorization. Only the buyer, seller, or arbitrator of a specific escrow can now trigger these verifications, preventing unauthorized off-chain data leaks.
Closes #210
2. Recovery of Unallocated Funds
Implemented a fund-tracking system using
TotalLockedandTotalStakedkeys. Added asweep_unallocated_fundsfunction that allows the admin to recover any tokens sent to the contract address that are not associated with active escrows or stakes.Closes #212
3. Support for Unfunded Escrows
Upgraded the
Escrowstruct to Version 3, adding afundedboolean. This enables a two-step creation process where an escrow can be initialized without funds and either funded later viafund_escrowor cleaned up if it remains stale for 24 hours.Closes #213
4. WASM Upgrade Timelock Enforcement
Renamed the upgrade execution method to
execute_upgradeto reflect its governance role and ensured that the timelock ETA is strictly validated before any contract update is performed.Closes #215
Technical Changes
CURRENT_ESCROW_VERSIONto3and addedfunded: booltoEscrow.create_unfunded_escrow,fund_escrow,cancel_unfunded_escrow, andsweep_unallocated_funds.require_auth()and role-based checks to metadata verifications.get_stored_escrowto automatically migrate legacy (v1/v2) escrows to the new v3 schema.