Skip to content

Commit

Permalink
use mini-alloc by default and hide panic handler when std
Browse files Browse the repository at this point in the history
  • Loading branch information
ggonzalez94 committed Oct 20, 2024
1 parent ca1f26a commit 0fafa5a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
34 changes: 22 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ all = "warn"

[workspace.dependencies]
# stylus-related
stylus-sdk = { version = "=0.6.0", default-features = false }
stylus-sdk = "0.6.0"
stylus-proc = { version = "=0.6.0", default-features = false }
mini-alloc = "0.4.2"

Expand Down
6 changes: 2 additions & 4 deletions contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Once defined as a dependency, use one of our pre-defined implementations by
importing them:
```ignore
use stylus_sdk::prelude::*;
use openzeppelin_stylus::token::erc20::Erc20;
sol_storage! {
Expand All @@ -43,14 +44,11 @@ impl MyContract { }
#![deny(rustdoc::broken_intra_doc_links)]
extern crate alloc;

#[global_allocator]
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;

pub mod access;
pub mod token;
pub mod utils;

#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", not(feature = "std")))]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
Expand Down
3 changes: 0 additions & 3 deletions examples/merkle-proofs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ use stylus_sdk::{
prelude::{entrypoint, public, sol_storage},
};

#[global_allocator]
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;

#[cfg(target_arch = "wasm32")]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
Expand Down

0 comments on commit 0fafa5a

Please sign in to comment.