storage-incentives icon indicating copy to clipboard operation
storage-incentives copied to clipboard

Neighbourhood hopping (new staking - part 1 - SWIP-19)

Open 0xCardiE opened this issue 1 year ago • 3 comments

This implements the feature allowing staked nodes to change their overlay without restaking (called neighbourhood hopping, see SWIP-19)

Implemented by changing stake registry to be keyed with node address instead of node overlay.

0xCardiE avatar Apr 16 '24 16:04 0xCardiE

I second @nugaon 's comments and wonder why you removed the stake struct lookup to prevent repeated map lookups

I made response on this earlier but seems it been missed so I will copy paste it here also at @nugaon @zelig

"Did some measurements... Thing is that "getStake" is wasteful in cases where there is lookup for just one of the struct values. Getter for each individual struct value by itself uses up to 2900 gas while getStake uses 9861 gas, as it fetches all values from storage, which means that getStake is only useful if we are operating with all values from struct, if not, then its less desirable option and we should use single getters for each value, which means all this single value getters are staying and we do use them in most cases."

0xCardiE avatar May 28 '24 15:05 0xCardiE

First, is there going to be a migration of the existing stakes from overlay-based to owner-based?

And if so, has anyone given thought (or better yet, a test) to what happens with multiple abandoned overlay-based stakes that are all owned by a single account? This happens when people keep their keys, but delete the rest of their data-dir causing a new overlay to be generated from the original account.

See this (short) conversation in Discord. Start at the link and follow the replies backwards in time. https://discord.com/channels/799027393297514537/811553590170353685/1251173722245693460

ldeffenb avatar Jun 14 '24 14:06 ldeffenb

First, is there going to be a migration of the existing stakes from overlay-based to owner-based?

And if so, has anyone given thought (or better yet, a test) to what happens with multiple abandoned overlay-based stakes that are all owned by a single account? This happens when people keep their keys, but delete the rest of their data-dir causing a new overlay to be generated from the original account.

See this (short) conversation in Discord. Start at the link and follow the replies backwards in time. https://discord.com/channels/799027393297514537/811553590170353685/1251173722245693460

yes, there will be migration but basically it will be from users/operators side and we will need to write instructions on that and communicate them. Basically old contract would be paused, nodes would be taking funds out and could put them in new contract for staking.

About abandoned overlays, if the user has private key of the address used for that node he should be able to take funds out, if he knows the overlay, he can just input it and take funds out. If ppl are forgetting what they own, we could take data from blockchain and make a document with which address has which overlay and what amount so they could search for it there and take the funds out for themselves.

0xCardiE avatar Jul 01 '24 11:07 0xCardiE