Skip to content

lib.rs does not implement a circuit breaker for repeated payment failures — failing courses stay active #178

Description

@SYLVIANNORUKA

Description

If enroll() fails repeatedly for a specific course in contracts/hamplard/src/lib.rs (e.g., due to a broken token contract), there is no circuit breaker that automatically pauses the course after N consecutive failures. The course remains in Active status indefinitely, causing ongoing failed transactions.

Affected modules: contracts/hamplard/src/lib.rs

No circuit breaker allows persistently-failing courses to remain active, wasting student transaction fees.

Expected Behavior

Track consecutive enrollment failure counts per course. After a configurable threshold is exceeded, automatically transition the course to Paused and emit an alert event.

Tasks

  • Add per-course failure counter to contract storage.
  • Increment counter on enrollment failure and check against threshold.
  • Auto-pause course when threshold is exceeded and emit alert event.
  • Add tests for circuit breaker activation and reset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions