Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow different type lengths to be stored and loaded #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
32 changes: 27 additions & 5 deletions eth_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,13 @@ value.

## storageStore

Store 256-bit a value in memory to persistent storage
Store bytes value in memory to persistent storage

**Parameters**

- `pathOffset` **i32ptr** the memory offset to load the path from (`bytes32`)
- `valueOffset` **i32ptr** the memory offset to load the value from (`bytes32`)
- `valueOffset` **i32ptr** the memory offset to load the value from (`bytes`)
- `valueLen` **i32** the length of the value

**Returns**

Expand All @@ -225,16 +226,37 @@ Store 256-bit a value in memory to persistent storage

## storageLoad

Loads a 256-bit a value to memory from persistent storage
Loads bytes value to memory from persistent storage. No more than
`resultMaxLength` is loaded. Returns the actual number of bytes loaded.
Returns 0 if there is nothing stored at the path.

**Parameters**

- `pathOffset` **i32ptr** the memory offset to load the path from (`bytes32`)
- `resultOffset` **i32ptr** the memory offset to store the result at (`bytes32`)
- `resultOffset` **i32ptr** the memory offset to store the result at (`bytes`)
- `resultMaxLength` **i32** the maximum length to load

**Returns**

*nothing*
- `lengthLoaded` **i32** Actual number of bytes loaded from storage

**Trap conditions**

- load `bytes32` from memory at `pathOffset` results in out of bounds access,
- store `bytes32` to memory at `resultOffset` results in out of bounds access.

## storageSize

Returns the length of the storage at the path.
Returns 0 if there is nothing stored at the path.

**Parameters**

- `pathOffset` **i32ptr** the memory offset to load the path from (`bytes32`)

**Returns**

- `size` **i32** Number of bytes at the path

**Trap conditions**

Expand Down