Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable full dip0003 deployment #29

Merged
merged 2 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 2 additions & 4 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ void CActiveMasternodeManager::Init()
LOCK(cs_main);

if (!fMasternodeMode) return;

if (!deterministicMNManager->IsDIP3Enforced()) return;
if (!FullDIP0003Mode()) return;

// Check that our local network configuration is correct
if (!fListen) {
Expand Down Expand Up @@ -130,8 +129,7 @@ void CActiveMasternodeManager::UpdatedBlockTip(const CBlockIndex* pindexNew, con
LOCK(cs_main);

if (!fMasternodeMode) return;

if (!deterministicMNManager->IsDIP3Enforced(pindexNew->nHeight)) return;
if (!FullDIP0003Mode()) return;

if (state == MASTERNODE_READY) {
auto mnList = deterministicMNManager->GetListForBlock(pindexNew->GetBlockHash());
Expand Down
132 changes: 73 additions & 59 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static CBlock FindDevNetGenesisBlock(const Consensus::Params& params, const CBlo
static Consensus::LLMQParams llmq5_60 = {
.type = Consensus::LLMQ_5_60,
.name = "llmq_5_60",
.size = 5,
.size = 3,
.minSize = 3,
.threshold = 3,

Expand Down Expand Up @@ -221,16 +221,19 @@ class CMainParams : public CChainParams {
consensus.nSuperblockCycle = 16616;
consensus.nGovernanceMinQuorum = 10;
consensus.nGovernanceFilterElements = 20000;
///////////////////////////////////////////////
consensus.nGenerationAmount = 700000000 * COIN;
consensus.nGenerationHeight = 362250;
///////////////////////////////////////////////
consensus.nMasternodeMinimumConfirmations = 15;
consensus.nMasternodeCollateral = 500000 * COIN;
consensus.nCollateralBugHeight = 331460;
consensus.BIP34Height = 951;
consensus.BIP34Hash = uint256S("0x000001f35e70f7c5705f64c6c5cc3dea9449e74d5b5c7cf74dad1bcca14a8012");
consensus.BIP65Height = 619382;
consensus.BIP66Height = 245817;
consensus.DIP0001Height = 12096;
consensus.DIP0003Height = 330000;
consensus.DIP0003EnforcementHeight = NEVER32;
consensus.DIP0003EnforcementHeight = consensus.nGenerationHeight + 50;
consensus.DIP0003EnforcementHash = uint256();
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.posLimit = uint256S("0007ffff00000000000000000000000000000000000000000000000000000000");
Expand All @@ -251,39 +254,39 @@ class CMainParams : public CChainParams {
consensus.nMinerConfirmationWindow = 2016;

consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = NEVER64;

// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = NEVER64;

// Deployment of DIP0001
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = NEVER64;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 50;

// Deployment of BIP147
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].bit = 2;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = NEVER64;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nThreshold = 50;

// Deployment of DIP0003
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].bit = 3;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 50;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 10;

// Deployment of DIP0008
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 10;

Expand Down Expand Up @@ -398,41 +401,44 @@ class CTestNetParams : public CChainParams {
public:
CTestNetParams() {
strNetworkID = "test";
consensus.nSubsidyHalvingInterval = NEVER32; // unused
consensus.nSubsidyHalvingInterval = NEVER32;
consensus.nMasternodePaymentsStartBlock = 50;
consensus.nMasternodePaymentsIncreaseBlock = NEVER32;
consensus.nMasternodePaymentsIncreasePeriod = NEVER32;
consensus.nInstantSendConfirmationsRequired = 2;
consensus.nInstantSendKeepLock = 6;
consensus.nInstantSendSigsRequired = 6;
consensus.nInstantSendSigsTotal = 10;
consensus.nBudgetPaymentsStartBlock = NEVER32;
consensus.nBudgetPaymentsCycleBlocks = NEVER32;
consensus.nBudgetPaymentsWindowBlocks = NEVER32;
consensus.nSuperblockStartBlock = NEVER32;
consensus.nSuperblockStartHash = uint256(); // do not check this on testnet
consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet
consensus.nInstantSendSigsRequired = 2;
consensus.nInstantSendSigsTotal = 4;
consensus.nBudgetPaymentsStartBlock = 50;
consensus.nBudgetPaymentsCycleBlocks = 50;
consensus.nBudgetPaymentsWindowBlocks = 100;
consensus.nSuperblockStartBlock = 100;
consensus.nSuperblockStartHash = uint256();
consensus.nSuperblockCycle = 24;
consensus.nGovernanceMinQuorum = 1;
consensus.nGovernanceFilterElements = 500;
///////////////////////////////////////////////
consensus.nGenerationAmount = 700000000 * COIN;
consensus.nGenerationHeight = 80;
///////////////////////////////////////////////
consensus.nMasternodeMinimumConfirmations = 15;
consensus.nMasternodeCollateral = 5000 * COIN;
consensus.nCollateralBugHeight = 0;
consensus.nMasternodeCollateral = 1000 * COIN;
consensus.BIP34Height = 1;
consensus.BIP34Hash = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");
consensus.BIP65Height = 0;
consensus.BIP66Height = 0;
consensus.DIP0001Height = 1;
consensus.DIP0003Height = 50;
consensus.DIP0003EnforcementHeight = 250;
consensus.DIP0003Height = 75;
consensus.DIP0003EnforcementHeight = consensus.nGenerationHeight + 50;
consensus.DIP0003EnforcementHash = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");
consensus.powLimit = uint256S("0000fffff0000000000000000000000000000000000000000000000000000000");
consensus.posLimit = uint256S("007ffff000000000000000000000000000000000000000000000000000000000");
consensus.nLastPoWBlock = 125;
consensus.nPowTargetTimespan = 450;
consensus.nPowTargetSpacing = 150;
consensus.nLastPoWBlock = consensus.DIP0003Height;
consensus.nPowTargetTimespan = 60;
consensus.nPowTargetSpacing = 60;
consensus.nPosTargetSpacing = consensus.nPowTargetSpacing;
consensus.nPosTargetTimespan = consensus.nPowTargetTimespan;
consensus.nMinimumStakeValue = 10000 * COIN;
consensus.nMinimumStakeValue = 100 * COIN;
consensus.nStakeMinAge = 10 * 60;
consensus.nStakeMaxAge = 60 * 60 * 24 * 30;
consensus.nModifierInterval = 60 * 20;
Expand All @@ -442,40 +448,41 @@ class CTestNetParams : public CChainParams {
consensus.nPowDGWHeight = NEVER32; // unused
consensus.nRuleChangeActivationThreshold = 1512;
consensus.nMinerConfirmationWindow = 2016;

consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = NEVER64;

// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = NEVER64;

// Deployment of DIP0001
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].bit = 1;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nTimeout = NEVER64;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 50;

// Deployment of BIP147
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].bit = 2;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nStartTime = 1573325000;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nTimeout = NEVER64;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_BIP147].nThreshold = 50;

// Deployment of DIP0003
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].bit = 3;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 50;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0003].nThreshold = 10;

// Deployment of DIP0008
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = 1544655600;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = NEVER32;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nWindowSize = 100;
consensus.vDeployments[Consensus::DEPLOYMENT_DIP0008].nThreshold = 10;

Expand All @@ -493,16 +500,26 @@ class CTestNetParams : public CChainParams {
nDefaultPort = 29999;
nPruneAfterHeight = 1000;

genesis = CreateGenesisBlock(1567646780, 24712, 0x1f00ffff, 1, 0 * COIN, true);
uint32_t nTime = 1573325000;
uint32_t nNonce = 0;

if (nNonce == 0) {
while (UintToArith256(genesis.GetHash()) >
UintToArith256(consensus.powLimit))
{
nNonce++;
genesis = CreateGenesisBlock(nTime, nNonce, 0x1f00ffff, 1, 0 * COIN, true);
if (nNonce % 128 == 0) printf("\rgenesis %08x", nNonce);
}
}

genesis = CreateGenesisBlock(nTime, nNonce, 0x1f00ffff, 1, 0 * COIN, true);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x0000d3b6747d6f7fe976c218fe7834d2fa79b661a6debe69a0af9b8faea3b0fa"));

vFixedSeeds.clear();
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));

vSeeds.clear();
vSeeds.push_back(CDNSSeedData("pacglobal.io", "seed2.pacglobal.io"));
vSeeds.push_back(CDNSSeedData("pacglobal.io", "seed3.pacglobal.io"));

// Testnet PACGlobal addresses start with 'y'
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
Expand All @@ -519,25 +536,23 @@ class CTestNetParams : public CChainParams {
nExtCoinType = 1;

// long living quorum params
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
consensus.llmqChainLocks = Consensus::LLMQ_50_60;
consensus.llmqForInstaPAC = Consensus::LLMQ_50_60;
consensus.llmqs[Consensus::LLMQ_5_60] = llmq5_60;
consensus.llmqChainLocks = Consensus::LLMQ_5_60;
consensus.llmqForInstaPAC = Consensus::LLMQ_5_60;

fMiningRequiresPeers = true;
fDefaultConsistencyChecks = false;
fRequireStandard = false;
fRequireStandard = true;
fRequireRoutableExternalIP = false;
fMineBlocksOnDemand = false;
fAllowMultipleAddressesFromGroup = false;
fAllowMultipleAddressesFromGroup = true;
fAllowMultiplePorts = true;

nPoolMinParticipants = 3;
nPoolMaxParticipants = 5;
nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes

vSporkAddresses = {"yarEgAKyKCAanupC45vXhdWe6DAQf7RKPh"};
vSporkAddresses = {"yTpFjxs3Rtwe7MXfC1i5XACz2K5UYi2GpL"};
nMinSporkKeys = 1;
fBIP9CheckMasternodesUpgraded = true;

Expand Down Expand Up @@ -582,7 +597,6 @@ class CDevNetParams : public CChainParams {
consensus.nGovernanceFilterElements = 500;
consensus.nMasternodeMinimumConfirmations = 1;
consensus.nMasternodeCollateral = 500000 * COIN;
consensus.nCollateralBugHeight = 0;
consensus.BIP34Height = 1; // BIP34 activated immediately on devnet
consensus.BIP65Height = 1; // BIP65 activated immediately on devnet
consensus.BIP66Height = 1; // BIP66 activated immediately on devnet
Expand Down
10 changes: 0 additions & 10 deletions src/chainparamsseeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@
* IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
*/
static SeedSpec6 pnSeed6_main[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0xcb,0x9a,0x6e}, 7112},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0xcb,0x9b,0x1a}, 7112},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0xcb,0x37,0x86}, 7112},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0xcb,0xdd,0xf9}, 7112},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd8,0xa3,0x29}, 7112},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd9,0x0b,0x8d}, 7112},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd9,0x0b,0x8c}, 7112},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd8,0x98,0x22}, 7112}
};
static SeedSpec6 pnSeed6_test[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9d,0xe6,0xf4,0xe9}, 29999},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa5,0x16,0x64,0x7f}, 29999}
};
#endif // PAC_CHAINPARAMSSEEDS_H
10 changes: 9 additions & 1 deletion src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ struct BIP9Deployment {
int64_t nWindowSize;
/** A number of blocks, in the range of 1..nWindowSize, which must signal for a fork in order to lock it in. */
int64_t nThreshold;
/** Constant for nTimeout very far in the future. */
static constexpr int64_t NO_TIMEOUT = std::numeric_limits<int64_t>::max();
/** Special value for nStartTime indicating that the deployment is always active.
* This is useful for testing, as it means tests don't need to deal with the activation
* process (which takes at least 3 BIP9 intervals). Only tests that specifically test the
* behaviour during activation cannot use this. */
static constexpr int64_t ALWAYS_ACTIVE = -1;
};

enum LLMQType : uint8_t
Expand Down Expand Up @@ -136,9 +143,10 @@ struct Params {
int nSuperblockCycle; // in blocks
int nGovernanceMinQuorum; // Min absolute vote count to trigger an action
int nGovernanceFilterElements;
CAmount nGenerationAmount;
int nGenerationHeight;
int nMasternodeMinimumConfirmations;
CAmount nMasternodeCollateral;
int nCollateralBugHeight;
/** Block height and hash at which BIP34 becomes active */
int BIP34Height;
uint256 BIP34Hash;
Expand Down
12 changes: 6 additions & 6 deletions src/evo/cbtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ bool CheckCbTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidatio
return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-height");
}

if (pindexPrev) {
bool fDIP0008Active = VersionBitsState(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0008, versionbitscache) == THRESHOLD_ACTIVE;
if (fDIP0008Active && cbTx.nVersion < 2) {
return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-version");
}
}
// if (pindexPrev) {
// bool fDIP0008Active = VersionBitsState(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0008, versionbitscache) == THRESHOLD_ACTIVE;
// if (fDIP0008Active && cbTx.nVersion < 2) {
// return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-version");
// }
// }

return true;
}
Expand Down
Loading