From af7cae777be15cda1f82b4ef428203d0a2a584ef Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Sat, 9 Oct 2021 22:28:13 +0530 Subject: [PATCH] move-only: move llmq parameters to their own file --- src/Makefile.am | 2 + src/chainparams.cpp | 140 +------------------------------------------ src/llmq/params.cpp | 143 ++++++++++++++++++++++++++++++++++++++++++++ src/llmq/params.h | 18 ++++++ 4 files changed, 164 insertions(+), 139 deletions(-) create mode 100644 src/llmq/params.cpp create mode 100644 src/llmq/params.h diff --git a/src/Makefile.am b/src/Makefile.am index b3ce3311a7..fc58612e81 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -204,6 +204,7 @@ BITCOIN_CORE_H = \ llmq/signing.h \ llmq/signing_shares.h \ llmq/utils.h \ + llmq/params.h \ logging.h \ logging/timer.h \ masternode/node.h \ @@ -592,6 +593,7 @@ libdash_common_a_SOURCES = \ key.cpp \ key_io.cpp \ keystore.cpp \ + llmq/params.cpp \ netaddress.cpp \ netbase.cpp \ net_permissions.cpp \ diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 625bdba185..d3597a7bd1 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -107,145 +108,6 @@ static CBlock FindDevNetGenesisBlock(const CBlock &prevBlock, const CAmount& rew assert(false); } -// this one is for testing only -static Consensus::LLMQParams llmq_test = { - .type = Consensus::LLMQ_TEST, - .name = "llmq_test", - .size = 3, - .minSize = 2, - .threshold = 2, - - .dkgInterval = 24, // one DKG per hour - .dkgPhaseBlocks = 2, - .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization - .dkgMiningWindowEnd = 18, - .dkgBadVotesThreshold = 2, - - .signingActiveQuorumCount = 2, // just a few ones to allow easier testing - - .keepOldConnections = 3, - .recoveryMembers = 3, -}; - -// this one is for testing only -static Consensus::LLMQParams llmq_test_v17 = { - .type = Consensus::LLMQ_TEST_V17, - .name = "llmq_test_v17", - .size = 3, - .minSize = 2, - .threshold = 2, - - .dkgInterval = 24, // one DKG per hour - .dkgPhaseBlocks = 2, - .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization - .dkgMiningWindowEnd = 18, - .dkgBadVotesThreshold = 2, - - .signingActiveQuorumCount = 2, // just a few ones to allow easier testing - - .keepOldConnections = 3, - .recoveryMembers = 3, -}; - -// this one is for devnets only -static Consensus::LLMQParams llmq_devnet = { - .type = Consensus::LLMQ_DEVNET, - .name = "llmq_devnet", - .size = 10, - .minSize = 7, - .threshold = 6, - - .dkgInterval = 24, // one DKG per hour - .dkgPhaseBlocks = 2, - .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization - .dkgMiningWindowEnd = 18, - .dkgBadVotesThreshold = 7, - - .signingActiveQuorumCount = 3, // just a few ones to allow easier testing - - .keepOldConnections = 4, - .recoveryMembers = 6, -}; - -static Consensus::LLMQParams llmq50_60 = { - .type = Consensus::LLMQ_50_60, - .name = "llmq_50_60", - .size = 50, - .minSize = 40, - .threshold = 30, - - .dkgInterval = 24, // one DKG per hour - .dkgPhaseBlocks = 2, - .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization - .dkgMiningWindowEnd = 18, - .dkgBadVotesThreshold = 40, - - .signingActiveQuorumCount = 24, // a full day worth of LLMQs - - .keepOldConnections = 25, - .recoveryMembers = 25, -}; - -static Consensus::LLMQParams llmq400_60 = { - .type = Consensus::LLMQ_400_60, - .name = "llmq_400_60", - .size = 400, - .minSize = 300, - .threshold = 240, - - .dkgInterval = 24 * 12, // one DKG every 12 hours - .dkgPhaseBlocks = 4, - .dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization - .dkgMiningWindowEnd = 28, - .dkgBadVotesThreshold = 300, - - .signingActiveQuorumCount = 4, // two days worth of LLMQs - - .keepOldConnections = 5, - .recoveryMembers = 100, -}; - -// Used for deployment and min-proto-version signalling, so it needs a higher threshold -static Consensus::LLMQParams llmq400_85 = { - .type = Consensus::LLMQ_400_85, - .name = "llmq_400_85", - .size = 400, - .minSize = 350, - .threshold = 340, - - .dkgInterval = 24 * 24, // one DKG every 24 hours - .dkgPhaseBlocks = 4, - .dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization - .dkgMiningWindowEnd = 48, // give it a larger mining window to make sure it is mined - .dkgBadVotesThreshold = 300, - - .signingActiveQuorumCount = 4, // four days worth of LLMQs - - .keepOldConnections = 5, - .recoveryMembers = 100, -}; - -// Used for Platform -static Consensus::LLMQParams llmq100_67 = { - .type = Consensus::LLMQ_100_67, - .name = "llmq_100_67", - .size = 100, - .minSize = 80, - .threshold = 67, - - .dkgInterval = 24, // one DKG per hour - .dkgPhaseBlocks = 2, - .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization - .dkgMiningWindowEnd = 18, - .dkgBadVotesThreshold = 80, - - .signingActiveQuorumCount = 24, // a full day worth of LLMQs - - .keepOldConnections = 25, - .recoveryMembers = 50, -}; - - /** * Main network */ diff --git a/src/llmq/params.cpp b/src/llmq/params.cpp new file mode 100644 index 0000000000..40d6c3f9fa --- /dev/null +++ b/src/llmq/params.cpp @@ -0,0 +1,143 @@ +// Copyright (c) 2021 The Dash Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +// this one is for testing only +Consensus::LLMQParams llmq_test = { + .type = Consensus::LLMQ_TEST, + .name = "llmq_test", + .size = 3, + .minSize = 2, + .threshold = 2, + + .dkgInterval = 24, // one DKG per hour + .dkgPhaseBlocks = 2, + .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization + .dkgMiningWindowEnd = 18, + .dkgBadVotesThreshold = 2, + + .signingActiveQuorumCount = 2, // just a few ones to allow easier testing + + .keepOldConnections = 3, + .recoveryMembers = 3, +}; + +// this one is for testing only +Consensus::LLMQParams llmq_test_v17 = { + .type = Consensus::LLMQ_TEST_V17, + .name = "llmq_test_v17", + .size = 3, + .minSize = 2, + .threshold = 2, + + .dkgInterval = 24, // one DKG per hour + .dkgPhaseBlocks = 2, + .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization + .dkgMiningWindowEnd = 18, + .dkgBadVotesThreshold = 2, + + .signingActiveQuorumCount = 2, // just a few ones to allow easier testing + + .keepOldConnections = 3, + .recoveryMembers = 3, +}; + +// this one is for devnets only +Consensus::LLMQParams llmq_devnet = { + .type = Consensus::LLMQ_DEVNET, + .name = "llmq_devnet", + .size = 10, + .minSize = 7, + .threshold = 6, + + .dkgInterval = 24, // one DKG per hour + .dkgPhaseBlocks = 2, + .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization + .dkgMiningWindowEnd = 18, + .dkgBadVotesThreshold = 7, + + .signingActiveQuorumCount = 3, // just a few ones to allow easier testing + + .keepOldConnections = 4, + .recoveryMembers = 6, +}; + +Consensus::LLMQParams llmq50_60 = { + .type = Consensus::LLMQ_50_60, + .name = "llmq_50_60", + .size = 50, + .minSize = 40, + .threshold = 30, + + .dkgInterval = 24, // one DKG per hour + .dkgPhaseBlocks = 2, + .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization + .dkgMiningWindowEnd = 18, + .dkgBadVotesThreshold = 40, + + .signingActiveQuorumCount = 24, // a full day worth of LLMQs + + .keepOldConnections = 25, + .recoveryMembers = 25, +}; + +Consensus::LLMQParams llmq400_60 = { + .type = Consensus::LLMQ_400_60, + .name = "llmq_400_60", + .size = 400, + .minSize = 300, + .threshold = 240, + + .dkgInterval = 24 * 12, // one DKG every 12 hours + .dkgPhaseBlocks = 4, + .dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization + .dkgMiningWindowEnd = 28, + .dkgBadVotesThreshold = 300, + + .signingActiveQuorumCount = 4, // two days worth of LLMQs + + .keepOldConnections = 5, + .recoveryMembers = 100, +}; + +// Used for deployment and min-proto-version signalling, so it needs a higher threshold +Consensus::LLMQParams llmq400_85 = { + .type = Consensus::LLMQ_400_85, + .name = "llmq_400_85", + .size = 400, + .minSize = 350, + .threshold = 340, + + .dkgInterval = 24 * 24, // one DKG every 24 hours + .dkgPhaseBlocks = 4, + .dkgMiningWindowStart = 20, // dkgPhaseBlocks * 5 = after finalization + .dkgMiningWindowEnd = 48, // give it a larger mining window to make sure it is mined + .dkgBadVotesThreshold = 300, + + .signingActiveQuorumCount = 4, // four days worth of LLMQs + + .keepOldConnections = 5, + .recoveryMembers = 100, +}; + +// Used for Platform +Consensus::LLMQParams llmq100_67 = { + .type = Consensus::LLMQ_100_67, + .name = "llmq_100_67", + .size = 100, + .minSize = 80, + .threshold = 67, + + .dkgInterval = 24, // one DKG per hour + .dkgPhaseBlocks = 2, + .dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization + .dkgMiningWindowEnd = 18, + .dkgBadVotesThreshold = 80, + + .signingActiveQuorumCount = 24, // a full day worth of LLMQs + + .keepOldConnections = 25, + .recoveryMembers = 50, +}; diff --git a/src/llmq/params.h b/src/llmq/params.h new file mode 100644 index 0000000000..28b2d7d2ed --- /dev/null +++ b/src/llmq/params.h @@ -0,0 +1,18 @@ +// Copyright (c) 2021 The Dash Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_LLMQ_PARAMS_H +#define BITCOIN_LLMQ_PARAMS_H + +#include + +extern Consensus::LLMQParams llmq_test; +extern Consensus::LLMQParams llmq_test_v17; +extern Consensus::LLMQParams llmq_devnet; +extern Consensus::LLMQParams llmq50_60; +extern Consensus::LLMQParams llmq400_60; +extern Consensus::LLMQParams llmq400_85; +extern Consensus::LLMQParams llmq100_67; + +#endif // BITCOIN_LLMQ_PARAMS_H