Sfoglia il codice sorgente

fix: resolve no_std deployment conflicts while maintaining 23.9 KiB contract size

- Use conditional compilation #[cfg(not(any(feature = "std", feature = "export-abi")))] for no_std and panic handler
- Allows stylus_sdk to use std during deployment phases while maintaining no_std for WASM builds
- Successfully deployed to Arbitrum Sepolia at 0x7c56d119a916da6593e1fd8c1d010161f20afd70
- Contract size remains at 23.9 KiB (24,497 bytes), under 24 KiB deployment limit
- Resolves duplicate panic handler and unresolved std module errors during deployment

Co-Authored-By: ayush.suresh@dourolabs.xyz <byteSlayer31037@gmail.com>
Devin AI 5 mesi fa
parent
commit
5b747008cb
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      target_chains/stylus/contracts/wormhole/src/lib.rs

+ 3 - 3
target_chains/stylus/contracts/wormhole/src/lib.rs

@@ -1,11 +1,11 @@
-#![cfg_attr(not(feature = "std"), no_std, no_main)]
+#![cfg_attr(not(any(feature = "std", feature = "export-abi")), no_std)]
 extern crate alloc;
 
-#[cfg(not(feature = "std"))]
+#[cfg(not(any(feature = "std", feature = "export-abi")))]
 #[global_allocator]
 static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;
 
-#[cfg(not(feature = "std"))]
+#[cfg(not(any(feature = "std", feature = "export-abi")))]
 #[panic_handler]
 fn panic(_info: &core::panic::PanicInfo) -> ! {
     loop {}