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

Check compression programs at runtime #115

Merged
merged 15 commits into from
Oct 29, 2024
Merged

Conversation

danenbm
Copy link
Contributor

@danenbm danenbm commented Oct 24, 2024

Purpose

Program changes

  • Changes Anchor validation structs to use UncheckedAccount rather than Program for log wrapper and compression programs.
  • Any time a Merkle tree account is passed in, validate that it is owned by one of the valid compression program choices, and that the provided log wrapper and compression program are also one of the valid choices.
  • Use the correct log wrapper program when broadcasting asset changes.
  • Use the correct CPI to either spl-account-compression or mpl-account-compression.
  • No check of the log wrapper program needed in decompress_V1 as it's not actually used in the instruction.

Testing

TODO

  • Better JS SDK that can help select the correct programs to default to per cluster.

Copy link

vercel bot commented Oct 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mpl-bubblegum-js-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2024 8:47am

@danenbm danenbm changed the title Danenbm/compression programs Check compression programs at runtime Oct 24, 2024
@danenbm danenbm marked this pull request as ready for review October 24, 2024 08:57

/// Validate the Merkle tree is owned by one of the valid program choices, and that the provided
/// log wrapper and compression program are one of the valid choices.
pub(crate) fn validate_ownership_and_programs(
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice. This is much cleaner than my habit of copying and pasting checks.

@danenbm danenbm changed the base branch from main to svm October 29, 2024 18:41
@danenbm danenbm merged commit 14329d8 into svm Oct 29, 2024
16 of 17 checks passed
@danenbm danenbm deleted the danenbm/compression-programs branch October 29, 2024 18:41
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