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

Fix to add assets to a collection with a different authority #217

Merged
merged 9 commits into from
Feb 21, 2025

Conversation

ASCorreia
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Feb 16, 2025

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 Feb 20, 2025 11:43pm

Copy link
Contributor

@blockiosaurus blockiosaurus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the JS tests you were using as well?

{
solana_program::msg!("UA: Rejected");
return Err(MplCoreError::InvalidAuthority.into());
}
} else if authority.key != &new_collection.update_authority {
} else if authority.key != &new_collection.update_authority && !plugin.additional_delegates.contains(&authority.key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this branch works. It'll be pulling from the default plugin that is guaranteed to have no addition_delegates, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.
Since it will be pulling from the default one, the && !plugin.additional_delegates.contains(&authority.key) will always evaluate to true, making the branch redundant.

By removing it, we don't need to create the default one and can check directly against the fetched plugin inside the UpdateDelegate plugin checks

import { createSignerFromKeypair, generateSigner, signerIdentity, sol } from "@metaplex-foundation/umi";
//import { Keypair, PublicKey } from "@solana/web3.js";

import wallet from "../../../wallet.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use the createUmi() in _setup.ts (e.g. in the other tests) it'll set up umi.identity as a keypair you can use instead of depending on a wallet file. It looks like that's what's causing the checks to fail, currently.

&new_collection,
authority,
&plugin_authority,
)
.is_err()
&& authority.key != &new_collection.update_authority
&& authority.key != &new_collection.update_authority)
&& !fetched_plugin.additional_delegates.contains(&authority.key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

HashSet::new()
};

if plugin_set.contains(&PluginType::UpdateDelegate) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can push this logically into the UpdateDelegate plugin for the Update lifecycle event. It'll only be checked if the UpdateDelegate exists and the reject will always override a success. I think it should be logically equivalent to what you're doing here and you won't have to change our messy validation function, haha.

@blockiosaurus blockiosaurus merged commit 1968701 into metaplex-foundation:main Feb 21, 2025
8 of 10 checks passed
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.

2 participants