I want to have a queue system in a pallet using a storage value and a bounded vector.
/// Data related to tranmission queues.
#[pallet::storage]
#[pallet::getter(fn at_block_queue)]
pub type AtBlockQueue<T: Config> = StorageValue<_, Queue<T::BlockNumber, T::SimultaneousTransmissionLimit>, ValueQuery>;
pub struct Queue<BlockNumber: Clone + PartialEq + Debug + sp_std::cmp::PartialOrd, Limit: Get<u32>>(
pub BoundedVec<(NFTId, BlockNumber), Limit>,
);
I would like this queue to be limited at 10_000_000 values. This seems ok while testing but the benchmarks are failing due to a failed allocation.
In my benchmarking code, I use a function to fill the queue to simulate usage :
// Benchmark / tests only
pub fn bulk_insert(
&mut self,
nft_id: NFTId,
block_number: BlockNumber,
number: u32,
) -> Result<(), ()> {
self.0.try_extend(vec![(nft_id, block_number); number as usize].into_iter())
}
I was wondering if the Limit value was too high or my benchmarking method is wrong.