Skip to content

Commit

Permalink
feat: put brr activation to height=1
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Aug 14, 2024
1 parent 22d427d commit 53f87d7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ class CRegTestParams : public CChainParams {
consensus.DIP0003EnforcementHeight = 500;
consensus.DIP0003EnforcementHash = uint256();
consensus.DIP0008Height = 1; // Always active unless overridden
consensus.BRRHeight = 1000; // see block_reward_reallocation_tests
consensus.BRRHeight = 1; // Always active unless overridden
consensus.DIP0020Height = 1;
consensus.DIP0024Height = 900;
consensus.DIP0024QuorumsHeight = 900;
Expand Down Expand Up @@ -1054,6 +1054,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
consensus.BIP65Height = int{height};
} else if (name == "csv") {
consensus.CSVHeight = int{height};
} else if (name == "brr") {
consensus.BRRHeight = int{height};
} else if (name == "dip0008") {
consensus.DIP0008Height = int{height};
} else if (name == "dip0020") {
Expand Down
2 changes: 1 addition & 1 deletion src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
argsman.AddArg("-devnet=<name>", "Use devnet chain with provided name", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, dip0008, dip0020). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0008, dip0020). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
Expand Down
2 changes: 1 addition & 1 deletion src/test/block_reward_reallocation_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using SimpleUTXOMap = std::map<COutPoint, std::pair<int, CAmount>>;
struct TestChainBRRBeforeActivationSetup : public TestChainSetup
{
// Force fast DIP3 activation
TestChainBRRBeforeActivationSetup() : TestChainSetup(497, {"-dip3params=30:50", "-vbparams=mn_rr:0:999999999999:0:20:16:12:5:1"}) {}
TestChainBRRBeforeActivationSetup() : TestChainSetup(497, {"-dip3params=30:50", "-testactivationheight=brr@1000", "-vbparams=mn_rr:0:999999999999:0:20:16:12:5:1"}) {}
};

static SimpleUTXOMap BuildSimpleUtxoMap(const std::vector<CTransactionRef>& txs)
Expand Down
2 changes: 1 addition & 1 deletion test/functional/rpc_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _test_getblockchaininfo(self):
'dip0008': { 'type': 'buried', 'active': True, 'height': 1},
'dip0020': { 'type': 'buried', 'active': True, 'height': 1},
'dip0024': { 'type': 'buried', 'active': False, 'height': 900},
'realloc': { 'type': 'buried', 'active': False, 'height': 1000},
'realloc': { 'type': 'buried', 'active': True, 'height': 1},
'v19': { 'type': 'buried', 'active': False, 'height': 900},
'v20': {
'type': 'bip9',
Expand Down
5 changes: 3 additions & 2 deletions test/functional/test_framework/blocktools.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,13 @@ def filter_tip_keys(chaintips):
return filtered_tips

# Identical to GetMasternodePayment in C++ code
# TODO: remove it or make **proper** tests for various height
def get_masternode_payment(nHeight, blockValue, fV20Active):
ret = int(blockValue / 5)

nMNPIBlock = 350
nMNPIPeriod = 10
nReallocActivationHeight = 2500
nReallocActivationHeight = 1

if nHeight > nMNPIBlock:
ret += int(blockValue / 20)
Expand All @@ -285,7 +286,7 @@ def get_masternode_payment(nHeight, blockValue, fV20Active):
# Block Reward Realocation is not activated yet, nothing to do
return ret

nSuperblockCycle = 10
nSuperblockCycle = 20
# Actual realocation starts in the cycle next to one activation happens in
nReallocStart = nReallocActivationHeight - nReallocActivationHeight % nSuperblockCycle + nSuperblockCycle

Expand Down

0 comments on commit 53f87d7

Please sign in to comment.