-
Notifications
You must be signed in to change notification settings - Fork 36
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
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) { |
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.
I'm not sure this branch works. It'll be pulling from the default plugin that is guaranteed to have no addition_delegates, right?
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.
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
clients/js/src/tests.ts
Outdated
import { createSignerFromKeypair, generateSigner, signerIdentity, sol } from "@metaplex-foundation/umi"; | ||
//import { Keypair, PublicKey } from "@solana/web3.js"; | ||
|
||
import wallet from "../../../wallet.json" |
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.
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) |
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.
Looks good!
programs/mpl-core/src/utils/mod.rs
Outdated
HashSet::new() | ||
}; | ||
|
||
if plugin_set.contains(&PluginType::UpdateDelegate) { |
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.
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.
1968701
into
metaplex-foundation:main
No description provided.