Skip to content

Contracts: Add RWA shipment status transition guards #803

Description

@Junirezz

Context

YieldVault tracks tokenized RWA cargo via ShipmentStatus (Pending, InTransit, Delivered, Cancelled) with admin-only add_shipment and update_shipment_status.

Problem / Gap

update_shipment_status allows arbitrary transitions (e.g., Delivered → Pending) with no lifecycle rules. Cancelled shipments can be moved back to InTransit, undermining auditability of real-world asset backing.

Proposed approach

  • Define an allowed transition matrix (e.g., Delivered and Cancelled are terminal).
  • Return a typed error instead of silently mutating lists on invalid transitions.
  • Add tests for each valid/invalid transition and list index consistency after updates.

Files/areas affected

  • contracts/vault/src/lib.rs (update_shipment_status, ShipmentStatus)
  • contracts/vault/src/test.rs (test_update_shipment_full_lifecycle_statuses)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions