mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Use checked math when calculating storage size (#7885)
This commit is contained in:
committed by
GitHub
parent
65569620c2
commit
c2ebcae0a6
@@ -643,8 +643,7 @@ define_env!(Env, <E: Ext>,
|
||||
let mut key: StorageKey = [0; 32];
|
||||
ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?;
|
||||
let value = Some(ctx.read_sandbox_memory(value_ptr, value_len)?);
|
||||
ctx.ext.set_storage(key, value);
|
||||
Ok(())
|
||||
ctx.ext.set_storage(key, value).map_err(Into::into)
|
||||
},
|
||||
|
||||
// Clear the value at the given key in the contract storage.
|
||||
@@ -656,8 +655,7 @@ define_env!(Env, <E: Ext>,
|
||||
ctx.charge_gas(RuntimeToken::ClearStorage)?;
|
||||
let mut key: StorageKey = [0; 32];
|
||||
ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?;
|
||||
ctx.ext.set_storage(key, None);
|
||||
Ok(())
|
||||
ctx.ext.set_storage(key, None).map_err(Into::into)
|
||||
},
|
||||
|
||||
// Retrieve the value under the given key from storage.
|
||||
|
||||
Reference in New Issue
Block a user