Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

nomination-pools: allow pool-ids to be reused #12001

Closed
kianenigma opened this issue Aug 10, 2022 · 4 comments · Fixed by #12407
Closed

nomination-pools: allow pool-ids to be reused #12001

kianenigma opened this issue Aug 10, 2022 · 4 comments · Fixed by #12407
Labels
J0-enhancement An additional feature request.

Comments

@kianenigma
Copy link
Contributor

Currently, pool ids only ever increase. While generally we suggest using a MaxPools limits, this allows one to spam the pool ids and consume a lot of them by creating a pool and immediately destroying it.

This is not a cheap or fast process, so it is not a huge risk either. Nonetheless, it would be nice to have a simple id-reuse system.

A simple way to do it is that create can have an Option<PoolId>. If None, the sender wants to use LastPoolId + 1 . If Some(claim), the sender is claiming that they know claim is free. claim must always be less then LastPoolId.

@kianenigma kianenigma added the J0-enhancement An additional feature request. label Aug 10, 2022
@kianenigma kianenigma moved this from Backlog to Sometime-soon in (Nominated) Proof of Stake Aug 16, 2022
@kianenigma kianenigma moved this from Sometime-soon to Backlog in (Nominated) Proof of Stake Aug 16, 2022
@Doordashcon
Copy link
Contributor

Hello @kianenigma would like to get a clear understanding of what this will accomplish.

@kianenigma
Copy link
Contributor Author

I think my description is pretty exact, don't have much to add to it after reading it again.

What I would consider is just keeping this fully backwards compatible and creating a new transaction create_with_pool_id instead of breaking the old one.

@ggwpez
Copy link
Member

ggwpez commented Oct 4, 2022

We would then need an ClaimedId event or something, otherwise UI could get confused to why a PoolId is now pointing to a different pool.
PS: Ah this would not change anything. Nvm.

@Ank4n
Copy link
Contributor

Ank4n commented Oct 17, 2022

Thinking out loud, I believe it shouldn't be too hard to to keep track of all the pools that are destroyed and ready to be claimed. In that case we would not really need another fn create_with_pool_id. The existing fn create would first try to get the next_reclaimable_pool_id and if not available, increment pool_id.

With current solution, we might need to expose an api to the frontend client to query a reclaimable pool-id that it can then pass to create_with_pool_id, so we will end up needing to track them anyway.

Repository owner moved this from 📕 Backlog to ✅ Done in (Nominated) Proof of Stake Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants