Skip to content

[pox] assertion in -extend too late #3727

Open
@friedger

Description

@friedger

Describe the bug
When using pox-3 stack-extend or delegate-stack-extent with clarinet unit tests the calls fail with an ArithmeticUnderFlow runtime error.

The check to prevent this error comes AFTER the substraction causing the runtime error.

It is not clear to me whether this can happen on mainchain. If not, the assertion below can be removed:

;; first cycle must be after the current cycle
      (asserts! (> first-extend-cycle cur-cycle) (err ERR_STACKING_INVALID_LOCK_PERIOD))

Steps To Reproduce
Call stack-extend or delegate-stack-extend in a unit test
See for example https://github.com/friedger/clarity-stacking-pools/blob/963ebc92cf7cba4f74f6ce14734b50438a4bffd1/tests/pox-pools-1-cycle_flow_test.ts#L346

Expected behavior
Return error ERR_STACKING_INVALID_LOCK_PERIOD

Metadata

Metadata

Assignees

No one assigned

    Labels

    PoXProof-of-Transfer RelatedPoX-5iceboxIssues that are not being worked onship future

    Type

    No type

    Projects

    Status

    Status: 🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions