Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion hathor/cli/run_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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()

Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions hathor/cli/run_node_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions hathor/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

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')

__all__ = [
'MAINNET_SETTINGS_FILEPATH',
'TESTNET_SETTINGS_FILEPATH',
'TESTNET_HOTEL_SETTINGS_FILEPATH',
'NANO_TESTNET_SETTINGS_FILEPATH',
'LOCALNET_SETTINGS_FILEPATH',
'UNITTESTS_SETTINGS_FILEPATH',
Expand Down
42 changes: 0 additions & 42 deletions hathor/conf/nano_testnet.py

This file was deleted.

2 changes: 1 addition & 1 deletion hathor/conf/testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
92 changes: 92 additions & 0 deletions hathor/conf/testnet_hotel.yml
Original file line number Diff line number Diff line change
@@ -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
48 changes: 0 additions & 48 deletions hathor/conf/unittests.py

This file was deleted.

17 changes: 1 addition & 16 deletions tests/others/test_hathor_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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)
5 changes: 2 additions & 3 deletions tests/resources/p2p/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down