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

Conversation

seanyoung
Copy link

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.

None yet

1 participant