From d79894a1ac98766c2c2ad477dfcc30f4e9535530 Mon Sep 17 00:00:00 2001 From: gogoex <110195520+gogoex@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:20:33 +0900 Subject: [PATCH] add CMutableTransaction size test --- src/Makefile.test.include | 1 + src/test/blsct/external_api/blsct_tests.cpp | 38 +++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/test/blsct/external_api/blsct_tests.cpp diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 7d2d6bc49ac18..9fc63d118ffd6 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -95,6 +95,7 @@ BITCOIN_TESTS =\ test/blsct/building_block/lazy_points_tests.cpp \ test/blsct/common_tests.cpp \ test/blsct/eip_2333/bls12_381_keygen_tests.cpp \ + test/blsct/external_api/blsct_tests.cpp \ test/blsct/keys_tests.cpp \ test/blsct/range_proof/range_proof_common_tests.cpp \ test/blsct/range_proof/generators_tests.cpp \ diff --git a/src/test/blsct/external_api/blsct_tests.cpp b/src/test/blsct/external_api/blsct_tests.cpp new file mode 100644 index 0000000000000..06cf2bc7a3537 --- /dev/null +++ b/src/test/blsct/external_api/blsct_tests.cpp @@ -0,0 +1,38 @@ +// Copyright (c) 2024 The Navio developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include +#include + +#define ASSERT_SIZE_EQ(type, size) BOOST_CHECK_EQUAL(sizeof(type), size) + +BOOST_FIXTURE_TEST_SUITE(external_api_tests, BasicTestingSetup) + +// This test verifies the sizes of CMutableTransaction and +// all user-defined types within it to detect any structural +// changes in the CMutableTransaction class +BOOST_AUTO_TEST_CASE(test_cmutable_transaction_sizes) +{ + ASSERT_SIZE_EQ(Txid, 32); + + ASSERT_SIZE_EQ(CTxIn, 104); + ASSERT_SIZE_EQ(COutPoint, 36); + ASSERT_SIZE_EQ(CScript, 32); + ASSERT_SIZE_EQ(CScriptWitness, 24); + + ASSERT_SIZE_EQ(CTxOutBLSCTData, 1248); + ASSERT_SIZE_EQ(MclG1Point, 144); + ASSERT_SIZE_EQ(bulletproofs::RangeProof, 808); + + ASSERT_SIZE_EQ(CTxOut, 1328); + ASSERT_SIZE_EQ(CAmount, 8); + ASSERT_SIZE_EQ(TokenId, 40); + + ASSERT_SIZE_EQ(CMutableTransaction, 344); + ASSERT_SIZE_EQ(blsct::Signature, 288); +} + +BOOST_AUTO_TEST_SUITE_END() +