-
Notifications
You must be signed in to change notification settings - Fork 530
Update idea: try using InternalUpdateArgs again to avoid multiple destructure
#1079
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Add support in Delegate and Revoke for Authority, Data, CollectionItem, and ProgrammableConfigItem Metadata delegates. * Remove Update Metadata delegate.
* Modify authority check to separate out item and collection-level delegates. * Add V2 Update args struct to allow user to specify token standard. * Check that new delegates are only changing metadata for which they are meant to have access. * Modify Update handler to update metadata fields based on the delegate type.
* Also add macro to help destructure UpdateArgs fields.
* Update is still changed to Data but order is preserved. * Also remove unnecessary Option for token_record in Update. * Add some comments clarifying authority types in Unverify.
* Return the value derived in the delegate method. * Also add a test for Authority delegate.
* If the collection toggle value passed in by a collection-level delegate contains a new collection value, that is used when determining authority. * This allows for setting a collection using a collection delegate when previously there was no collection in the metadata. * Also add tests for delegates on collection parent: collection delegate can update members of collection but collection item delegate cannot. * Also add test to fail updating to a verified collection.
…ction This is important because the passed in collection is also used for permissions. If we allowed the collection-level programmable config delegate to pass in a new collection, it would also use that value in `get_authority_type`.
* Added a test that uses old token-metadata lib to build the
instructions and interact with the data.
* As part of this needed to run `cargo update -p mpl-token-metadata@1.9.1`
which resulted in the following updates to lateset versions:
Updating crates.io index
Updating git repository `https://github.com/metaplex-foundation/rooster`
Updating mpl-token-metadata v1.8.0 -> v1.9.1
Updating mpl-utils v0.0.6 -> v0.1.0
Updating rooster v0.1.0 (https://github.com/metaplex-foundation/rooster#6923ee3b) -> #ca1221c9
Modify tests as well
* Use different UpdateArg types for different delegates * Change new UpdateArg types to V2 Also use a Default method to cleanup InternalUpdateArgs
- Adding authorization data to all UpdateArgs variants. - Add helper functions to create default versions for each UpdateArgs variant. - Add back in legacy support for ProgrammableConfig delegate so that it can use V1 UpdateArgs. - Update tests to use new UpdateArgs. - Add more tests for ProgrammableConfig delegate. - Update "old lib" test to test ProgrammableConfig delegate.
Make consistent in instruction builder and shank annotation.
* Remove InternalUpdateArgs struct and `From` trait implementation. * Deconstruct `UpdateArgs` where used. * Remove redundant authority type and metadata delegate role checks from `Metadata::update_v1` because `validate_update` already checks that the authority is allowed to perform an update, and the `UpdateArgs` enforces that the authority is only changing fields for which it is authorized.
Also make match statements in validate_update more concise.
* Holder authority test. * Pass with same token standard being passed in. * Token doesn't match mint test. * Metadata doesn't match mint test. * Wrong edition test. * Some failure cases around collection-level delegates.
Contributor
Author
|
Omitted this from #1058 due to size constraints. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Idea to bring back
InternalUpdateArgs, but instead of implementingFromtrait like last time, use a default() and then populate as we go invalidate_update.This prevents us from having to destructure the UpdateArgs a second time within Metadata::update_v1.
However, this increases the binary size from 700240 to 702752 so I think we should avoid this implementation in the short term.