Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
1d547a7
Added GET_SNAPSHOT_INFO message handling
ogabrielides Mar 29, 2022
fb8aab0
Quorum members by rotation
ogabrielides Sep 30, 2021
c1beadc
Quorum utils functions
ogabrielides Mar 29, 2022
7301d9d
Handle GET_QUORUM_ROTATION_INFO with baseBlockHash from client
ogabrielides Mar 29, 2022
d4651c5
Storing QuorumSnaphots in evoDB when requesting them
ogabrielides Mar 29, 2022
54d09d2
Added DIP Enforcement param
ogabrielides Oct 12, 2021
f692429
quorumIndex cache
ogabrielides Oct 18, 2021
ca02de9
Quorum Rotation deployment control
ogabrielides Apr 5, 2022
516b5f6
Usage of Bitsets for storing CQuorumSnapshots
ogabrielides Oct 18, 2021
210633b
Correct handling of early quorum quarters
ogabrielides Oct 19, 2021
ab30ac6
More asserts
ogabrielides Oct 29, 2021
137c545
Corrections
ogabrielides Mar 29, 2022
2956da4
Handling of quorumIndex
ogabrielides Apr 5, 2022
0dd3a49
Refactoring of truncate mechanism
ogabrielides Oct 22, 2021
98d96a3
Various fixes
ogabrielides Oct 25, 2021
799df94
Interface correction
ogabrielides Oct 25, 2021
4e50bf6
Added template type for indexed cache
ogabrielides Oct 25, 2021
caf9aa4
Added quorumIndex into commitmenHash
ogabrielides Oct 25, 2021
9673e65
Various changes
ogabrielides Oct 25, 2021
fcdf331
Needs to update maqQuorumsCache along with indexedQuorumsCache
ogabrielides Oct 26, 2021
5098c28
Added CFinalCommitment version 2
ogabrielides Oct 27, 2021
90c6098
Renamed variables
ogabrielides Oct 27, 2021
7550b9b
Fixes
ogabrielides Oct 27, 2021
bffda1c
Refactoring & correct caching of quorumMembers by rotation
ogabrielides Oct 27, 2021
b8c278f
Added assertions
ogabrielides Oct 27, 2021
676bf74
Refactoring
ogabrielides Oct 29, 2021
5dc9794
Interface change
ogabrielides Nov 1, 2021
f4e766b
Handling of previous DKG session failure
ogabrielides Nov 1, 2021
5a4d8ba
Applied refactoring
ogabrielides Nov 1, 2021
0b276e1
Build quarter members improvments
ogabrielides Nov 2, 2021
cc4dd66
Merge Quorum Rotation and Decreased fee into one deployment (DIP24)
ogabrielides Mar 29, 2022
9b47c8b
Added new LLMQ Type
ogabrielides Nov 3, 2021
c562af3
Added functional tests + refactoring
ogabrielides Mar 30, 2022
4b4c5bb
Refactoring
ogabrielides Nov 11, 2021
37fe33a
Spreaded Quorum creation and Quorum Index adaptation
ogabrielides Apr 5, 2022
47b035d
quorumIndex adaptations
ogabrielides Nov 22, 2021
8189dc0
Added quorumIndex in CFinalCommitment
ogabrielides Nov 22, 2021
86bff1f
Latest work
ogabrielides Apr 5, 2022
f27822c
Final refactoring
ogabrielides Mar 30, 2022
266fea4
Batch of refactoring
kwvg Apr 5, 2022
94d4e54
Fixes for tests
ogabrielides Nov 25, 2021
b8ace43
Fix for CFinalCommitment
ogabrielides Nov 27, 2021
f1f34d5
Fix for Quorums
ogabrielides Nov 29, 2021
36ea698
Fix
ogabrielides Nov 29, 2021
7c4408f
Small changes
ogabrielides Dec 2, 2021
7b4ec1d
Thread sync fic
ogabrielides Dec 3, 2021
907be87
Safety changes
ogabrielides Dec 5, 2021
9c7ff5c
Reuse mns when needed
ogabrielides Dec 5, 2021
1cd1b59
Refactoring
ogabrielides Dec 7, 2021
79670f9
More refactoring
ogabrielides Dec 8, 2021
0852357
Fixes for rotationinfo handling
ogabrielides Dec 13, 2021
198e3e1
Fix for rotation of members
ogabrielides Dec 16, 2021
23858cb
Correct order of MNs lists in Quorum Snapshots
ogabrielides Dec 18, 2021
bc43329
Adding extra logs
ogabrielides Dec 22, 2021
1eb6194
Sync rotation quorums + qrinfo changes
ogabrielides Dec 30, 2021
805c606
Fix + extra logs
ogabrielides Dec 31, 2021
2363cdc
Removed redundant field
ogabrielides Jan 3, 2022
56741f8
Fix for null final commitment + refactoring
ogabrielides Jan 4, 2022
213cd85
Added timers in tests
ogabrielides Jan 14, 2022
7682c39
Fix for qrinfo message: quorumdiff and merkleRootQuorums
ogabrielides Jan 17, 2022
142a5da
Small changes for rotation test
ogabrielides Jan 17, 2022
dc8adcb
Remove reading from scanQuorumCache
ogabrielides Apr 5, 2022
b3277c5
Added quorum list output
ogabrielides Jan 17, 2022
a3b4a0e
Crash fix
ogabrielides Jan 19, 2022
4675c41
Experimental commit
ogabrielides Jan 20, 2022
38bb8ab
apply changes to specialtxman.cpp from specialtx.cpp
PastaPastaPasta Jan 26, 2022
9b653ad
all the changes
PastaPastaPasta Jan 23, 2022
3bb9733
substancially speed up feature_llmq_rotation.py
PastaPastaPasta Jan 26, 2022
0d17922
reenable asserts, add check for reorgs
PastaPastaPasta Jan 26, 2022
3012bdc
Refactoring
ogabrielides Jan 25, 2022
40d3813
Added extra logs
ogabrielides Feb 3, 2022
2212f63
format
ogabrielides Mar 29, 2022
7eb5ec7
trivial
UdjinM6 Feb 4, 2022
548ee13
drop extra boost includes
UdjinM6 Feb 4, 2022
9787cbb
drop ContainsMN
UdjinM6 Feb 4, 2022
3a1d36e
fix ScanQuorums
UdjinM6 Feb 8, 2022
7824e76
check quorum hash and index in CFinalCommitment::Verify
UdjinM6 Feb 8, 2022
6a7f694
fix/tweak tests
UdjinM6 Feb 8, 2022
6cd10d8
IsQuorumRotationEnabled should be aware of the context
UdjinM6 Feb 8, 2022
b81ac6b
Calculating members based on earlier block.
ogabrielides Apr 5, 2022
64d2d3e
Fix for Quorum Members Cache
ogabrielides Feb 17, 2022
c08bc7e
Removed duplicate size of baseBlockHashes
ogabrielides Feb 21, 2022
8e36f79
Adaptations of qrinfo to -8 mn lists
ogabrielides Feb 23, 2022
177c959
Introduction of llmqTypeDIP24InstantSend
ogabrielides Mar 8, 2022
848cc40
Adaptation for llmqTypeDIP24InstantSend
ogabrielides Mar 8, 2022
1485c79
Adaptations for IS
ogabrielides Mar 11, 2022
bb78347
bump protocol version
PastaPastaPasta Mar 12, 2022
ffb524c
Added feature_llmq_is_migration test
ogabrielides Mar 17, 2022
dfb23d0
Various cleanups
ogabrielides Mar 29, 2022
a19aa0f
use unordered_lru_cache for quorumSnapshotCache
UdjinM6 Mar 23, 2022
a678146
trivial refactor ComputeQuorumMembersByQuarterRotation
UdjinM6 Mar 23, 2022
afc3043
Reduced CFinalCommitment::quorumIndex from 32 to 16 bits
ogabrielides Mar 24, 2022
1175f3b
Keep verified LLMQ relay connections
ogabrielides Mar 25, 2022
325ba27
Experimental Relay connection fix
ogabrielides Mar 26, 2022
0a473cf
Fix for EnsureQuorumConnections rotation
ogabrielides Mar 27, 2022
a605df4
Using only valid Mns for checking
ogabrielides Mar 30, 2022
edac644
Override of nPowTargetSpacing (devnet only)
ogabrielides Mar 31, 2022
4ee1fc0
Show penalty score in masternode rpc
ogabrielides Apr 5, 2022
aec8ba9
fixups
PastaPastaPasta Apr 4, 2022
77fc993
Rotation refactoring
ogabrielides Apr 7, 2022
88f2df6
Update src/chainparams.cpp
UdjinM6 Apr 7, 2022
abe5cc7
Replaced LogPrintf with LogPrint
ogabrielides Apr 8, 2022
8e917e6
IS locking fix once DIP24 activation
ogabrielides Apr 11, 2022
e6d2196
Various cleanup
ogabrielides Apr 11, 2022
52ab2c7
Updated MIN_MASTERNODE_PROTO_VERSION
ogabrielides Apr 11, 2022
be31027
Introduce LLMQ_TEST_INSTANTSEND reg-test only quorum and actually tes…
UdjinM6 Apr 12, 2022
888d347
Renamed field lastQuorumHashPerIndex
ogabrielides Apr 13, 2022
8a8d2c3
Renamed to DIP0024
ogabrielides Apr 14, 2022
f095c7e
chore: update nStartTime and nTimeout for mainnet / testnet for DEPLO…
PastaPastaPasta Apr 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ BITCOIN_CORE_H = \
llmq/dkgsession.h \
llmq/init.h \
llmq/instantsend.h \
llmq/snapshot.h \
llmq/signing.h \
llmq/signing_shares.h \
llmq/utils.h \
Expand Down Expand Up @@ -404,6 +405,7 @@ libdash_server_a_SOURCES = \
llmq/dkgsession.cpp \
llmq/init.cpp \
llmq/instantsend.cpp \
llmq/snapshot.cpp \
llmq/signing.cpp \
llmq/signing_shares.cpp \
llmq/utils.cpp \
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ BITCOIN_TESTS =\
test/evo_instantsend_tests.cpp \
test/evo_simplifiedmns_tests.cpp \
test/evo_trivialvalidation.cpp \
test/evo_utils_tests.cpp \
test/flatfile_tests.cpp \
test/fs_tests.cpp \
test/getarg_tests.cpp \
Expand Down
140 changes: 94 additions & 46 deletions src/chainparams.cpp

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ void SetupChainParamsBaseOptions()
gArgs.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_50_60, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqdevnetparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_DEVNET quorum (default: 3:2, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqinstantsend=<quorum name>", "Override the default LLMQ type used for InstantSend. Allows using InstantSend with smaller LLMQs. (default: llmq_50_60, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqtestparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_TEST quorum (default: 10:6, regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqinstantsenddip0024=<quorum name>", "Override the default LLMQ type used for InstantSendDIP0024. (default: llmq_60_75, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqtestparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_TEST quorum (default: 3:2, regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqtestinstantsendparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_TEST_INSTANTSEND quorums (default: 3:2, regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-powtargetspacing=<n>", "Override the default PowTargetSpacing value in seconds (default: 2.5 minutes, devnet-only)", ArgsManager::ALLOW_INT, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-minimumdifficultyblocks=<n>", "The number of blocks that can be mined with the minimum difficulty at the start of a chain (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
Expand Down
10 changes: 5 additions & 5 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@

namespace Consensus {

enum DeploymentPos
{
enum DeploymentPos {
DEPLOYMENT_TESTDUMMY,
DEPLOYMENT_CSV, // Deployment of BIP68, BIP112, and BIP113.
DEPLOYMENT_CSV, // Deployment of BIP68, BIP112, and BIP113.
DEPLOYMENT_DIP0001, // Deployment of DIP0001 and lower transaction fees.
DEPLOYMENT_BIP147, // Deployment of BIP147 (NULLDUMMY)
DEPLOYMENT_BIP147, // Deployment of BIP147 (NULLDUMMY)
DEPLOYMENT_DIP0003, // Deployment of DIP0002 and DIP0003 (txv3 and deterministic MN lists)
DEPLOYMENT_DIP0008, // Deployment of ChainLock enforcement
DEPLOYMENT_REALLOC, // Deployment of Block Reward Reallocation
DEPLOYMENT_DIP0020, // Deployment of DIP0020, DIP0021 and LMQ_100_67 quorums
DEPLOYMENT_GOV_FEE, // Deployment of decreased governance proposal fee
DEPLOYMENT_DIP0024, // Deployment of DIP0024 (Quorum Rotation) and decreased governance proposal fee
// NOTE: Also add new deployments to VersionBitsDeploymentInfo in versionbits.cpp
MAX_VERSION_BITS_DEPLOYMENTS
};
Expand Down Expand Up @@ -120,6 +119,7 @@ struct Params {
std::vector<LLMQParams> llmqs;
LLMQType llmqTypeChainLocks;
LLMQType llmqTypeInstantSend{LLMQType::LLMQ_NONE};
LLMQType llmqTypeDIP0024InstantSend{LLMQType::LLMQ_NONE};
LLMQType llmqTypePlatform{LLMQType::LLMQ_NONE};
LLMQType llmqTypeMnhf{LLMQType::LLMQ_NONE};
};
Expand Down
5 changes: 3 additions & 2 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,8 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C
}
if (!qc.commitment.IsNull()) {
const auto& llmq_params = llmq::GetLLMQParams(qc.commitment.llmqType);
uint32_t quorumHeight = qc.nHeight - (qc.nHeight % llmq_params.dkgInterval);
int qcnHeight = int(qc.nHeight);
int quorumHeight = qcnHeight - (qcnHeight % llmq_params.dkgInterval) + int(qc.commitment.quorumIndex);
auto pQuorumBaseBlockIndex = pindexPrev->GetAncestor(quorumHeight);
if (!pQuorumBaseBlockIndex || pQuorumBaseBlockIndex->GetBlockHash() != qc.commitment.quorumHash) {
// we should actually never get into this case as validation should have caught it...but let's be sure
Expand Down Expand Up @@ -875,7 +876,7 @@ void CDeterministicMNManager::HandleQuorumCommitment(const llmq::CFinalCommitmen
{
// The commitment has already been validated at this point, so it's safe to use members of it

auto members = llmq::CLLMQUtils::GetAllQuorumMembers(llmq::GetLLMQParams(qc.llmqType), pQuorumBaseBlockIndex);
auto members = llmq::CLLMQUtils::GetAllQuorumMembers(qc.llmqType, pQuorumBaseBlockIndex);

for (size_t i = 0; i < members.size(); i++) {
if (!mnList.HasMN(members[i]->proTxHash)) {
Expand Down
2 changes: 1 addition & 1 deletion src/evo/specialtxman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool CheckSpecialTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CVali
case TRANSACTION_QUORUM_COMMITMENT:
return llmq::CheckLLMQCommitment(tx, pindexPrev, state);
case TRANSACTION_MNHF_SIGNAL:
return VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_GOV_FEE) == ThresholdState::ACTIVE && CheckMNHFTx(tx, pindexPrev, state);
return VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024) == ThresholdState::ACTIVE && CheckMNHFTx(tx, pindexPrev, state);
}
} catch (const std::exception& e) {
LogPrintf("%s -- failed: %s\n", __func__, e.what());
Expand Down
4 changes: 2 additions & 2 deletions src/governance/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ void CGovernanceManager::UpdateCachesAndClean()
} else {
// NOTE: triggers are handled via triggerman
if (pObj->GetObjectType() == GOVERNANCE_OBJECT_PROPOSAL) {
bool fAllowScript = (VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_GOV_FEE) == ThresholdState::ACTIVE);
bool fAllowScript = (VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024) == ThresholdState::ACTIVE);
bool fAllowLegacyFormat = !fAllowScript; // reusing the same bit to stop accepting proposals in legacy format
CProposalValidator validator(pObj->GetDataAsHexString(), fAllowLegacyFormat, fAllowScript);
if (!validator.Validate()) {
Expand Down Expand Up @@ -672,7 +672,7 @@ void CGovernanceManager::SyncObjects(CNode* pnode, CConnman& connman) const

LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- syncing all objects to peer=%d\n", __func__, pnode->GetId());

bool fAllowScript = WITH_LOCK(cs_main, return VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_GOV_FEE) == ThresholdState::ACTIVE);
bool fAllowScript = WITH_LOCK(cs_main, return VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024) == ThresholdState::ACTIVE);

LOCK(cs);

Expand Down
6 changes: 3 additions & 3 deletions src/governance/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ bool CGovernanceObject::IsValidLocally(std::string& strError, bool& fMissingConf

switch (nObjectType) {
case GOVERNANCE_OBJECT_PROPOSAL: {
bool fAllowScript = (VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_GOV_FEE) == ThresholdState::ACTIVE);
bool fAllowScript = (VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024) == ThresholdState::ACTIVE);
bool fAllowLegacyFormat = !fAllowScript; // reusing the same bit to stop accepting proposals in legacy format
CProposalValidator validator(GetDataAsHexString(), fAllowLegacyFormat, fAllowScript);
// Note: It's ok to have expired proposals
Expand Down Expand Up @@ -559,7 +559,7 @@ bool CGovernanceObject::IsCollateralValid(std::string& strError, bool& fMissingC
findScript << OP_RETURN << ToByteVector(nExpectedHash);

AssertLockHeld(cs_main);
bool fork_active = VersionBitsState(LookupBlockIndex(nBlockHash), Params().GetConsensus(), Consensus::DEPLOYMENT_GOV_FEE, versionbitscache) == ThresholdState::ACTIVE;
bool fork_active = VersionBitsState(LookupBlockIndex(nBlockHash), Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024, versionbitscache) == ThresholdState::ACTIVE;
CAmount nMinFee = GetMinCollateralFee(fork_active);

LogPrint(BCLog::GOBJECT, "CGovernanceObject::IsCollateralValid -- txCollateral->vout.size() = %s, findScript = %s, nMinFee = %lld\n",
Expand Down Expand Up @@ -683,7 +683,7 @@ void CGovernanceObject::Relay(CConnman& connman) const
// But we don't want to relay it to pre-GOVSCRIPT_PROTO_VERSION peers if payment_address is p2sh
// because they won't accept it anyway and will simply ban us eventually.
LOCK(cs_main);
bool fAllowScript = (VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_GOV_FEE) == ThresholdState::ACTIVE);
bool fAllowScript = (VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0024) == ThresholdState::ACTIVE);
if (fAllowScript) {
CProposalValidator validator(GetDataAsHexString(), false /* no legacy format */, false /* but also no script */);
if (!validator.Validate(false /* ignore expiration */)) {
Expand Down
8 changes: 6 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@
#include <walletinitinterface.h>

#include <evo/deterministicmns.h>
#include <llmq/quorums.h>
#include <llmq/init.h>
#include <llmq/blockprocessor.h>
#include <llmq/init.h>
#include <llmq/quorums.h>
#include <llmq/signing.h>
#include <llmq/snapshot.h>
#include <llmq/utils.h>

#include <statsd_client.h>
Expand Down Expand Up @@ -320,6 +321,7 @@ void PrepareShutdown(InitInterfaces& interfaces)
}
pblocktree.reset();
llmq::DestroyLLMQSystem();
llmq::quorumSnapshotManager.reset();
deterministicMNManager.reset();
evoDb.reset();
}
Expand Down Expand Up @@ -1980,6 +1982,8 @@ bool AppInitMain(InitInterfaces& interfaces)
evoDb.reset(new CEvoDB(nEvoDbCache, false, fReset || fReindexChainState));
deterministicMNManager.reset();
deterministicMNManager.reset(new CDeterministicMNManager(*evoDb));
llmq::quorumSnapshotManager.reset();
llmq::quorumSnapshotManager.reset(new llmq::CQuorumSnapshotManager(*evoDb));

llmq::InitLLMQSystem(*evoDb, false, fReset || fReindexChainState);

Expand Down
Loading