-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AHM] Vesting #575
base: dev-asset-hub-migration
Are you sure you want to change the base?
[AHM] Vesting #575
Conversation
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
pallets/ah-migrator/src/vesting.rs
Outdated
// TODO what do? should we create a storage item and insert the truncated ones? | ||
// Nobody seems to use the Vesting pallet on AH yet, but we cannot be sure that there | ||
// won't be a truncatenation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muharem, any better idea? I think if we increase the max vesting schedules in AH then it can still happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, or we could use the same storage, but derive new account id from an actual account id, but both ways exploitable. I would just add a storage item, since its low effort thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea this is an issue and easy attack vector.
pallets/ah-migrator/src/vesting.rs
Outdated
// TODO what do? should we create a storage item and insert the truncated ones? | ||
// Nobody seems to use the Vesting pallet on AH yet, but we cannot be sure that there | ||
// won't be a truncatenation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, or we could use the same storage, but derive new account id from an actual account id, but both ways exploitable. I would just add a storage item, since its low effort thing.
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
What you mean by this? |
Merging into the AHM working branch. Depends on #579
Pallet Vesting
Pallet vesting has one storage map to hold the vesting schedules and one storage value to track the
current version of the pallet. The version can be easily migrated, but for the schedules it is a bit difficult.
Storage: Vesting
The vesting schedules are already measured in relay blocks, as can be seen
here.
This means that we can just integrate the existing schedules. The only possibly issue is when there
are lots of pre-existing schedules. The maximal number of schedules is 28; both on Relay and AH.
We cannot use the merge functionality of the vesting pallet since that can be used as an attack
vector: anyone can send 28 vested transfers with very large unlock duration and low amount to force
all other schedules to adapt this long unlock period. This would reduce the rewards per block, which
is bad.
For now, we are writing all colliding AH schedules into a storage item for manual inspection later.
It could still happen that unmalicious users will have more than 28 schedules, but as nobody has
used the vested transfers on AH yet.
Q: Maybe we should disable vested transfers with the next runtime upgrade on AH.
Storage: StorageVersion
The vesting pallet is not using the proper FRAME version tracking; rather, it tracks its version in
the
StorageVersion
value. It does this incorrectly though, with Asset Hub reporting version 0instead of 1. We ignore and correct this by writing 1 to the storage.
User Impact
This affects users that have vesting schedules on the Relay chain or on Asset Hub. There exists a
risk that the number of total schedules exceeds 28, which means that they will not fit into the
storage anymore.
We then prioritize the schedules from AH and pause and stash all schedules that do not fit (up to
28).