Hey all, I made a Rust canister development framework called Rustic.
This is a thin wrapper around
ic-cdk and provides some functionalities familiar to EVM Solidity developers such as access control and reentrancy guard. It also incorporates some know-how in canister development such as using stable memory for storing data. The goal is to save much boilerplate code and hide away some IC implementation details, in order to provide an easy entry for new developers coming into the ecosystem.
This is only the first version now and is unstable. Next up I will work to add some examples and improve test coverage.
Your comments, suggestions, and code contributions are welcome.
[Posts are my own and do not represent DFINITY]
I’m a simple man. I notice cool stuff, I star the related GitHub repo.
Interesting features and code, thanks for the share.
Seems interesting! With the
modifiers macro usage it feels a lot like solidity. Looking forward to some examples.
Random thoughts & suggestions:
I’d particularly like to see lifecycle examples. It seems there’s an idea there? But I’m not quite sure how it’s meant to be used, or how it improves on preupgrade/postupgrade.
Also, fwiw, I’ve been considering moving from an explicit concept of “owners” and “admins” to just querying the canister’s controllers. If you can deploy new code to the canister you’re basically a super-admin anyway, and it reduces the number of concepts and amount of code. Maybe you could have
is_admin, and a third,
Building on the modifiers, could you could add a
non_reentrant modifier (like openzeppelin) which just does the
let _guard = ReentrancyGuard::new() before your main function? Or would the
drop happen to early in that case? That might help people avoid the subtle
let _ = trap.
The LogBuffer stuff looks pretty nice. I have a similar thing implemented for error tracking, but yours is pretty clean.
Overall Looking forward to see where it goes
Edit: I should add, that most of what I write is in motoko. Wen motokoic?
Great suggestions! The
non_reentrant feature is implemented in
rustic-macros = "0.1.3".