Skip to content

Commit

Permalink
Merge pull request #960 from HathorNetwork/master
Browse files Browse the repository at this point in the history
Release-candidate v0.59.0-rc.3
  • Loading branch information
jansegre authored Feb 23, 2024
2 parents cc3129a + da4a89c commit f46f0be
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 10 deletions.
7 changes: 5 additions & 2 deletions hathor/builder/cli_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions hathor/cli/run_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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
Expand Down
24 changes: 21 additions & 3 deletions hathor/conf/mainnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
),
}
)
)
24 changes: 22 additions & 2 deletions hathor/conf/mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 6 additions & 1 deletion hathor/consensus/transaction_consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 7 additions & 2 deletions tests/others/test_cli_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'])
Expand All @@ -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)
Expand Down

0 comments on commit f46f0be

Please sign in to comment.