Split ext_clear_storage out from ext_set_storage (#5103)

* split out ext_clear_storage from ext_set_storage contracts API

* update tests to adjust for the ext_set_storage changes

* adjust COMPLEXITY for the ext_set_storage API changes

* remove value_len == 0 constraint for ext_set_storage

* bump spec_version

* remove guarantee from COMPLEXITY of ext_clear_storage

Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
Hero Bird
2020-03-11 09:46:20 +01:00
committed by GitHub
parent 93ee3104e7
commit e5e0ca7389
4 changed files with 50 additions and 36 deletions
+11 -1
View File
@@ -261,10 +261,20 @@ Each external function invoked from a contract can involve some overhead.
This function receives a `key` and `value` as arguments. It consists of the following steps:
1. Reading the sandbox memory for `key` and `value` (see sandboxing memory get).
2. Setting the storage by the given `key` with the given `value` (see `set_storage`).
2. Setting the storage at the given `key` to the given `value` (see `set_storage`).
**complexity**: Complexity is proportional to the size of the `value`. This function induces a DB write of size proportional to the `value` size (if flushed to the storage), so should be priced accordingly.
## ext_clear_storage
This function receives a `key` as argument. It consists of the following steps:
1. Reading the sandbox memory for `key` (see sandboxing memory get).
2. Clearing the storage at the given `key` (see `set_storage`).
**complexity**: Complexity is constant. This function induces a DB write to clear the storage entry
(upon being flushed to the storage) and should be priced accordingly.
## ext_get_storage
This function receives a `key` as an argument. It consists of the following steps: