Skip to content

Commit ee42c15

Browse files
chore: run clang-format and add trivial headers
1 parent 6b41290 commit ee42c15

File tree

6 files changed

+38
-35
lines changed

6 files changed

+38
-35
lines changed

src/bench/bls.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static void BLS_ToBytes_Signature(benchmark::Bench& bench)
364364
CBLSSecretKey sk;
365365
sk.MakeNewKey();
366366
auto sig = sk.Sign(uint256::ONE, false);
367-
367+
368368
bench.run([&] {
369369
auto bytes = sig.ToBytes(false);
370370
ankerl::nanobench::doNotOptimizeAway(bytes);
@@ -376,7 +376,7 @@ static void BLS_ToByteVector_Signature(benchmark::Bench& bench)
376376
CBLSSecretKey sk;
377377
sk.MakeNewKey();
378378
auto sig = sk.Sign(uint256::ONE, false);
379-
379+
380380
bench.run([&] {
381381
auto bytes = sig.ToByteVector(false);
382382
ankerl::nanobench::doNotOptimizeAway(bytes);
@@ -388,7 +388,7 @@ static void BLS_ToBytes_PubKey(benchmark::Bench& bench)
388388
CBLSSecretKey sk;
389389
sk.MakeNewKey();
390390
auto pk = sk.GetPublicKey();
391-
391+
392392
bench.run([&] {
393393
auto bytes = pk.ToBytes(false);
394394
ankerl::nanobench::doNotOptimizeAway(bytes);
@@ -400,7 +400,7 @@ static void BLS_ToByteVector_PubKey(benchmark::Bench& bench)
400400
CBLSSecretKey sk;
401401
sk.MakeNewKey();
402402
auto pk = sk.GetPublicKey();
403-
403+
404404
bench.run([&] {
405405
auto bytes = pk.ToByteVector(false);
406406
ankerl::nanobench::doNotOptimizeAway(bytes);
@@ -412,7 +412,7 @@ static void BLS_Serialize_Signature_Array(benchmark::Bench& bench)
412412
CBLSSecretKey sk;
413413
sk.MakeNewKey();
414414
auto sig = sk.Sign(uint256::ONE, false);
415-
415+
416416
bench.run([&] {
417417
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
418418
ss << sig;
@@ -425,7 +425,7 @@ static void BLS_Serialize_Signature_Vector(benchmark::Bench& bench)
425425
CBLSSecretKey sk;
426426
sk.MakeNewKey();
427427
auto sig = sk.Sign(uint256::ONE, false);
428-
428+
429429
bench.run([&] {
430430
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
431431
auto vec = sig.ToByteVector(false);

src/governance/vote.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <hash.h>
99
#include <primitives/transaction.h>
10+
#include <span.h>
1011
#include <uint256.h>
1112
#include <util/string.h>
1213

src/masternode/node.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class CActiveMasternodeManager
6767
[[nodiscard]] bool Decrypt(const EncryptedObj<Obj>& obj, size_t idx, Obj& ret_obj, int version) const
6868
EXCLUSIVE_LOCKS_REQUIRED(!cs);
6969
[[nodiscard]] CBLSSignature Sign(const uint256& hash, const bool is_legacy) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
70-
[[nodiscard]] std::array<uint8_t, BLS_CURVE_SIG_SIZE> SignBasic(const uint256& hash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
70+
[[nodiscard]] std::array<uint8_t, BLS_CURVE_SIG_SIZE> SignBasic(const uint256& hash) const
71+
EXCLUSIVE_LOCKS_REQUIRED(!cs);
7172

7273
/* TODO: Reconsider external locking */
7374
[[nodiscard]] COutPoint GetOutPoint() const { READ_LOCK(cs); return m_info.outpoint; }

src/serialize.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <algorithm>
1212
#include <atomic>
13+
#include <array>
1314
#include <concepts>
1415
#include <cstdint>
1516
#include <cstring>

src/test/bls_tests.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -597,14 +597,14 @@ BOOST_AUTO_TEST_CASE(bls_tobytes_vs_tobytevector_signature)
597597
{
598598
// Test that ToBytes() and ToByteVector() produce identical results for signatures
599599
bls::bls_legacy_scheme.store(false);
600-
600+
601601
CBLSSecretKey sk;
602602
sk.MakeNewKey();
603603
auto sig = sk.Sign(uint256::ONE, false);
604-
604+
605605
auto bytes_array = sig.ToBytes(false);
606606
auto bytes_vector = sig.ToByteVector(false);
607-
607+
608608
BOOST_CHECK_EQUAL(bytes_array.size(), BLS_CURVE_SIG_SIZE);
609609
BOOST_CHECK_EQUAL(bytes_vector.size(), BLS_CURVE_SIG_SIZE);
610610
BOOST_CHECK(std::equal(bytes_array.begin(), bytes_array.end(), bytes_vector.begin()));
@@ -614,14 +614,14 @@ BOOST_AUTO_TEST_CASE(bls_tobytes_vs_tobytevector_pubkey)
614614
{
615615
// Test that ToBytes() and ToByteVector() produce identical results for public keys
616616
bls::bls_legacy_scheme.store(false);
617-
617+
618618
CBLSSecretKey sk;
619619
sk.MakeNewKey();
620620
auto pk = sk.GetPublicKey();
621-
621+
622622
auto bytes_array = pk.ToBytes(false);
623623
auto bytes_vector = pk.ToByteVector(false);
624-
624+
625625
BOOST_CHECK_EQUAL(bytes_array.size(), BLS_CURVE_PUBKEY_SIZE);
626626
BOOST_CHECK_EQUAL(bytes_vector.size(), BLS_CURVE_PUBKEY_SIZE);
627627
BOOST_CHECK(std::equal(bytes_array.begin(), bytes_array.end(), bytes_vector.begin()));
@@ -631,13 +631,13 @@ BOOST_AUTO_TEST_CASE(bls_tobytes_vs_tobytevector_seckey)
631631
{
632632
// Test that ToBytes() and ToByteVector() produce identical results for secret keys
633633
bls::bls_legacy_scheme.store(false);
634-
634+
635635
CBLSSecretKey sk;
636636
sk.MakeNewKey();
637-
637+
638638
auto bytes_array = sk.ToBytes(false);
639639
auto bytes_vector = sk.ToByteVector(false);
640-
640+
641641
BOOST_CHECK_EQUAL(bytes_array.size(), BLS_CURVE_SECKEY_SIZE);
642642
BOOST_CHECK_EQUAL(bytes_vector.size(), BLS_CURVE_SECKEY_SIZE);
643643
BOOST_CHECK(std::equal(bytes_array.begin(), bytes_array.end(), bytes_vector.begin()));
@@ -647,29 +647,29 @@ BOOST_AUTO_TEST_CASE(bls_signature_array_serialization)
647647
{
648648
// Test that BLS signatures serialize correctly with std::array
649649
bls::bls_legacy_scheme.store(false);
650-
650+
651651
CBLSSecretKey sk;
652652
sk.MakeNewKey();
653653
auto sig = sk.Sign(uint256::ONE, false);
654-
654+
655655
// Serialize using standard serialization
656656
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
657657
ss << sig;
658-
658+
659659
// Deserialize
660660
CBLSSignature sig2;
661661
ss >> sig2;
662-
662+
663663
BOOST_CHECK(sig == sig2);
664-
664+
665665
// Verify the serialized size is exactly BLS_CURVE_SIG_SIZE (no size prefix)
666666
CDataStream ss2(SER_NETWORK, PROTOCOL_VERSION);
667667
ss2 << sig;
668668
BOOST_CHECK_EQUAL(ss2.size(), BLS_CURVE_SIG_SIZE);
669-
669+
670670
// Test array assignment from ToBytes
671671
std::array<uint8_t, BLS_CURVE_SIG_SIZE> sig_array = sig.ToBytes(false);
672-
672+
673673
// Construct signature from array via Span
674674
CBLSSignature sig3(Span{sig_array}, false);
675675
BOOST_CHECK(sig == sig3);

src/test/serialize_tests.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ BOOST_AUTO_TEST_CASE(array_serialization_bytes)
313313
std::array<uint8_t, 4> arr_in = {0x01, 0x02, 0x03, 0x04};
314314
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
315315
ss << arr_in;
316-
316+
317317
// Should serialize without size prefix for byte arrays
318318
BOOST_CHECK_EQUAL(ss.size(), 4);
319-
319+
320320
std::array<uint8_t, 4> arr_out;
321321
ss >> arr_out;
322322
BOOST_CHECK(arr_in == arr_out);
@@ -328,7 +328,7 @@ BOOST_AUTO_TEST_CASE(array_serialization_integers)
328328
std::array<int32_t, 3> arr_in = {100, 200, 300};
329329
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
330330
ss << arr_in;
331-
331+
332332
std::array<int32_t, 3> arr_out;
333333
ss >> arr_out;
334334
BOOST_CHECK(arr_in == arr_out);
@@ -340,7 +340,7 @@ BOOST_AUTO_TEST_CASE(array_serialization_bools)
340340
std::array<bool, 5> arr_in = {true, false, true, true, false};
341341
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
342342
ss << arr_in;
343-
343+
344344
std::array<bool, 5> arr_out;
345345
ss >> arr_out;
346346
BOOST_CHECK(arr_in == arr_out);
@@ -353,7 +353,7 @@ BOOST_AUTO_TEST_CASE(array_serialization_empty)
353353
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
354354
ss << arr_in;
355355
BOOST_CHECK_EQUAL(ss.size(), 0);
356-
356+
357357
std::array<uint8_t, 0> arr_out;
358358
ss >> arr_out;
359359
}
@@ -365,11 +365,11 @@ BOOST_AUTO_TEST_CASE(array_serialization_bls_signature)
365365
for (size_t i = 0; i < BLS_CURVE_SIG_SIZE; ++i) {
366366
arr_in[i] = static_cast<uint8_t>(i);
367367
}
368-
368+
369369
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
370370
ss << arr_in;
371371
BOOST_CHECK_EQUAL(ss.size(), BLS_CURVE_SIG_SIZE);
372-
372+
373373
std::array<uint8_t, BLS_CURVE_SIG_SIZE> arr_out;
374374
ss >> arr_out;
375375
BOOST_CHECK(arr_in == arr_out);
@@ -381,19 +381,19 @@ BOOST_AUTO_TEST_CASE(array_serialization_multiple)
381381
std::array<uint8_t, BLS_CURVE_PUBKEY_SIZE> arr1;
382382
std::array<uint8_t, BLS_CURVE_SIG_SIZE> arr2;
383383
std::array<int32_t, 2> arr3 = {42, 84};
384-
384+
385385
for (size_t i = 0; i < BLS_CURVE_PUBKEY_SIZE; ++i) arr1[i] = static_cast<uint8_t>(i);
386386
for (size_t i = 0; i < BLS_CURVE_SIG_SIZE; ++i) arr2[i] = static_cast<uint8_t>(255 - i);
387-
387+
388388
CDataStream ss(SER_DISK, PROTOCOL_VERSION);
389389
ss << arr1 << arr2 << arr3;
390-
390+
391391
std::array<uint8_t, BLS_CURVE_PUBKEY_SIZE> arr1_out;
392392
std::array<uint8_t, BLS_CURVE_SIG_SIZE> arr2_out;
393393
std::array<int32_t, 2> arr3_out;
394-
394+
395395
ss >> arr1_out >> arr2_out >> arr3_out;
396-
396+
397397
BOOST_CHECK(arr1 == arr1_out);
398398
BOOST_CHECK(arr2 == arr2_out);
399399
BOOST_CHECK(arr3 == arr3_out);

0 commit comments

Comments
 (0)