Merge pull request #2554 from codablock/pr_testnetreset

Reset/Fork testnet to block 4000
This commit is contained in:
Alexander Block 2018-12-14 10:09:42 +01:00 committed by GitHub
commit b7dc7c54e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 97 deletions

View File

@ -349,7 +349,7 @@ public:
consensus.nBudgetPaymentsCycleBlocks = 50;
consensus.nBudgetPaymentsWindowBlocks = 10;
consensus.nSuperblockStartBlock = 4200; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
consensus.nSuperblockStartHash = uint256S("00000000cffabc0f646867fba0550afd6e30e0f4b0fc54e34d3e101a1552df5d");
consensus.nSuperblockStartHash = uint256(); // do not check this on testnet
consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet
consensus.nGovernanceMinQuorum = 1;
consensus.nGovernanceFilterElements = 500;
@ -364,8 +364,8 @@ public:
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
consensus.fPowAllowMinDifficultyBlocks = true;
consensus.fPowNoRetargeting = false;
consensus.nPowKGWHeight = 4001; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
consensus.nPowDGWHeight = 4001;
consensus.nPowKGWHeight = 4002; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
consensus.nPowDGWHeight = 4002;
consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
@ -374,35 +374,35 @@ public:
// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1506556800; // September 28th, 2017
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1538092800; // September 28th, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1544655600; // Dec 13th, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1576191600; // Dec 13th, 2019
// Deployment of DIP0001
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1505692800; // Sep 18th, 2017
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 1537228800; // Sep 18th, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1544655600; // Dec 13th, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = 1576191600; // Dec 13th, 2019
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 50; // 50% of 100
// Deployment of BIP147
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].bit = 2;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 1517792400; // Feb 5th, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = 1549328400; // Feb 5th, 2019
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 1544655600; // Dec 13th, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = 1576191600; // Dec 13th, 2019
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nThreshold = 50; // 50% of 100
// Deployment of DIP0003
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].bit = 3;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 1540504800; // Oct 26, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = 1572040800; // Oct 26, 2019
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 1544655600; // Dec 13th, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = 1576191600; // Dec 13th, 2019
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 50; // 50% of 100
// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000006e06c236f3dc1e"); // 260940
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000000000003cd72a542"); // 4000
// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S("0x000000000118fa2f031efedf874adbe7fe6b023cdf9478e8e2400c2d505df30d"); // 260940
consensus.defaultAssumeValid = uint256S("0x00000ce22113f3eb8636e225d6a1691e132fdd587aed993e1bc9b07a0235eea4"); // 4000
pchMessageStart[0] = 0xce;
pchMessageStart[1] = 0xe2;
@ -444,11 +444,6 @@ public:
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
// This is temporary until we reset testnet for retesting of the full DIP3 deployment
consensus.nTemporaryTestnetForkDIP3Height = 264000;
consensus.nTemporaryTestnetForkHeight = 274000;
consensus.nTemporaryTestnetForkDIP3BlockHash.SetHex("00000048e6e71d4bd90e7c456dcb94683ae832fcad13e1760d8283f7e89f332f");
fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = false;
@ -470,14 +465,11 @@ public:
( 261, uint256S("0x00000c26026d0815a7e2ce4fa270775f61403c040647ff2c3091f99e894a4618"))
( 1999, uint256S("0x00000052e538d27fa53693efe6fb6892a0c1d26c0235f599171c48a3cce553b1"))
( 2999, uint256S("0x0000024bc3f4f4cb30d29827c13d921ad77d2c6072e586c7f60d83c2722cdcc5"))
( 100000, uint256S("0x0000000003aa53e24b6e60ef97642e4193611f2bcb75ea1fa8105f0b5ffd5242"))
( 143200, uint256S("0x0000000004a7878409189b7a8f75b3815d9b8c45ee8f79955a6c727d83bddb04"))
( 260940, uint256S("0x000000000118fa2f031efedf874adbe7fe6b023cdf9478e8e2400c2d505df30d"))
};
chainTxData = ChainTxData{
1541743239, // * UNIX timestamp of last known number of transactions
6134223, // * total number of transactions between genesis and that timestamp
1544707462, // * UNIX timestamp of last known number of transactions
4100, // * total number of transactions between genesis and that timestamp
// (the tx=... number in the SetBestChain debug.log lines)
0.01 // * estimated number of transactions per second after that timestamp
};

View File

@ -158,11 +158,6 @@ struct Params {
std::map<LLMQType, LLMQParams> llmqs;
bool fLLMQAllowDummyCommitments;
// This is temporary until we reset testnet for retesting of the full DIP3 deployment
int nTemporaryTestnetForkDIP3Height{0};
uint256 nTemporaryTestnetForkDIP3BlockHash;
int nTemporaryTestnetForkHeight{0};
};
} // namespace Consensus

View File

@ -73,18 +73,6 @@ bool CalcCbTxMerkleRootMNList(const CBlock& block, const CBlockIndex* pindexPrev
CSimplifiedMNList sml(tmpMNList);
// BEGIN TEMPORARY CODE
const auto& consensus = Params().GetConsensus();
if (consensus.nTemporaryTestnetForkHeight != 0 &&
pindexPrev->nHeight + 1 > consensus.nTemporaryTestnetForkDIP3Height &&
pindexPrev->nHeight + 1 < consensus.nTemporaryTestnetForkHeight &&
chainActive[consensus.nTemporaryTestnetForkDIP3Height]->GetBlockHash() == consensus.nTemporaryTestnetForkDIP3BlockHash) {
for (auto& sme : sml.mnList) {
sme.confirmedHash.SetNull();
}
}
// END TEMPORARY CODE
bool mutated = false;
merkleRootRet = sml.CalcMerkleRoot(&mutated);
return !mutated;

View File

@ -266,26 +266,6 @@ bool CQuorumBlockProcessor::IsMiningPhase(Consensus::LLMQType llmqType, int nHei
bool CQuorumBlockProcessor::IsCommitmentRequired(Consensus::LLMQType llmqType, int nHeight)
{
// BEGIN TEMPORARY CODE
bool allowMissingQc = false;
{
// TODO We added the commitments code while DIP3 was already activated on testnet and we want
// to avoid reverting the chain again, as people already had many MNs registered at that time.
// So, we do a simple hardfork here at a fixed height, but only while we're on the original
// DIP3 chain.
// As we need to fork/revert the chain later to re-test all deployment stages of DIP3, we can
// remove all this temporary code later.
LOCK(cs_main);
const auto& consensus = Params().GetConsensus();
if (consensus.nTemporaryTestnetForkDIP3Height != 0 &&
nHeight > consensus.nTemporaryTestnetForkDIP3Height &&
nHeight < consensus.nTemporaryTestnetForkHeight &&
chainActive[consensus.nTemporaryTestnetForkDIP3Height]->GetBlockHash() == consensus.nTemporaryTestnetForkDIP3BlockHash) {
allowMissingQc = true;
}
}
// END TEMPORARY CODE
uint256 quorumHash = GetQuorumBlockHash(llmqType, nHeight);
// perform extra check for quorumHash.IsNull as the quorum hash is unknown for the first block of a session
@ -295,7 +275,7 @@ bool CQuorumBlockProcessor::IsCommitmentRequired(Consensus::LLMQType llmqType, i
// did we already mine a non-null commitment for this session?
bool hasMinedCommitment = !quorumHash.IsNull() && HasMinedCommitment(llmqType, quorumHash);
return isMiningPhase && !hasMinedCommitment && !allowMissingQc;
return isMiningPhase && !hasMinedCommitment;
}
// WARNING: This method returns uint256() on the first block of the DKG interval (because the block hash is not known yet)

View File

@ -89,43 +89,18 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockH
return bnPowLimit.GetCompact();
}
if (params.fPowAllowMinDifficultyBlocks && (
// testnet ...
(params.hashDevnetGenesisBlock.IsNull() && pindexLast->nChainWork >= UintToArith256(uint256S("0x000000000000000000000000000000000000000000000000003e9ccfe0e03e01"))) ||
// or devnet
!params.hashDevnetGenesisBlock.IsNull())) {
// NOTE: 000000000000000000000000000000000000000000000000003e9ccfe0e03e01 is the work of the "wrong" chain,
// so this rule activates there immediately and new blocks with high diff from that chain are going
// to be rejected by updated nodes. Note, that old nodes are going to reject blocks from updated nodes
// after the "right" chain reaches this amount of work too. This is a temporary condition which should
// be removed when we decide to hard-fork testnet again.
// TODO: remove "testnet+work OR devnet" part on next testnet hard-fork
// Special difficulty rule for testnet/devnet:
// If the new block's timestamp is more than 2* 2.5 minutes
// then allow mining of a min-difficulty block.
// start using smoother adjustment on testnet when total work hits
// 000000000000000000000000000000000000000000000000003ff00000000000
if (pindexLast->nChainWork >= UintToArith256(uint256S("0x000000000000000000000000000000000000000000000000003ff00000000000"))
// and immediately on devnet
|| !params.hashDevnetGenesisBlock.IsNull()) {
// recent block is more than 2 hours old
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + 2 * 60 * 60) {
return bnPowLimit.GetCompact();
}
// recent block is more than 10 minutes old
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*4) {
arith_uint256 bnNew = arith_uint256().SetCompact(pindexLast->nBits) * 10;
if (bnNew > bnPowLimit) {
bnNew = bnPowLimit;
}
return bnNew.GetCompact();
}
} else {
// old stuff
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2) {
return bnPowLimit.GetCompact();
if (params.fPowAllowMinDifficultyBlocks) {
// recent block is more than 2 hours old
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + 2 * 60 * 60) {
return bnPowLimit.GetCompact();
}
// recent block is more than 10 minutes old
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing * 4) {
arith_uint256 bnNew = arith_uint256().SetCompact(pindexLast->nBits) * 10;
if (bnNew > bnPowLimit) {
bnNew = bnPowLimit;
}
return bnNew.GetCompact();
}
}