Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
consider key size in try_insert too
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
  • Loading branch information
xermicus committed Oct 27, 2023
commit 570f3ab6b576eb6904211c6b93b521e891ca0607
5 changes: 5 additions & 0 deletions crates/storage/src/lazy/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ where
R: Storable + scale::EncodeLike<V>,
{
let key_size = <Q as Encode>::encoded_size(&key);

if key_size > ink_env::BUFFER_SIZE {
return Err(ink_env::Error::BufferTooSmall)
}

let value_size = <R as Storable>::encoded_size(value);

if key_size.saturating_add(value_size) > ink_env::BUFFER_SIZE {
Expand Down