-
Notifications
You must be signed in to change notification settings - Fork 531
Changes to new Update instruction
#1058
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
Conversation
|
Workflow |
|
Workflow |
* 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.
a6a3b29 to
8d3e5f4
Compare
|
Workflow |
|
Workflow |
* 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.
|
Workflow |
|
Workflow |
b5d66ad to
21659ce
Compare
|
Workflow |
21659ce to
23cfe43
Compare
* Return the value derived in the delegate method. * Also add a test for Authority delegate.
|
Workflow |
|
Workflow |
|
Workflow |
|
Workflow |
|
Workflow |
|
Workflow |
351a401 to
f96b81a
Compare
* 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.
4aebe99 to
8cf70af
Compare
|
Workflow |
|
Workflow |
|
Workflow |
* 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.
lorisleiva
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Michael! My approval vouches only for the client/JS side but I do really like the API that came out of this PR.
I left a little comment out of curiosity.
febo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
New change
Fromtrait implementation.UpdateArgswhere used.Metadata::update_v1becausevalidate_updatealready checks that the authority is allowed to perform an update, and theUpdateArgsenforces that the authority is only changing fields for which it is authorized.Notes
DelegateandRevokeforAuthorityItem,Data,DataItem,CollectionItem, andProgrammableConfigItemMetadata delegates.AuthorityMetadata delegate is replaced byAuthorityItem, andUpdateMetadata delegate is replaced byData. This is OK because @samuelvanderwaal ran a script and saw no current usage of those delegates (those delegates cannot currently do anything anyways).Updateto support new and changed delegatesV2UpdateArgsvariants for update authority and each metadata delegate type, which makes it clear to users what metadata fields can be updated by each authority type. It also makes it trivial to enforce this in the handler.Updatehandler to update metadata areas based on update authority or delegated authority.Cargo lock change
During test development Cargo.lock file was updated, had to run
cargo update -p mpl-token-metadata@1.10.0to get the compiler to select a newer version ofmpl-utilsand succeed overall.Docs
Here is the related docs PR: metaplex-foundation/docs#425
Enum Compatibility
UpdateArgsI added all new variants to the end of the enum.MetadataDelegateRoleenum I changed the name ofAuthoritytoAuthorityItem,UpdatetoData, and added the new delegates to the end of the enum. This is OK because @samuelvanderwaal ran a script and saw no current usage of those delegates (those delegates cannot currently do anything anyways).DelegateArgsandRevokeArgsenums I changed the name ofUpdateV1toDataV1, and added new delegates to the end of the enum.Delegate expiration
Updateinstruction.Tests
unverifytest on collection delegate behavior changeUpdateArgs.UpdateArgsmeant for Programmable Config delegate, as well as the V1UpdateArgs.collectionfield in V1UpdateArgs.DelegateArgsenum was modified).Unrelated change