Skip to content

Commit

Permalink
found the culprit of the code size bloat
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Jan 31, 2025
1 parent 1e72f27 commit 0958b2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions stylus-proc/src/macros/public/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl PublicImpl {
let fallback_deny: Option<syn::ExprIf> = match fallback_purity {
Purity::Payable => None,
_ => Some(parse_quote! {
if let Err(err) = stylus_sdk::abi::internal::deny_value("fallback") {
if let Err(err) = stylus_sdk::abi::internal::deny_value(storage.vm(), "fallback") {
return Some(Err(err));
}
}),
Expand All @@ -82,7 +82,7 @@ impl PublicImpl {
parse_quote! {
impl<S, #generic_params> #Router<S> for #self_ty
where
S: stylus_sdk::stylus_core::storage::TopLevelStorage + core::borrow::BorrowMut<Self>
S: stylus_sdk::stylus_core::storage::TopLevelStorage + core::borrow::BorrowMut<Self> + stylus_sdk::stylus_core::host::HostAccess,
#(
S: core::borrow::BorrowMut<#inheritance>,
)*
Expand Down Expand Up @@ -320,7 +320,7 @@ impl<E: FnExtension> PublicFn<E> {
} else {
let name = self.name.to_string();
Some(parse_quote! {
if let Err(err) = internal::deny_value(#name) {
if let Err(err) = internal::deny_value(storage.vm(), #name) {
return Some(Err(err));
}
})
Expand Down
4 changes: 2 additions & 2 deletions stylus-sdk/src/abi/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub const fn digest_to_selector(digest: [u8; 32]) -> [u8; 4] {
}

#[allow(unused)]
pub fn deny_value(method_name: &str) -> Result<(), Vec<u8>> {
if msg::value() == U256::ZERO {
pub fn deny_value(vm: &dyn stylus_core::host::Host, method_name: &str) -> Result<(), Vec<u8>> {
if vm.msg_value() == U256::ZERO {
return Ok(());
}
console!("method {method_name} not payable");
Expand Down

0 comments on commit 0958b2c

Please sign in to comment.