Skip to content
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

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

Open
rakita opened this issue Mar 12, 2023 · 2 comments
Open

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

rakita opened this issue Mar 12, 2023 · 2 comments

Comments

@rakita
Copy link

rakita commented Mar 12, 2023

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 rakita changed the title Replace B256 aliases with u8 arrays B256([u8,32]) Replace B256 aliases with u8 arrays B256([u8;32]) Mar 12, 2023
@recmo
Copy link
Owner

recmo commented Apr 20, 2023

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).

@rakita
Copy link
Author

rakita commented May 26, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants