diff --git a/hathor/builder/cli_builder.py b/hathor/builder/cli_builder.py index af820f4c5..8c1f41fff 100644 --- a/hathor/builder/cli_builder.py +++ b/hathor/builder/cli_builder.py @@ -174,7 +174,10 @@ def create_manager(self, reactor: Reactor) -> HathorManager: sync_choice: SyncChoice if self._args.sync_bridge: + self.log.warn('--sync-bridge is the default, this parameter has no effect') sync_choice = SyncChoice.BRIDGE + elif self._args.sync_v1_only: + sync_choice = SyncChoice.V1_ONLY elif self._args.sync_v2_only: sync_choice = SyncChoice.V2_ONLY elif self._args.x_sync_bridge: @@ -183,8 +186,8 @@ def create_manager(self, reactor: Reactor) -> HathorManager: elif self._args.x_sync_v2_only: self.log.warn('--x-sync-v2-only is deprecated and will be removed, use --sync-v2-only instead') sync_choice = SyncChoice.V2_ONLY - else: # default - sync_choice = SyncChoice.V1_ONLY + else: + sync_choice = SyncChoice.BRIDGE enable_sync_v1: bool enable_sync_v2: bool diff --git a/hathor/cli/run_node.py b/hathor/cli/run_node.py index 7f99cc864..89f4e37de 100644 --- a/hathor/cli/run_node.py +++ b/hathor/cli/run_node.py @@ -129,6 +129,7 @@ def create_parser(cls) -> ArgumentParser: sync_args = parser.add_mutually_exclusive_group() sync_args.add_argument('--sync-bridge', action='store_true', help='Enable running both sync protocols.') + sync_args.add_argument('--sync-v1-only', action='store_true', help='Disable support for running sync-v2.') sync_args.add_argument('--sync-v2-only', action='store_true', help='Disable support for running sync-v1.') sync_args.add_argument('--x-sync-v2-only', action='store_true', help=SUPPRESS) # old argument sync_args.add_argument('--x-sync-bridge', action='store_true', help=SUPPRESS) # old argument diff --git a/hathor/cli/run_node_args.py b/hathor/cli/run_node_args.py index fadc3521c..4df46f009 100644 --- a/hathor/cli/run_node_args.py +++ b/hathor/cli/run_node_args.py @@ -66,6 +66,7 @@ class RunNodeArgs(BaseModel, extra=Extra.allow): x_sync_bridge: bool x_sync_v2_only: bool sync_bridge: bool + sync_v1_only: bool sync_v2_only: bool x_localhost_only: bool x_rocksdb_indexes: bool diff --git a/hathor/conf/mainnet.py b/hathor/conf/mainnet.py index 6dd4acdc6..e88ac4cf3 100644 --- a/hathor/conf/mainnet.py +++ b/hathor/conf/mainnet.py @@ -203,7 +203,7 @@ features={ Feature.NOP_FEATURE_1: Criteria( bit=0, - start_height=4_213_440, # N (right now the best block is 4_169_000 on mainnet) + start_height=4_213_440, # N timeout_height=4_253_760, # N + 2 * 20160 (2 weeks after the start) minimum_activation_height=4_273_920, # N + 3 * 20160 (3 weeks after the start) lock_in_on_timeout=False, @@ -212,13 +212,31 @@ ), Feature.NOP_FEATURE_2: Criteria( bit=1, - start_height=4_213_440, # N (right now the best block is 4_169_000 on mainnet) + start_height=4_213_440, # N timeout_height=4_253_760, # N + 2 * 20160 (2 weeks after the start) minimum_activation_height=0, lock_in_on_timeout=False, version='0.59.0', signal_support_by_default=False, - ) + ), + Feature.NOP_FEATURE_3: Criteria( + bit=2, + start_height=4_273_920, # N (on 2024/02/22, the best block is 4_251_000 on mainnet) + timeout_height=4_475_520, # N + 10 * 20160 (10 weeks after the start) + minimum_activation_height=4_495_680, # N + 11 * 20160 (11 weeks after the start) + lock_in_on_timeout=False, + version='0.59.0', + signal_support_by_default=True, + ), + Feature.NOP_FEATURE_4: Criteria( + bit=3, + start_height=4_273_920, # N (on 2024/02/22, the best block is 4_251_000 on mainnet) + timeout_height=4_475_520, # N + 10 * 20160 (10 weeks after the start) + minimum_activation_height=0, + lock_in_on_timeout=False, + version='0.59.0', + signal_support_by_default=False, + ), } ) ) diff --git a/hathor/conf/mainnet.yml b/hathor/conf/mainnet.yml index 650915685..9c51cde42 100644 --- a/hathor/conf/mainnet.yml +++ b/hathor/conf/mainnet.yml @@ -186,7 +186,7 @@ FEATURE_ACTIVATION: NOP_FEATURE_1: bit: 0 - start_height: 4_213_440 # N (right now the best block is 4_169_000 on mainnet) + start_height: 4_213_440 # N timeout_height: 4_253_760 # N + 2 * 20160 (2 weeks after the start) minimum_activation_height: 4_273_920 # N + 3 * 20160 (3 weeks after the start) lock_in_on_timeout: false @@ -195,9 +195,29 @@ FEATURE_ACTIVATION: NOP_FEATURE_2: bit: 1 - start_height: 4_213_440 # N (right now the best block is 4_169_000 on mainnet) + start_height: 4_213_440 # N timeout_height: 4_253_760 # N + 2 * 20160 (2 weeks after the start) minimum_activation_height: 0 lock_in_on_timeout: false version: 0.59.0 signal_support_by_default: false + + #### Second Phased Testing features on mainnet #### + + NOP_FEATURE_3: + bit: 2 + start_height: 4_273_920 # N (on 2024/02/22, the best block is 4_251_000 on mainnet) + timeout_height: 4_475_520 # N + 10 * 20160 (10 weeks after the start) + minimum_activation_height: 4_495_680 # N + 11 * 20160 (11 weeks after the start) + lock_in_on_timeout: false + version: 0.59.0 + signal_support_by_default: true + + NOP_FEATURE_4: + bit: 3 + start_height: 4_273_920 # N (on 2024/02/22, the best block is 4_251_000 on mainnet) + timeout_height: 4_475_520 # N + 10 * 20160 (10 weeks after the start) + minimum_activation_height: 0 + lock_in_on_timeout: false + version: 0.59.0 + signal_support_by_default: false diff --git a/hathor/consensus/transaction_consensus.py b/hathor/consensus/transaction_consensus.py index 1cb250679..17a32202d 100644 --- a/hathor/consensus/transaction_consensus.py +++ b/hathor/consensus/transaction_consensus.py @@ -235,7 +235,12 @@ def update_voided_info(self, tx: Transaction) -> None: conflict_tx = cast(Transaction, tx.storage.get_transaction(h)) conflict_tx_meta = conflict_tx.get_metadata() if conflict_tx_meta.voided_by: - self.mark_as_voided(conflict_tx) + if conflict_tx_meta.first_block is not None: + # do nothing + assert bool(self.context.consensus.soft_voided_tx_ids & conflict_tx_meta.voided_by) + self.log.info('skipping soft voided conflict', conflict_tx=conflict_tx.hash_hex) + else: + self.mark_as_voided(conflict_tx) # Finally, check our conflicts. meta = tx.get_metadata() diff --git a/tests/others/test_cli_builder.py b/tests/others/test_cli_builder.py index 1b3f6a53d..64e95e208 100644 --- a/tests/others/test_cli_builder.py +++ b/tests/others/test_cli_builder.py @@ -58,7 +58,7 @@ def test_all_default(self): self.assertIsNone(manager.wallet) self.assertEqual('unittests', manager.network) self.assertTrue(manager.connections.is_sync_version_enabled(SyncVersion.V1_1)) - self.assertFalse(manager.connections.is_sync_version_enabled(SyncVersion.V2)) + self.assertTrue(manager.connections.is_sync_version_enabled(SyncVersion.V2)) self.assertFalse(self.resources_builder._built_prometheus) self.assertFalse(self.resources_builder._built_status) self.assertFalse(manager._enable_event_queue) @@ -104,7 +104,7 @@ def test_memory_storage_with_rocksdb_indexes(self): def test_sync_default(self): manager = self._build(['--memory-storage']) self.assertTrue(manager.connections.is_sync_version_enabled(SyncVersion.V1_1)) - self.assertFalse(manager.connections.is_sync_version_enabled(SyncVersion.V2)) + self.assertTrue(manager.connections.is_sync_version_enabled(SyncVersion.V2)) def test_sync_bridge(self): manager = self._build(['--memory-storage', '--x-sync-bridge']) @@ -126,6 +126,11 @@ def test_sync_v2_only2(self): self.assertFalse(manager.connections.is_sync_version_enabled(SyncVersion.V1_1)) self.assertTrue(manager.connections.is_sync_version_enabled(SyncVersion.V2)) + def test_sync_v1_only(self): + manager = self._build(['--memory-storage', '--sync-v1-only']) + self.assertTrue(manager.connections.is_sync_version_enabled(SyncVersion.V1_1)) + self.assertFalse(manager.connections.is_sync_version_enabled(SyncVersion.V2)) + def test_keypair_wallet(self): manager = self._build(['--memory-storage', '--wallet', 'keypair']) self.assertIsInstance(manager.wallet, Wallet)