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

🗻 Store bumps and other seeds in PDAs #27

Open
alecchendev opened this issue Mar 14, 2022 · 0 comments · May be fixed by #60
Open

🗻 Store bumps and other seeds in PDAs #27

alecchendev opened this issue Mar 14, 2022 · 0 comments · May be fixed by #60
Assignees
Labels
atomic Single task, well defined enhancement New feature or request

Comments

@alecchendev
Copy link
Member

alecchendev commented Mar 14, 2022

becoming a sort of dev ux standard + saves on compute inside program instructions, which is something we could feasibly care about - rn a full renew takes up ~15k/20k compute units

main tasks here:

  • for all existing PDAs (besides token/mint accounts)
    • add a bump field in the state.rs
    • if the program initializes the PDA, make sure to initialize it with enough space to hold the bump
    • whenever that PDA is passed into an instruction and validated, use create_program_address and include the bump as a seed
      • change the current check_pda helper to maybe take in another with_bump: bool parameter and use create_program_address or find_program_address based on that
      • OR add a check_pda_with_bump function

note:

  • for Subscription metadata, please add the bump at the end of the struct because my initialize.js script deserializes some stuff with kinda hardcoded values so adding it at the beginning would break that, but at the end its all good.
  • also for subscription metadata, store the count seed

also:

  • if whoever's implementing this has the time, throw in changes to check_initialized_ata to 1) be renamed to check_ata_initialized and run check_ata within it so you don't have to run both
@alecchendev alecchendev added the atomic Single task, well defined label Mar 14, 2022
@alecchendev alecchendev self-assigned this Apr 10, 2022
@alecchendev alecchendev linked a pull request Apr 10, 2022 that will close this issue
@alecchendev alecchendev added the enhancement New feature or request label Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
atomic Single task, well defined enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant