-
Notifications
You must be signed in to change notification settings - Fork 0
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
[MTG-134][MTG-234][MTG-164] Bubblegum update - Master PR #5
Open
StanChe
wants to merge
94
commits into
main
Choose a base branch
from
feature/cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # programs/bubblegum/program/src/processor/create_tree_with_root.rs
# Conflicts: # programs/bubblegum/program/src/processor/create_tree_with_root.rs # programs/bubblegum/program/tests/rollup.rs # programs/bubblegum/program/tests/utils/tree.rs
# Conflicts: # clients/js/src/generated/instructions/prepareTree.ts # clients/rust/src/generated/instructions/finalize_tree_with_root.rs # idls/bubblegum.json # programs/bubblegum/program/src/processor/finalize_tree_with_root.rs # programs/bubblegum/program/tests/rollup.rs # programs/bubblegum/program/tests/utils/tree.rs
Add canopy size check
# Conflicts: # programs/bubblegum/program/tests/rollup.rs
The reason for adding prep_tree are still unknown, but keeping it for now. As the next steps I'd suggest to get rid of it to keep the styling consistent across bubblegum methods
next steps: - test are really shitty, we need to create test helpers to build this - when the SDK is ready - use it in tests
…ot.rs Co-authored-by: Kyrylo Stepanov <[email protected]>
[MTG-482] using the delegated stake in the minimal requirement check
[MTG-545] feat: update client
…cleanup # Conflicts: # clients/rust/Cargo.lock # clients/rust/Cargo.toml # programs/bubblegum/Cargo.lock # programs/bubblegum/program/Cargo.toml # programs/bubblegum/program/src/processor/create_tree.rs
…on is not available on mainnet yet
Use constants from external crate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A finalized version of the Bubblegum update for batch minting
Batch operations
As was observed, minting of assets constitutes over 90% of all operations pertaining to digital assets. In order to reduce the number of transactions and optimize the time and cost it takes to put your tree on-chain during the Solana heavy load events Metaplex has introduced the batch-mint operations. The batch extension to the Bubblegum program introduces offline Merkle tree creation, enabling users to prepare and manage Merkle trees offline before finalizing them on-chain. The resulting trees are fully compatible with the regular trees. The snapshot of the tree created is required to be stored off-chain so the replay of the tree creation is possible on any indexer.
Batch-Mint Operations
Introduction
The latest extension to the Bubblegum contract introduces batch-mint operations, allowing users to mint multiple cNFTs in just several transactions, which significantly reduces on-chain overhead and optimizes minting processes for large collections.
How It Works
With the batch-mint operations, users can prepare an entire set of NFTs off-chain, populate them within a Merkle tree structure, and then mint them to the tree in a small number of transactions. This process is designed to handle large-scale NFT collections more efficiently.
Steps to Perform a Batch-Mint
In order to simplify the Merkle tree creation and interactions we recommend using the SDK.
To understand the batch-mint flow, let's recall the structure of a tree data account:
where n is the depth of the canopy.
prepare_tree
method to initialize an account with a tree header and an empty tree body and empty canopy buffer.add_canopy
method is invoked, tree body at this stage stays emptyfinalize_tree_with_root
for a tree without verified collections orfinalize_tree_with_root_and_collection
for a tree with one verified collection are used. Signatures from both the tree owner and a designated staker are required.📄
prepare_tree
Prepare a tree structure that will be used to hold multiple NFTs in a batch-mint operation. This step initializes the tree and allocates the necessary resources for subsequent operations.
Accounts
tree_authority
TreeConfig
PDA account that is initialized by this instruction.merkle_tree
payer
tree_creator
log_wrapper
spl-noop
) program ID for logging.compression_program
spl-account-compression
program ID.system_program
Arguments
max_depth
max_buffer_size
public
📄
add_canopy
Add an optional canopy to the tree structure. A canopy is used to optimize the verification process for the tree, making it easier to validate NFT ownership.
Accounts
tree_authority
TreeConfig
PDA account previously initialized byprepare_tree
.merkle_tree
tree_delegate
log_wrapper
spl-noop
) program ID for logging.compression_program
spl-account-compression
program ID.system_program
Arguments
start_index
canopy_nodes
📄
finalize_tree_with_root
Finalize the tree structure by setting the Merkle root, which represents the entire batch of NFTs. This operation completes the preparation phase and makes the tree ready for usage.
Accounts
tree_authority
TreeConfig
PDA account previously initialized byprepare_tree
.merkle_tree
payer
tree_delegate
staker
registrar
voter
mining
fee_receiver
log_wrapper
spl-noop
) program ID for logging.compression_program
spl-account-compression
program ID.system_program
Pubkeys
(s) that are 32-byte Keccak256 hash values that represent the nodes for this cNFT's Merkle proof.Arguments
root
rightmost_leaf
rightmost_index
_metadata_url
_metadata_hash
📄
finalize_tree_with_root_and_collection
Finalize the tree structure by setting the Merkle root and associating it with a specific NFT collection. This operation allows having a verified collection for NFTs in the batch.
Accounts
tree_authority
TreeConfig
PDA account previously initialized byprepare_tree
.merkle_tree
payer
tree_delegate
staker
collection_authority
registrar
voter
mining
fee_receiver
collection_authority_record_pda
collection_mint
collection_metadata
edition_account
log_wrapper
spl-noop
) program ID for logging.compression_program
spl-account-compression
program ID.system_program
Pubkeys
(s) that are 32-byte Keccak256 hash values that represent the nodes for this cNFT's Merkle proof.Arguments
root
rightmost_leaf
rightmost_index
_metadata_url
_metadata_hash