From d02336b1ce5694384b6c0dd233086c7329d2ab50 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 27 Dec 2024 13:25:32 -0600 Subject: [PATCH] builds --- stylus-proc/src/macros/entrypoint.rs | 2 +- stylus-proc/src/macros/storage.rs | 8 +++++++- stylus-sdk/src/storage/traits.rs | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/stylus-proc/src/macros/entrypoint.rs b/stylus-proc/src/macros/entrypoint.rs index 6280190..b358342 100644 --- a/stylus-proc/src/macros/entrypoint.rs +++ b/stylus-proc/src/macros/entrypoint.rs @@ -127,7 +127,7 @@ fn top_level_storage_impl(item: &syn::ItemStruct) -> syn::ItemImpl { fn struct_entrypoint_fn(name: &Ident) -> syn::ItemFn { parse_quote! { fn #STRUCT_ENTRYPOINT_FN(input: alloc::vec::Vec, host: Rc) -> stylus_sdk::ArbResult { - stylus_sdk::abi::router_entrypoint::<#name, #name, H>(input, host) + stylus_sdk::abi::router_entrypoint::<#name, #name, H>(input, host) } } } diff --git a/stylus-proc/src/macros/storage.rs b/stylus-proc/src/macros/storage.rs index 9d51628..69dcffa 100644 --- a/stylus-proc/src/macros/storage.rs +++ b/stylus-proc/src/macros/storage.rs @@ -166,6 +166,9 @@ impl StorageField { return None; }; let ty = &self.ty; + if ty.to_token_stream().to_string() == "Rc < H >".to_string() { + return None; + } Some(parse_quote! { #ident: { let bytes = <#ty as storage::StorageType>::SLOT_BYTES; @@ -177,7 +180,7 @@ impl StorageField { space -= bytes; let root = root + alloy_primitives::U256::from(slot); - let field = <#ty as storage::StorageType>::new(root, space as u8, Rc::clone(&self.host)); + let field = <#ty as storage::StorageType>::new(root, space as u8, Rc::clone(&host)); if words > 0 { slot += words; space = 32; @@ -189,6 +192,9 @@ impl StorageField { fn size(&self) -> TokenStream { let ty = &self.ty; + if ty.to_token_stream().to_string() == "Rc < H >".to_string() { + return quote! {}; + } quote! { let bytes = <#ty as storage::StorageType>::SLOT_BYTES; let words = <#ty as storage::StorageType>::REQUIRED_SLOTS; diff --git a/stylus-sdk/src/storage/traits.rs b/stylus-sdk/src/storage/traits.rs index 2d0bf15..d71b438 100644 --- a/stylus-sdk/src/storage/traits.rs +++ b/stylus-sdk/src/storage/traits.rs @@ -319,7 +319,7 @@ pub trait GlobalStorage { if B == 256 { return Self::set_word( - host, + Rc::clone(&host), key, FixedBytes::from_slice(&value.to_be_bytes::<32>()), );