uint icon indicating copy to clipboard operation
uint copied to clipboard

Replace `B256` aliases with `u8` arrays `B256([u8;32])`

Open rakita opened this issue 1 year ago • 2 comments

Hi @recmo are you open to replacing current B types that are aliases for U with [u8;32], we will do the legwork if you approve it.

Current B types in revm that i need are made with primitive-types macros and have some From/Serde added to them: https://github.com/bluealloy/revm/blob/afc30663270f77df9b4399ad9d4cfb0ad2b814ec/crates/primitives/src/bits.rs#L4-L21

This would make a lot of projects be able to directly import ruint: ethers, reth, foundry, revm.

rakita avatar Mar 12 '23 13:03 rakita

It's easy to get a &[u8;N] view on Uint using .as_le_slice(), from_le_bytes or even .as_le_slice_mut(). Does that solve the problem?

Note that this requires a little-endian architecture (which is basically universal).

recmo avatar Apr 20 '23 13:04 recmo

It's easy to get a &[u8;N] view on Uint using .as_le_slice(), from_le_bytes or even .as_le_slice_mut(). Does that solve the problem?

Note that this requires a little-endian architecture (which is basically universal).

Yeah, but most crypto libs work with big endian it is kinda expected for hash/bits to be in that format, I should have started with that.

rakita avatar May 26 '23 22:05 rakita