Skip to content
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] Cleanup and add Preimage doc #543

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Jan 15, 2025

👉 To be merged into the Asset Hub Migration working branch.

Changes:

  • Factor out XCM sending into common function

  • Cleanup

  • Add docs for the preimage pallet that I started with

  • Does not require a CHANGELOG entry

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
pallets/rc-migrator/src/lib.rs Outdated Show resolved Hide resolved

Q: One question here would be whether or not we want to translate these calls. I think we can and should. But I am not sure about the best time point to do so. We can translate the preimages calls upon arrival on the Asset Hub, although there is a small change that a preimage that was not intended to be decoded as a call would be translated. After all, the preimage pallet is a universal data storage without any implied semantics about its content. It could therefore be better to translate the preimages once we are migrating the Referenda pallet and then only translate all preimages that occur as hash lookups in a referenda.
Basically: loop referenda -> load referenda -> load preimage of referenda -> translate preimage -> calculate new preimage hash -> update preimage with new hash -> update referenda with new hash.
One further note on the preimage translation: If the length of a preimage is increased by the translation, then we should not reconsider the deposit but keep the original deposit as to not punish users for this. The cases that the translation increases the size of a preimage past the 4MiB hard limit should be negligible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the deposit should be lower on the AH. probably wont be a problem. we keep the deposit same and provide a call to update it (which should release some funds)


[Maps](https://github.com/paritytech/polkadot-sdk/blob/00946b10ab18331f959f5cbced7c433b6132b1cb/substrate/frame/preimage/src/lib.rs#L185) a hash and the length of a preimage to its preimage data. Preimages can be migrated rather easily by sending them in chunks from the Relay and appending them on the Asset Hub. The preimages are often used to store large governance calls.

Q: One question here would be whether or not we want to translate these calls. I think we can and should. But I am not sure about the best time point to do so. We can translate the preimages calls upon arrival on the Asset Hub, although there is a small change that a preimage that was not intended to be decoded as a call would be translated. After all, the preimage pallet is a universal data storage without any implied semantics about its content. It could therefore be better to translate the preimages once we are migrating the Referenda pallet and then only translate all preimages that occur as hash lookups in a referenda.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. something we also have discussed with Joe and Donal, we wanna map them.


[Maps](https://github.com/paritytech/polkadot-sdk/blob/00946b10ab18331f959f5cbced7c433b6132b1cb/substrate/frame/preimage/src/lib.rs#L185) a hash and the length of a preimage to its preimage data. Preimages can be migrated rather easily by sending them in chunks from the Relay and appending them on the Asset Hub. The preimages are often used to store large governance calls.

Q: One question here would be whether or not we want to translate these calls. I think we can and should. But I am not sure about the best time point to do so. We can translate the preimages calls upon arrival on the Asset Hub, although there is a small change that a preimage that was not intended to be decoded as a call would be translated. After all, the preimage pallet is a universal data storage without any implied semantics about its content. It could therefore be better to translate the preimages once we are migrating the Referenda pallet and then only translate all preimages that occur as hash lookups in a referenda.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only scheduler which used by referenda or root can request a preimage. in theory there should only preimages with valid calls having request count > 0.

Copy link
Member Author

@ggwpez ggwpez Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, so we could also do the translation as we migrate the preimages. Will add a note.

But then when we do the governance migration afterwards it will not find the hashes anymore. So they kind of need to happen together anyway.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez merged commit ed7255a into dev-asset-hub-migration Jan 16, 2025
23 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants