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

feat: add b256<->u256 from impls #398

Merged
merged 1 commit into from
Mar 4, 2023

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Mar 4, 2023

converting hash types to u256 is incredibly annoying.

ethereum-types solved this via a BigendianHash trait

https://github.com/paritytech/parity-common/blob/27b17c0d5d32ebf384dd4b535d9045598904519d/ethereum-types/src/hash.rs#L18

however, I really would like to have From impls instead, so you don't have to do.

U256::from_be_bytes(b256.0) or U256::from_be_bytes(b256.to_fixed_bytes())

@rakita
Copy link
Member

rakita commented Mar 4, 2023

From impl looks better

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

Successfully merging this pull request may close these issues.

2 participants