diff --git a/.vscode/settings.json b/.vscode/settings.json index a2aaa0a3c06b..2db48d976705 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -80,6 +80,34 @@ "unordered_map": "cpp", "unordered_set": "cpp", "variant": "cpp", - "algorithm": "cpp" + "algorithm": "cpp", + "coroutine": "cpp", + "xmemory": "cpp", + "charconv": "cpp", + "resumable": "cpp", + "format": "cpp", + "forward_list": "cpp", + "functional": "cpp", + "iterator": "cpp", + "ranges": "cpp", + "span": "cpp", + "stop_token": "cpp", + "utility": "cpp", + "valarray": "cpp", + "xfacet": "cpp", + "xhash": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocbuf": "cpp", + "xlocinfo": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xstddef": "cpp", + "xstring": "cpp", + "xtr1common": "cpp", + "xtree": "cpp", + "xutility": "cpp" } -} \ No newline at end of file +} diff --git a/README.md b/README.md index 589aa9e1305e..889fca0be833 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Brief Specifications * Coin Name: StakeCubeCoin * Coin Ticker: SCC -* Consensus: PoW/MN (x11) +* Consensus: PoW/MN (FiroPow) * MN Collateral: 1000 SCC * Block reward: 0.5 - 9 SCC * MN reward: 70% @@ -26,9 +26,9 @@ Brief Specifications What is StakeCubeCoin (SCC)? ------------------------- -StakeCubeCoin is a fork of the Dash codebase; which uses a combination of x11-PoW and Deterministic Masternodes to secure the cryptocurrency's network and blockchain. +StakeCubeCoin is a fork of the Dash codebase; which uses a combination of FiroPow-PoW and Deterministic Masternodes to secure the cryptocurrency's network and blockchain. -The StakeCubeCoin blockchain is further secured by Masternodes, which enforce ChainLocks and InstantSend for an extremely fast, secure network monitored by 1000s of Masternodes, constantly producing secure quorums. +The StakeCubeCoin blockchain is further secured by Masternodes, which enforce ChainLocks and InstantSend for a high-speed, secure network monitored by 1000s of Masternodes, constantly producing secure quorums. The first consecutive blocks contain the coins allocated for the user coin swap (From the MUE codebase), destined for holders of the previous PoS/MN version of StakeCubeCoin. @@ -40,13 +40,13 @@ A total of 1,000 SCC is required to run a masternode; Issue Tracker ------------ -The integrated GitHub issue tracker is used for this project. Upon running into an issue, please submit it [here](https://github.com/stakecube/StakeCubeCoin/issues). +The integrated GitHub issue tracker is used for this project. When you encounter an issue, please submit it [here](https://github.com/stakecube/StakeCubeCoin/issues). Documentation ------------- -The documentation is a work-in-progress. It is located in the doc folder. +The documentation is a work in progress. It is located in the doc folder. Additionally, you may join the StakeCube discord server for direct support from the StakeCube team and community: https://discord.gg/zB3xBhe @@ -58,5 +58,5 @@ License StakeCubeCoin is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT. -StakeCubeCoin is derived from code developed by the Dashpay team (https://github.com/dashpay/dash) and where possible, have left all copyright notices and trademarks untouched. +StakeCubeCoin is derived from code developed by the Dashpay team (https://github.com/dashpay/dash) and where possible, has left all copyright notices and trademarks untouched. diff --git a/configure.ac b/configure.ac index 3dc0e904aa77..2f6d9cc7ca0d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ AC_PREREQ([2.69]) define(_CLIENT_VERSION_MAJOR, 3) define(_CLIENT_VERSION_MINOR, 3) -define(_CLIENT_VERSION_REVISION, 1) +define(_CLIENT_VERSION_REVISION, 9) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_RC, 0) -define(_CLIENT_VERSION_IS_RELEASE, true) -define(_COPYRIGHT_YEAR, 2022) +define(_CLIENT_VERSION_IS_RELEASE, false) +define(_COPYRIGHT_YEAR, 2023) define(_COPYRIGHT_HOLDERS,[The %s developers]) define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[SCC Core]]) AC_INIT([SCC Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_REVISION, m4_if(_CLIENT_VERSION_BUILD, [0], [], _CLIENT_VERSION_BUILD))m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/stakecube/StakeCubeCoin/issues],[stakecube],[https://stakecube.net/]) @@ -1390,7 +1390,7 @@ fi if test x$use_boost = xyes; then - + BOOST_LIBS="$BOOST_LDFLAGS $BOOST_FILESYSTEM_LIB $BOOST_THREAD_LIB" dnl If boost (prior to 1.57) was built without c++11, it emulated scoped enums diff --git a/depends/packages/immer.mk b/depends/packages/immer.mk index 89eb8ab7786d..33cdad018be2 100644 --- a/depends/packages/immer.mk +++ b/depends/packages/immer.mk @@ -1,6 +1,6 @@ package=immer $(package)_version=v0.6.2 -$(package)_download_path=https://github.com/arximboldi/immer/archive +$(package)_download_path=https://github.com/arximboldi/immer/archive/refs/tags $(package)_download_file=$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_download_file) $(package)_sha256_hash=c3bb8847034437dee64adacb04e1e0163ae640b596c582eb4c0aa1d7c6447cd7 diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 981db4d5155f..7c7d3f47b9ed 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -250,6 +250,15 @@ class CMainParams : public CChainParams { consensus.vDeployments[Consensus::DEPLOYMENT_DIP0020].nThresholdMin = 2420; // 60% of 4032 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0020].nFalloffCoeff = 5; // this corresponds to 10 periods + // Deployment of decreased proposal fee, script addresses for Governance Proposals + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].bit = 7; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nStartTime = 1635724800; // Nov 1st, 2021 + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nTimeout = 999999999999ULL; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nWindowSize = 100; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nThresholdStart = 80; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nThresholdMin = 60; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nFalloffCoeff = 5; // this corresponds to 10 periods + // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0000000000000000000000000000000000000000000000902015d2c183b40ba9"); // Blk 484,917 @@ -344,7 +353,8 @@ class CMainParams : public CChainParams { nPoolMaxParticipants = 5; nFulfilledRequestExpireTime = 60*60; // fulfilled requests expire in 1 hour - vSporkAddresses = {"sJbcSRccZQfmgjeW28uEEh9PswngZj1RXb"}; + vSporkAddressesV1 = {"sJbcSRccZQfmgjeW28uEEh9PswngZj1RXb"}; + vSporkAddressesV2 = {"sRSMpxfoejLYu7Y7Jd44MPfK76ap6cnXUR"}; nMinSporkKeys = 1; fBIP9CheckMasternodesUpgraded = true; @@ -396,13 +406,25 @@ class CMainParams : public CChainParams { {412200, uint256S("0000000000001bf066316f9a8da865f3e16f4770d3a36fd007253d0c07599c65")}, {432200, uint256S("0000000000004914b4bf906e1e1b869338cdd61b249cab868d4b8640e1dee35c")}, {452200, uint256S("0000000000001aacd70727211dbac4a888d34f423497da206d1cad9492ec4594")}, - {472200, uint256S("00000000000003163bd40055b06f813615f104e2f67f910bc5814d731f9afa20")} + {472200, uint256S("00000000000003163bd40055b06f813615f104e2f67f910bc5814d731f9afa20")}, + // Historical refs + {500000, uint256S("000000000001020e80eb983cc1f16f22676544c3f89ca374c8f92f260d89800a")}, + {550000, uint256S("00000000005333d7f47a5ea1275e14edf813a69259e7cc0d023c7cd655fb2517")}, + {550500, uint256S("000000000061cc0cf09219cad0b6ea9843a593d58d50130e9ca5aed254bdb4e7")}, + {551500, uint256S("0000000000832d63fb60c46529eb1bca584b0a019e18a18cb2255abf745d3671")}, + // Post team re-org + {555000, uint256S("0000000001a965f5f2bd59b114f53d0d61f21649a686c675028639cdad64c665")}, + {600000, uint256S("00000000004428e377917ebf1b5e256baed842139c57f4c199712ae2607284db")}, + {650000, uint256S("0000000002a791bd190def7536560777a6105f6a682c6bbab899a3781b2b44b3")}, + {700000, uint256S("000000000361299a95ea6a73d9a202a94893b3ec4fb441330740e20f9748cf36")}, + {703355, uint256S("0000000002354cfaeb716435d7cfa632651f32ea22ef9796d25b893e264b2ea5")}, + {703363, uint256S("00000000013b1c713a1ae71e6328f0f21efa08c7b8432d40bce681e4588645c4")} } }; chainTxData = ChainTxData{ - 1647874171, // * UNIX timestamp of last known number of transactions (Block 1) - 646614, // * total number of transactions between genesis and that timestamp + 1692077442, // * UNIX timestamp of last known number of transactions (Block 1) + 703363, // * total number of transactions between genesis and that timestamp // (the tx=... number in the SetBestChain debug.log lines) 0.0153 // * estimated number of transactions per second after that timestamp }; @@ -502,6 +524,15 @@ class CTestNetParams : public CChainParams { consensus.vDeployments[Consensus::DEPLOYMENT_DIP0020].nThresholdMin = 60; // 60% of 100 consensus.vDeployments[Consensus::DEPLOYMENT_DIP0020].nFalloffCoeff = 5; // this corresponds to 10 periods + // Deployment of decreased proposal fee, script addresses for Governance Proposals + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].bit = 7; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nStartTime = 1635724800; // Nov 1st, 2021 + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nTimeout = 999999999999ULL; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nWindowSize = 100; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nThresholdStart = 80; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nThresholdMin = 60; + consensus.vDeployments[Consensus::DEPLOYMENT_GOV_FEE].nFalloffCoeff = 5; // this corresponds to 10 periods + // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("00"); // 470000 @@ -564,7 +595,8 @@ class CTestNetParams : public CChainParams { nPoolMaxParticipants = 20; nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes - vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; + vSporkAddressesV1 = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; + vSporkAddressesV2 = {"yaBHHsZP4MthVVexFXiLgzUw7mwzxY9KRF"}; nMinSporkKeys = 1; fBIP9CheckMasternodesUpgraded = true; @@ -753,7 +785,8 @@ class CDevNetParams : public CChainParams { nPoolMaxParticipants = 20; nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes - vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; + vSporkAddressesV1 = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; + vSporkAddressesV2 = {"yaBHHsZP4MthVVexFXiLgzUw7mwzxY9KRF"}; nMinSporkKeys = 1; // devnets are started with no blocks and no MN, so we can't check for upgraded MN (as there are none) fBIP9CheckMasternodesUpgraded = false; @@ -931,7 +964,8 @@ class CRegTestParams : public CChainParams { nPoolMaxParticipants = 20; // privKey: cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK - vSporkAddresses = {"yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"}; + vSporkAddressesV1 = {"yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"}; + vSporkAddressesV2 = {"yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"}; nMinSporkKeys = 1; // regtest usually has no masternodes in most tests, so don't check for upgraged MNs fBIP9CheckMasternodesUpgraded = false; diff --git a/src/chainparams.h b/src/chainparams.h index 3206b924fd16..f4e1cac55d7c 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -106,7 +106,8 @@ class CChainParams int PoolMinParticipants() const { return nPoolMinParticipants; } int PoolMaxParticipants() const { return nPoolMaxParticipants; } int FulfilledRequestExpireTime() const { return nFulfilledRequestExpireTime; } - const std::vector& SporkAddresses() const { return vSporkAddresses; } + const std::vector& SporkAddressesV1() const { return vSporkAddressesV1; } + const std::vector& SporkAddressesV2() const { return vSporkAddressesV2; } int MinSporkKeys() const { return nMinSporkKeys; } bool BIP9CheckMasternodesUpgraded() const { return fBIP9CheckMasternodesUpgraded; } const Consensus::LLMQParams& GetLLMQ(Consensus::LLMQType llmqType) const; @@ -141,7 +142,8 @@ class CChainParams int nPoolMinParticipants; int nPoolMaxParticipants; int nFulfilledRequestExpireTime; - std::vector vSporkAddresses; + std::vector vSporkAddressesV1; + std::vector vSporkAddressesV2; int nMinSporkKeys; bool fBIP9CheckMasternodesUpgraded; diff --git a/src/init.cpp b/src/init.cpp index 8cec045b2aa6..c9333dfe0750 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1687,7 +1687,7 @@ bool AppInitMain(InitInterfaces& interfaces) if (gArgs.IsArgSet("-sporkaddr")) { vSporkAddresses = gArgs.GetArgs("-sporkaddr"); } else { - vSporkAddresses = Params().SporkAddresses(); + vSporkAddresses = Params().SporkAddressesV1(); } for (const auto& address: vSporkAddresses) { if (!sporkManager.SetSporkAddress(address)) { @@ -2486,6 +2486,40 @@ bool AppInitMain(InitInterfaces& interfaces) return false; } + + // ********************************************************* Step 12.1: uprade sporks + + if (chain_active_height >= 750000 && chainparams.NetworkIDString() == CBaseChainParams::MAIN) { + std::vector vSporkAddresses; + if (gArgs.IsArgSet("-sporkaddr")) { + vSporkAddresses = gArgs.GetArgs("-sporkaddr"); + } else { + vSporkAddresses = Params().SporkAddressesV2(); + } + sporkManager.ClearSporkAddresses(); + for (const auto& address : vSporkAddresses) { + if (!sporkManager.SetSporkAddress(address)) { + return InitError(_("Invalid spork address specified with -sporkaddr").translated); + } + } + LogPrintf("Using V2 Spork Addresses\n"); + } + if (chain_active_height >= 7500 && chainparams.NetworkIDString() == CBaseChainParams::TESTNET) { + std::vector vSporkAddresses; + if (gArgs.IsArgSet("-sporkaddr")) { + vSporkAddresses = gArgs.GetArgs("-sporkaddr"); + } else { + vSporkAddresses = Params().SporkAddressesV2(); + } + sporkManager.ClearSporkAddresses(); + for (const auto& address : vSporkAddresses) { + if (!sporkManager.SetSporkAddress(address)) { + return InitError(_("Invalid spork address specified with -sporkaddr").translated); + } + } + LogPrintf("Using V2 Spork Addresses\n"); + } + // ********************************************************* Step 13: finished SetRPCWarmupFinished(); diff --git a/src/miner.cpp b/src/miner.cpp index a000269dbb12..ca15ae50e9ff 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -213,7 +213,7 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev); - if (nHeight == 491409) { + if (nHeight == 491409 && chainparams.NetworkIDString() == CBaseChainParams::MAIN) { pblock->nBits = chainparams.GetConsensus().nInitialPPDifficulty; } else { pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus()); diff --git a/src/spork.cpp b/src/spork.cpp index a80cc1311214..9c66bb52e175 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -273,6 +273,12 @@ bool CSporkManager::GetSporkByHash(const uint256& hash, CSporkMessage& sporkRet) return true; } +void CSporkManager::ClearSporkAddresses() +{ + LOCK(cs); + setSporkPubKeyIDs.clear(); +} + bool CSporkManager::SetSporkAddress(const std::string& strAddress) { LOCK(cs); diff --git a/src/spork.h b/src/spork.h index 5e65f9911b47..0798fdd29f3f 100644 --- a/src/spork.h +++ b/src/spork.h @@ -284,6 +284,12 @@ class CSporkManager */ bool GetSporkByHash(const uint256& hash, CSporkMessage &sporkRet) const; + /** + * ClearSporkAddresses is used to clear the spork listing due to a change. + * use wisely. + */ + void ClearSporkAddresses(); + /** * SetSporkAddress is used to set a public key ID which will be used to * verify spork signatures. diff --git a/src/validation.cpp b/src/validation.cpp index 023659fd184f..50fe1a8b6853 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1949,6 +1949,12 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl return state.DoS(50, false, REJECT_INVALID, "invalid-progpow-epoch", false, "invalid epoch number"); } + /*uint256 exp_mix_hash{}, final_hash; + final_hash = block.GetProgPowHashFull(exp_mix_hash); + if (exp_mix_hash != block.mix_hash) { + return state.DoS(50, false, REJECT_INVALID, "invalid-mixhash", false, "mix_hash validity failed"); + }*/ + // verify that the view's current state corresponds to the previous block uint256 hashPrevBlock = pindex->pprev == nullptr ? uint256() : pindex->pprev->GetBlockHash(); assert(hashPrevBlock == view.GetBestBlock());