AstarNetwork / astar-frame

Core frame modules for Astar & Shiden network.
Other
58 stars 38 forks source link

[Pending] Rebond unlocking chunks #97

Open shunsukew opened 1 year ago

shunsukew commented 1 year ago

Solves https://github.com/AstarNetwork/astar-frame/issues/63

Pull Request Summary Added feature rebond_and_stake unlocking chunks to contracts.

Once stakers start the unbonding, their unbonded funds will remain locked during the unbonding period. During this period, these funds neither generate any rewards nor can they be used for payment, transfer, etc.

One functionality we could provide is for stakers to re-bond their unbonding chunks. They could select unbonding chunks as a source when staking on a contract from UI, similar as they do for nomination_transfer. This will result in unbonding chunks being consumed and (re)staked on some contract.

Check list

shunsukew commented 1 year ago

compilation started to fail after pushing small commit https://github.com/AstarNetwork/astar-frame/pull/97/commits/852fb39ac8f512e7c7765a78e33be761e81dbc99. Why, will check

github-actions[bot] commented 1 year ago

Code Coverage

Package Line Rate Branch Rate Health
chain-extensions/trait/src 0% 0%
chain-extensions/rmrk/src 0% 0%
chain-extensions/types/dapps-staking/src 0% 0%
contracts/xvm/src 0% 0%
frame/dapps-staking/src/pallet 90% 0%
frame/block-reward/src 96% 0%
frame/pallet-xcm/src 81% 0%
chain-extensions/xvm/src 0% 0%
frame/pallet-xvm/src 9% 0%
precompiles/utils/macro/src 0% 0%
precompiles/utils/src/data 72% 0%
chain-extensions/dapps-staking/src 0% 0%
frame/collator-selection/src 88% 0%
precompiles/substrate-ecdsa/src 78% 0%
precompiles/xvm/src 71% 0%
primitives/xcm/src 88% 0%
precompiles/utils/src 84% 0%
chain-extensions/types/rmrk/src 0% 0%
frame/pallet-xvm/src/pallet 37% 0%
precompiles/assets-erc20/src 91% 0%
frame/dapps-staking/src 94% 0%
precompiles/dapps-staking/src 95% 0%
precompiles/sr25519/src 78% 0%
chain-extensions/types/xvm/src 0% 0%
precompiles/utils/macro/tests 100% 0%
precompiles/xcm/src 80% 0%
frame/xc-asset-config/src 87% 0%
frame/custom-signatures/src 81% 0%
Summary 80% (7588 / 9480) 0% (0 / 0)

Minimum allowed line rate is 60%

shunsukew commented 1 year ago

@Dinonard I also added chain extension and precompiles, but I started to think they should be separately released (in a different PR) after this function become stable. What do you think?

shunsukew commented 1 year ago

Thanks for working on this!

About your precompile/chain-extension questions, I think we should keep them out of this PR. And maybe we shouldn't add them at all. Your comment about feature being stable makes sense and I'd also add the point that we'll be redesigning dapps-staking very soon. It's not necessarily true that this function will be compatible with new version so I'd wait until then with it. That way we reduce number of incompatible legacy functions.

That makes sense. In that case, I'd make this PR pending until the redesign and its implementation finish. I'll resume this PR work after that.

Dinonard commented 1 year ago

Thanks for working on this! About your precompile/chain-extension questions, I think we should keep them out of this PR. And maybe we shouldn't add them at all. Your comment about feature being stable makes sense and I'd also add the point that we'll be redesigning dapps-staking very soon. It's not necessarily true that this function will be compatible with new version so I'd wait until then with it. That way we reduce number of incompatible legacy functions.

That makes sense. In that case, I'd make this PR pending until the redesign and its implementation finish. I'll resume this PR work after that.

I'm not sure how feasible is that, tbh. We don't know if this will even be applicable then.

I don't see an issue with this being merged now but we should avoid precompiles/chain-extensions. Also, not sure how much it makes sense to ask UI team to do this since it will most likely be changed soon.

Anyhow, draft status that you used is probably the way to go.