Skip to content

Commit

Permalink
Merge branch master into onchaingov-pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Dec 28, 2022
2 parents a3e585b + 16ea458 commit 1aa01bd
Show file tree
Hide file tree
Showing 24 changed files with 246 additions and 121 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
Expand Down
122 changes: 72 additions & 50 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CMainParams : public CChainParams {
consensus.FortCanningGreatWorldHeight = 2212000; // Sep 7th, 2022.
consensus.FortCanningEpilogueHeight = 2257500; // Sep 22nd, 2022.
consensus.GrandCentralHeight = 2479000; // Dec 8th, 2022.
consensus.GrandCentralNextHeight = std::numeric_limits<int>::max();
consensus.GrandCentralEpilogueHeight = 2574000; // Jan 10th, 2023.

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
// consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand Down Expand Up @@ -395,7 +395,7 @@ class CTestNetParams : public CChainParams {
consensus.FortCanningGreatWorldHeight = 1223000;
consensus.FortCanningEpilogueHeight = 1244000;
consensus.GrandCentralHeight = 1366000;
consensus.GrandCentralNextHeight = std::numeric_limits<int>::max();
consensus.GrandCentralEpilogueHeight = 1438200;

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
// consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand Down Expand Up @@ -587,27 +587,27 @@ class CDevNetParams : public CChainParams {
consensus.BIP34Hash = uint256();
consensus.BIP65Height = 0;
consensus.BIP66Height = 0;
consensus.AMKHeight = 0;
consensus.BayfrontHeight = 0;
consensus.BayfrontMarinaHeight = 0;
consensus.BayfrontGardensHeight = 0;
consensus.ClarkeQuayHeight = 0;
consensus.DakotaHeight = 10;
consensus.DakotaCrescentHeight = 10;
consensus.EunosHeight = 150;
consensus.AMKHeight = 150;
consensus.BayfrontHeight = 3000;
consensus.BayfrontMarinaHeight = 90470;
consensus.BayfrontGardensHeight = 101342;
consensus.ClarkeQuayHeight = 155000;
consensus.DakotaHeight = 220680;
consensus.DakotaCrescentHeight = 287700;
consensus.EunosHeight = 354950;
consensus.EunosKampungHeight = consensus.EunosHeight;
consensus.EunosPayaHeight = 300;
consensus.FortCanningHeight = std::numeric_limits<int>::max();
consensus.FortCanningMuseumHeight = std::numeric_limits<int>::max();
consensus.FortCanningParkHeight = std::numeric_limits<int>::max();
consensus.FortCanningHillHeight = std::numeric_limits<int>::max();
consensus.FortCanningRoadHeight = std::numeric_limits<int>::max();
consensus.FortCanningCrunchHeight = std::numeric_limits<int>::max();
consensus.FortCanningSpringHeight = std::numeric_limits<int>::max();
consensus.FortCanningGreatWorldHeight = std::numeric_limits<int>::max();
consensus.FortCanningEpilogueHeight = std::numeric_limits<int>::max();
consensus.GrandCentralHeight = std::numeric_limits<int>::max();
consensus.GrandCentralNextHeight = std::numeric_limits<int>::max();
consensus.EunosPayaHeight = 463300;
consensus.FortCanningHeight = 686200;
consensus.FortCanningMuseumHeight = 724000;
consensus.FortCanningParkHeight = 828800;
consensus.FortCanningHillHeight = 828900;
consensus.FortCanningRoadHeight = 893700;
consensus.FortCanningCrunchHeight = 1011600;
consensus.FortCanningSpringHeight = 1086000;
consensus.FortCanningGreatWorldHeight = 1223000;
consensus.FortCanningEpilogueHeight = 1244000;
consensus.GrandCentralHeight = 1366000;
consensus.GrandCentralEpilogueHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks
Expand Down Expand Up @@ -663,13 +663,13 @@ class CDevNetParams : public CChainParams {

consensus.props.cfp.fee = COIN / 100; // 1%
consensus.props.cfp.minimumFee = 10 * COIN; // 10 DFI
consensus.props.cfp.approvalThreshold = COIN / 2; // vote pass with over 50% majority
consensus.props.voc.fee = 5 * COIN;
consensus.props.cfp.approvalThreshold = COIN / 2; // vote pass with over 50%
consensus.props.voc.fee = 50 * COIN;
consensus.props.voc.emergencyFee = 10000 * COIN;
consensus.props.voc.approvalThreshold = 66670000; // vote pass with over 66.67% majority
consensus.props.voc.approvalThreshold = 66670000; // vote pass with over 66.67%
consensus.props.quorum = COIN / 100; // 1% of the masternodes must vote
consensus.props.votingPeriod = 100; // tally votes every 1K blocks
consensus.props.emergencyPeriod = 50;
consensus.props.votingPeriod = 70000; // tally votes every 70K blocks
consensus.props.emergencyPeriod = 8640;
consensus.props.feeBurnPct = COIN / 2;

consensus.nonUtxoBlockSubsidies.emplace(CommunityAccountType::IncentiveFunding, 45 * COIN / 200); // 45 DFI @ 200 per block (rate normalized to (COIN == 100%))
Expand All @@ -691,10 +691,11 @@ class CDevNetParams : public CChainParams {
consensus.newNonUTXOSubsidies.emplace(CommunityAccountType::Unallocated, consensus.dist.unallocated);
consensus.newNonUTXOSubsidies.emplace(CommunityAccountType::CommunityDevFunds, consensus.dist.community);

pchMessageStartPostAMK[0] = pchMessageStart[0] = 0x0b;
pchMessageStartPostAMK[1] = pchMessageStart[1] = 0x11;
pchMessageStartPostAMK[2] = pchMessageStart[2] = 0x09;
pchMessageStartPostAMK[3] = pchMessageStart[3] = 0x07;
pchMessageStartPostAMK[0] = pchMessageStart[0] = 0x0c;
pchMessageStartPostAMK[1] = pchMessageStart[1] = 0x10;
pchMessageStartPostAMK[2] = pchMessageStart[2] = 0x10;
pchMessageStartPostAMK[3] = pchMessageStart[3] = 0x08;

nDefaultPort = 20555; /// @note devnet matter
nPruneAfterHeight = 1000;
m_assumed_blockchain_size = 30;
Expand All @@ -713,38 +714,40 @@ class CDevNetParams : public CChainParams {
consensus.foundationShare = 10; // old style - just percents
consensus.foundationShareDFIP1 = 199 * COIN / 10 / 200; // 19.9 DFI @ 200 per block (rate normalized to (COIN == 100%)

// now it is for devnet and regtest only, 2 first of genesis MNs acts as foundation members
consensus.foundationMembers.emplace(GetScriptForDestination(DecodeDestination("7M3g9CSERjLdXisE5pv2qryDbURUj9Vpi1", *this)));
consensus.foundationMembers.emplace(GetScriptForDestination(DecodeDestination("7L29itepC13pgho1X2y7mcuf4WjkBi7x2w", *this)));
consensus.foundationMembers.clear();
consensus.foundationMembers.insert(consensus.foundationShareScript);

consensus.accountDestruction.clear();
consensus.accountDestruction.insert(GetScriptForDestination(DecodeDestination("trnZD2qPU1c3WryBi8sWX16mEaq9WkGHeg", *this))); // cVUZfDj1B1o7eVhxuZr8FQLh626KceiGQhZ8G6YCUdeW3CAV49ti
consensus.accountDestruction.insert(GetScriptForDestination(DecodeDestination("75jrurn8tkDLhZ3YPyzhk6D9kc1a4hBrmM", *this))); // cSmsVpoR6dSW5hPNKeGwC561gXHXcksdQb2yAFQdjbSp5MUyzZqr

consensus.smartContracts.clear();
consensus.smartContracts[SMART_CONTRACT_DFIP_2201] = GetScriptForDestination(CTxDestination(WitnessV0KeyHash(std::vector<unsigned char>{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0})));
consensus.smartContracts[SMART_CONTRACT_DFIP_2203] = GetScriptForDestination(CTxDestination(WitnessV0KeyHash(std::vector<unsigned char>{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1})));
consensus.smartContracts[SMART_CONTRACT_DFIP2206F] = GetScriptForDestination(CTxDestination(WitnessV0KeyHash(std::vector<unsigned char>{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2})));

// owner base58, operator base58
vMasternodes.push_back({"7M3g9CSERjLdXisE5pv2qryDbURUj9Vpi1", "7Grgx69MZJ4wDKRx1bBxLqTnU9T3quKW7n"});
vMasternodes.push_back({"7L29itepC13pgho1X2y7mcuf4WjkBi7x2w", "773MiaEtQK2HAwWj55gyuRiU8tSwowRTTW"});
vMasternodes.push_back({"75Wramp2iARchHedXcn1qRkQtMpSt9Mi3V", "7Ku81yvqbPkxpWjZpZWZZnWydXyzJozZfN"});
vMasternodes.push_back({"7LfqHbyh9dBQDjWB6MxcWvH2PBC5iY4wPa", "75q6ftr3QGfBT3DBu15fVfetP6duAgfhNH"});
vMasternodes.push_back({"7LMorkhKTDjbES6DfRxX2RiNMbeemUkxmp", "7KEu9JMKCx6aJ9wyg138W3p42rjg19DR5D"});
vMasternodes.push_back({"7E8Cjn9cqEwnrc3E4zN6c5xKxDSGAyiVUM", "78MWNEcAAJxihddCw1UnZD8T7fMWmUuBro"});
vMasternodes.push_back({"7GxxMCh7sJsvRK4GXLX5Eyh9B9EteXzuum", "7MYdTGv3bv3z65ai6y5J1NFiARg8PYu4hK"});
vMasternodes.push_back({"7BQZ67KKYWSmVRukgv57m4HorjbGh7NWrQ", "7GULFtS6LuJfJEikByKKg8psscg84jnfHs"});

std::vector<CTxOut> initdist;
initdist.push_back(CTxOut(100000000 * COIN, GetScriptForDestination(DecodeDestination("7M3g9CSERjLdXisE5pv2qryDbURUj9Vpi1", *this))));
initdist.push_back(CTxOut(100000000 * COIN, GetScriptForDestination(DecodeDestination("7L29itepC13pgho1X2y7mcuf4WjkBi7x2w", *this))));
initdist.push_back(CTxOut(100000000 * COIN, GetScriptForDestination(DecodeDestination("75Wramp2iARchHedXcn1qRkQtMpSt9Mi3V", *this))));
initdist.push_back(CTxOut(100000000 * COIN, GetScriptForDestination(DecodeDestination("7LfqHbyh9dBQDjWB6MxcWvH2PBC5iY4wPa", *this))));
initdist.push_back(CTxOut(100000000 * COIN, GetScriptForDestination(DecodeDestination("te7wgg1X9HDJvMbrP2S51uz2Gxm2LPW4Gr", *this))));
initdist.push_back(CTxOut(100000000 * COIN, GetScriptForDestination(DecodeDestination("tmYVkwmcv73Hth7hhHz15mx5K8mzC1hSef", *this))));
initdist.push_back(CTxOut(100000000 * COIN, GetScriptForDestination(DecodeDestination("tahuMwb9eX83eJhf2vXL6NPzABy3Ca8DHi", *this))));

consensus.burnAddress = GetScriptForDestination(DecodeDestination("7DefichainBurnAddressXXXXXXXdMUE5n", *this));
consensus.retiredBurnAddress = GetScriptForDestination(DecodeDestination("7DefichainDSTBurnAddressXXXXXzS4Hi", *this));

// Destination for unused emission
consensus.unusedEmission = GetScriptForDestination(DecodeDestination("7HYC4WVAjJ5BGVobwbGTEzWJU8tzY3Kcjq", *this));

genesis = CreateGenesisBlock(1585132338, 0x1d00ffff, 1, initdist, CreateGenesisMasternodes()); // old=1296688602
genesis = CreateGenesisBlock(1586099762, 0x1d00ffff, 1, initdist, CreateGenesisMasternodes()); // old=1296688602
consensus.hashGenesisBlock = genesis.GetHash();

assert(consensus.hashGenesisBlock == uint256S("0x0000099a168f636895a019eacfc1798ec54c593c015cfc5aac1f12817f7ddff7"));
assert(genesis.hashMerkleRoot == uint256S("0x3f327ba2475176bcf8226b10d871f0f992e17ba9e040ff3dbd11d17c1e5914cb"));
assert(consensus.hashGenesisBlock == uint256S("0x034ac8c88a1a9b846750768c1ad6f295bc4d0dc4b9b418aee5c0ebd609be8f90"));
assert(genesis.hashMerkleRoot == uint256S("0xb71cfd828e692ca1b27e9df3a859740851047a5b5a68f659a908e8815aa35f38"));

vFixedSeeds.clear();
vSeeds.clear();
Expand All @@ -758,17 +761,24 @@ class CDevNetParams : public CChainParams {


checkpointData = {
{
// {546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")},
}
{
{ 50000, uint256S("74a468206b59bfc2667aba1522471ca2f0a4b7cd807520c47355b040c7735ccc")},
{100000, uint256S("9896ac2c34c20771742bccda4f00f458229819947e02204022c8ff26093ac81f")},
{150000, uint256S("af9307f438f5c378d1a49cfd3872173a07ed4362d56155e457daffd1061742d4")},
{300000, uint256S("205b522772ce34206a08a635c800f99d2fc4e9696ab8c470dad7f5fa51dfea1a")},
}
};

chainTxData = ChainTxData{
/* nTime */ 0,
/* nTxCount */ 0,
/* dTxRate */ 0
};

UpdateActivationParametersFromArgs();
}

void UpdateActivationParametersFromArgs();
};

/**
Expand Down Expand Up @@ -810,7 +820,7 @@ class CRegTestParams : public CChainParams {
consensus.FortCanningGreatWorldHeight = 10000000;
consensus.FortCanningEpilogueHeight = 10000000;
consensus.GrandCentralHeight = 10000000;
consensus.GrandCentralNextHeight = 10000000;
consensus.GrandCentralEpilogueHeight = 10000000;

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand Down Expand Up @@ -1052,7 +1062,7 @@ void SetupCommonArgActivationParams(Consensus::Params &consensus) {
UpdateHeightValidation("Fort Canning Great World", "-greatworldheight", consensus.FortCanningGreatWorldHeight);
UpdateHeightValidation("Fort Canning Epilogue", "-fortcanningepilogueheight", consensus.FortCanningEpilogueHeight);
UpdateHeightValidation("Grand Central", "-grandcentralheight", consensus.GrandCentralHeight);
UpdateHeightValidation("Grand Central Next", "-grandcentralnextheight", consensus.GrandCentralNextHeight);
UpdateHeightValidation("Grand Central Next", "-grandcentralepilogueheight", consensus.GrandCentralEpilogueHeight);

if (gArgs.GetBoolArg("-simulatemainnet", false)) {
consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks
Expand Down Expand Up @@ -1095,6 +1105,18 @@ void CMainParams::UpdateActivationParametersFromArgs() {
}


void CDevNetParams::UpdateActivationParametersFromArgs() {
if (gArgs.IsArgSet("-devnet-bootstrap")) {
nDefaultPort = 18555;
vSeeds.emplace_back("testnet-seed.defichain.io");
pchMessageStartPostAMK[0] = 0x0b;
pchMessageStartPostAMK[1] = 0x11;
pchMessageStartPostAMK[2] = 0x09;
pchMessageStartPostAMK[3] = 0x07;
}
}


void CRegTestParams::UpdateActivationParametersFromArgs()
{
SetupCommonArgActivationParams(consensus);
Expand Down
18 changes: 12 additions & 6 deletions src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void SetupChainParamsBaseOptions()
gArgs.AddArg("-segwitheight=<n>", "Set the activation height of segwit. -1 to disable. (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-testnet", "Use the test chain", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-devnet", "Use the dev chain", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-devnet-bootstrap", "Use the dev chain and sync from testnet", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-vbparams=deployment:start:end", "Use given start/end times for specified version bits deployment (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
}

Expand All @@ -35,16 +36,21 @@ const CBaseChainParams& BaseParams()

std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
{
if (chain == CBaseChainParams::MAIN)
if (chain == CBaseChainParams::MAIN) {
return std::make_unique<CBaseChainParams>("", 8554);
else if (chain == CBaseChainParams::TESTNET)
} else if (chain == CBaseChainParams::TESTNET) {
return std::make_unique<CBaseChainParams>("testnet3", 18554);
else if (chain == CBaseChainParams::DEVNET)
return std::make_unique<CBaseChainParams>("devnet", 20554);
else if (chain == CBaseChainParams::REGTEST)
} else if (chain == CBaseChainParams::DEVNET) {
if (gArgs.IsArgSet("-devnet-bootstrap")) {
return std::make_unique<CBaseChainParams>("devnet", 18554);
} else {
return std::make_unique<CBaseChainParams>("devnet", 20554);
}
} else if (chain == CBaseChainParams::REGTEST) {
return std::make_unique<CBaseChainParams>("regtest", 19554);
else
} else {
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
}
}

void SelectBaseParams(const std::string& chain)
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct Params {
int FortCanningGreatWorldHeight;
int FortCanningEpilogueHeight;
int GrandCentralHeight;
int GrandCentralNextHeight;
int GrandCentralEpilogueHeight;

/** Foundation share after AMK, normalized to COIN = 100% */
CAmount foundationShareDFIP1;
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ void SetupServerArgs()
gArgs.AddArg("-greatworldheight", "Alias for Fort Canning Great World fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningepilogueheight", "Alias for Fort Canning Epilogue fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-grandcentralheight", "Grand Central fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-grandcentralnextheight", "Grand Central Next fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-grandcentralepilogueheight", "Grand Central Next fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-jellyfish_regtest", "Configure the regtest network for jellyfish testing", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
gArgs.AddArg("-regtest-skip-loan-collateral-validation", "Skip loan collateral check for jellyfish testing", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
gArgs.AddArg("-regtest-minttoken-simulate-mainnet", "Simulate mainnet for minttokens on regtest - default behavior on regtest is to allow anyone to mint mintable tokens for ease of testing", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
Expand Down
Loading

0 comments on commit 1aa01bd

Please sign in to comment.