use anchor_lang::{prelude::*, solana_program::hash, Discriminator};
use crate::blob::Blob;
#[constant]
pub const SEED: &[u8] = b"blobs";
#[constant]
pub const MAX_CHUNKS: u16 = 2048;
#[constant]
pub const MAX_BLOB_SIZE: u32 = MAX_CHUNKS as u32 * CHUNK_SIZE as u32;
#[constant]
pub const CHUNK_SIZE: u16 = 915;
pub const COMPOUND_TX_SIZE: u16 = 854;
pub const COMPOUND_DECLARE_TX_SIZE: u16 = 868;
#[constant]
pub const CHUNKS_BITMAP_SIZE: u16 = MAX_CHUNKS / 8;
#[constant]
pub const BLOB_SLOT_INCREMENTAL_DELAY_LIMIT: u64 = 5 * 60 * 2;
#[constant]
pub const BLOB_SLOT_TOTAL_DELAY_LIMIT: u64 = 15 * 60 * 2;
#[constant]
pub const BLOB_ACCOUNT_DATA_OFFSET: u8 = Blob::DISCRIMINATOR.len() as u8;
#[constant]
pub const BLOB_ACCOUNT_DATA_LEN: u8 = hash::HASH_BYTES as u8 + core::mem::size_of::<u32>() as u8;
pub const BLOB_DATA_START: usize = BLOB_ACCOUNT_DATA_OFFSET as usize;
pub const BLOB_DATA_END: usize = BLOB_DATA_START + BLOB_ACCOUNT_DATA_LEN as usize;
pub fn initial_hash() -> [u8; hash::HASH_BYTES] {
hash::Hasher::default().result().to_bytes()
}