-
Notifications
You must be signed in to change notification settings - Fork 53
Use mini-alloc by default and remove panic handler #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Seems this is similar to pr. We could discuss it there. |
In terms of DevEx I think that we should prioritise I believe that our library will be used by more "mature" Stylus developers that understand the SDK and need to build more advanced projects. For this I think having well documented steps for including our library to the project is enough. For the merge I see 2 options:
|
Just updated dependencies for mini alloc. We don't need to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked these changes as a patch for openzeppelin-stylus
at stylus-debug-issue
repo. Seems it works currently (when you call cargo clean
between changes).
I suspect that probably issue was with 0.4.2
version of mini-alloc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be merged after #375 and use nigthly-2024-09-05
Resolves #292 Sets the general structure for a Changelog that we can follow starting with the changes for `v0.2.0`. Structure and how to maintain it based on: https://keepachangelog.com/en/1.1.0/ DO NOT MERGE UNTIL WE RELEASE `0.1.0` SINCE WE ARE SPECIFYING THE DATE OF THAT RELEASE --------- Co-authored-by: Daniel Bigos <[email protected]>
…eppelin/rust-contracts-stylus into improve-default-allocators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.
…ocators # Conflicts: # .github/workflows/check-wasm.yml # .github/workflows/e2e-tests.yml # .github/workflows/gas-bench.yml
Mi intention is not that we directly merge this PR, but that it serves 2 purposes
Background
While testing how the experience will be for someone that creates a new stylus project by running
cargo stylus new
I realized a couple things that I think hurt DX.#[no_std]
by default it defines a custom panic_handler such that if you use it from ano_std
environment you don’t have to define it yourself. The problem is that if you want to use the std library in your project(and that seems to be a reasonable assumption according to this), you cannot do it since it results in a duplication of the panic_handler function. This is also the default behavior when you create a new project withcargo stylus new
.Proposed Solution
cargo stylus new
.cargo stylus new
it is harder to realize and you might spend some time trying to figure it out.std
flag on our library, which might enable other behaviors we haven’t considered? Since we’ve been mainly using it for testingno_std
and having zero dependencies on the std library would have to define it themselves.This approach is more reasonable IMO, since it makes it easier for newcomers, but it requires some extra effort if you are experienced enough to define your contracts with
no_std
.The problem today is that we set the library type to cdylib, which requires the crate to define a panic_handler when using
no_std
(more info here). If we find a way to do this, maybe this is the best approach, maybe it is possible using unstable features.Edit
cdylib
(thanks @qalisander )! Now the user of the library can just usestd
or define their own panic handler.