Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

transfer-hook: Relax requirement of validation account#7099

Merged
joncinque merged 2 commits into
solana-labs:masterfrom
joncinque:tknohook
Aug 2, 2024
Merged

transfer-hook: Relax requirement of validation account#7099
joncinque merged 2 commits into
solana-labs:masterfrom
joncinque:tknohook

Conversation

@joncinque
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@joncinque joncinque deleted the tknohook branch August 2, 2024 17:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants