-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: add replacePlugin #38
Conversation
Feat. add data migration logic
…rhub/Decipher-ERC6900-Reference-Implementation into replace-plugin-0.7-brynn
Feat: add data migration in replacePlugin
�feat: Add VersionRegistry
…b/Decipher-ERC6900-Reference-Implementation into replace-plugin-0.7-sm
feat: add test codes for `replacePlugin`
Thanks for your research and work on this issue @sm-stack @Sangyeup @brynnPark! There are a few things we may want to think about more, and I'd like to invite other folks to leave their thoughts too.
Would love to continue our discussions either here or in erc6900/resources#13! |
I just read through your doc |
Thanks for your feedback, @jaypaik! We are now discussing how to implement this, and I'll share the doc you mentioned at Issue#13. The aspects you mentioned may need significant changes on this PR, so I'll close this and work at another branch. |
Motivation
As mentioned at Issue #13, replacing a plugin relies on a weak assumption of nicely implemented
uninstallPlugin
-installPlugin
pattern.This approach can potentially disrupt the account's state, especially if the plugin being replaced is entangled with dependencies that are not trivially interchangeable. Therefore, it is necessary that plugin replacement is conducted with caution, ensuring that only minor, non-disruptive modifications are permitted.
Solution
This pull request solves Issue #13, by implementing
replacePlugin
function. This function enables 'hot swapping' between homogeneous plugins. For this, the following concepts are introduced.Version Registry
replacePlugin
determines the validity of replacement with the versions of plugins. Version in plugins are in the format of sematic versioning, and only the patch version updates are available. For this, a plugin is required to furnish a version registry in its manifest. The registry is responsible for classifying compatible plugins and determining the validity of the replacement. Also, downgrades to lower versions are prohibited, since downgrades have an edge case that an execution function is used in another plugin as dependency, and the downgrade process removes it.Plugin Data Migration
During replacement, the user data (e.g. session key data at Session Key plugin) in the replaced plugin should be migrated to the new plugin, to minimize the confusion of users. However, allowing users to define the migration data in arbitrary way is dangerous, since authorizing user to manipulate the storage of the plugin can lead to unintended behavior. To prevent this, users can migrate data defined at
getDataForReplacement
inside each plugin. This can ensure that the data removal and addition will be done in the expected way.