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

Stop Bad Trees from Exiting Backfiller Tree Lookup #113

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all 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
29 changes: 21 additions & 8 deletions nft_ingester/src/backfiller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,18 +737,31 @@ impl<'a, T: Messenger> Backfiller<'a, T> {
let (mut header_bytes, rest) = account
.data
.split_at_mut(CONCURRENT_MERKLE_TREE_HEADER_SIZE_V1);
let header: ConcurrentMerkleTreeHeader =
ConcurrentMerkleTreeHeader::try_from_slice(&mut header_bytes)
.map_err(|e| IngesterError::RpcGetDataError(e.to_string()))?;
let header = match ConcurrentMerkleTreeHeader::try_from_slice(&mut header_bytes) {
Ok(header) => header,
Err(e) => {
error!("Failed to parse header: {}", e);
continue;
}
};

let auth = Pubkey::find_program_address(&[pubkey.as_ref()], &mpl_bubblegum::ID).0;

let merkle_tree_size = merkle_tree_get_size(&header)
.map_err(|e| IngesterError::RpcGetDataError(e.to_string()))?;
let merkle_tree_size = match merkle_tree_get_size(&header) {
Ok(size) => size,
Err(e) => {
error!("Failed to get size: {}", e);
continue;
}
};
let (tree_bytes, _canopy_bytes) = rest.split_at_mut(merkle_tree_size);
let seq_bytes = tree_bytes[0..8].try_into().map_err(|_e| {
IngesterError::RpcGetDataError("Failed to convert seq bytes to array".to_string())
})?;
let seq_bytes = match tree_bytes[0..8].try_into() {
Ok(bytes) => bytes,
Err(_e) => {
error!("Failed to convert seq bytes to array");
continue;
}
};
let seq = u64::from_le_bytes(seq_bytes);
list.insert(pubkey, SlotSeq(header.get_creation_slot(), seq));

Expand Down
Loading