https://libro.blockdeep.dev/high/Be_Careful_With_Storage_Growth.html
fn add_entry_limited(entry: u32) -> Result<(), Error> {
Entries::<T>::try_mutate(|entries| {
entries.try_push(entry).map_err(|_| Error::<T>::TooManyEntries)?;
Ok(())
})
}
There should be a try_push api directly on the storage item, which is much more efficient than doing try_mutate.
In fact, that should probably be its own best practice.
https://libro.blockdeep.dev/high/Be_Careful_With_Storage_Growth.html
There should be a
try_pushapi directly on the storage item, which is much more efficient than doingtry_mutate.In fact, that should probably be its own best practice.