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

Enhance session's migrate method with optional transfer of ownership #336

Closed
miloszm opened this issue Feb 21, 2024 · 0 comments · Fixed by #339
Closed

Enhance session's migrate method with optional transfer of ownership #336

miloszm opened this issue Feb 21, 2024 · 0 comments · Fixed by #339
Assignees
Labels
team:Core Low Level Core Development Team (Rust) type:enhancement Issues concerning code or feature improvement (performance, refactoring, etc)

Comments

@miloszm
Copy link
Contributor

miloszm commented Feb 21, 2024

Summary

Sessions's method migrate allows for convenient migration of data between an old and a new contract, yet typical use case also involves setting the same owner when deploying the new contract. Current implementation requires owner to be explicitly provided, which is not convenient when dealing with, say, genesis contracts, whose ownership is read from the configuration file and in general is not easily accessible at the location where migration is performed.

Possible solution design or implementation

It would be more optimal if method migrate, optionally, provided a possibility to migrate contract ownership as well. This way we could be certain that the new contract has not only the same contract id, but also an owner. It would also be much more convenient to use the method migrate in places where owner is not easily accessible

Additional context

This feature is needed, for example, for stake contract migration, due to important optimisations.

@miloszm miloszm added team:Core Low Level Core Development Team (Rust) type:enhancement Issues concerning code or feature improvement (performance, refactoring, etc) labels Feb 21, 2024
@miloszm miloszm changed the title Enhance session's migrate method with a possibility of transferring the ownership Enhance session's migrate method with optional transfer of ownership Feb 21, 2024
@miloszm miloszm self-assigned this Feb 21, 2024
@miloszm miloszm changed the title Enhance session's migrate method with optional transfer of ownership Enhance session's migrate method with optional change of ownership Feb 22, 2024
@miloszm miloszm changed the title Enhance session's migrate method with optional change of ownership Enhance session's migrate method with optional transfer of ownership Feb 22, 2024
ureeves added a commit that referenced this issue Feb 22, 2024
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
ureeves added a commit that referenced this issue Feb 22, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:Core Low Level Core Development Team (Rust) type:enhancement Issues concerning code or feature improvement (performance, refactoring, etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant