Skip to content

Conversation

@LucasGrasso
Copy link
Contributor

Partially addresses #2653

  • [n] y/n | Does it introduce breaking changes?
  • [n] y/n | Is it dependent on a specific version of cargo-contract or pallet-revive?

Description

Implements the following host fns:

  • set_storage - Implementing set_storage_or_clear for normal storage
  • get_storage - Implementing get_storage_or_zero for normal storage
  • set_transient_storage - Implementing set_storage_or_clear for transient storage
  • get_transient_storage - Implementing get_storage_or_zero for transient storage
  • call_data_load
  • return_data_copy

@LucasGrasso
Copy link
Contributor Author

LucasGrasso commented Dec 1, 2025

Hey @cmichi @davidsemakula, I would appreciate your thoughts on the following:

Related to Storage functions:

  • Currently I'm defining functions for transient and normal storage. I think its more dev friendly than having to set the flags manually.
  • Currently I am setting key to be an U256 and value to be [u8;32]. I've been thinking to have a key be any type that implements scale::Encode and that can be encoded to 32-bytes and value to implement Storeable + Default, so to turn to the default value when get_storage_or_zero returns [0,32]. I think this would be great for developers but it implies creating specific functions for clearing a key. (Something like https://github.com/LucasGrasso/ink/pull/1/files)

Related to return_data_copy:

  • Should I return a Vec and own the buffer or just make the user pass a buffer?

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