diff --git a/hathor/cli/run_node.py b/hathor/cli/run_node.py index 32547ac91..7f2618624 100644 --- a/hathor/cli/run_node.py +++ b/hathor/cli/run_node.py @@ -80,6 +80,7 @@ def create_parser(cls) -> ArgumentParser: netargs = parser.add_mutually_exclusive_group() netargs.add_argument('--nano-testnet', action='store_true', help='Connect to Hathor nano-testnet') netargs.add_argument('--testnet', action='store_true', help='Connect to Hathor testnet') + netargs.add_argument('--testnet-hotel', action='store_true', help='Connect to Hathor testnet-hotel') netargs.add_argument('--localnet', action='store_true', help='Create a localnet with default configuration.') parser.add_argument('--test-mode-tx-weight', action='store_true', @@ -494,7 +495,12 @@ def check_python_version(self) -> None: ])) def __init__(self, *, argv=None): - from hathor.conf import LOCALNET_SETTINGS_FILEPATH, NANO_TESTNET_SETTINGS_FILEPATH, TESTNET_SETTINGS_FILEPATH + from hathor.conf import ( + LOCALNET_SETTINGS_FILEPATH, + NANO_TESTNET_SETTINGS_FILEPATH, + TESTNET_HOTEL_SETTINGS_FILEPATH, + TESTNET_SETTINGS_FILEPATH, + ) from hathor.conf.get_settings import get_global_settings self.log = logger.new() @@ -511,6 +517,8 @@ def __init__(self, *, argv=None): os.environ['HATHOR_CONFIG_YAML'] = self._args.config_yaml elif self._args.testnet: os.environ['HATHOR_CONFIG_YAML'] = TESTNET_SETTINGS_FILEPATH + elif self._args.testnet_hotel: + os.environ['HATHOR_CONFIG_YAML'] = TESTNET_HOTEL_SETTINGS_FILEPATH elif self._args.nano_testnet: os.environ['HATHOR_CONFIG_YAML'] = NANO_TESTNET_SETTINGS_FILEPATH elif self._args.localnet: diff --git a/hathor/cli/run_node_args.py b/hathor/cli/run_node_args.py index 35f36e47c..96470f518 100644 --- a/hathor/cli/run_node_args.py +++ b/hathor/cli/run_node_args.py @@ -30,6 +30,7 @@ class RunNodeArgs(BaseModel, extra=Extra.allow): auto_hostname: bool unsafe_mode: Optional[str] testnet: bool + testnet_hotel: bool test_mode_tx_weight: bool dns: Optional[str] peer: Optional[str] diff --git a/hathor/conf/__init__.py b/hathor/conf/__init__.py index 95287288f..07dab18ab 100644 --- a/hathor/conf/__init__.py +++ b/hathor/conf/__init__.py @@ -20,6 +20,7 @@ MAINNET_SETTINGS_FILEPATH = str(parent_dir / 'mainnet.yml') TESTNET_SETTINGS_FILEPATH = str(parent_dir / 'testnet.yml') +TESTNET_HOTEL_SETTINGS_FILEPATH = str(parent_dir / 'testnet_hotel.yml') NANO_TESTNET_SETTINGS_FILEPATH = str(parent_dir / 'nano_testnet.yml') LOCALNET_SETTINGS_FILEPATH = str(parent_dir / 'localnet.yml') UNITTESTS_SETTINGS_FILEPATH = str(parent_dir / 'unittests.yml') @@ -27,6 +28,7 @@ __all__ = [ 'MAINNET_SETTINGS_FILEPATH', 'TESTNET_SETTINGS_FILEPATH', + 'TESTNET_HOTEL_SETTINGS_FILEPATH', 'NANO_TESTNET_SETTINGS_FILEPATH', 'LOCALNET_SETTINGS_FILEPATH', 'UNITTESTS_SETTINGS_FILEPATH', diff --git a/hathor/conf/nano_testnet.py b/hathor/conf/nano_testnet.py deleted file mode 100644 index c94565b30..000000000 --- a/hathor/conf/nano_testnet.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2022 Hathor Labs -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from hathor.conf.settings import HathorSettings - -SETTINGS = HathorSettings( - P2PKH_VERSION_BYTE=b'\x49', - MULTISIG_VERSION_BYTE=b'\x87', - NETWORK_NAME='nano-testnet-bravo', - BOOTSTRAP_DNS=['bravo.nano-testnet.hathor.network'], - # Genesis stuff - GENESIS_OUTPUT_SCRIPT=bytes.fromhex('76a91478e804bf8aa68332c6c1ada274ac598178b972bf88ac'), - GENESIS_BLOCK_TIMESTAMP=1750978888, - GENESIS_BLOCK_NONCE=896384, - GENESIS_BLOCK_HASH=bytes.fromhex('000003076f294c2c93d8cc48f68b6c93087361ca78c54faa91daaffde84ba916'), - GENESIS_TX1_NONCE=16, - GENESIS_TX1_HASH=bytes.fromhex('001c9a3e8810bc3389b0fd3cfb118e9190f95bd5bf313a9575a4663d0a80af2d'), - GENESIS_TX2_NONCE=154, - GENESIS_TX2_HASH=bytes.fromhex('002fecfce5e78047f9b967a27b1b2436c3fea17e24c770d59421bacdcadda0ea'), - # tx weight parameters. With these settings, tx weight is always 8 - MIN_TX_WEIGHT_K=0, - MIN_TX_WEIGHT_COEFFICIENT=0, - MIN_TX_WEIGHT=8, - CHECKPOINTS=[], - ENABLE_NANO_CONTRACTS=True, - ENABLE_ON_CHAIN_BLUEPRINTS=True, - NC_ON_CHAIN_BLUEPRINT_ALLOWED_ADDRESSES=[ - 'WWFiNeWAFSmgtjm4ht2MydwS5GY3kMJsEK', - 'WQFDxic8xWWnMLL4aE5abY2XRKPNvGhtjY', - ], -) diff --git a/hathor/conf/testnet.yml b/hathor/conf/testnet.yml index 7a4fb0452..914f1828a 100644 --- a/hathor/conf/testnet.yml +++ b/hathor/conf/testnet.yml @@ -82,7 +82,7 @@ FEATURE_ACTIVATION: NOP_FEATURE_1: bit: 0 # N = 4_495_680 - # Expected to be reached around Tuesday, 2025-01-06. + # Expected to be reached around Monday, 2025-01-06. # Right now the best block is 4_489_259 on testnet (2025-01-03). start_height: 4_495_680 # N timeout_height: 4_576_320 # N + 4 * 20160 (4 weeks after the start) diff --git a/hathor/conf/testnet_hotel.yml b/hathor/conf/testnet_hotel.yml new file mode 100644 index 000000000..7f2c5cd91 --- /dev/null +++ b/hathor/conf/testnet_hotel.yml @@ -0,0 +1,92 @@ +P2PKH_VERSION_BYTE: x49 +MULTISIG_VERSION_BYTE: x87 +NETWORK_NAME: testnet-hotel +BOOTSTRAP_DNS: + - hotel.testnet.hathor.network + +# Genesis stuff +GENESIS_OUTPUT_SCRIPT: 76a914a584cf48b161e4a49223ed220df30037ab740e0088ac +GENESIS_BLOCK_TIMESTAMP: 1577836800 +GENESIS_BLOCK_NONCE: 826272 +GENESIS_BLOCK_HASH: 0000033139d08176d1051fb3a272c3610457f0c7f686afbe0afe3d37f966db85 +GENESIS_TX1_NONCE: 190 +GENESIS_TX1_HASH: 00e161a6b0bee1781ea9300680913fb76fd0fac4acab527cd9626cc1514abdc9 +GENESIS_TX2_NONCE: 115 +GENESIS_TX2_HASH: 00975897028ceb037307327c953f5e7ad4d3f42402d71bd3d11ecb63ac39f01a + +# tx weight parameters. With these settings tx weight is always 8 +MIN_TX_WEIGHT_K: 0 +MIN_TX_WEIGHT_COEFFICIENT: 0 +MIN_TX_WEIGHT: 8 +CHECKPOINTS: + 100_000: 0000007ece4c7830169f360ed11c51b776e1b72bf0060e6e5b325ca8be474ac5 + 200_000: 00000113ecd4b666116abf3d3f05ad509d903d6b456a1e8c35e46a9e426af11a + 300_000: 000000e42df13e4e7490cee98f303cb3b0ca33f362af180c5f7df740c98699d9 + 400_000: 000000e9a748b34fc4d662d88bb36ef2a033ba129960924208be14eccdac1a65 + 500_000: 000000b5c4572d7b85e585849540ece44b73948c5cdbc6f17a9a3a77fbd0f29a + 600_000: 000000f6743ba3d67e51d7adc21821b8263726ce3bc86010d5e1a905bf2531dc + 700_000: 0000008fda01c9e5fd6f99a5461e6dbf1039cba38cc8d0fc738a097d71caa968 + 800_000: 000000397af32fcc4eeb6985d96326c1ff4644792631872a00394688b1782af5 + 900_000: 00000097ae405036614f4335ad0e631df8fc5f7434e82c3421627e2fea4e1830 + 1_000_000: 000000145ba662cdee0d72034658f93a0a3a4568d5ba5083ff09013ca1e6556c + 1_100_000: 000000404e6ff6a23695a6ffe712ce1c4efc02e75bbc11c3129f4c2377b07743 + 1_200_000: 0000003be5fae5bb2c9ceaed589d172bcd9e74ca6c8d7d2ca06567f65cea7c9b + 1_300_000: 0000000000007d39de6e781c377bc202213b0b5b60db14c13d0b16e06d6fd5ac + 1_400_000: 000000000df9cb786c68a643a52a67c22ab54e8b8e41cbe9b761133f6c8abbfe + 1_500_000: 000000000c3591805f4748480b59ac1788f754fc004930985a487580e2b5de8f + 1_600_000: 00000000060adfdfd7d488d4d510b5779cf35a3c50df7bcff941fbb6957be4d2 + 1_700_000: 0000000007afc04aebad15b14fcd93c1b5193dc503b190433f55be8c218b6d12 + 1_800_000: 00000000126f16af2ba934a60cf8f2da32d3ed2688c56ce8ff477e483a3ffc42 + 1_900_000: 0000000005d2a2ba2231663187b460396189af0ffca7b2e93fccc85cde04cbdc + 2_000_000: 000000000009a8451ff2d5ec54951d717da2766aedb3131485466cc993879ee1 + 2_100_000: 0000000009f961804cd7f43da05f08a94a2fa09f82c7d605afc5982ab242a7e4 + 2_200_000: 0000000002e260b970846a89c23e754a763e7c5f1578b6ec4e67bdb94c667997 + 2_300_000: 0000000006e0894c8f7fd029fe446a42433875647759183ba3fbb0ff0b7ceb64 + 2_400_000: 0000000011ab28f3be17e3a098307fa73750cc8d74f1f60cfb44b524a60c94ec + 2_500_000: 00000000045d2bcc10c896bfc7d1f28788e3530a81f50ee096f386eec772634f + 2_600_000: 000000000766b9ac25e2ece5685effa834e61284e38f368c841210606bb1fdfc + 2_700_000: 0000000005d0ee31d0f47f6ff9aa570b9f25b9d44a8a59cea0e0f8a1729b9c90 + 2_800_000: 000000000a5bd4f266fa13d2c0594cabf6465758f7f5814bde626032706b81e5 + 2_900_000: 000000000b11b0a09ff0d7c2cfd9228f31c53008e700532e439d3a3d9c63fb8e + 3_000_000: 00000000013289569569cd51580183a2c870dfe5a395adaa00ae66fefe51af3d + 3_100_000: 00000000170c55e6ec207400bfc42786c1e0c32fe045a1d815f930daf2bf3020 + 3_200_000: 00000000149986cb99c202136bd388fb2a7fcba4bdfd6ac049069ac5e08a587f + 3_300_000: 000000000e16f87ac7133639cb52a99574944b8457939396e7faf1615fcfdb0f + 3_400_000: 000000000f551f6224a459904436072f5ff10fd3db17f2d7e25b1ef9b149c121 + 3_500_000: 0000000006572b8cf41130e88776adf8583e970905df2afe593ca31c91ab0c4c + 3_600_000: 000000000215fcc7018cc31bbfb943ca43c6297529fa008bf34665f3ac64d340 + 3_700_000: 000000000dbf5e8ab4f90f2187db6db429c9d0cb8169051ce8a9e79b810509d7 + 3_800_000: 00000000030411ec36c7f5386a94e147460d86592f85459e0eadd5cd0e3da7b4 + 3_900_000: 000000000bc2c7078a3c59d878196f1491aad45a0df9d312909d85482ac8d714 + 4_000_000: 000000000eba0dae3ec27cf5596ef49731744edebadb9fbae42160b6aa2e2461 + 4_100_000: 00000000052aa77fd8db71d5306257f9fe068c3401d95b17fcedcccfc9b76c82 + 4_200_000: 00000000010a8dae043c84fcb2cef6a2b42a28279b95af20ab5a098acf2a3565 + 4_300_000: 000000000019da781ef75fa5f59c5537d8ed18b64c589c3e036109cfb1d84f7d + +FEATURE_ACTIVATION: + default_threshold: 15_120 # 15120 = 75% of evaluation_interval (20160) + features: + INCREASE_MAX_MERKLE_PATH_LENGTH: + bit: 3 + # N = 3_548_160 + # Expected to be reached around Sunday, 2024-02-04. + # Right now the best block is 3_521_000 on testnet (2024-01-26). + start_height: 3_548_160 + timeout_height: 3_588_480 + minimum_activation_height: 0 + lock_in_on_timeout: false + version: 0.59.0 + signal_support_by_default: true + + # NOP feature to test Feature Activation for Transactions + NOP_FEATURE_1: + bit: 0 + # N = 4_495_680 + # Expected to be reached around Monday, 2025-01-06. + # Right now the best block is 4_489_259 on testnet (2025-01-03). + start_height: 4_495_680 # N + timeout_height: 4_576_320 # N + 4 * 20160 (4 weeks after the start) + minimum_activation_height: 0 + lock_in_on_timeout: false + version: 0.63.0 + signal_support_by_default: true diff --git a/hathor/conf/unittests.py b/hathor/conf/unittests.py deleted file mode 100644 index fe809e332..000000000 --- a/hathor/conf/unittests.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2021 Hathor Labs -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from hathor.conf.settings import HathorSettings -from hathor.feature_activation.settings import Settings as FeatureActivationSettings - -SETTINGS = HathorSettings( - P2PKH_VERSION_BYTE=b'\x28', - MULTISIG_VERSION_BYTE=b'\x64', - NETWORK_NAME='unittests', - BLOCKS_PER_HALVING=2 * 60, - MIN_BLOCK_WEIGHT=2, - MIN_TX_WEIGHT=2, - MIN_SHARE_WEIGHT=2, - MAX_TX_WEIGHT_DIFF=25.0, - BLOCK_DIFFICULTY_N_BLOCKS=20, - GENESIS_OUTPUT_SCRIPT=bytes.fromhex('76a914d07bc82d6e0d1bb116614076645e9b87c8c83b4188ac'), - GENESIS_BLOCK_NONCE=5, - GENESIS_BLOCK_HASH=bytes.fromhex('2ebb3b8edcb72a7e46cc0efacfe1b109e2e9dd868a90fe0906968dc8fbbf6488'), - GENESIS_TX1_NONCE=6, - GENESIS_TX1_HASH=bytes.fromhex('16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952'), - GENESIS_TX2_NONCE=2, - GENESIS_TX2_HASH=bytes.fromhex('33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'), - REWARD_SPEND_MIN_BLOCKS=10, - SLOW_ASSERTS=True, - MAX_TX_WEIGHT_DIFF_ACTIVATION=0.0, - FEATURE_ACTIVATION=FeatureActivationSettings( - evaluation_interval=4, - max_signal_bits=4, - default_threshold=3 - ), - ENABLE_NANO_CONTRACTS=True, - ENABLE_ON_CHAIN_BLUEPRINTS=True, - NC_ON_CHAIN_BLUEPRINT_ALLOWED_ADDRESSES=[ - 'HFwHrQHUftQ7obLj7xbQjG4ZEwvyVXeyoE', - ], -) diff --git a/tests/others/test_hathor_settings.py b/tests/others/test_hathor_settings.py index ba8a258e6..a69107b69 100644 --- a/tests/others/test_hathor_settings.py +++ b/tests/others/test_hathor_settings.py @@ -20,17 +20,10 @@ from pydantic import ValidationError from hathor.checkpoint import Checkpoint -from hathor.conf import ( - MAINNET_SETTINGS_FILEPATH, - NANO_TESTNET_SETTINGS_FILEPATH, - TESTNET_SETTINGS_FILEPATH, - UNITTESTS_SETTINGS_FILEPATH, -) +from hathor.conf import MAINNET_SETTINGS_FILEPATH, TESTNET_SETTINGS_FILEPATH from hathor.conf.mainnet import SETTINGS as MAINNET_SETTINGS -from hathor.conf.nano_testnet import SETTINGS as NANO_TESTNET_SETTINGS from hathor.conf.settings import DECIMAL_PLACES, GENESIS_TOKEN_UNITS, GENESIS_TOKENS, HathorSettings from hathor.conf.testnet import SETTINGS as TESTNET_SETTINGS -from hathor.conf.unittests import SETTINGS as UNITTESTS_SETTINGS @pytest.mark.parametrize('filepath', ['fixtures/valid_hathor_settings_fixture.yml']) @@ -247,11 +240,3 @@ def test_mainnet_settings_migration(): def test_testnet_settings_migration(): assert TESTNET_SETTINGS == HathorSettings.from_yaml(filepath=TESTNET_SETTINGS_FILEPATH) - - -def test_unittests_settings_migration(): - assert UNITTESTS_SETTINGS == HathorSettings.from_yaml(filepath=UNITTESTS_SETTINGS_FILEPATH) - - -def test_nano_testnet_settings_migration(): - assert NANO_TESTNET_SETTINGS == HathorSettings.from_yaml(filepath=NANO_TESTNET_SETTINGS_FILEPATH) diff --git a/tests/resources/p2p/test_status.py b/tests/resources/p2p/test_status.py index 44da55eab..0d21c0665 100644 --- a/tests/resources/p2p/test_status.py +++ b/tests/resources/p2p/test_status.py @@ -3,7 +3,6 @@ from twisted.internet.defer import inlineCallbacks import hathor -from hathor.conf.unittests import SETTINGS from hathor.p2p.peer_endpoint import PeerAddress from hathor.p2p.resources import StatusResource from hathor.simulator import FakeConnection @@ -44,14 +43,14 @@ def test_get(self): self.assertIn('height', dag_data['best_block_tips'][0]) self.assertIsInstance(dag_data['best_block_tips'][0]['hash'], str) self.assertIsInstance(dag_data['best_block_tips'][0]['height'], int) - self.assertEqual(dag_data['best_block_tips'][0]['hash'], SETTINGS.GENESIS_BLOCK_HASH.hex()) + self.assertEqual(dag_data['best_block_tips'][0]['hash'], self._settings.GENESIS_BLOCK_HASH.hex()) self.assertEqual(dag_data['best_block_tips'][0]['height'], 0) self.assertIsNotNone(dag_data['best_block']) self.assertIn('hash', dag_data['best_block']) self.assertIn('height', dag_data['best_block']) self.assertIsInstance(dag_data['best_block']['hash'], str) self.assertIsInstance(dag_data['best_block']['height'], int) - self.assertEqual(dag_data['best_block']['hash'], SETTINGS.GENESIS_BLOCK_HASH.hex()) + self.assertEqual(dag_data['best_block']['hash'], self._settings.GENESIS_BLOCK_HASH.hex()) self.assertEqual(dag_data['best_block']['height'], 0) @inlineCallbacks