Open YaronWittenstein opened 2 years ago
Depends on: #438
Extend the Storage trait here: https://github.com/spacemeshos/svm/blob/master/crates/sdk-storage/src/lib.rs to have load256 / store256 and load512 / store512
Storage
load256 / store256
load512 / store512
Implement under lib.rs:
lib.rs
pub fn load256<S: Storage>(var_id: u32) -> svm_sdk_types::Blob32 { ... } pub fn load512<S: Storage>(var_id: u32) -> svm_sdk_types::Blob64 { ... } pub fn store256<S: Storage>(var_id: u32, slice: &[u8]) { ... } pub fn store512<S: Storage>(var_id: u32, slice: &[u8]) { ... }
Re-expose new getters and setters under the svm-sdk crate: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk/src/lib.rs#L351
svm-sdk
Extend the sdk-storage-mock crate to support the new functionality.
sdk-storage-mock
Extend the sdk-storage-ffi crate to support the new functionality.
sdk-storage-ffi
Add to svm-macros crate: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk-macros/src/struct/storage.rs#L152
svm-macros
match ty.as_str() { "Blob32" => ..., "Blob64" => ..., }
And also extend this method: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk-macros/src/struct/storage.rs#L267
with the following:
field_byte_count
fn field_byte_count(ty: &PrimType) -> usize { match ty.as_str() { "svm_sdk :: Blob32" => 32, "svm_sdk :: Blob64" => 64 }
Depends on: #438
Extend the
Storage
trait here: https://github.com/spacemeshos/svm/blob/master/crates/sdk-storage/src/lib.rs to haveload256 / store256
andload512 / store512
Implement under
lib.rs
:Re-expose new getters and setters under the
svm-sdk
crate: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk/src/lib.rs#L351Extend the
sdk-storage-mock
crate to support the new functionality.Extend the
sdk-storage-ffi
crate to support the new functionality.Add to
svm-macros
crate: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk-macros/src/struct/storage.rs#L152And also extend this method: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk-macros/src/struct/storage.rs#L267
with the following:
field_byte_count
https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk-macros/src/struct/storage.rs#L411