Skip to content

Recovery functions desync the dedicated escrow storage key from shipment.escrow_amount #780

Description

@dinahmaccodes

Tier: Hard
Description: Every normal escrow-mutating path calls persist_shipment, which writes both storage::set_shipment and storage::set_escrow together. unlock_escrow, recover_shipment, clear_finalization, rollback_on_external_failure (recovery.rs:149-357) call storage::set_shipment directly and never storage::set_escrow, guaranteeing consistency::check_shipment_invariants (which diffs shipment.escrow_amount against storage::get_escrow) will flag a false EscrowMismatch the moment any of them runs. They also bypass validate_shipment_invariants entirely.
Files: contracts/shipment/src/recovery.rs:149-357, contracts/shipment/src/lib.rs:194-199
Tasks:

  • Route all four recovery functions through persist_shipment (or an equivalent that keeps storage::set_escrow in sync), and run validate_shipment_invariants
    Acceptance Criteria:
  • Running any recovery function never produces a false EscrowMismatch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions