refactor: implement contract constructor for initialization and updat… - #625
Merged
Cedarich merged 2 commits intoAug 28, 2026
Merged
Conversation
…e escrow deadline validation constraints.
|
@PeterOche 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! 🚀 |
…g contract IDs with underscores
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.
…e escrow deadline validation constraints.
fix(contract): resolve critical security vulnerabilities in deadline validation, initialization, multisig auth, and dispute resolution
Summary
This PR addresses four smart contract security vulnerabilities affecting escrow creation, role initialization, multisig threshold authorization, and dispute payouts.
Closes
Detailed Changes
1. Deadline Validation & Lead Time Enforcement (#623)
deadline > env.ledger().timestamp() + MIN_DEADLINE_LEAD_SECS(whereMIN_DEADLINE_LEAD_SECS = 60) in bothcreate_escrowandcreate_escrows_batch.Error::InvalidDeadline(12) when a deadline is in the past, equal to the current timestamp, or within the 60s minimum lead time window.docs/contract/ERRORS.mderror documentation.2. Atomic Constructor Initialization (#621)
initandinitializefunctions with Soroban__constructor(env, admin, operator, arbitrator, treasury, fee_bps).is_initialized(env) -> boolfor deploy verification and smoke checks.ensure_initialized(env)gate returningError::ContractNotInitialized(36) on operational entrypoints (create_escrow,create_escrows_batch,deposit_funds).3. Multisig Authorization & Signer Validation (#622)
approved_signers: Vec<Address>toEscrowandEscrowEntryV2.configure_multisigto require an explicitsignerslist and validatethreshold_amount >= 0,required_signatures > 0, andrequired_signatures <= signers.len()(returningError::InvalidSignerConfiguration37on invalid configuration).collect_signatureto addresses present inapproved_signers.release_milestoneandconfirm_deliveryrequire depositor authorization in addition to meeting the required approved signature count.4. Unfunded Escrow Dispute & Solvency Accounting (#620)
funded_amount: i128tracking onEscrowEntryV2andEscrow, populated upon successfuldeposit_funds.raise_disputestrictly toEscrowStatus::Active(rejectingCreatedunfunded escrows withError::InvalidEscrowStatus).invariants.rsstate transitions to disallowCreated -> Disputed.resolve_disputedistributable payouts tomin(nominal_outstanding, funded_outstanding), ensuring dispute resolution cannot spend pooled token balances belonging to other escrows.Breaking Changes & Migration Notes
(admin, operator, arbitrator, treasury, fee_bps). Calling separateinit()/initialize()methods is removed.configure_multisignow requires an explicitsigners: Vec<Address>parameter.Activestatus).Testing & Verification
All unit, invariant, and integration test suites pass cleanly:
cargo test --lib