Use primitive-types crate to unify Substrate primitives#61
Conversation
5fada08 to
4a24423
Compare
| fn from(value: &'a $hash) -> Self { | ||
| Self::from(value.as_ref() as &[u8]) | ||
| fn into_uint(&self) -> $uint { | ||
| $uint::from(self.as_ref() as &[u8]) |
There was a problem hiding this comment.
Not really introduced by this PR but the casting it to &[u8] is redundant because fixed_hash impl AsRef<[u8]>
niklasad1
left a comment
There was a problem hiding this comment.
The code looks good to me but the code-organization with uint/hash still remains in this repo is hard to understand.
So now we have if I got it right:
- parity-common/fixed-hash
- parity-common/uint
- parity-common/primitives (both uint and hash)
- this repo (both uint and hash)
Can we move (uint, hash) in this repo to parity-common/primitives?
I think we don't have |
|
@sorpaas I guess it matter of definition on what is but we still have two files named |
|
@sorpaas what to do about this PR? The end goal should probably be to deprecate this repo after paritytech/parity-common#97 right? |
|
@sorpaas This can be closed yes? |
|
Yes this can be closed. I think we moved most of the code to |
openethereum/parity-ethereum#9994
This uses the new
primitive-typescrate to allow common types in Parity Ethereum and Substrate to be shared.primitive-types.ethereum-types, we define the conversion ofuinttypes tohash. Because it assumes big endian, those are currently specific to Ethereum and if used out of context, it can lead to confusion. For example,parity-codecuse little endian forU256encoding. As a result, I created a new traitBigEndianHashthat handles those conversions.ethereum-types-serializecrate is no longer used. So it's removed.