22// Distributed under the MIT software license, see the accompanying
33// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44
5- #include < test/util/setup_common.h>
65#include < test/util/llmq_tests.h>
6+ #include < test/util/setup_common.h>
77
88#include < bls/bls.h>
99#include < chainparams.h>
1010#include < evo/deterministicmns.h>
1111#include < llmq/commitment.h>
12+ #include < llmq/context.h>
1213#include < llmq/params.h>
1314#include < llmq/quorums.h>
1415#include < llmq/signing.h>
@@ -21,13 +22,13 @@ using namespace llmq;
2122using namespace llmq ::testutils;
2223
2324// Test fixture with helper functions
24- struct LLMQSigningSharesTestFixture : public TestingSetup
25- {
25+ struct LLMQSigningSharesTestFixture : public TestingSetup {
2626 std::unique_ptr<CBLSWorker> blsWorker;
2727 CBLSSecretKey sk;
2828 std::unique_ptr<CActiveMasternodeManager> mn_activeman;
2929
30- LLMQSigningSharesTestFixture () : TestingSetup()
30+ LLMQSigningSharesTestFixture () :
31+ TestingSetup (CBaseChainParams::REGTEST )
3132 {
3233 blsWorker = std::make_unique<CBLSWorker>();
3334
@@ -38,8 +39,7 @@ struct LLMQSigningSharesTestFixture : public TestingSetup
3839
3940 // Helper to create a minimal test quorum
4041 CQuorumCPtr CreateMinimalTestQuorum (int size, bool hasVerificationVector = true ,
41- const std::vector<bool >& validMembers = {},
42- bool includeOurProTxHash = false )
42+ const std::vector<bool >& validMembers = {}, bool includeOurProTxHash = false )
4343 {
4444 const auto & params = GetLLMQParams (Consensus::LLMQType::LLMQ_TEST_V17 );
4545
@@ -123,12 +123,8 @@ BOOST_AUTO_TEST_CASE(preverify_missing_verification_vector)
123123
124124 // Call PreVerifyBatchedSigShares - it should detect missing verification vector
125125 // (if it gets past the earlier checks for quorum activity and membership)
126- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
127- *mn_activeman,
128- *Assert (m_node.llmq_ctx ->qman ),
129- sessionInfo,
130- batchedSigShares
131- );
126+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
127+ sessionInfo, batchedSigShares);
132128
133129 // We expect it to fail (not be successful)
134130 BOOST_CHECK (!result.IsSuccess ());
@@ -149,12 +145,8 @@ BOOST_AUTO_TEST_CASE(preverify_duplicate_member)
149145 auto batchedSigShares = CreateTestBatchedSigShares ({0 , 1 , 0 , 2 });
150146
151147 // Call PreVerifyBatchedSigShares
152- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
153- *mn_activeman,
154- *Assert (m_node.llmq_ctx ->qman ),
155- sessionInfo,
156- batchedSigShares
157- );
148+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
149+ sessionInfo, batchedSigShares);
158150
159151 // We expect failure
160152 BOOST_CHECK (!result.IsSuccess ());
@@ -177,12 +169,8 @@ BOOST_AUTO_TEST_CASE(preverify_member_out_of_bounds)
177169 auto batchedSigShares = CreateTestBatchedSigShares ({0 , 1 , 10 });
178170
179171 // Call PreVerifyBatchedSigShares
180- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
181- *mn_activeman,
182- *Assert (m_node.llmq_ctx ->qman ),
183- sessionInfo,
184- batchedSigShares
185- );
172+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
173+ sessionInfo, batchedSigShares);
186174
187175 // We expect failure
188176 BOOST_CHECK (!result.IsSuccess ());
@@ -205,12 +193,8 @@ BOOST_AUTO_TEST_CASE(preverify_invalid_quorum_member)
205193 auto batchedSigShares = CreateTestBatchedSigShares ({0 , 1 , 2 });
206194
207195 // Call PreVerifyBatchedSigShares
208- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
209- *mn_activeman,
210- *Assert (m_node.llmq_ctx ->qman ),
211- sessionInfo,
212- batchedSigShares
213- );
196+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
197+ sessionInfo, batchedSigShares);
214198
215199 // We expect failure
216200 BOOST_CHECK (!result.IsSuccess ());
@@ -232,12 +216,8 @@ BOOST_AUTO_TEST_CASE(preverify_valid_batch_structure)
232216 auto batchedSigShares = CreateTestBatchedSigShares ({0 , 1 , 2 , 3 , 4 });
233217
234218 // Call PreVerifyBatchedSigShares
235- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
236- *mn_activeman,
237- *Assert (m_node.llmq_ctx ->qman ),
238- sessionInfo,
239- batchedSigShares
240- );
219+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
220+ sessionInfo, batchedSigShares);
241221
242222 // The batch structure is valid, but we may fail on QuorumTooOld or NotAMember
243223 // This test ensures that valid batch structure doesn't cause crashes
@@ -247,8 +227,7 @@ BOOST_AUTO_TEST_CASE(preverify_valid_batch_structure)
247227 // (not a ban-worthy failure from structure validation)
248228 if (!result.IsSuccess ()) {
249229 // If not successful, it should be due to quorum checks, not structure validation
250- BOOST_CHECK (result.result == PreVerifyResult::QuorumTooOld ||
251- result.result == PreVerifyResult::NotAMember ||
230+ BOOST_CHECK (result.result == PreVerifyResult::QuorumTooOld || result.result == PreVerifyResult::NotAMember ||
252231 result.result == PreVerifyResult::MissingVerificationVector);
253232 }
254233}
@@ -264,12 +243,8 @@ BOOST_AUTO_TEST_CASE(preverify_empty_batch)
264243 auto batchedSigShares = CreateTestBatchedSigShares ({});
265244
266245 // Call PreVerifyBatchedSigShares
267- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
268- *mn_activeman,
269- *Assert (m_node.llmq_ctx ->qman ),
270- sessionInfo,
271- batchedSigShares
272- );
246+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
247+ sessionInfo, batchedSigShares);
273248
274249 // Empty batch should not trigger ban-worthy errors related to member validation
275250 // It may fail early checks (QuorumTooOld, NotAMember), but shouldn't trigger
@@ -291,12 +266,8 @@ BOOST_AUTO_TEST_CASE(preverify_multiple_duplicates)
291266 auto batchedSigShares = CreateTestBatchedSigShares ({0 , 1 , 2 , 1 , 3 , 2 , 4 });
292267
293268 // Call PreVerifyBatchedSigShares
294- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
295- *mn_activeman,
296- *Assert (m_node.llmq_ctx ->qman ),
297- sessionInfo,
298- batchedSigShares
299- );
269+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
270+ sessionInfo, batchedSigShares);
300271
301272 // We expect failure
302273 BOOST_CHECK (!result.IsSuccess ());
@@ -318,12 +289,8 @@ BOOST_AUTO_TEST_CASE(preverify_boundary_max_member)
318289 auto batchedSigShares = CreateTestBatchedSigShares ({0 , static_cast <uint16_t >(quorum_size - 1 )});
319290
320291 // Call PreVerifyBatchedSigShares
321- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
322- *mn_activeman,
323- *Assert (m_node.llmq_ctx ->qman ),
324- sessionInfo,
325- batchedSigShares
326- );
292+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
293+ sessionInfo, batchedSigShares);
327294
328295 // This should not trigger QuorumMemberOutOfBounds since the max index is valid
329296 if (!result.IsSuccess ()) {
@@ -343,12 +310,8 @@ BOOST_AUTO_TEST_CASE(preverify_all_members_invalid)
343310 auto batchedSigShares = CreateTestBatchedSigShares ({0 , 1 , 2 });
344311
345312 // Call PreVerifyBatchedSigShares
346- auto result = CSigSharesManager::PreVerifyBatchedSigShares (
347- *mn_activeman,
348- *Assert (m_node.llmq_ctx ->qman ),
349- sessionInfo,
350- batchedSigShares
351- );
313+ auto result = CSigSharesManager::PreVerifyBatchedSigShares (*mn_activeman, *Assert (m_node.llmq_ctx ->qman ),
314+ sessionInfo, batchedSigShares);
352315
353316 // We expect failure
354317 BOOST_CHECK (!result.IsSuccess ());
0 commit comments