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

Combine plugin updating into single utility function #113

Closed

Conversation

danenbm
Copy link
Contributor

@danenbm danenbm commented May 8, 2024

This combines the code that moves the plugins and registry in update, update_plugin, and update_external_plugin to use a single utility function called move_plugins_and_registry. It is built upon #112

Copy link

vercel bot commented May 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mpl-core-js-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2024 9:24am

@danenbm danenbm force-pushed the danenbm/update-plugin-handling-2 branch from 6791c66 to a45f883 Compare May 8, 2024 09:23
@danenbm danenbm changed the title Combine plugin updating into util Combine plugin updating into single utility function May 8, 2024
@blockiosaurus
Copy link
Contributor

Can we add more tests to check multiple removal and addition IXes? This code has me paranoid.

nhanphan pushed a commit that referenced this pull request May 8, 2024
…112)

Notes
Also combine asset and collection update functions to use the same processors.
Also fix offset calculations when updating external plugins (added test for this case).
More advanced refactor: Combine plugin updating into single utility function #113
Note this PR is built upon #109 so that it can be tested with the new tests from that branch.
Base automatically changed from danenbm/update-plugin-handling to nhan/more-types May 8, 2024 16:47
nhanphan added a commit that referenced this pull request May 8, 2024
* Adding anchor types.

* Update.

* removed audit warning (#108)

* better types, new test

* Updating Kinobi dependency.

* Fixing kinobi reference.

* Bumping Kinobi version and fixing clients.

* Fixing mpl-utils version.

* Immutability plugins (#96)

* Add ImmutableMetadata && AddBlocker plugins

* Update autogenerated parts

* add tests

* change the order of enums

* update generated part

* added tests for ensuring that UA is the only one who can add the plugin

* added tests for ensuring that UA is the only one who can add the plugin for collection and nested plugins

* update tests

* add audit details to readme (#103)

* removed audit warning (#108)

* regenerated clients

* updated tests

* updated rust clients

* chore: Release mpl-core version 0.6.0

* Modify `update` and `update_plugin` to move external plugin offsets (#112)

Notes
Also combine asset and collection update functions to use the same processors.
Also fix offset calculations when updating external plugins (added test for this case).
More advanced refactor: Combine plugin updating into single utility function #113
Note this PR is built upon #109 so that it can be tested with the new tests from that branch.

* Deploy JS client v0.4.7

* update ava version, allow assertions on external plugins, check oracles in oracle tests

* minor add plugin interface change

* add additional test assert, formatting

---------

Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: Tony Boyle <[email protected]>
Co-authored-by: Kyrylo Stepanov <[email protected]>
Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: Michael Danenberg <[email protected]>
Base automatically changed from nhan/more-types to third-party-plugins-staging May 8, 2024 20:59
@danenbm danenbm marked this pull request as draft May 13, 2024 19:00
danenbm added a commit that referenced this pull request May 20, 2024
* Add structs and instructions for third party plugins (#58)

* Add structs and ixs for third party plugins

* lifecyle_checks into a HashMap and add check_external_registry

* Use Vec for third party lifecycle checks

* Combine lifecycle hooks and allow custom seeds

* Regenerate IDL and clients

* Rename external plugin header to external plugin

* Also move external plugin data offset inside of
external plugin.

* Regenerate IDL and clients

* Add create_v2 and create_colleciton_v2 basic structure

* Regenerate IDL and clients

* Add external plugin init info container

* Regenerate IDL and clients

* Add init and update structs for external plugins

* Also limit hookable lifecycle events.

* Resolve other PR comments.

* Regenerate IDL and clients

* Move key information into init structs (#65)

* Move key info into external plugin init info

* Regenerate clients and IDL

* Danenbm/no init data (#66)

* Do not allow data init on 3P plugins

* Also no lifecycle checks for data store.

* Regenerate IDL and clients

* Change external plugin registry name (#67)

* change external plugins to external registry

* Regenerate IDL and clients

* Update custom JS deserializer

* Remove extra accounts type (#68)

* External plugin key change (#73)

* Adding WIP for adding external plugins.

* Updating some permissions and adding more tests.

* Adding new IXes and data auth.

* Adding max size parameter.

* Removing allocate.

* Forgot to save.

* Removing size and clear IX.

* Updating based on feedback.

* Updating based on feedback and adding to create.'

* Adding tests and removing force approve.

* Danenbm/update from main (#80)

* Serde Pubkey DisplayFromStr (#78)

* Update kinobi version

* Regenerate clients

* chore: Release mpl-core version 0.5.0

---------

Co-authored-by: danenbm <[email protected]>

* Adding remove plugin.

* Removing prints.

* Adding for collection.

* Nhan/js sdk v1 (#75)

- sdk v1
- retain mostly backwards compatibility some types have changed name: BasePluginAuthority -> PluginAuthority
- many generated types have changed from Type -> BaseType
- support external plugins

* Oracle account type (#82)

* Regenerate IDL and clients

* Add Oracle validation type

* Regenerate IDL and clients

* Update JS SDK for ValidationResultsOffset

* fix minor type issues

---------

Co-authored-by: Nhan Phan <[email protected]>

* formatting

* Fixing deser.

* Testing fo realz.

* Adding ExternalPluginNotFound Error.

* Moving duped code to helper function.

* Add external plugin validation functions  (#85)

* Add validations for external plugins on lifecycle events

* Remove external_plugin_validate from plugin_checks

* WIP.

* Moving data offset and length to the record level.

* Updating JS hooks.

* Call external plugin validations (#86)

* Add validations for external plugins on lifecycle events

* Remove external_plugin_validate from plugin_checks

* Call external plugin validations

* Discard ForceApproved in external plugin validation

* Fast exit if external validation rejects

* Also mark ForceApproved as unreachable for external plugins

* Adding missing params to function after rebase

* Add missing ForceApproved check

* Update ExternalRegistryRecordSafe and fix tests (#88)

* Finishing up update external plugin.

* Removing prints.

* Adding check to prevent duplicate external plugins.

* Whoops missed collections.

* Adding resize optimization.

* Oracle lifecycle validations (#89)

* Update ExternalRegistryRecordSafe and fix tests

* Add accounts, asset, and collection to PluginValidationContext

* Implement Oracle lifecycle validations

* Add new error codes

* Regenerate IDL and clients

* Derive custom PDA using Seeds Vec

* Make sure third party plugins can approve or reject before using output

* Use user program for Program Seed

* Change ExternalCheckResult to u32

* Regenerate IDL and clients

* Fixup add accounts (#94)

* Add missing accounts

* Format fix

* Add Address seed and remove Program seed (#95)

* Add missing accounts

* Format fix

* Remove program seed and add address seed

* Regenerate IDL and clients

* Update JS SDK Seed type

* Format fix

* Format fix

* Prevent Oracle from approving lifecycle events (#98)

* Prevent Oracle from approving lifecycle events

* Regenerate IDL and clients

* Change error to be Oracle specific and prevent Oracle from listening

* Lint fix (#97)

* Add default case for extraAccount seed handler

* Regenerate JS client

* Format fix

* Danenbm/oracle error code (#100)

* Regenerate IDL with changed error code

* Make check tighter to not allow zero checks

Also fix Rust client tests

* oracle test wip (#90)

* Require passing in oracle lifecycle checks Vec (#101)

* Regenerate IDL with changed error code

* Make check tighter to not allow zero checks

Also fix Rust client tests

* Require Oracle to provide lifecycle checks at init

* Regenerate IDL and clients

* update oracle init helper

* Fix Rust tests

* Require non-empty Vec

* Regenerate IDL and clients

* Change CanDeny to CanReject

* Regenerate IDL and clients

* Format fix

* Add test

* Add more tests

* More tests for invalid checks and multiple oracle test

* Prevent duplicate lifecycle checks in external plugins (#104)

* Prevent duplicate lifecycle check on external plugins

* Regenerate IDL and clients

* Add Rust tests

* Danenbm/lifecycle check requirements (#105)

* Require LifecycleHook to have lifecycle checks

Also do not update lifecycle checks when update value is None

* Regenerate IDL and clients

* Fix JS client and fix Rust tests

* Add tests

* Add Rust tests for updating with duplicate lifecycle events

* fix cyclic dep, create with plugin, update with key

---------

Co-authored-by: Nhan Phan <[email protected]>

* Block `LifecycleHook` and `DataStore` from being created or added later (#106)

* Block LifecycleHook and DataStore for now

* Skip tests for deactivated external plugins

* Add more Oracle update tests

* Add tests to verify LifecycleHook and DataStore cannot be added

* Ignore Rust update test

* Add collection tests

* fix external plugin offsets, better types, new tests (#109)

* Adding anchor types.

* Update.

* removed audit warning (#108)

* better types, new test

* Updating Kinobi dependency.

* Fixing kinobi reference.

* Bumping Kinobi version and fixing clients.

* Fixing mpl-utils version.

* Immutability plugins (#96)

* Add ImmutableMetadata && AddBlocker plugins

* Update autogenerated parts

* add tests

* change the order of enums

* update generated part

* added tests for ensuring that UA is the only one who can add the plugin

* added tests for ensuring that UA is the only one who can add the plugin for collection and nested plugins

* update tests

* add audit details to readme (#103)

* removed audit warning (#108)

* regenerated clients

* updated tests

* updated rust clients

* chore: Release mpl-core version 0.6.0

* Modify `update` and `update_plugin` to move external plugin offsets (#112)

Notes
Also combine asset and collection update functions to use the same processors.
Also fix offset calculations when updating external plugins (added test for this case).
More advanced refactor: Combine plugin updating into single utility function #113
Note this PR is built upon #109 so that it can be tested with the new tests from that branch.

* Deploy JS client v0.4.7

* update ava version, allow assertions on external plugins, check oracles in oracle tests

* minor add plugin interface change

* add additional test assert, formatting

---------

Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: Tony Boyle <[email protected]>
Co-authored-by: Kyrylo Stepanov <[email protected]>
Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: Michael Danenberg <[email protected]>

* Improve Oracle account deserialization error handling (#115)

* Remap oracle account deserialization errors

Also fix extra space on last error message

* Regenerate IDL and clients

* Add tests and more error handling to Oracle borrowing and slicing

* Change test name

* Oracle uninitialized variant (#116)

* Add uninitialized variant to OracleValidation

* Regenerate IDL and clients

* Handle uninitialized kind in JS

* Add test for empty account

* Add ability to specify custom program for custom PDA (#117)

* Add ability to specify custom program for custom PDA

* Regenerate IDL and JS SDK

* Add customProgramId JS handling

* Add test

* Update oracle example js package

* bump version v1-alpha

* bump version v1-alpha

* Run CI on third-party-plugins-staging (#122)

* Run on third-party-plugins-staging for now

* Format fix

* Nhan/rename external plugin (#119)

* bump version v1-alpha

* bump version v1-alpha

* initial rename

* Rename Oracle pda - stacked onto rename external plugin (#121)

* Format fix

* Rename oracle pda to base_address_config in program

* Regenerate IDL and clients

* Update oracle SDK functions

* Format JS and fix all tests

* rename to external plugin adapater

* formatting

* rename back to external validation result

* use internal validationresult type

* rename a few more things

* minor nits, comments

---------

Co-authored-by: Michael Danenberg <[email protected]>

* remove unused remove collection plugin type field (#123)

* bump version v1-alpha

* remove unused type

* Add simple test to use new SDK to add Oracle plugin (#125)

* slightly refactor collection plugin types, add test (#124)

* bump alpha version

* bump version v1-alpha

* add types, bump version

* add fetch helpers, reduce strictness for umi context ix types, fix derive bug, better asset vs. collection plugin types (#126)

* bump version v1-alpha

* better deprecation message

* lint, more flexible arg

---------

Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: blockiosaurus <[email protected]>
Co-authored-by: danenbm <[email protected]>
Co-authored-by: Nhan Phan <[email protected]>
Co-authored-by: Nhan Phan <[email protected]>
Co-authored-by: Tony Boyle <[email protected]>
Co-authored-by: Kyrylo Stepanov <[email protected]>
Co-authored-by: blockiosaurus <[email protected]>
@danenbm danenbm closed this Jun 10, 2024
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.

3 participants