stabilize seal_contains_storage (seal0) and seal_set_storage (seal1) (#11378)

This commit is contained in:
Alexander Gryaznov
2022-05-10 11:07:13 +03:00
committed by GitHub
parent 4b64c9085a
commit e45d53552d
3 changed files with 9 additions and 13 deletions
@@ -185,7 +185,6 @@ pub enum RuntimeCosts {
/// Weight of calling `seal_clear_storage` per cleared byte.
ClearStorage(u32),
/// Weight of calling `seal_contains_storage` per byte of the checked item.
#[cfg(feature = "unstable-interface")]
ContainsStorage(u32),
/// Weight of calling `seal_get_storage` with the specified size in storage.
GetStorage(u32),
@@ -269,7 +268,6 @@ impl RuntimeCosts {
ClearStorage(len) => s
.clear_storage
.saturating_add(s.clear_storage_per_byte.saturating_mul(len.into())),
#[cfg(feature = "unstable-interface")]
ContainsStorage(len) => s
.contains_storage
.saturating_add(s.contains_storage_per_byte.saturating_mul(len.into())),
@@ -889,7 +887,7 @@ define_env!(Env, <E: Ext>,
//
// Returns the size of the pre-existing value at the specified key if any. Otherwise
// `SENTINEL` is returned as a sentinel value.
[__unstable__] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) -> u32 => {
[seal1] seal_set_storage(ctx, key_ptr: u32, value_ptr: u32, value_len: u32) -> u32 => {
ctx.set_storage(key_ptr, value_ptr, value_len)
},
@@ -951,7 +949,7 @@ define_env!(Env, <E: Ext>,
//
// Returns the size of the pre-existing value at the specified key if any. Otherwise
// `SENTINEL` is returned as a sentinel value.
[__unstable__] seal_contains_storage(ctx, key_ptr: u32) -> u32 => {
[seal0] seal_contains_storage(ctx, key_ptr: u32) -> u32 => {
let charged = ctx.charge_gas(RuntimeCosts::ContainsStorage(ctx.ext.max_value_size()))?;
let mut key: StorageKey = [0; 32];
ctx.read_sandbox_memory_into_buf(key_ptr, &mut key)?;