Skip to content

feat: 🎸 add unlockInstruction to complete the lock/relock cycle - #1630

Open
prashantasdeveloper wants to merge 1 commit into
developfrom
feat/unlock-instruction
Open

feat: 🎸 add unlockInstruction to complete the lock/relock cycle#1630
prashantasdeveloper wants to merge 1 commit into
developfrom
feat/unlock-instruction

Conversation

@prashantasdeveloper

Copy link
Copy Markdown
Contributor

Description

  • Add Instruction.unlockForExecution — a mediator-only procedure that moves an instruction from LockedForExecution back to Pending (mirrors the existing lockForExecution, dispatching settlement.unlockInstruction on-chain).
  • Add Instruction.getRelockStatus() — reads unlockedTimestamp / instructionRelockCount storage plus the relockCooldown / maxRelockCount chain consts, returning { unlockedAt, relockCount, maxRelockCount, cooldownEndsAt } so callers can show/enforce the cooldown before relocking.
  • Adds assertInstructionValidForUnlocking guard (mirrors assertInstructionValidForLocking, validating LockedForExecution status).

This completes the lock/relock cycle — lockForExecution existed already, but there was no way to unlock a locked instruction back to Pending.

Breaking Changes

NA

JIRA Link

Checklist

  • Unit tests for the new procedure (unlockInstructionForExecution.ts), the new guard (utils.ts), and the new entity methods (Instruction/__tests__/index.ts)
  • yarn test, tsc --noEmit, and eslint all pass
  • Verified live end-to-end against a real v8 chain (polymesh:8.0.2-testnet-debian via polymesh-dev-env docker compose): created a SettleAfterLock instruction with a mediator, locked it, confirmed getRelockStatus() before/after unlock, unlocked it back to Pending, and confirmed the chain rejects an immediate relock during the cooldown window

@prashantasdeveloper
prashantasdeveloper requested a review from a team as a code owner July 30, 2026 12:21
`Instruction.unlockForExecution` moves a `LockedForExecution` instruction
back to `Pending`, and `Instruction.getRelockStatus` exposes the mediator's
last unlock timestamp, relock count, and the on-chain relock cooldown
window, so callers can implement the full lock/relock flow that
`lockForExecution` alone couldn't complete.
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant