feat: improve stableswap pool share mint/burn process#1482
Conversation
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
|
Crate versions that have been updated:
Runtime version has been increased. |
Weight Diff Report
35 extrinsic(s) changed across 2 pallet(s). New: 0. Removed: 0. pallet_omnipool_liquidity_mining
pallet_stableswap
Threshold: ±10%. Base |
cl0w5
left a comment
There was a problem hiding this comment.
Can you add an end-to-end regression / integration test covering the whole flow?
placeOrder → settleOtcOrder → router → StableSwap → OTC cleanup
| T::Currency::withdraw(pool_id, who, amount, ExistenceRequirement::AllowDeath) | ||
| } | ||
|
|
||
| fn debug_assert_issuance_in_sync(pool_id: T::AssetId) { |
There was a problem hiding this comment.
This will still trigger as a false positive (?) during OTC settlement:
- OTC temporarily mints M LP tokens.
- The token system’s total issuance increases by M.
- StableSwap’s new internal ShareIssuance intentionally does not increase.
- OTC routes the received assets through StableSwap to buy LP tokens.
- StableSwap checks this debug assertion which fails because: total_issuance = ShareIssuance + M
Only later would OTC burn the temporary M tokens and bring both counters back into sync. The assertion runs before that cleanup can happen.
The panic from the debug assert will also prevent an end-to-end regression test
There was a problem hiding this comment.
i have prepare a change in the settlemtn to not use mint at all.
There was a problem hiding this comment.
mby this should be real assert, not just debug
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
|
Quick benchmark at commit 9fe44b6 has been executed successfully. |
This PR reworks stable pool shares mint and burn process.
instead of relying on total issuance - stableswap tracks issuance of each pool separately.
The goal of this rework is to harden security of the stableswap implementation, despite the need of extra storage.