From 47c88586ffe52ac7fcc5a876c285d44af2a3e7b9 Mon Sep 17 00:00:00 2001 From: Paolo Tagliaferri Date: Thu, 10 Mar 2022 12:48:46 +0100 Subject: [PATCH 1/3] Updated community fund addresses with fork point 9 (sidechain version) - Extended unit tests to include checks for the new addresses - Added unit tests for REGTEST addresses - Added a Python test for REGTEST addresses --- qa/pull-tester/rpc-tests.sh | 1 + qa/rpc-tests/fundaddresses.py | 81 ++++++++++++ src/gtest/test_forkmanager.cpp | 129 +++++++++++++++++++ src/zen/forks/fork9_sidechainversionfork.cpp | 30 +++++ 4 files changed, 241 insertions(+) create mode 100755 qa/rpc-tests/fundaddresses.py diff --git a/qa/pull-tester/rpc-tests.sh b/qa/pull-tester/rpc-tests.sh index c7d720d187..7cf4f3e5cc 100755 --- a/qa/pull-tester/rpc-tests.sh +++ b/qa/pull-tester/rpc-tests.sh @@ -133,6 +133,7 @@ testScripts=( 'getblockexpanded.py' 'sc_rpc_cmds_json_output.py' 'sc_getscgenesisinfo.py' + 'fundaddresses.py' ); testScriptsExt=( 'getblocktemplate_longpoll.py' diff --git a/qa/rpc-tests/fundaddresses.py b/qa/rpc-tests/fundaddresses.py new file mode 100755 index 0000000000..19eba8b162 --- /dev/null +++ b/qa/rpc-tests/fundaddresses.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python2 +# Copyright (c) 2014 The Bitcoin Core developers +# Copyright (c) 2018 The Zencash developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +from test_framework.test_framework import SC_VERSION_FORK_HEIGHT, BitcoinTestFramework +from test_framework.util import assert_equal, initialize_chain_clean, start_nodes, mark_logs + +NUMB_OF_NODES = 1 +DEBUG_MODE = 1 + +class FundAddressesTest(BitcoinTestFramework): + + def setup_chain(self, split=False): + print("Initializing test directory " + self.options.tmpdir) + initialize_chain_clean(self.options.tmpdir, NUMB_OF_NODES) + + def setup_network(self, split=False): + self.nodes = [] + + self.nodes = start_nodes(NUMB_OF_NODES, self.options.tmpdir) + + self.is_network_split = split + self.sync_all() + + def check_block_fund_addresses(self, block_hash, expected_addresses): + block_data = self.nodes[0].getblock(block_hash, 1) + tx_data = block_data["tx"] + for tx in tx_data: + vout_data = self.nodes[0].getrawtransaction(tx, 1)["vout"] + + # We expect the coinbase transaction to have one output for each fund address + # (foundation one is always mandatory, secure node and super node ones only starting from fork 3) + # and one output for the miner reward. + assert_equal(len(vout_data), len(expected_addresses) + 1) + + for i in range(1, len(vout_data)): + vout = vout_data[i] + assert_equal(vout["scriptPubKey"]["addresses"][0], expected_addresses[i - 1]) + + def run_test(self): + + ''' + This test checks that the right addresses are used for community, securenode and supernode funds + when mining blocks. + ''' + + # network topology: (0) + + mark_logs("Node 0 generates 500 blocks", self.nodes, DEBUG_MODE) + blocks = self.nodes[0].generate(500) + self.sync_all() + + # Consider that blocks[0] is not the genesis block but the block at height 1 (second block) + # For this reason, all fork heights are must be decreased by 1 + + current_fork_height = 1 - 1 # chainsplit fork + mark_logs("Check chainsplit fork address [height = {}]".format(current_fork_height + 1), self.nodes, DEBUG_MODE) + self.check_block_fund_addresses(blocks[current_fork_height], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"]) + self.check_block_fund_addresses(blocks[current_fork_height + 1], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"]) + + current_fork_height = 101 - 1 # community fund fork + mark_logs("Check community fund fork address [height = {}]".format(current_fork_height + 1), self.nodes, DEBUG_MODE) + self.check_block_fund_addresses(blocks[current_fork_height - 1], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"]) + self.check_block_fund_addresses(blocks[current_fork_height], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"]) + self.check_block_fund_addresses(blocks[current_fork_height + 1], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"]) + + current_fork_height = 105 - 1 # null transaction fork + mark_logs("Check null transaction fork addresses [height = {}]".format(current_fork_height + 1), self.nodes, DEBUG_MODE) + self.check_block_fund_addresses(blocks[current_fork_height - 1], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"]) + self.check_block_fund_addresses(blocks[current_fork_height], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD", "zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7", "zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"]) + self.check_block_fund_addresses(blocks[current_fork_height + 1], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD", "zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7", "zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"]) + + current_fork_height = SC_VERSION_FORK_HEIGHT - 1 # sidechain version fork + mark_logs("Check sidechain version fork addresses [height = {}]".format(current_fork_height + 1), self.nodes, DEBUG_MODE) + self.check_block_fund_addresses(blocks[current_fork_height - 1], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD", "zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7", "zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"]) + self.check_block_fund_addresses(blocks[current_fork_height], ["zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh", "zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM", "zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"]) + self.check_block_fund_addresses(blocks[current_fork_height + 1], ["zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh", "zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM", "zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"]) + +if __name__ == '__main__': + FundAddressesTest().main() diff --git a/src/gtest/test_forkmanager.cpp b/src/gtest/test_forkmanager.cpp index 1897569d47..2ecf4befc9 100644 --- a/src/gtest/test_forkmanager.cpp +++ b/src/gtest/test_forkmanager.cpp @@ -115,6 +115,33 @@ TEST(ForkManager, SelectNetworkAfterChainsplit) { EXPECT_TRUE(ForkManager::getInstance().isAfterChainsplit(110001)); } +TEST(ForkManager, GetCommunityFundAddressRegtest) { + SelectParams(CBaseChainParams::REGTEST); + Fork::CommunityFundType foundation = Fork::CommunityFundType::FOUNDATION; + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(0, 840000, foundation),""); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1 - 1, 840000, foundation),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1 + 1, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101 - 1, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101 + 1, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105 - 1, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105 + 1, 840000, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 - 1, 0, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, foundation),"zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, foundation),"zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, foundation),"zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh"); +} + TEST(ForkManager, GetCommunityFundAddressTestnet) { SelectParams(CBaseChainParams::TESTNET); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(70000,840000, Fork::CommunityFundType::FOUNDATION),""); @@ -123,6 +150,14 @@ TEST(ForkManager, GetCommunityFundAddressTestnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(85500,840000, Fork::CommunityFundType::FOUNDATION),"zrRBQ5heytPMN5nY3ssPf3cG4jocXeD8fm1"); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(260499,840000, Fork::CommunityFundType::FOUNDATION),"zrRBQ5heytPMN5nY3ssPf3cG4jocXeD8fm1"); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(260500,840000, Fork::CommunityFundType::FOUNDATION),"zrFzxutppvxEdjyu4QNjogBMjtC1py9Hp1S"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::FOUNDATION),"zrFzxutppvxEdjyu4QNjogBMjtC1py9Hp1S"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::FOUNDATION),"zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::FOUNDATION),"zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::FOUNDATION),"zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb"); } TEST(ForkManager, GetCommunityFundAddressMainnet) { @@ -143,26 +178,120 @@ TEST(ForkManager, GetCommunityFundAddressMainnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(339200,840000, Fork::CommunityFundType::FOUNDATION),"zsyF68hcYYNLPj5i4PfQJ1kUY6nsFnZkc82"); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(344699,840000, Fork::CommunityFundType::FOUNDATION),"zsyF68hcYYNLPj5i4PfQJ1kUY6nsFnZkc82"); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(344700,840000, Fork::CommunityFundType::FOUNDATION),"zszpcLB6C5B8QvfDbF2dYWXsrpac5DL9WRk"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::FOUNDATION),"zszpcLB6C5B8QvfDbF2dYWXsrpac5DL9WRk"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::FOUNDATION),"zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::FOUNDATION),"zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::FOUNDATION),"zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8"); +} + +TEST(ForkManager, GetSecureNodeFundAddressRegtest) { + SelectParams(CBaseChainParams::REGTEST); + Fork::CommunityFundType securenode = Fork::CommunityFundType::SECURENODE; + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(0, 840000, securenode),""); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1 - 1, 840000, securenode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1, 840000, securenode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1 + 1, 840000, securenode),""); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101 - 1, 840000, securenode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101, 840000, securenode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101 + 1, 840000, securenode),""); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105 - 1, 840000, securenode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105, 840000, securenode),"zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105 + 1, 840000, securenode),"zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 - 1, 0, securenode),"zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, securenode),"zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, securenode),"zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, securenode),"zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM"); } TEST(ForkManager, GetSecureNodeFundAddressTestnet) { SelectParams(CBaseChainParams::TESTNET); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(260500,840000, Fork::CommunityFundType::SECURENODE),"zrS7QUB2eDbbKvyP43VJys3t7RpojW8GdxH"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SECURENODE),"zrS7QUB2eDbbKvyP43VJys3t7RpojW8GdxH"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SECURENODE),"zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SECURENODE),"zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SECURENODE),"zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg"); } TEST(ForkManager, GetSecureNodeFundAddressMainnet) { SelectParams(CBaseChainParams::MAIN); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(344700,840000, Fork::CommunityFundType::SECURENODE),"zsxWnyDbU8pk2Vp98Uvkx5Nh33RFzqnCpWN"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SECURENODE),"zsxWnyDbU8pk2Vp98Uvkx5Nh33RFzqnCpWN"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SECURENODE),"zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SECURENODE),"zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SECURENODE),"zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf"); +} + +TEST(ForkManager, GetSuperNodeFundAddressRegtest) { + SelectParams(CBaseChainParams::REGTEST); + Fork::CommunityFundType supernode = Fork::CommunityFundType::SUPERNODE; + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(0, 840000, supernode),""); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1 - 1, 840000, supernode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1, 840000, supernode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1 + 1, 840000, supernode),""); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101 - 1, 840000, supernode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101, 840000, supernode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(101 + 1, 840000, supernode),""); + + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105 - 1, 840000, supernode),""); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105, 840000, supernode),"zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(105 + 1, 840000, supernode),"zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 - 1, 0, supernode),"zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, supernode),"zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, supernode),"zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, supernode),"zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"); } TEST(ForkManager, GetSuperNodeFundAddressTestnet) { SelectParams(CBaseChainParams::TESTNET); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(260500,840000, Fork::CommunityFundType::SUPERNODE),"zrFr5HVm7woVq3oFzkMEdJdbfBchfPAPDsP"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SUPERNODE),"zrFr5HVm7woVq3oFzkMEdJdbfBchfPAPDsP"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SUPERNODE),"zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SUPERNODE),"zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SUPERNODE),"zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5"); } TEST(ForkManager, GetSuperNodeFundAddressMainnet) { SelectParams(CBaseChainParams::MAIN); EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(344700,840000, Fork::CommunityFundType::SUPERNODE),"zsnL6pKdzvZ1BPVzALUoqw2KsY966XFs5CE"); + + // Test the new addresses introduced in the hard fork 9 (sidechain version) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SUPERNODE),"zsnL6pKdzvZ1BPVzALUoqw2KsY966XFs5CE"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SUPERNODE),"zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SUPERNODE),"zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG"); + + // Test the highest possible block (for spotting potential regressions) + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SUPERNODE),"zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG"); } TEST(ForkManager, GetMinimumTimeTestnet) { diff --git a/src/zen/forks/fork9_sidechainversionfork.cpp b/src/zen/forks/fork9_sidechainversionfork.cpp index 1823d98976..f0f0b1eca5 100644 --- a/src/zen/forks/fork9_sidechainversionfork.cpp +++ b/src/zen/forks/fork9_sidechainversionfork.cpp @@ -9,6 +9,36 @@ SidechainVersionFork::SidechainVersionFork() {CBaseChainParams::Network::REGTEST,450}, {CBaseChainParams::Network::TESTNET,2000000}}); + setCommunityFundAddressMap({{CBaseChainParams::Network::MAIN,{ + "zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8" + }}, + {CBaseChainParams::Network::REGTEST,{ + "zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh" + }}, + {CBaseChainParams::Network::TESTNET,{ + "zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb" + }}}, CommunityFundType::FOUNDATION); + + setCommunityFundAddressMap({{CBaseChainParams::Network::MAIN,{ + "zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf" + }}, + {CBaseChainParams::Network::REGTEST,{ + "zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM" + }}, + {CBaseChainParams::Network::TESTNET,{ + "zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg" + }}}, CommunityFundType::SECURENODE); + + setCommunityFundAddressMap({{CBaseChainParams::Network::MAIN,{ + "zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG" + }}, + {CBaseChainParams::Network::REGTEST,{ + "zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG" + }}, + {CBaseChainParams::Network::TESTNET,{ + "zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5" + }}}, CommunityFundType::SUPERNODE); + } } \ No newline at end of file From 5092410f135b71efaddf8ddab170de662568b79a Mon Sep 17 00:00:00 2001 From: cronicc Date: Tue, 15 Mar 2022 19:15:00 +0000 Subject: [PATCH 2/3] Set fork activation heights, set new treasury addresses: * Testnet fork activation block 1028900 2022-03-29 ~15:00UTC * Mainnet fork activation block 1127000 2022-04-18 ~11:40UTC --- qa/rpc-tests/fundaddresses.py | 4 +- src/gtest/test_checkblock.cpp | 2 +- src/gtest/test_forkmanager.cpp | 72 ++++++++++---------- src/zen/forks/fork9_sidechainversionfork.cpp | 60 ++++++++++++---- 4 files changed, 86 insertions(+), 52 deletions(-) diff --git a/qa/rpc-tests/fundaddresses.py b/qa/rpc-tests/fundaddresses.py index 19eba8b162..7e1e8ea78d 100755 --- a/qa/rpc-tests/fundaddresses.py +++ b/qa/rpc-tests/fundaddresses.py @@ -74,8 +74,8 @@ def run_test(self): current_fork_height = SC_VERSION_FORK_HEIGHT - 1 # sidechain version fork mark_logs("Check sidechain version fork addresses [height = {}]".format(current_fork_height + 1), self.nodes, DEBUG_MODE) self.check_block_fund_addresses(blocks[current_fork_height - 1], ["zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD", "zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7", "zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"]) - self.check_block_fund_addresses(blocks[current_fork_height], ["zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh", "zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM", "zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"]) - self.check_block_fund_addresses(blocks[current_fork_height + 1], ["zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh", "zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM", "zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"]) + self.check_block_fund_addresses(blocks[current_fork_height], ["zrLaR63UYCHVvo5BJHoMUTuZFPmcUu866wB", "zrPaU1KWpNrg5fcLsSk17z7cc71FvnVnXxi", "zrMna8FbuTyrvFikAsmQMyAfufF3WoGksFu"]) + self.check_block_fund_addresses(blocks[current_fork_height + 1], ["zrLaR63UYCHVvo5BJHoMUTuZFPmcUu866wB", "zrPaU1KWpNrg5fcLsSk17z7cc71FvnVnXxi", "zrMna8FbuTyrvFikAsmQMyAfufF3WoGksFu"]) if __name__ == '__main__': FundAddressesTest().main() diff --git a/src/gtest/test_checkblock.cpp b/src/gtest/test_checkblock.cpp index 33925c195b..99293105d8 100644 --- a/src/gtest/test_checkblock.cpp +++ b/src/gtest/test_checkblock.cpp @@ -872,7 +872,7 @@ TEST(ContextualCheckBlock, SidechainCreationVersion) { SelectParams(CBaseChainParams::MAIN); - int sidechainVersionForkHeight = 2000000; + int sidechainVersionForkHeight = 1127000; // Create a Sidechain Creation transaction with version 0 CMutableTransaction mtx_v0 = txCreationUtils::createNewSidechainTxWith(CAmount(10)); diff --git a/src/gtest/test_forkmanager.cpp b/src/gtest/test_forkmanager.cpp index 2ecf4befc9..643316c123 100644 --- a/src/gtest/test_forkmanager.cpp +++ b/src/gtest/test_forkmanager.cpp @@ -135,11 +135,11 @@ TEST(ForkManager, GetCommunityFundAddressRegtest) { // Test the new addresses introduced in the hard fork 9 (sidechain version) EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 - 1, 0, foundation),"zrQWJd1fhtkQtrjbYPXfHFF1c61DUtiXcCD"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, foundation),"zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, foundation),"zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, foundation),"zrLaR63UYCHVvo5BJHoMUTuZFPmcUu866wB"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, foundation),"zrLaR63UYCHVvo5BJHoMUTuZFPmcUu866wB"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, foundation),"zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, foundation),"zrLaR63UYCHVvo5BJHoMUTuZFPmcUu866wB"); } TEST(ForkManager, GetCommunityFundAddressTestnet) { @@ -152,12 +152,12 @@ TEST(ForkManager, GetCommunityFundAddressTestnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(260500,840000, Fork::CommunityFundType::FOUNDATION),"zrFzxutppvxEdjyu4QNjogBMjtC1py9Hp1S"); // Test the new addresses introduced in the hard fork 9 (sidechain version) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::FOUNDATION),"zrFzxutppvxEdjyu4QNjogBMjtC1py9Hp1S"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::FOUNDATION),"zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::FOUNDATION),"zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900 - 1, 0, Fork::CommunityFundType::FOUNDATION),"zrFzxutppvxEdjyu4QNjogBMjtC1py9Hp1S"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900, 0, Fork::CommunityFundType::FOUNDATION),"zrFwQjR613EuvLSufoNvUzZrfKvjSQx5a23"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900 + 1, 0, Fork::CommunityFundType::FOUNDATION),"zrFwQjR613EuvLSufoNvUzZrfKvjSQx5a23"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::FOUNDATION),"zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::FOUNDATION),"zrFwQjR613EuvLSufoNvUzZrfKvjSQx5a23"); } TEST(ForkManager, GetCommunityFundAddressMainnet) { @@ -180,12 +180,12 @@ TEST(ForkManager, GetCommunityFundAddressMainnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(344700,840000, Fork::CommunityFundType::FOUNDATION),"zszpcLB6C5B8QvfDbF2dYWXsrpac5DL9WRk"); // Test the new addresses introduced in the hard fork 9 (sidechain version) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::FOUNDATION),"zszpcLB6C5B8QvfDbF2dYWXsrpac5DL9WRk"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::FOUNDATION),"zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::FOUNDATION),"zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000 - 1, 0, Fork::CommunityFundType::FOUNDATION),"zszpcLB6C5B8QvfDbF2dYWXsrpac5DL9WRk"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000, 0, Fork::CommunityFundType::FOUNDATION),"zshX5BAgUvNgM1VoBVKZyFVVozTDjjJvRxJ"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000 + 1, 0, Fork::CommunityFundType::FOUNDATION),"zshX5BAgUvNgM1VoBVKZyFVVozTDjjJvRxJ"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::FOUNDATION),"zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::FOUNDATION),"zshX5BAgUvNgM1VoBVKZyFVVozTDjjJvRxJ"); } TEST(ForkManager, GetSecureNodeFundAddressRegtest) { @@ -208,11 +208,11 @@ TEST(ForkManager, GetSecureNodeFundAddressRegtest) { // Test the new addresses introduced in the hard fork 9 (sidechain version) EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 - 1, 0, securenode),"zrQG6x9j33DLbCfzAqu3qKMe7z1VDL1z2L7"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, securenode),"zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, securenode),"zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, securenode),"zrPaU1KWpNrg5fcLsSk17z7cc71FvnVnXxi"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, securenode),"zrPaU1KWpNrg5fcLsSk17z7cc71FvnVnXxi"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, securenode),"zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, securenode),"zrPaU1KWpNrg5fcLsSk17z7cc71FvnVnXxi"); } TEST(ForkManager, GetSecureNodeFundAddressTestnet) { @@ -220,12 +220,12 @@ TEST(ForkManager, GetSecureNodeFundAddressTestnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(260500,840000, Fork::CommunityFundType::SECURENODE),"zrS7QUB2eDbbKvyP43VJys3t7RpojW8GdxH"); // Test the new addresses introduced in the hard fork 9 (sidechain version) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SECURENODE),"zrS7QUB2eDbbKvyP43VJys3t7RpojW8GdxH"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SECURENODE),"zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SECURENODE),"zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900 - 1, 0, Fork::CommunityFundType::SECURENODE),"zrS7QUB2eDbbKvyP43VJys3t7RpojW8GdxH"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900, 0, Fork::CommunityFundType::SECURENODE),"zrQM7AZ1qpm9TPzLc2YinGhWePt7vaHz4Rg"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900 + 1, 0, Fork::CommunityFundType::SECURENODE),"zrQM7AZ1qpm9TPzLc2YinGhWePt7vaHz4Rg"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SECURENODE),"zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SECURENODE),"zrQM7AZ1qpm9TPzLc2YinGhWePt7vaHz4Rg"); } TEST(ForkManager, GetSecureNodeFundAddressMainnet) { @@ -233,12 +233,12 @@ TEST(ForkManager, GetSecureNodeFundAddressMainnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(344700,840000, Fork::CommunityFundType::SECURENODE),"zsxWnyDbU8pk2Vp98Uvkx5Nh33RFzqnCpWN"); // Test the new addresses introduced in the hard fork 9 (sidechain version) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SECURENODE),"zsxWnyDbU8pk2Vp98Uvkx5Nh33RFzqnCpWN"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SECURENODE),"zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SECURENODE),"zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000 - 1, 0, Fork::CommunityFundType::SECURENODE),"zsxWnyDbU8pk2Vp98Uvkx5Nh33RFzqnCpWN"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000, 0, Fork::CommunityFundType::SECURENODE),"zsx68qSKMNoc1ZPQpGwNFZXVzgf27KN6a9u"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000 + 1, 0, Fork::CommunityFundType::SECURENODE),"zsx68qSKMNoc1ZPQpGwNFZXVzgf27KN6a9u"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SECURENODE),"zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SECURENODE),"zsx68qSKMNoc1ZPQpGwNFZXVzgf27KN6a9u"); } TEST(ForkManager, GetSuperNodeFundAddressRegtest) { @@ -261,11 +261,11 @@ TEST(ForkManager, GetSuperNodeFundAddressRegtest) { // Test the new addresses introduced in the hard fork 9 (sidechain version) EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 - 1, 0, supernode),"zrMasbhB1yyfQ5RBUm7NPcEjGWZdRneWCEx"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, supernode),"zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, supernode),"zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450, 0, supernode),"zrMna8FbuTyrvFikAsmQMyAfufF3WoGksFu"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(450 + 1, 0, supernode),"zrMna8FbuTyrvFikAsmQMyAfufF3WoGksFu"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, supernode),"zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, supernode),"zrMna8FbuTyrvFikAsmQMyAfufF3WoGksFu"); } TEST(ForkManager, GetSuperNodeFundAddressTestnet) { @@ -273,12 +273,12 @@ TEST(ForkManager, GetSuperNodeFundAddressTestnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(260500,840000, Fork::CommunityFundType::SUPERNODE),"zrFr5HVm7woVq3oFzkMEdJdbfBchfPAPDsP"); // Test the new addresses introduced in the hard fork 9 (sidechain version) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SUPERNODE),"zrFr5HVm7woVq3oFzkMEdJdbfBchfPAPDsP"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SUPERNODE),"zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SUPERNODE),"zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900 - 1, 0, Fork::CommunityFundType::SUPERNODE),"zrFr5HVm7woVq3oFzkMEdJdbfBchfPAPDsP"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900, 0, Fork::CommunityFundType::SUPERNODE),"zrSRNSqeBNEtXqn8NkAgJ9gwhLTJmXjKqoX"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1028900 + 1, 0, Fork::CommunityFundType::SUPERNODE),"zrSRNSqeBNEtXqn8NkAgJ9gwhLTJmXjKqoX"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SUPERNODE),"zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SUPERNODE),"zrSRNSqeBNEtXqn8NkAgJ9gwhLTJmXjKqoX"); } TEST(ForkManager, GetSuperNodeFundAddressMainnet) { @@ -286,12 +286,12 @@ TEST(ForkManager, GetSuperNodeFundAddressMainnet) { EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(344700,840000, Fork::CommunityFundType::SUPERNODE),"zsnL6pKdzvZ1BPVzALUoqw2KsY966XFs5CE"); // Test the new addresses introduced in the hard fork 9 (sidechain version) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 - 1, 0, Fork::CommunityFundType::SUPERNODE),"zsnL6pKdzvZ1BPVzALUoqw2KsY966XFs5CE"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000, 0, Fork::CommunityFundType::SUPERNODE),"zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG"); - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(2000000 + 1, 0, Fork::CommunityFundType::SUPERNODE),"zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000 - 1, 0, Fork::CommunityFundType::SUPERNODE),"zsnL6pKdzvZ1BPVzALUoqw2KsY966XFs5CE"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000, 0, Fork::CommunityFundType::SUPERNODE),"zszMgcogAqz49sLHGV22YCDFSvwzwkfog4k"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(1127000 + 1, 0, Fork::CommunityFundType::SUPERNODE),"zszMgcogAqz49sLHGV22YCDFSvwzwkfog4k"); // Test the highest possible block (for spotting potential regressions) - EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SUPERNODE),"zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG"); + EXPECT_EQ(ForkManager::getInstance().getCommunityFundAddress(INT_MAX, 0, Fork::CommunityFundType::SUPERNODE),"zszMgcogAqz49sLHGV22YCDFSvwzwkfog4k"); } TEST(ForkManager, GetMinimumTimeTestnet) { @@ -421,7 +421,7 @@ TEST(ForkManager, SidechainVersionForkMainnet) { SelectParams(CBaseChainParams::MAIN); // TODO: set proper fork height value. - int sidechainVersionForkHeight = 2000000; + int sidechainVersionForkHeight = 1127000; EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(0), 0); EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(sidechainVersionForkHeight - 1), 0); EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(sidechainVersionForkHeight), 1); @@ -432,7 +432,7 @@ TEST(ForkManager, SidechainVersionForkTestnet) { SelectParams(CBaseChainParams::TESTNET); // TODO: set proper fork height value. - int sidechainVersionForkHeight = 2000000; + int sidechainVersionForkHeight = 1028900; EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(0), 0); EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(sidechainVersionForkHeight - 1), 0); EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(sidechainVersionForkHeight), 1); @@ -454,4 +454,4 @@ TEST(ForkManager, HighestFork) { SelectParams(CBaseChainParams::MAIN); const Fork* highestFork = ForkManager::getInstance().getHighestFork(); EXPECT_EQ(typeid(*highestFork), typeid(SidechainVersionFork)); -} \ No newline at end of file +} diff --git a/src/zen/forks/fork9_sidechainversionfork.cpp b/src/zen/forks/fork9_sidechainversionfork.cpp index f0f0b1eca5..aef093ccae 100644 --- a/src/zen/forks/fork9_sidechainversionfork.cpp +++ b/src/zen/forks/fork9_sidechainversionfork.cpp @@ -4,41 +4,75 @@ namespace zen { SidechainVersionFork::SidechainVersionFork() { - // TODO: set proper fork height values. - setHeightMap({{CBaseChainParams::Network::MAIN,2000000}, + setHeightMap({{CBaseChainParams::Network::MAIN,1127000}, {CBaseChainParams::Network::REGTEST,450}, - {CBaseChainParams::Network::TESTNET,2000000}}); + {CBaseChainParams::Network::TESTNET,1028900}}); setCommunityFundAddressMap({{CBaseChainParams::Network::MAIN,{ - "zstvVYkJdEVinD9hxqyyevKcaX7dkGddTS8" + "zshX5BAgUvNgM1VoBVKZyFVVozTDjjJvRxJ" }}, {CBaseChainParams::Network::REGTEST,{ - "zrGrtLkMLiGPeRtzDmHeRiAKjVcRYmGWddh" + "zrLaR63UYCHVvo5BJHoMUTuZFPmcUu866wB" }}, {CBaseChainParams::Network::TESTNET,{ - "zrRARDJGHe6VxZRPHd5bUtkkWn8qb5nGwKb" + "zrFwQjR613EuvLSufoNvUzZrfKvjSQx5a23" }}}, CommunityFundType::FOUNDATION); setCommunityFundAddressMap({{CBaseChainParams::Network::MAIN,{ - "zszxbgE4fPZMeMyVhfhiejG9VRE4LPMVSVf" + "zsx68qSKMNoc1ZPQpGwNFZXVzgf27KN6a9u" }}, {CBaseChainParams::Network::REGTEST,{ - "zr8SmmBHw7ios52wx7UktF3NhejxmBTUAwM" + "zrPaU1KWpNrg5fcLsSk17z7cc71FvnVnXxi" }}, {CBaseChainParams::Network::TESTNET,{ - "zr8mk2LzX243vfTJGuUavbhr9Zv5hihrXQg" + "zrQM7AZ1qpm9TPzLc2YinGhWePt7vaHz4Rg" }}}, CommunityFundType::SECURENODE); setCommunityFundAddressMap({{CBaseChainParams::Network::MAIN,{ - "zsmtifdePb5b1fgwkdz1msgSEJLJQ8NyXpG" + "zszMgcogAqz49sLHGV22YCDFSvwzwkfog4k" }}, {CBaseChainParams::Network::REGTEST,{ - "zr7hHLWwfQeFeDjWAy1NsimsKm5pra5snLG" + "zrMna8FbuTyrvFikAsmQMyAfufF3WoGksFu" }}, {CBaseChainParams::Network::TESTNET,{ - "zrCqcKMTwc5ukZ19LP7aUvsNtGscHFNMrw5" + "zrSRNSqeBNEtXqn8NkAgJ9gwhLTJmXjKqoX" }}}, CommunityFundType::SUPERNODE); } -} \ No newline at end of file +} + +/* + * All TESTNET and MAINNET P2SH addresses are 4-of-7 + * + * Transaction IDs of TESTNET test spends: + * - FOUNDATION sig 1-4 https://explorer-testnet.horizen.io/tx/f2fa104ef0860d9acde910fc12dc2811605d1004bdc5782ea485ab3a631fa109 + * - FOUNDATION sig 4-7 https://explorer-testnet.horizen.io/tx/0a5ea2b738205948fe8f405879849b395e7e1ba9ba9cf0e1853205d375d1ae99 + * - SECURENODE sig 1-4 https://explorer-testnet.horizen.io/tx/dcb499d09124f7af2878b29b8561f5ddbe3ca87162ec90bb72b0602f6c0832e4 + * - SECURENODE sig 4-7 https://explorer-testnet.horizen.io/tx/aa95f1de2d2f262fdc79f3c76110936fb2725a8f4247c21477efefb07d52cfc4 + * - SUPERNODE sig 1-4 https://explorer-testnet.horizen.io/tx/a62910954d0da695595f2aea64e11bc4401aa0278f180778d7640316ebe27b83 + * - SUPERNODE sig 4-7 https://explorer-testnet.horizen.io/tx/6f869ead9863fc48b35d88839b08c807dfa806492645ca5bb9cdd355d9b9bc7b + * + * Transaction IDs of MAINNET test spends: + * - FOUNDATION sig 1-4 https://explorer.horizen.io/tx/14f816686bd5bf742e1d43223afbef5f8c3457260e17225d6e1522610038733e + * - FOUNDATION sig 4-7 https://explorer.horizen.io/tx/0472999feb5412acfa6435c24b40457c10622bf3565c442c40e40b217d1bbf6b + * - SECURENODE sig 1-4 https://explorer.horizen.io/tx/c43c6cf943d86ff9f934f450b9596b92a20152f28748867e784e8a296ca6d827 + * - SECURENODE sig 4-7 https://explorer.horizen.io/tx/1661852b4c7911207d047230b22f4c593a9565abdb732267526c1c64e12981b8 + * - SUPERNODE sig 1-4 https://explorer.horizen.io/tx/a6594c6e85d93e9bc3ff8f50523239a566e4fa05d849708c3cebeca3301dd25c + * - SUPERNODE sig 4-7 https://explorer.horizen.io/tx/b55ad707e34054e9463304d6e44d31ed03e74e137db734a90d9c6deb2be62099 + * + * These are the private keys used in REGTEST for getting the community fund P2SH addresses: + * + * === FOUNDATION === + * "privkey": "cUMHPZfWjg6Gdh39afY7WPpeRppZMyUVWV7C42aQEZFk8WVbrBL7" + * + * === SECURENODE === + * "privkey": "cSth3ZwnkFyS755DfGKzsPK1bJt84ch3zhL6LvcBrnr1r4PiYA8K" + * + * === SUPERNODE === + * "privkey": "cPdgSYx5wuXkx3FGqNk8ByUFiEXRC5EDhF5iQB4KwnkGHgXDhnZz" + * After having imported the relevant priv key: + * src/zen-cli --regtest importprivkey + * The multi sig (m=1) redeemscript can be added to the wallet via: + * src/zen-cli --regtest addmultisigaddress 1 "[\"\"] + */ From 6f1ffaeccf187e2903bfa608c54c5138fe7d834c Mon Sep 17 00:00:00 2001 From: cronicc Date: Thu, 17 Mar 2022 15:02:18 +0000 Subject: [PATCH 3/3] Address review comments --- qa/rpc-tests/fundaddresses.py | 2 +- src/gtest/test_forkmanager.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/qa/rpc-tests/fundaddresses.py b/qa/rpc-tests/fundaddresses.py index 7e1e8ea78d..2a459550f6 100755 --- a/qa/rpc-tests/fundaddresses.py +++ b/qa/rpc-tests/fundaddresses.py @@ -52,7 +52,7 @@ def run_test(self): self.sync_all() # Consider that blocks[0] is not the genesis block but the block at height 1 (second block) - # For this reason, all fork heights are must be decreased by 1 + # For this reason, all fork heights must be decreased by 1 current_fork_height = 1 - 1 # chainsplit fork mark_logs("Check chainsplit fork address [height = {}]".format(current_fork_height + 1), self.nodes, DEBUG_MODE) diff --git a/src/gtest/test_forkmanager.cpp b/src/gtest/test_forkmanager.cpp index 643316c123..d6cac96b43 100644 --- a/src/gtest/test_forkmanager.cpp +++ b/src/gtest/test_forkmanager.cpp @@ -420,7 +420,6 @@ TEST(ForkManager, SidechainForkMainnet) { TEST(ForkManager, SidechainVersionForkMainnet) { SelectParams(CBaseChainParams::MAIN); - // TODO: set proper fork height value. int sidechainVersionForkHeight = 1127000; EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(0), 0); EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(sidechainVersionForkHeight - 1), 0); @@ -431,7 +430,6 @@ TEST(ForkManager, SidechainVersionForkMainnet) { TEST(ForkManager, SidechainVersionForkTestnet) { SelectParams(CBaseChainParams::TESTNET); - // TODO: set proper fork height value. int sidechainVersionForkHeight = 1028900; EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(0), 0); EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(sidechainVersionForkHeight - 1), 0); @@ -442,7 +440,6 @@ TEST(ForkManager, SidechainVersionForkTestnet) { TEST(ForkManager, SidechainVersionForkRegtest) { SelectParams(CBaseChainParams::REGTEST); - // TODO: set proper fork height value. int sidechainVersionForkHeight = 450; EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(0), 0); EXPECT_EQ(ForkManager::getInstance().getMaxSidechainVersion(sidechainVersionForkHeight - 1), 0);