Skip to content

feat: refuse a lane with lock-release liquidity on both ends - #42

Open
aelmanaa wants to merge 1 commit into
mainfrom
feat/refuse-lock-and-lock
Open

aelmanaa wants to merge 1 commit into
mainfrom
feat/refuse-lock-and-lock

Conversation

@aelmanaa

Copy link
Copy Markdown
Contributor

This pull request introduces a guard to prevent misconfiguration of cross-chain token lanes where both ends use lock-release pools—a setup that causes liquidity to drain in one direction and requires manual rebalancing. The changes add explicit refusal (with an override) to the ApplyChainUpdates script, update documentation to clarify the hazard and workflow, and add tests to enforce and verify the new logic.

Key changes:

Lock-and-lock lane prevention logic

  • Added a _refuseLockAndLock function to ApplyChainUpdates.s.sol that checks if both ends of a lane are lock-release pools and refuses to apply the lane unless ACK_LOCK_AND_LOCK=true is set, or warns in safe mode. This prevents accidental draining of liquidity. [1] [2] [3]
  • Implemented lockAndLockReasonForTest for testability and added a helper to check deployment keys for lock-release pools. [1] [2]
  • Updated RegistryWriter with _activeDeploymentKey to extract the pool type/version from a peer's project store, enabling the guard to function.

Documentation updates

  • Updated operational docs (liquidity.md, pools.md, lanes-and-remotes.md, troubleshooting/index.md) to explain the lock-and-lock hazard, refusal behavior, override mechanism, and relevant environment variables. [1] [2] [3] [4]
  • Added ACK_LOCK_AND_LOCK to the list of environment variables in both the primitive and its catalog entry. [1] [2]

Testing

  • Added ApplyChainUpdatesLockAndLock.t.sol test contract to verify the new refusal logic for various peer pool configurations, including positive (refusal) and negative (allow) cases.

These changes collectively ensure that dangerous lock-and-lock lanes are not created by accident, and provide clear instructions, override options, and test coverage for this behavior.

@aelmanaa
aelmanaa requested review from a team as code owners September 22, 2026 11:59
@github-actions

Copy link
Copy Markdown

👋 aelmanaa, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

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