moved hash.rs to bigint library #1827
Conversation
@@ -648,7 +648,7 @@ impl BlockChainClient for Client { | |||
timestamp: view.timestamp(), | |||
difficulty: view.difficulty(), | |||
last_hashes: last_hashes, | |||
gas_used: U256::zero(), | |||
gas_used: Default::default(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I prefer more explicit approach in such cases (U256::default(), U256::from(0)
), for me it just means less cognitive load.
Look at transaction_hash
below especialy, It's quite difficult to understand what type is returned (it gets even more tricky when there is some more .map
ing on options/results/vectors done).
But it's just an opinion :) I'm good with the changes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i think U256::zero() is much more preferred even
we deal with numbers here, not with some objects/classes
fn shift_bloomed() { | ||
use sha3::Hashable; | ||
//use sha3::Hashable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened here? Ignored and commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have mentioned that in PR description. It's commented out and will be moved out of hash.rs
. These tests use keccak function and I didn't want to bring sha3 as a dependency here.
blooms methods are moved to separate trait - tests are no longer commented |
needs a merge -- the |
@@ -1150,7 +1150,7 @@ fn key_save_load() { | |||
#[test] | |||
fn host_client_url() { | |||
let mut config = NetworkConfiguration::new(); | |||
let key = h256_from_hex("6f7b0d801bc7b5ce7bbd930b84fd0369b3eb25d09be58d64ba811091046f3aa2"); | |||
let key = "6f7b0d801bc7b5ce7bbd930b84fd0369b3eb25d09be58d64ba811091046f3aa2".into(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a simple .into()
whereas the address stuff requires a .parse().unwrap()
?
looks good (particularly the |
in next pr, I will make
ethkey
/ethstore
use bigint library