Skip to content

Commit

Permalink
Change FCR to GW
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed May 18, 2022
1 parent b980af0 commit 3d52a54
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 50 deletions.
10 changes: 5 additions & 5 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class CMainParams : public CChainParams {
consensus.FortCanningParkHeight = 1503143;
consensus.FortCanningHillHeight = 1604999; // Feb 7, 2022.
consensus.FortCanningRoadHeight = 1786000; // April 11, 2022.
consensus.FortCanningGreenHeight = std::numeric_limits<int>::max();
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
// consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand Down Expand Up @@ -359,7 +359,7 @@ class CTestNetParams : public CChainParams {
consensus.FortCanningParkHeight = 828800;
consensus.FortCanningHillHeight = 828900;
consensus.FortCanningRoadHeight = 893700;
consensus.FortCanningGreenHeight = std::numeric_limits<int>::max();
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
// consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand Down Expand Up @@ -549,7 +549,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.FortCanningGreenHeight = std::numeric_limits<int>::max();
consensus.GreatWorldHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks
Expand Down Expand Up @@ -731,7 +731,7 @@ class CRegTestParams : public CChainParams {
consensus.FortCanningParkHeight = 10000000;
consensus.FortCanningHillHeight = 10000000;
consensus.FortCanningRoadHeight = 10000000;
consensus.FortCanningGreenHeight = 10000000;
consensus.GreatWorldHeight = 10000000;

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.pos.nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
Expand Down Expand Up @@ -952,7 +952,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 Green", "-fortcanninggreenheight", consensus.FortCanningGreenHeight);
UpdateHeightValidation("Fort Canning Green", "-greatworldheight", consensus.GreatWorldHeight);

if (gArgs.GetBoolArg("-simulatemainnet", false)) {
consensus.pos.nTargetTimespan = 5 * 60; // 5 min == 10 blocks
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct Params {
int FortCanningParkHeight;
int FortCanningHillHeight;
int FortCanningRoadHeight;
int FortCanningGreenHeight;
int GreatWorldHeight;

/** 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 @@ -476,7 +476,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("-fortcanninggreenheight", "Fort Canning Green fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-greatworldheight", "Fort Canning Green 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);
#ifdef USE_UPNP
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 @@ -748,8 +748,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
case TokenKeys::LoanCollateralFactor:
case TokenKeys::LoanMintingEnabled:
case TokenKeys::LoanMintingInterest: {
if (view.GetLastHeight() < Params().GetConsensus().FortCanningGreenHeight) {
return Res::Err("Cannot be set before FortCanningGreen");
if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) {
return Res::Err("Cannot be set before GreatWorld");
}
if (!VerifyToken(view, attrV0->typeId)) {
return Res::Err("No such token (%d)", attrV0->typeId);
Expand All @@ -762,8 +762,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;
}
case TokenKeys::FixedIntervalPriceId:
if (view.GetLastHeight() < Params().GetConsensus().FortCanningGreenHeight) {
return Res::Err("Cannot be set before FortCanningGreen");
if (view.GetLastHeight() < Params().GetConsensus().GreatWorldHeight) {
return Res::Err("Cannot be set before GreatWorld");
}
if (!VerifyToken(view, attrV0->typeId)) {
return Res::Err("No such token (%d)", attrV0->typeId);
Expand All @@ -787,8 +787,8 @@ Res ATTRIBUTES::Validate(const CCustomCSView & view) const
break;

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

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

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

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

Res operator()(CLoanUpdateLoanTokenMessage& obj) const {
auto res = isPostFortCanningFork();
if (!res)
return res;
res = isPostFortCanningGreenFork();
return res ? Res::Err("called after FortCanningGreen height") : serialize(obj);
res = isPostGreatWorldFork();
return res ? Res::Err("called after GreatWorld 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().FortCanningGreenHeight && symbol.find('/') != std::string::npos) {
if (creationHeight >= Params().GetConsensus().GreatWorldHeight && symbol.find('/') != std::string::npos) {
return Res::Err("token symbol should not contain '/'");
}
return Res::Ok();
Expand Down
2 changes: 1 addition & 1 deletion src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
}

// TXs for the creationTx field in new tokens created via token split
if (nHeight >= chainparams.GetConsensus().FortCanningGreenHeight) {
if (nHeight >= chainparams.GetConsensus().GreatWorldHeight) {
const auto attributes = pcustomcsview->GetAttributes();
if (attributes) {
CDataStructureV0 splitKey{AttributeTypes::Oracles, OracleIDs::Splits, static_cast<uint32_t>(nHeight)};
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
BuriedForkDescPushBack(softforks, "fortcanningpark", consensusParams.FortCanningParkHeight);
BuriedForkDescPushBack(softforks, "fortcanninghill", consensusParams.FortCanningHillHeight);
BuriedForkDescPushBack(softforks, "fortcanningroad", consensusParams.FortCanningRoadHeight);
BuriedForkDescPushBack(softforks, "fortcanningpark", consensusParams.FortCanningParkHeight);
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 @@ -3534,7 +3534,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().FortCanningGreenHeight + 1) {
if (pindex->nHeight != chainparams.GetConsensus().GreatWorldHeight + 1) {
return;
}

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

void CChainState::ProcessTokenSplits(const CBlock& block, const CBlockIndex* pindex, CCustomCSView& cache, const CChainParams& chainparams) {
if (pindex->nHeight < chainparams.GetConsensus().FortCanningGreenHeight) {
if (pindex->nHeight < chainparams.GetConsensus().GreatWorldHeight) {
return;
}
const auto attributes = cache.GetAttributes();
Expand Down Expand Up @@ -5427,7 +5427,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.FortCanningGreenHeight))
!IsTokenSplitTx(*block.vtx[i], dummy, height >= consensusParams.GreatWorldHeight))
return state.Invalid(ValidationInvalidReason::CONSENSUS, false, REJECT_INVALID, "bad-cb-multiple", "more than one coinbase");
}
}
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', '-fortcanninggreenheight=1700', '-jellyfish_regtest=1', '-simulatemainnet'],
['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanninghillheight=300', '-fortcanninggreenheight=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', '-greatworldheight=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 FortCanningGreen height', self.nodes[0].setloantoken, {
assert_raises_rpc_error(-32600, 'called after GreatWorld 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 FortCanningGreen height', self.nodes[0].updateloantoken, "DUSD", {
assert_raises_rpc_error(-32600, 'called after GreatWorld 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 FortCanningGreen height', self.nodes[0].setcollateraltoken, {
assert_raises_rpc_error(-32600, 'called after GreatWorld height', self.nodes[0].setcollateraltoken, {
'token': self.idDFI,
'factor': 1,
'fixedIntervalPriceId': "DFI/USD"})
Expand Down
22 changes: 11 additions & 11 deletions test/functional/feature_setgov.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
self.extra_args = [
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-fortcanninggreenheight=1200', '-subsidytest=1'],
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-fortcanninggreenheight=1200', '-subsidytest=1']]
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-greatworldheight=1200', '-subsidytest=1'],
['-txnotokens=0', '-amkheight=50', '-bayfrontheight=50', '-eunosheight=200', '-fortcanningheight=400', '-fortcanninghillheight=1110', '-fortcanningroadheight=1150', '-greatworldheight=1200', '-subsidytest=1']]


def run_test(self):
Expand Down Expand Up @@ -591,15 +591,15 @@ def run_test(self):
assert_equal(result['v0/token/5/dfip2203'], 'true')

# Check errors
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningGreen", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/locks/token/5':'true'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningGreen", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/oracles/splits/4000': '1/50'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningGreen", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/fixed_interval_price_id':'TSLA/USD'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningGreen", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_enabled':'true'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningGreen", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_factor':'1.00000000'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningGreen", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_enabled':'true'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before FortCanningGreen", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_interest':'5.00000000'}})

# Move to FCG fork
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/locks/token/5':'true'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/oracles/splits/4000': '1/50'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/fixed_interval_price_id':'TSLA/USD'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_enabled':'true'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_collateral_factor':'1.00000000'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_enabled':'true'}})
assert_raises_rpc_error(-32600, "ATTRIBUTES: Cannot be set before GreatWorld", self.nodes[0].setgov, {"ATTRIBUTES":{'v0/token/5/loan_minting_interest':'5.00000000'}})

# Move to GW fork
self.nodes[0].generate(1200 - self.nodes[0].getblockcount())

# Check errors
Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_token_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TokenLockTest(DefiTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
self.extra_args = [['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-eunosheight=1', '-fortcanningheight=1', '-fortcanninghillheight=1', '-fortcanningroadheight=1', '-fortcanninggreenheight=200', '-subsidytest=1']]
self.extra_args = [['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-eunosheight=1', '-fortcanningheight=1', '-fortcanninghillheight=1', '-fortcanningroadheight=1', '-greatworldheight=200', '-subsidytest=1']]

def run_test(self):
self.nodes[0].generate(150)
Expand Down
Loading

0 comments on commit 3d52a54

Please sign in to comment.