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

transfer-hook: Relax requirement of validation account #7099

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

joncinque
Copy link
Contributor

Problem

It's possible to write a perfectly good transfer hook without the extra account metas, and just the transfer hook program. For example, if you add a field to the metadata portion of the mint, a transfer hook program can check only that, so it has no need for anything else.

Summary of changes

Relax the requirement that the extra account metas account is provided. This was surprisingly straightforward, but maybe a little brittle, so let me know what you think.

@joncinque joncinque requested a review from buffalojoec August 1, 2024 12:12
Copy link
Contributor

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Yep, this makes a lot of sense to me. Nice idea! Everything looks great.

Comment on lines +966 to +969
// only add the transfer hook program id, nothing else
let token = token_context
.token
.with_transfer_hook_accounts(vec![AccountMeta::new_readonly(program_id, false)]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe someday this can come out, too!

solana-foundation/solana-improvement-documents#163

@joncinque joncinque merged commit ea94e5d into solana-labs:master Aug 2, 2024
31 checks passed
@joncinque joncinque deleted the tknohook branch August 2, 2024 17:54
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