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: Client is_signer usage in to_account_metas #3322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Arrowana
Copy link
Contributor

@Arrowana Arrowana commented Oct 20, 2024

Problem: Not using is_signer prevents proper functioning of the client whenever a PDA is used, let's say when composing and instruction with the inner CPI using the inner client

That is not exactly for the general case but the sole purpose of this argument is for this objective so it seems reasonable to make it work.

From the trait

anchor/lang/src/lib.rs

Lines 154 to 160 in 340e9c1

pub trait ToAccountMetas {
/// `is_signer` is given as an optional override for the signer meta field.
/// This covers the edge case when a program-derived-address needs to relay
/// a transaction from a client to another program but sign the transaction
/// before the relay. The client cannot mark the field as a signer, and so
/// we have to override the is_signer meta field given by the client.
fn to_account_metas(&self, is_signer: Option<bool>) -> Vec<AccountMeta>;

Copy link

vercel bot commented Oct 20, 2024

@Arrowana is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added lang fix Bug fix PR labels Oct 20, 2024
Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

Thanks. This seems to be only about composite accounts, correct?

It would also be great to have a CPI test for the problematic scenario this PR solves.

@Arrowana
Copy link
Contributor Author

Not only about composite, all accounts. It also changes the branch for non composite.

Yes, I can add a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix PR lang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants