Skip to content

Commit 587ad02

Browse files
Changes to new Update instruction (#1058)
* Additional Metadata Delegates * Add support in Delegate and Revoke for Authority, Data, CollectionItem, and ProgrammableConfigItem Metadata delegates. * Remove Update Metadata delegate. * Changes to Update to support new and changed delegates * 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. * Update tests to support new version of UpdateArgs * Also add macro to help destructure UpdateArgs fields. * Fix delegate test based on auth rules update * Put enums back in original order * 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. * Change unverify test on collection delegate behavior change * Fix JS Update test * Modify DA test util object to return delegate or token record * Return the value derived in the delegate method. * Also add a test for Authority delegate. * Add collection delegate test * Comment out JS test where the delegate is no longer available * Add test for collection item delegate * Regenerate JS API * Add more delegate success test cases * Add tests for delegate not authorized * Add Update test for persistent delegate and token standard pass/fail * Allow collection delegates to use update arg val for permission * 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. * Test that collection programmable config delegate cannot update collection 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`. * Move dependencies up * Update deps in Cargo.lock and add test using old TM lib * 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 * Update JS test to check invalid role * Minor deconstruct update and comments * Remove check for mint decimals zero when changing token standard * Make Data delegate collection-level and add DataItem delegate Modify tests as well * Regenerate IDL and SDK * Use different UpdateArg types for different delegates (#1066) * Use different UpdateArg types for different delegates * Change new UpdateArg types to V2 Also use a Default method to cleanup InternalUpdateArgs * Revert to master Cargo.toml and lock file * Doing cargo update -p mpl-token-metadata@1.10.0 * Update tests for new UpdateArgs variants - 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. * Regenerate IDL and JS lib * Make delegate_record, token, and edition readonly Make consistent in instruction builder and shank annotation. * Add some tests for collection-level Data delegate * Add collection delegate update authority mismatch test * Rename UpdateArgs to indicate updating as a role * Regenerate IDL and SDK * Space savings * 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. * Allow passing in current token standard Also make match statements in validate_update more concise. * Clarify comments and reorder account validations * Minor comment update * Minor description change to generated IDL/SDK * Add more BPF tests * 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. --------- Co-authored-by: Samuel Vanderwaal <samuel.vanderwaal@gmail.com>
1 parent b399679 commit 587ad02

File tree

24 files changed

+4231
-474
lines changed

24 files changed

+4231
-474
lines changed

token-metadata/Cargo.lock

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)