serai-dex / serai

Other
262 stars 49 forks source link

no_std support #279

Closed kayabaNerve closed 4 months ago

kayabaNerve commented 1 year ago

We have some crates explicitly no_std, yet it'd be great to offer no_std/alloc variants of others.

monero-serai would have to std-feature-gate its RPC. It also uses serde-json in its seed code. That could be replaced simply by making the JSON files it read Rust files (vec![ instead of [).

hashbrown offers a HashSet/HashMap on alloc alone.

We'd need a way to replace the Read/Write traits though...

kayabaNerve commented 1 year ago

https://github.com/kayabaNerve/serai/tree/foundation shows the changes needed for this re: crypto, monero.

kayabaNerve commented 1 year ago

The end goal is all crates under crypto, bitcoin-serai, and monero-serai to support no_std (likely alloc) builds. There is further commentary on the usability of a monero-serai such built, as it can sign tranactions yet not create them. There likely should be some refactor of the RPC so a message channel could be defined as the RPC, allowing JS to handle web requests and just pass comms back and forth.

kayabaNerve commented 1 year ago

Rust 1.70 stabilized OnceCell which will let us remove lazy-static. lazy-static inverts the usual no-std handling (if you want to support no-std, you always have to use a less efficient no-std compat crate), so that'll be great.

kayabaNerve commented 1 year ago

https://github.com/serai-dex/serai/commit/adfbde6e2494290099511c39976915522bfd6239 moved Monero to an arbitrary RPC.

kayabaNerve commented 1 year ago

monero-serai is now no-std as of #311.

kayabaNerve commented 4 months ago

Closing this as having made sufficient progress.