Skip to content

[bug] escrow-vault: refund_escrow sets refunded_amount = refund (assignment) instead of += (accumulation) — inconsistent with release functions #727

Description

@gboigwe

Summary

release_escrow and release_partial both use accumulating assignment:

escrow.released_amount += locked; // accumulates

But refund_escrow uses direct assignment:

escrow.refunded_amount = refund; // ❌ overwrites, not accumulates

While the current code flow makes double-calling refund_escrow impossible (state becomes Refunded and locked_amount = 0), this inconsistency breaks the invariant that amount = released_amount + refunded_amount + locked_amount if future code ever allows incremental refunding (e.g., partial refund after partial release).

Location

contracts/escrow-vault/src/lib.rs, refund_escrow

escrow.refunded_amount = refund; // ❌ should be +=

Fix

escrow.refunded_amount += refund;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions