we’ve change the code and no tests were updated, which signals to me that our coverage is lacking: the CI won’t complain when the current change is invalidated in any way.
We have an arith_uint256_tests already, we could add a simple test there that proves why we need this change (which fails before the change and passes after):
0diff --git a/src/test/arith_uint256_tests.cpp b/src/test/arith_uint256_tests.cpp
1--- a/src/test/arith_uint256_tests.cpp (revision 77c120d6bf1c214b30992ee5723c063d6fb638f9)
2+++ b/src/test/arith_uint256_tests.cpp (date 1757362769804)
3@@ -65,6 +65,8 @@
4
5 BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality
6 {
7+ static_assert(std::is_trivially_copyable_v<arith_uint256>);
8+
9 BOOST_CHECK(1 == 0+1);
10 // constructor arith_uint256(vector<char>):
11 BOOST_CHECK(R1L.ToString() == ArrayToString(R1Array,32));
It would also prove that the original version would pass the tests:
0diff --git a/src/arith_uint256.h b/src/arith_uint256.h
1--- a/src/arith_uint256.h (revision 3eea9fd39532eeda648e44de365fc4c9112f6fc6)
2+++ b/src/arith_uint256.h (date 1757363002301)
3@@ -37,21 +37,6 @@
4 pn[i] = 0;
5 }
6
7- base_uint(const base_uint& b)
8- {
9- for (int i = 0; i < WIDTH; i++)
10- pn[i] = b.pn[i];
11- }
12-
13- base_uint& operator=(const base_uint& b)
14- {
15- if (this != &b) {
16- for (int i = 0; i < WIDTH; i++)
17- pn[i] = b.pn[i];
18- }
19- return *this;
20- }
21-
22 base_uint(uint64_t b)
23 {
24 pn[0] = (unsigned int)b;
I don’t mind the explicit one suggested in #33332 (review), but I personally don’t see why it’s better, as long as we have a test that already guarantees what we’re after (note: the PR description still mentions the removal).
I don’t insist on removing needless code since others seem to prefer it, but I do insist on adding test for this.