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

Creators and collection batch mint verifications #204

Merged
merged 5 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ log = "0.4.17"
metrics = "0.20.1"
migration = {path = "migration"}
mime_guess = "2.0.4"
mpl-bubblegum = { path = "blockbuster/mpl-bubblegum/clients/rust", features = ["serde"] }
mpl-bubblegum = { git = "https://github.com/adm-metaex/mpl-bubblegum.git", branch = "feature/cleanup", features = ["serde"] }
mpl-core = { git = "https://github.com/RequescoS/mpl-core.git", features = ["serde"] }
mpl-token-metadata = "4.1.1"
nft_ingester = {path = "nft_ingester"}
Expand Down Expand Up @@ -100,18 +100,18 @@ solana-program = "1.18.11"
solana-sdk = "1.18.11"
solana-transaction-status = "1.18.11"
solana-zk-token-sdk = "1.17.16"
spl-account-compression = { path = "blockbuster/mpl-bubblegum/solana-program-library/account-compression/programs/account-compression", features = ["no-entrypoint"] }
spl-account-compression = { git = "https://github.com/StanChe/solana-program-library.git", branch = "feature/init_with_root", features = ["no-entrypoint"] }
spl-associated-token-account = ">= 1.1.3, < 3.0"
spl-concurrent-merkle-tree = { path = "blockbuster/mpl-bubblegum/solana-program-library/libraries/concurrent-merkle-tree"}
spl-noop = { path = "blockbuster/mpl-bubblegum/solana-program-library/account-compression/programs/noop", features = ["no-entrypoint"] }
spl-concurrent-merkle-tree = { git = "https://github.com/StanChe/solana-program-library.git", branch = "feature/init_with_root" }
spl-noop = { git = "https://github.com/StanChe/solana-program-library.git", branch = "feature/init_with_root", features = ["no-entrypoint"] }
spl-pod = {version = "0.1.0", features = ["serde-traits"]}
spl-token = ">= 3.5.0, < 5.0"
spl-token-2022 = {version = "1.0", features = ["no-entrypoint"]}
spl-token-group-interface = "0.1.0"
spl-token-metadata-interface = "0.2.0"
sqlx = "0.6.2"
stretto = "0.8.4"
thiserror = "1.0.31"
thiserror = "1.0.63"
tokio = "1.30.0"
tokio-stream = "0.1.14"
tower = "0.4.13"
Expand All @@ -131,6 +131,7 @@ serde_with = "3.8.1"
bincode = "1.3.3"
tempfile = "3.10.1"
async-channel = "2.3.1"
bubblegum-batch-sdk = { git = "https://github.com/metaplex-foundation/bubblegum-batch-sdk.git", branch = "main" }

[workspace.lints.clippy]
clone_on_ref_ptr = "deny"
Expand Down
8 changes: 4 additions & 4 deletions blockbuster/blockbuster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ readme = "../README.md"
[dependencies]
bytemuck = { version = "1.14.0", features = ["derive"] }
spl-token-2022 = { version = "1.0", features = ["no-entrypoint"] }
spl-account-compression = { path = "../mpl-bubblegum/solana-program-library/account-compression/programs/account-compression", features = ["no-entrypoint"] }
spl-noop = { path = "../mpl-bubblegum/solana-program-library/account-compression/programs/noop", features = ["no-entrypoint"] }
mpl-bubblegum = { path = "../mpl-bubblegum/clients/rust" }
spl-account-compression = { git = "https://github.com/StanChe/solana-program-library.git", branch = "feature/init_with_root", features = ["no-entrypoint"] }
spl-noop = { git = "https://github.com/StanChe/solana-program-library.git", branch = "feature/init_with_root", features = ["no-entrypoint"] }
Copy link

Choose a reason for hiding this comment

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

you could also use workspace import here

mpl-bubblegum = { workspace = true }
mpl-core = { git = "https://github.com/RequescoS/mpl-core.git", features = ["serde"] }
mpl-token-metadata = { version = "4.1.1", features = ["serde"] }
spl-token = { version = "4.0.0", features = ["no-entrypoint"] }
async-trait = "0.1.57"
bs58 = "0.4.0"
lazy_static = "1.4.0"
borsh = "~0.10.3"
thiserror = "1.0.32"
thiserror = "1.0.63"
log = "0.4.17"
solana-sdk = "~1.18.11"
solana-transaction-status = "~1.18.11"
Expand Down
51 changes: 44 additions & 7 deletions blockbuster/blockbuster/src/programs/bubblegum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use log::warn;
use mpl_bubblegum::{
get_instruction_type,
instructions::{
FinalizeTreeWithRootInstructionArgs, UnverifyCreatorInstructionArgs,
UpdateMetadataInstructionArgs, VerifyCreatorInstructionArgs,
FinalizeTreeWithRootAndCollectionInstructionArgs, FinalizeTreeWithRootInstructionArgs,
UnverifyCreatorInstructionArgs, UpdateMetadataInstructionArgs,
VerifyCreatorInstructionArgs,
},
types::{BubblegumEventType, MetadataArgs, UpdateArgs},
};
Expand All @@ -35,19 +36,22 @@ pub struct FinalizeTreeWithRootInstructionArgsWithStaker {
pub metadata_url: String,
pub metadata_hash: String,
pub staker: Pubkey,
pub collection_mint: Option<Pubkey>,
}
impl FinalizeTreeWithRootInstructionArgsWithStaker {
fn build_finalize_tree_with_root_instruction_args_with_staker(
args: FinalizeTreeWithRootInstructionArgs,
staker: Pubkey,
collection_mint: Option<Pubkey>,
) -> Self {
Self {
rightmost_root: args.rightmost_root,

Choose a reason for hiding this comment

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

lets rename to just 'root'?

rightmost_root: args.root,
rightmost_leaf: args.rightmost_leaf,
rightmost_index: args.rightmost_index,
metadata_url: args.metadata_url,
metadata_hash: args.metadata_hash,
staker,
collection_mint,
}
}
}
Expand Down Expand Up @@ -80,7 +84,7 @@ pub enum Payload {
update_args: UpdateArgs,
tree_id: Pubkey,
},
CreateTreeWithRoot {
FinalizeTreeWithRoot {
args: FinalizeTreeWithRootInstructionArgsWithStaker,
tree_id: Pubkey,
},
Expand Down Expand Up @@ -237,9 +241,14 @@ impl ProgramParser for BubblegumParser {
InstructionName::UpdateMetadata => {
b_inst.payload = Some(build_update_metadata_payload(keys, ix_data)?);
}
InstructionName::CreateTreeWithRoot => {
InstructionName::FinalizeTreeWithRoot => {
b_inst.payload = Some(build_create_tree_with_root_payload(keys, ix_data)?);
}
InstructionName::FinalizeTreeWithRootAndCollection => {
b_inst.payload = Some(build_create_tree_with_root_and_collection_payload(
keys, ix_data,
)?);
}
_ => {}
};
}
Expand Down Expand Up @@ -348,7 +357,35 @@ fn build_create_tree_with_root_payload(
let staker = *keys
.get(4)
.ok_or(BlockbusterError::InstructionParsingError)?;
let args = FinalizeTreeWithRootInstructionArgsWithStaker::build_finalize_tree_with_root_instruction_args_with_staker(args, staker);
let args = FinalizeTreeWithRootInstructionArgsWithStaker::build_finalize_tree_with_root_instruction_args_with_staker(args, staker, None);

Ok(Payload::FinalizeTreeWithRoot { args, tree_id })
}

// See Bubblegum for offsets and positions:
// https://github.com/metaplex-foundation/mpl-bubblegum/blob/main/programs/bubblegum/README.md
fn build_create_tree_with_root_and_collection_payload(
keys: &[Pubkey],
ix_data: &[u8],
) -> Result<Payload, BlockbusterError> {
let args = FinalizeTreeWithRootAndCollectionInstructionArgs::try_from_slice(ix_data)?;

let tree_id = *keys
.get(1)
.ok_or(BlockbusterError::InstructionParsingError)?;
let staker = *keys
.get(4)
.ok_or(BlockbusterError::InstructionParsingError)?;
let collection_mint = *keys
.get(10)
n00m4d marked this conversation as resolved.
Show resolved Hide resolved
.ok_or(BlockbusterError::InstructionParsingError)?;
let args = FinalizeTreeWithRootInstructionArgsWithStaker::build_finalize_tree_with_root_instruction_args_with_staker(FinalizeTreeWithRootInstructionArgs {
root: args.root,
rightmost_leaf: args.rightmost_leaf,
rightmost_index: args.rightmost_index,
metadata_url: args.metadata_url,
metadata_hash: args.metadata_hash,
}, staker, Some(collection_mint));

Ok(Payload::CreateTreeWithRoot { args, tree_id })
Ok(Payload::FinalizeTreeWithRoot { args, tree_id })
}
3 changes: 3 additions & 0 deletions digital_asset_types/src/dao/generated/batch_mint_to_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct Model {
pub created_at_slot: i64,
pub signature: String,
pub staker: Vec<u8>,
pub collection: Option<Vec<u8>>,
pub download_attempts: i32,
pub batch_mint_persisting_state: BatchMintPersistingState,
pub batch_mint_fail_status: Option<BatchMintFailStatus>,
Expand All @@ -33,6 +34,7 @@ pub enum Column {
CreatedAtSlot,
Signature,
Staker,
Collection,
DownloadAttempts,
BatchMintPersistingState,
BatchMintFailStatus,
Expand Down Expand Up @@ -62,6 +64,7 @@ impl ColumnTrait for Column {
Self::CreatedAtSlot => ColumnType::BigInteger.def(),
Self::Signature => ColumnType::String(None).def(),
Self::Staker => ColumnType::Binary.def(),
Self::Collection => ColumnType::Binary.def().null(),
Self::DownloadAttempts => ColumnType::Integer.def(),
Self::BatchMintPersistingState => BatchMintPersistingState::db_type(),
Self::BatchMintFailStatus => BatchMintFailStatus::db_type().null(),
Expand Down
2 changes: 0 additions & 2 deletions digital_asset_types/src/dao/generated/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3

#![allow(unused_imports)]

pub use super::asset::Entity as Asset;
pub use super::asset_authority::Entity as AssetAuthority;
pub use super::asset_creators::Entity as AssetCreators;
Expand Down
Loading
Loading