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

piecrust: optional owner in Session::migrate #339

Merged
merged 3 commits into from
Feb 23, 2024
Merged

Conversation

ureeves
Copy link
Member

@ureeves ureeves commented Feb 22, 2024

Session::migrate is changed to allow for taking the owner of the previous contract, as opposed to it being mandatory to set a new owner.

This entailed numerous API change, the gist of which being that the owner is handled internally as a Vec<u8> as opposed to a [u8; N]. This puts some responsibility on the user of the crate to think about what this means for when the contracts call owner or self_owner. It is likely wise to only set owner which are always the same size.

Resolves #336

We specify that the caller is *heavily* encouraged to pass owners that
are always the same size for every contract.
It is now optional to provide an `owner` to the `Session::migrate` call.
If the owner is not specified, it will be taken from the previous
contract at the slot being migrated. If the owner is not specified and
the contract being replaced does not exist, the call will panic.

Resolves #336
Copy link
Contributor

@miloszm miloszm left a comment

Choose a reason for hiding this comment

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

LGTM

@ureeves ureeves merged commit 7002510 into main Feb 23, 2024
6 checks passed
@ureeves ureeves deleted the optional-owner-336 branch February 23, 2024 09:42
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.

Enhance session's migrate method with optional transfer of ownership
2 participants