From 0123e4f3b3cac6f0f5b9662cb5059e4f4836d30a Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Wed, 29 May 2024 18:20:13 -0400 Subject: [PATCH 1/9] remove withdraw stake check --- sips/sip-remove-check.md | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sips/sip-remove-check.md diff --git a/sips/sip-remove-check.md b/sips/sip-remove-check.md new file mode 100644 index 0000000..e974301 --- /dev/null +++ b/sips/sip-remove-check.md @@ -0,0 +1,58 @@ +| SIP-Number | | +| ---: | :--- | +| Title | Allow StakedSui objects to be redeemed in same epoch | +| Description | Currently, a StakedSui object cannot be created and redeemed in the same epoch, which is an unncessary restriction. | +| Author | ripleys | +| Editor | | +| Type | Standard | +| Category | Framework | +| Created | 29-05-2024 | +| Comments-URI | | +| Status | | +| Requires | | + +## Abstract + +A StakedSui object cannot be created and redeemed in the same epoch due to [this](https://github.com/MystenLabs/sui/blob/main/crates/sui-framework/packages/sui-system/sources/sui_system_state_inner.move#L519) assertion. This is an unncessary restriction that reduces LST efficiency and prevents instant unstaking of LSTs. + +## Motivation + +### LST Inefficiency + +Suppose there exists an LST (lets call it xSUI) that holds 1 active StakedSui object. An active StakedSui object means that the object is currently earning rewards in this epoch. + +Now, a user comes and and mints some xSui. The LST now holds 1 active StakedSui object and 1 inactive StakedSui object. + +Now, in the same epoch, the user wants to redeem the xSUI for its underlying SUI. From the LST perspective, it is better to convert the inactive StakedSui object to Sui and give it to the user, as this object is not earning rewards yet. If the LST redeems part of the _active_ StakedSui object instead, it loses 1 epoch of rewards. + +### Prevents Instant Unstaking of entire xSUI supply. + +Definition: Instant unstaking is the ability to instantly convert xSUI to Sui. + +This restriction prevents any LST from implementing instant unstaking of the entire xSUI supply. Currently, vSUI and afSUI implement instant unstaking but only up to a certain amount, depending on the percentage of supply (vSUI) or the amount of Sui reserves (afSUI). + +Currently, if an LST allowed instant unstaking of the entire supply, a malicious user could mint a really large supply of xSUI, unstake it all, and leave the LST with only inactive StakedSui objects, which cannot be redeemed until the next epoch. While this is likely a costly attack due to fees, and isn't really an "attack" since there are no loss of funds, it's still very annoying as the instant unstaking feature is now broken until next epoch. + +Why is instant unstaking useful? + +- There is no longer a need to provide liquidity on xSui/{Sui, USDC, USDT} pairs on DEXes. Instead, all LSTs share the same Sui liquidity. This is a big benefit for new entrants to the LST space, as they no longer need to source millions of dollars to provide liquidity on their xSui pairs. +- LSTs that implement instant unstaking cannot depeg due to liquidity conditions. This makes the product much more usable across the defi ecosystem. In lending in particular, LST depegs are a big source of risk. + + +## Specification + +Remove [this](https://github.com/MystenLabs/sui/blob/main/crates/sui-framework/packages/sui-system/sources/sui_system_state_inner.move#L519) assertion. + +In [staking_pool.move](https://github.com/MystenLabs/sui/blob/mainnet-v1.2.1/crates/sui-framework/packages/sui-system/sources/staking_pool.move#L137), the `request_withdraw_stake` will need extra logic to handle the case where the StakedSui object was created in the current epoch. But that is very straightforward to do. + +## Rationale + +This change is fairly minor, and there's no other way to implement the suggestions in this SIP. + +## Backwards Compatibility + +No interfaces are changing here. + +## Security Considerations + +It's possible that existing LSTs depend on this check in their implementation. Their signoff is likely required to proceed with this SIP. From 47c170aefa0799732f7af1597aaa69dc1dc971a4 Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Thu, 30 May 2024 00:48:11 -0400 Subject: [PATCH 2/9] remember my name --- sips/sip-remove-check.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sips/sip-remove-check.md b/sips/sip-remove-check.md index e974301..04ae14d 100644 --- a/sips/sip-remove-check.md +++ b/sips/sip-remove-check.md @@ -2,7 +2,7 @@ | ---: | :--- | | Title | Allow StakedSui objects to be redeemed in same epoch | | Description | Currently, a StakedSui object cannot be created and redeemed in the same epoch, which is an unncessary restriction. | -| Author | ripleys | +| Author | ripleys <0xripleys@solend.fi> | | Editor | | | Type | Standard | | Category | Framework | From 89d1fb4ea528852030bf591065978f126458d21e Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Fri, 31 May 2024 12:26:25 -0400 Subject: [PATCH 3/9] minor edits --- sips/sip-remove-check.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sips/sip-remove-check.md b/sips/sip-remove-check.md index 04ae14d..992d0a7 100644 --- a/sips/sip-remove-check.md +++ b/sips/sip-remove-check.md @@ -36,7 +36,7 @@ Currently, if an LST allowed instant unstaking of the entire supply, a malicious Why is instant unstaking useful? - There is no longer a need to provide liquidity on xSui/{Sui, USDC, USDT} pairs on DEXes. Instead, all LSTs share the same Sui liquidity. This is a big benefit for new entrants to the LST space, as they no longer need to source millions of dollars to provide liquidity on their xSui pairs. -- LSTs that implement instant unstaking cannot depeg due to liquidity conditions. This makes the product much more usable across the defi ecosystem. In lending in particular, LST depegs are a big source of risk. +- LSTs that implement instant unstaking cannot depeg due to liquidity conditions. This makes the product much more usable across the defi ecosystem. LST depegs are a big source of risk in lending and any leveraged staking product. ## Specification @@ -55,4 +55,4 @@ No interfaces are changing here. ## Security Considerations -It's possible that existing LSTs depend on this check in their implementation. Their signoff is likely required to proceed with this SIP. +This change does not affect security. From 51e838c52a9a9c83fa16e67e4a9d92faef19d499 Mon Sep 17 00:00:00 2001 From: amogh-sui <152476631+amogh-sui@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:04:04 -0400 Subject: [PATCH 4/9] Update status of SIP-33 --- sips/sip-remove-check.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sips/sip-remove-check.md b/sips/sip-remove-check.md index 992d0a7..2d5a696 100644 --- a/sips/sip-remove-check.md +++ b/sips/sip-remove-check.md @@ -1,15 +1,15 @@ -| SIP-Number | | +| SIP-Number | 33 | | ---: | :--- | | Title | Allow StakedSui objects to be redeemed in same epoch | | Description | Currently, a StakedSui object cannot be created and redeemed in the same epoch, which is an unncessary restriction. | | Author | ripleys <0xripleys@solend.fi> | -| Editor | | +| Editor | Amogh Gupta | | Type | Standard | | Category | Framework | | Created | 29-05-2024 | -| Comments-URI | | -| Status | | -| Requires | | +| Comments-URI | https://sips.sui.io/comments-33 | +| Status | Draft| +| Requires |NA| ## Abstract From 8f0bc97c73f4022b9c9da99aae4623f7f8142c27 Mon Sep 17 00:00:00 2001 From: amogh-sui <152476631+amogh-sui@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:12:05 -0400 Subject: [PATCH 5/9] Update title of the SIP for more clarity --- sips/sip-remove-check.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sips/sip-remove-check.md b/sips/sip-remove-check.md index 2d5a696..8abbd19 100644 --- a/sips/sip-remove-check.md +++ b/sips/sip-remove-check.md @@ -1,6 +1,6 @@ | SIP-Number | 33 | | ---: | :--- | -| Title | Allow StakedSui objects to be redeemed in same epoch | +| Title | Allow inactive StakedSui objects to be redeemed immediately | | Description | Currently, a StakedSui object cannot be created and redeemed in the same epoch, which is an unncessary restriction. | | Author | ripleys <0xripleys@solend.fi> | | Editor | Amogh Gupta | From 005344f53abfaa8654ab47b34f69b57ba2e35f4c Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Fri, 14 Jun 2024 15:21:23 -0400 Subject: [PATCH 6/9] add reference implementation --- sips/sip-remove-check.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sips/sip-remove-check.md b/sips/sip-remove-check.md index 8abbd19..d9b887e 100644 --- a/sips/sip-remove-check.md +++ b/sips/sip-remove-check.md @@ -53,6 +53,10 @@ This change is fairly minor, and there's no other way to implement the suggestio No interfaces are changing here. +## Reference Implementation + +https://github.com/MystenLabs/sui/pull/18265 + ## Security Considerations This change does not affect security. From cf923cd483dfd169822eb9867b3b211a13a88f8b Mon Sep 17 00:00:00 2001 From: amogh-sui <152476631+amogh-sui@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:55:47 -0400 Subject: [PATCH 7/9] Changed status to "Review" --- sips/sip-remove-check.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sips/sip-remove-check.md b/sips/sip-remove-check.md index d9b887e..567d3c3 100644 --- a/sips/sip-remove-check.md +++ b/sips/sip-remove-check.md @@ -8,7 +8,7 @@ | Category | Framework | | Created | 29-05-2024 | | Comments-URI | https://sips.sui.io/comments-33 | -| Status | Draft| +| Status | Review| | Requires |NA| ## Abstract From d0164287c33b9ddf795de5bd2da071c6eb2a2b64 Mon Sep 17 00:00:00 2001 From: Will Riches Date: Tue, 5 Nov 2024 15:56:08 -0800 Subject: [PATCH 8/9] Fix error --- sips/{sip-remove-check.md => sip-33.md} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename sips/{sip-remove-check.md => sip-33.md} (98%) diff --git a/sips/sip-remove-check.md b/sips/sip-33.md similarity index 98% rename from sips/sip-remove-check.md rename to sips/sip-33.md index 567d3c3..8fe2c43 100644 --- a/sips/sip-remove-check.md +++ b/sips/sip-33.md @@ -8,8 +8,8 @@ | Category | Framework | | Created | 29-05-2024 | | Comments-URI | https://sips.sui.io/comments-33 | -| Status | Review| -| Requires |NA| +| Status | Review | +| Requires | N/A | ## Abstract From b117bcfa2fe28b7f2acd4f15858855c265cef36b Mon Sep 17 00:00:00 2001 From: Will Riches Date: Tue, 5 Nov 2024 16:22:46 -0800 Subject: [PATCH 9/9] Change SIP-33 status to Final --- sips/sip-33.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sips/sip-33.md b/sips/sip-33.md index 8fe2c43..2ca0f34 100644 --- a/sips/sip-33.md +++ b/sips/sip-33.md @@ -8,7 +8,7 @@ | Category | Framework | | Created | 29-05-2024 | | Comments-URI | https://sips.sui.io/comments-33 | -| Status | Review | +| Status | Final | | Requires | N/A | ## Abstract