Skip to content

Allow different type lengths to be stored and loaded#197

Open
seanyoung wants to merge 1 commit intoewasm:masterfrom
seanyoung:storage
Open

Allow different type lengths to be stored and loaded#197
seanyoung wants to merge 1 commit intoewasm:masterfrom
seanyoung:storage

Conversation

@seanyoung
Copy link
Copy Markdown

In a wasm context not all types are 256 bit like in evm. This would make
easier to store smaller primitives (e.g. i32), since they would not
require padding.

The bigger win is when storing/retrieving dynamically sized arrays. Strings
can be stored under a single key and do not require splitting up into
smaller 32 byte chunks, and arrays do not need to store a size parameter.

Signed-off-by: Sean Young sean@mess.org

Note this is how I've started implementing storage in solang: https://github.com/hyperledger-labs/solang and this works much better than the U256 values.

In a wasm context not all types are 256 bit like in evm. This would make
easier to store smaller primitives (e.g. i32), since they would not
require padding.

The bigger win is when storing/retrieving dynamically sized arrays. Strings
can be stored under a single key and do not require splitting up into
smaller 32 byte chunks, and arrays do not need to store a size parameter.

Signed-off-by: Sean Young <sean@mess.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant