Skip to content

Conversation

@random-zebra
Copy link

Keep going with the migration started in #1395 and #1414.
This time migrate the whole class uint160, so it is defined as a child of base_blob (essentially replace uint160 with blob_uint160), thus migrating CKeyID and CScriptID as well.

Since opaque blobs (unlike the arith_uint classes) have trivial copy-assignment operator, this fixes the "scary" -Wclass-memaccess warning reported in #2076 (tested before/after patch, with gcc v9.3.0)

Bonus: this fixes also a minor bug found along the way: few places where we are checking the result of boost::get<CKeyID> over the pointed CKeyID, which shouldn't even have a bool operator(), and might even be un-initialized (though we always verify IsValidDestination before, so this is mostly redundant) instead of checking the pointer itself.

@random-zebra random-zebra self-assigned this Dec 20, 2020
@furszy furszy added this to the Future milestone Dec 20, 2020
@random-zebra random-zebra removed this from the Future milestone Dec 21, 2020
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, utACK dea250c

@random-zebra random-zebra added this to the 5.1.0 milestone Jan 17, 2021
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK dea250c

@random-zebra random-zebra merged commit 6ceb077 into PIVX-Project:master Jan 22, 2021
furszy added a commit that referenced this pull request May 10, 2021
722759d [Refactor] Remove arith_uint256::GetCheapHash() and fix uint256 implem. (random-zebra)
a640051 [Refactor] uint256: update GetHex() and SetHex() (random-zebra)
bce58ac [Refactor] uint256: raname data --> m_data and make it protected (random-zebra)
4ddd8f1 [BUG] Use arith_uint256 for old modifier's block sorting (random-zebra)
b1c0afb [Trivial] Log stake modifier and timeBlockFrom in CheckKernelHash() (random-zebra)
ddf0dcb [arith_uint256] Do not destroy *this content if passed-in operator may reference it (Karl-Johan Alm)
8fe19b1 [Refactor] uint256 add missing explicit instantiation for base_blob<512> (random-zebra)
22213ff [Refactor] Migrate uint256.h/.cpp to blob_uint implementation (random-zebra)
957f529 [Refactor] pow/pos: use arith_uint256 for difficulty targets (random-zebra)
9663d99 [Refactoring] GUI/RPC: use uint256S() to construct uint256 from string (random-zebra)
b02a67b [Refactor] Use arith_uint256 for masternode ranking computations (random-zebra)
990072e [Refactor] Move trim256 and use arith_uint512 for HashQuark calculations (random-zebra)
f8c41ca [Refactor] zerocoin: use arith_uint256 where needed (random-zebra)
bce0583 [Refactor] zc ParamGeneration: pass big args by ref and use arith_uint (random-zebra)
6488f24 [Tests] Fix arith in pedersen_hash_/skiplist_/pmt_/transaction_tests (random-zebra)
86e177b [Tests] Replace uint256 tests with blob_uint256 tests (random-zebra)
b4a459b [Refactoring] BIP38: init uint from string and use arith where needed (random-zebra)

Pull request description:

  Finally out of an old rabbit hole, started with #1395, #1414, and #2092.
  As per title, complete the migration:
  - use `arith_uint*` classes whenever the uint is interpreted as a number
  - make `uint*` classes child of `base_blob`, and use it everywhere else
  - remove `blob_uint*` temporary class
  - update tests

ACKs for top commit:
  furszy:
    Have been running this since the last rebase and all good, ACK 722759d
  Fuzzbawls:
    ACK 722759d

Tree-SHA512: cf593243c2f2dbba1a7534cacb7ed261518b4969498dfc703ea875faf87ad94a3ee25eb587aebda225d8617a94301bff5017bb7f00b04d91e0f3e3fbbd04e0f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants