Skip to content

Commit

Permalink
add CMutableTransaction size test
Browse files Browse the repository at this point in the history
  • Loading branch information
gogoex committed Oct 23, 2024
1 parent a20bf9b commit d79894a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
38 changes: 38 additions & 0 deletions src/test/blsct/external_api/blsct_tests.cpp
Original file line number Diff line number Diff line change
@@ -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 <boost/test/unit_test.hpp>
#include <test/util/setup_common.h>
#include <primitives/transaction.h>

#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<Mcl>, 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()

0 comments on commit d79894a

Please sign in to comment.