Change address constructors to explicit
This PR is mainly for making clear how public keys are being ordered in the system, aka explicitly implement
bool operator < ( const public_key_type&, const public_key_type&);
and make sure it's backward-compatible (convert the public keys to addresses and compare the addresses).
More info is here: https://github.com/cryptonomex/graphene/issues/630#issuecomment-199981206 .
The == operators are mainly used in balance_evaluator.cpp, actually I'm not sure whether it's good to have them (does it make sense to compare a pts_address with an address, or compare a public key to an address?), please advise. https://github.com/bitshares/bitshares-core/blob/76ab28eff06d6f29e7836fcd62ffc01a24871f82/libraries/chain/balance_evaluator.cpp#L33-L38
The equality operator here boils down to a memcmp of the 2 ripemd160 hashes.
https://github.com/bitshares/bitshares-fc/blob/d679377312d715840408d2990f824d2c6e729aea/src/crypto/ripemd160.cpp#L98-L100
Are you attempting to replace the GRAPHENE_ASSERT with something else? What would you suggest they be replaced with?
Perhaps I am misunderstanding why you are questioning whether it is good to have the equality operators.
My question was: does it make sense to compare a pts_address with an address, or compare a public key to an address?
As mentioned on Telegram, I'm undecided if we should merge this in the upcoming release.
I generally think explicit constructors are better, because that avoids surprising automatic conversion.
OTOH making existing constructors explicit can have surprising side effects, so the change is a bit dangerous.
Surprising side-effects could be avoided by changing all one-argument constructors to explicit. SonarQube lists 61 such issues in the core code, not counting those in fc nor test suites.
Makes sense. I've removed it from this milestone.
Is there a desire to revisit this PR for the 201810 Feature Release?
Like I said, we should make all one-arg constructors explicit in one go. But I think we have more important stuff and little time for the next release, so I'd drop it from this one.
Moving to next milestone.
@pmconrad Sorry, my meeting notes are lacking, so request you comment here with proper instructions for this PR. This is what I captured: "recommendation for now until we decide how to do all explicit constructors"
See my comment above - merging this now could have unforeseeable side effects. Better to switch all one-arg constructors to explicit at once.







