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

2.8.0 #1264

Merged
merged 6 commits into from
May 23, 2022
Merged

2.8.0 #1264

Show file tree
Hide file tree
Changes from 5 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
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, 2)
define(_CLIENT_VERSION_MINOR, 7)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_MINOR, 8)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
Expand Down
5 changes: 5 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class CMainParams : public CChainParams {
consensus.FortCanningParkHeight = 1503143;
consensus.FortCanningHillHeight = 1604999; // Feb 7, 2022.
consensus.FortCanningRoadHeight = 1786000; // April 11, 2022.
consensus.FortCanningSpiceGardenHeight = 1936000; // June 2, 2022.
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -359,6 +360,7 @@ class CTestNetParams : public CChainParams {
consensus.FortCanningParkHeight = 828800;
consensus.FortCanningHillHeight = 828900;
consensus.FortCanningRoadHeight = 893700;
consensus.FortCanningSpiceGardenHeight = 1011600;
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -549,6 +551,7 @@ class CDevNetParams : public CChainParams {
consensus.FortCanningParkHeight = std::numeric_limits<int>::max();
consensus.FortCanningHillHeight = std::numeric_limits<int>::max();
consensus.FortCanningRoadHeight = std::numeric_limits<int>::max();
consensus.FortCanningSpiceGardenHeight = std::numeric_limits<int>::max();
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -731,6 +734,7 @@ class CRegTestParams : public CChainParams {
consensus.FortCanningParkHeight = 10000000;
consensus.FortCanningHillHeight = 10000000;
consensus.FortCanningRoadHeight = 10000000;
consensus.FortCanningSpiceGardenHeight = 10000000;
consensus.GreatWorldHeight = 10000000;

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -952,6 +956,7 @@ void CRegTestParams::UpdateActivationParametersFromArgs()
UpdateHeightValidation("Fort Canning Park", "-fortcanningparkheight", consensus.FortCanningParkHeight);
UpdateHeightValidation("Fort Canning Hill", "-fortcanninghillheight", consensus.FortCanningHillHeight);
UpdateHeightValidation("Fort Canning Road", "-fortcanningroadheight", consensus.FortCanningRoadHeight);
UpdateHeightValidation("Fort Canning Split", "-fortcanningspicegardenheight", consensus.FortCanningSpiceGardenHeight);
UpdateHeightValidation("Great World", "-greatworldheight", consensus.GreatWorldHeight);

if (gArgs.GetBoolArg("-simulatemainnet", false)) {
Expand Down
1 change: 1 addition & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ struct Params {
int FortCanningParkHeight;
int FortCanningHillHeight;
int FortCanningRoadHeight;
int FortCanningSpiceGardenHeight;
int GreatWorldHeight;

/** Foundation share after AMK, normalized to COIN = 100% */
Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ void SetupServerArgs()
gArgs.AddArg("-fortcanningparkheight", "Fort Canning Park fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanninghillheight", "Fort Canning Hill fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningroadheight", "Fort Canning Road fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningspicegardenheight", "Fort Canning Spice Garden fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-greatworldheight", "Great World 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("-simulatemainnet", "Configure the regtest network to mainnet target timespan and spacing ", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
Expand Down
16 changes: 8 additions & 8 deletions src/masternodes/govvariables/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
case TokenKeys::LoanCollateralFactor:
case TokenKeys::LoanMintingEnabled:
case TokenKeys::LoanMintingInterest: {
if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) {
return Res::Err("Cannot be set before GreatWorld");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
}
if (!VerifyToken(view, attrV0->typeId)) {
return Res::Err("No such token (%d)", attrV0->typeId);
Expand All @@ -745,8 +745,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;
}
case TokenKeys::FixedIntervalPriceId:
if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) {
return Res::Err("Cannot be set before GreatWorld");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
}
if (!VerifyToken(view, attrV0->typeId)) {
return Res::Err("No such token (%d)", attrV0->typeId);
Expand All @@ -770,8 +770,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;

case AttributeTypes::Oracles:
if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) {
return Res::Err("Cannot be set before GreatWorld");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
}
if (attrV0->typeId == OracleIDs::Splits) {
const auto splitMap = boost::get<OracleSplits>(&attribute.second);
Expand Down Expand Up @@ -832,8 +832,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;

case AttributeTypes::Locks:
if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) {
return Res::Err("Cannot be set before GreatWorld");
if (view.GetLastHeight() < Params().GetConsensus().FortCanningSpiceGardenHeight) {
return Res::Err("Cannot be set before FortCanningSpiceGarden");
}
if (attrV0->typeId != ParamIDs::TokenID) {
return Res::Err("Unrecognised locks id");
Expand Down
19 changes: 13 additions & 6 deletions src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ class CCustomMetadataParseVisitor : public boost::static_visitor<Res>
return Res::Ok();
}

Res isPostFortCanningSpiceGardenFork() const {
if(static_cast<int>(height) < consensus.FortCanningSpiceGardenHeight) {
return Res::Err("called before FortCanningSpiceGarden height");
}
return Res::Ok();
}

Res isPostGreatWorldFork() const {
if(static_cast<int>(height) < consensus.GreatWorldHeight) {
return Res::Err("called before GreatWorldHeight height");
Expand Down Expand Up @@ -522,24 +529,24 @@ class CCustomMetadataParseVisitor : public boost::static_visitor<Res>
auto res = isPostFortCanningFork();
if (!res)
return res;
res = isPostGreatWorldFork();
return res ? Res::Err("called after GreatWorld height") : serialize(obj);
res = isPostFortCanningSpiceGardenFork();
return res ? Res::Err("called after FortCanningSpiceGarden height") : serialize(obj);
}

Res operator()(CLoanSetLoanTokenMessage& obj) const {
auto res = isPostFortCanningFork();
if (!res)
return res;
res = isPostGreatWorldFork();
return res ? Res::Err("called after GreatWorld height") : serialize(obj);
res = isPostFortCanningSpiceGardenFork();
return res ? Res::Err("called after FortCanningSpiceGarden height") : serialize(obj);
}

Res operator()(CLoanUpdateLoanTokenMessage& obj) const {
auto res = isPostFortCanningFork();
if (!res)
return res;
res = isPostGreatWorldFork();
return res ? Res::Err("called after GreatWorld height") : serialize(obj);
res = isPostFortCanningSpiceGardenFork();
return res ? Res::Err("called after FortCanningSpiceGarden height") : serialize(obj);
}

Res operator()(CLoanSchemeMessage& obj) const {
Expand Down
2 changes: 1 addition & 1 deletion src/masternodes/tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ inline Res CTokenImplementation::IsValidSymbol() const
if (symbol.find('#') != std::string::npos) {
return Res::Err("token symbol should not contain '#'");
}
if (creationHeight >= Params().GetConsensus().GreatWorldHeight && symbol.find('/') != std::string::npos) {
if (creationHeight >= Params().GetConsensus().FortCanningSpiceGardenHeight && symbol.find('/') != std::string::npos) {
return Res::Err("token symbol should not contain '/'");
}
return Res::Ok();
Expand Down
33 changes: 2 additions & 31 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
addPackageTxs(nPackagesSelected, nDescendantsUpdated, nHeight, mnview);

// TXs for the creationTx field in new tokens created via token split
if (nHeight >= chainparams.GetConsensus().GreatWorldHeight) {
if (nHeight >= chainparams.GetConsensus().FortCanningSpiceGardenHeight) {
const auto attributes = mnview.GetAttributes();
if (attributes) {
CDataStructureV0 splitKey{AttributeTypes::Oracles, OracleIDs::Splits, static_cast<uint32_t>(nHeight)};
Expand Down Expand Up @@ -708,31 +708,6 @@ namespace pos {
return Status::stakeReady;
}

// This is an internal only method to ignore some mints, even though it's valid.
// This is done to workaround https://github.com/DeFiCh/ain/issues/693, so on specific bug condition,
// i.e, when subnode 1 stakes before subnode 0 on Eunos Paya+ (in particular to target pre-Eunos Paya masternodes that's carried over), it's ignored.
// in order to give time for subnode 0 to first succeed and create a record.
//
// This is done to ensure that we can workaround the bug, without waiting for consensus change in next update.
// This shouldn't have any effect on the mining, even though we ignore some successful hashes since the
// Coinages are retained and keep growing. Once subnode 0 mines, subnode 1 should stake again shortly with
// higher coinage / TM.
//
bool shouldIgnoreMint(uint8_t subNode, int64_t blockHeight, int64_t creationHeight,
const std::vector<int64_t>& subNodesBlockTime, const CChainParams& chainParams) {

auto eunosPayaHeight = chainParams.GetConsensus().EunosPayaHeight;
if (blockHeight < eunosPayaHeight || creationHeight >= eunosPayaHeight) {
return false;
}

if (subNode == 1 && subNodesBlockTime[0] == subNodesBlockTime[1]) {
LogPrint(BCLog::STAKING, "MakeStake: kernel ignored\n");
return true;
}
return false;
}

Staker::Status Staker::stake(const CChainParams& chainparams, const ThreadStaker::Args& args) {

bool found = false;
Expand Down Expand Up @@ -807,7 +782,7 @@ namespace pos {
// Plus one to avoid time-too-old error on exact median time.
nLastCoinStakeSearchTime = tip->GetMedianTimePast() + 1;
}

lastBlockSeen = tip->GetBlockHash();
}

Expand All @@ -828,8 +803,6 @@ namespace pos {
if (pos::CheckKernelHash(stakeModifier, nBits, creationHeight, blockTime, blockHeight, masternodeID, chainparams.GetConsensus(),
subNodesBlockTime, timelock, ctxState))
{
if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams))
break;
LogPrint(BCLog::STAKING, "MakeStake: kernel found\n");

found = true;
Expand All @@ -853,8 +826,6 @@ namespace pos {
if (pos::CheckKernelHash(stakeModifier, nBits, creationHeight, blockTime, blockHeight, masternodeID, chainparams.GetConsensus(),
subNodesBlockTime, timelock, ctxState))
{
if (shouldIgnoreMint(ctxState.subNode, blockHeight, creationHeight, subNodesBlockTime, chainparams))
break;
LogPrint(BCLog::STAKING, "MakeStake: kernel found\n");

found = true;
Expand Down
1 change: 1 addition & 0 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
BuriedForkDescPushBack(softforks, "fortcanningpark", consensusParams.FortCanningParkHeight);
BuriedForkDescPushBack(softforks, "fortcanninghill", consensusParams.FortCanningHillHeight);
BuriedForkDescPushBack(softforks, "fortcanningroad", consensusParams.FortCanningRoadHeight);
BuriedForkDescPushBack(softforks, "fortcanningspicegarden", consensusParams.FortCanningSpiceGardenHeight);
BuriedForkDescPushBack(softforks, "greatworld", consensusParams.GreatWorldHeight);
BIP9SoftForkDescPushBack(softforks, "testdummy", consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);
obj.pushKV("softforks", softforks);
Expand Down
6 changes: 3 additions & 3 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3610,7 +3610,7 @@ void CChainState::ProcessTokenToGovVar(const CBlockIndex* pindex, CCustomCSView&

// Migrate at +1 height so that GetLastHeight() in Gov var
// Validate() has a height equal to the GW fork.
if (pindex->nHeight != chainparams.GetConsensus().GreatWorldHeight + 1) {
if (pindex->nHeight != chainparams.GetConsensus().FortCanningSpiceGardenHeight + 1) {
return;
}

Expand Down Expand Up @@ -4030,7 +4030,7 @@ static Res VaultSplits(CCustomCSView& view, ATTRIBUTES& attributes, const DCT_ID
}

void CChainState::ProcessTokenSplits(const CBlock& block, const CBlockIndex* pindex, CCustomCSView& cache, const CreationTxs& creationTxs, const CChainParams& chainparams) {
if (pindex->nHeight < chainparams.GetConsensus().GreatWorldHeight) {
if (pindex->nHeight < chainparams.GetConsensus().FortCanningSpiceGardenHeight) {
return;
}
const auto attributes = cache.GetAttributes();
Expand Down Expand Up @@ -5499,7 +5499,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
if (block.vtx[i]->IsCoinBase() &&
!IsAnchorRewardTx(*block.vtx[i], dummy, height >= consensusParams.FortCanningHeight) &&
!IsAnchorRewardTxPlus(*block.vtx[i], dummy, height >= consensusParams.FortCanningHeight) &&
!IsTokenSplitTx(*block.vtx[i], dummy, height >= consensusParams.GreatWorldHeight))
!IsTokenSplitTx(*block.vtx[i], dummy, height >= consensusParams.FortCanningSpiceGardenHeight))
return state.Invalid(ValidationInvalidReason::CONSENSUS, false, REJECT_INVALID, "bad-cb-multiple", "more than one coinbase");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 70028;
static const int PROTOCOL_VERSION = 70029;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down
10 changes: 5 additions & 5 deletions test/functional/feature_loan_vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
self.extra_args = [
['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-greatworldheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'],
['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-greatworldheight=1700', '-jellyfish_regtest=1', '-simulatemainnet']
['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-fortcanningspicegardenheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'],
['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-fortcanningspicegardenheight=1700', '-jellyfish_regtest=1', '-simulatemainnet']
]
self.vaults = []
self.owner_addresses = []
Expand Down Expand Up @@ -750,19 +750,19 @@ def loan_and_collateral_token_to_govvar(self):
self.move_to_gw_fork()

# Try and call disabled RPC calls
assert_raises_rpc_error(-32600, 'called after GreatWorld height', self.nodes[0].setloantoken, {
assert_raises_rpc_error(-32600, 'called after FortCanningSpiceGarden height', self.nodes[0].setloantoken, {
'symbol': "DUSD",
'name': "DUSD stable token",
'fixedIntervalPriceId': "DUSD/USD",
'mintable': True,
'interest': 1})
assert_raises_rpc_error(-32600, 'called after GreatWorld height', self.nodes[0].updateloantoken, "DUSD", {
assert_raises_rpc_error(-32600, 'called after FortCanningSpiceGarden height', self.nodes[0].updateloantoken, "DUSD", {
'symbol': "DUSD",
'name': "DUSD stable token",
'fixedIntervalPriceId': "DUSD/USD",
'mintable': True,
'interest': 1})
assert_raises_rpc_error(-32600, 'called after GreatWorld height', self.nodes[0].setcollateraltoken, {
assert_raises_rpc_error(-32600, 'called after FortCanningSpiceGarden height', self.nodes[0].setcollateraltoken, {
'token': self.idDFI,
'factor': 1,
'fixedIntervalPriceId': "DFI/USD"})
Expand Down
Loading