-
Notifications
You must be signed in to change notification settings - Fork 512
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
Changes to new Update
instruction
#1058
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.
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.
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
From
trait implementation.UpdateArgs
where used.Metadata::update_v1
becausevalidate_update
already checks that the authority is allowed to perform an update, and theUpdateArgs
enforces that the authority is only changing fields for which it is authorized.Notes
Delegate
andRevoke
forAuthorityItem
,Data
,DataItem
,CollectionItem
, andProgrammableConfigItem
Metadata delegates.Authority
Metadata delegate is replaced byAuthorityItem
, andUpdate
Metadata 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).Update
to support new and changed delegatesV2
UpdateArgs
variants 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.Update
handler 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 [email protected]
to get the compiler to select a newer version ofmpl-utils
and succeed overall.Docs
Here is the related docs PR: metaplex-foundation/docs#425
Enum Compatibility
UpdateArgs
I added all new variants to the end of the enum.MetadataDelegateRole
enum I changed the name ofAuthority
toAuthorityItem
,Update
toData
, 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).DelegateArgs
andRevokeArgs
enums I changed the name ofUpdateV1
toDataV1
, and added new delegates to the end of the enum.Delegate expiration
Update
instruction.Tests
unverify
test on collection delegate behavior changeUpdateArgs
.UpdateArgs
meant for Programmable Config delegate, as well as the V1UpdateArgs
.collection
field in V1UpdateArgs
.DelegateArgs
enum was modified).Unrelated change