From b99102f9c99d959836f737e019c7de23c29f48a4 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Wed, 21 Sep 2022 11:47:30 -0500 Subject: [PATCH 01/10] Bump max_misuse_attempts by 50% to 120000. --- tests/unit/wallet/test_database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/wallet/test_database.py b/tests/unit/wallet/test_database.py index 8c0b4e9f86..13406a224d 100644 --- a/tests/unit/wallet/test_database.py +++ b/tests/unit/wallet/test_database.py @@ -470,7 +470,7 @@ async def test_reset_on_version_change(self): class TestSQLiteRace(AsyncioTestCase): - max_misuse_attempts = 80000 + max_misuse_attempts = 120000 def setup_db(self): self.db = sqlite3.connect(":memory:", isolation_level=None) From 516c2dd5d092e8b214afc6caca696f63a80769cc Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Thu, 29 Sep 2022 22:29:14 -0500 Subject: [PATCH 02/10] Bump hub to fix subscribe race + EADDRINUSE issue. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 97046d40f5..47f9fe137d 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ 'jsonschema==4.4.0', ], 'hub': [ - 'hub@git+https://github.com/lbryio/hub.git@024aceda53fe6d1ab8d519b73584437c25de6975' + 'hub@git+https://github.com/lbryio/hub.git@9b178222296aecc7699cf82141c7a48fe866f22a' ] }, classifiers=[ From 419b5b45f2a47fe870e5aa384f44d8c5164386f2 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Mon, 3 Oct 2022 09:57:42 -0400 Subject: [PATCH 03/10] Allow a few initial "transaction not found" responses from Hub. --- .../transactions/test_transaction_commands.py | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/tests/integration/transactions/test_transaction_commands.py b/tests/integration/transactions/test_transaction_commands.py index 4b478af047..ff473b4781 100644 --- a/tests/integration/transactions/test_transaction_commands.py +++ b/tests/integration/transactions/test_transaction_commands.py @@ -2,7 +2,7 @@ import unittest from lbry.testcase import CommandTestCase - +from lbry.wallet import Transaction class TransactionCommandsTestCase(CommandTestCase): @@ -29,17 +29,42 @@ async def test_transaction_show(self): # someone's tx change_address = await self.blockchain.get_raw_change_address() sendtxid = await self.blockchain.send_to_address(change_address, 10) - await asyncio.sleep(0.2) - tx = await self.daemon.jsonrpc_transaction_show(sendtxid) - self.assertEqual(tx.id, sendtxid) - self.assertEqual(tx.height, -1) + # After a few tries, Hub should have the transaction (in mempool). + for i in range(5): + tx = await self.daemon.jsonrpc_transaction_show(sendtxid) + # Retry if Hub is not aware of the transaction. + if isinstance(tx, dict): + # Fields: 'success', 'code', 'message' + self.assertFalse(tx['success'], tx) + self.assertEqual(tx['code'], 404, tx) + self.assertEqual(tx['message'], "transaction not found", tx) + await asyncio.sleep(0.1) + continue + break + # verify transaction show (in mempool) + self.assertTrue(isinstance(tx, Transaction), str(tx)) + # Fields: 'txid', 'raw', 'height', 'position', 'is_verified', and more. + self.assertEqual(tx.id, sendtxid, vars(tx)) + self.assertEqual(tx.height, -1, vars(tx)) + self.assertEqual(tx.is_verified, False, vars(tx)) + + # transaction is confirmed and leaves mempool await self.generate(1) + + # verify transaction show tx = await self.daemon.jsonrpc_transaction_show(sendtxid) - self.assertEqual(tx.height, self.ledger.headers.height) + self.assertTrue(isinstance(tx, Transaction), str(tx)) + self.assertEqual(tx.id, sendtxid, vars(tx)) + self.assertEqual(tx.height, self.ledger.headers.height, vars(tx)) + self.assertEqual(tx.is_verified, True, vars(tx)) # inexistent result = await self.daemon.jsonrpc_transaction_show('0'*64) - self.assertFalse(result['success']) + self.assertTrue(isinstance(result, dict), result) + # Fields: 'success', 'code', 'message' + self.assertFalse(result['success'], result) + self.assertEqual(result['code'], 404, result) + self.assertEqual(result['message'], "transaction not found", result) async def test_utxo_release(self): await self.send_to_address_and_wait( From b9d25c6d01d6acc174f0357006a05585474f30e8 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Fri, 11 Nov 2022 13:39:38 -0600 Subject: [PATCH 04/10] Bump hub to latest, getting fix for TX negative caching issue and others. --- lbry/wallet/orchstr8/node.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lbry/wallet/orchstr8/node.py b/lbry/wallet/orchstr8/node.py index 5842cac9db..ea041802ad 100644 --- a/lbry/wallet/orchstr8/node.py +++ b/lbry/wallet/orchstr8/node.py @@ -214,6 +214,7 @@ def __init__(self, node_number=1): self.port = 50001 + node_number # avoid conflict with default daemon self.udp_port = self.port self.elastic_notifier_port = 19080 + node_number + self.elastic_services = f'localhost:9200/localhost:{self.elastic_notifier_port}' self.session_timeout = 600 self.stopped = True self.index_name = uuid4().hex @@ -235,7 +236,7 @@ async def start(self, lbcwallet_node: 'LBCWalletNode', extraconf=None): 'host': self.hostname, 'tcp_port': self.port, 'udp_port': self.udp_port, - 'elastic_notifier_port': self.elastic_notifier_port, + 'elastic_services': self.elastic_services, 'session_timeout': self.session_timeout, 'max_query_workers': 0, 'es_index_prefix': self.index_name, diff --git a/setup.py b/setup.py index 47f9fe137d..109f9b5fc6 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ 'jsonschema==4.4.0', ], 'hub': [ - 'hub@git+https://github.com/lbryio/hub.git@9b178222296aecc7699cf82141c7a48fe866f22a' + 'hub@git+https://github.com/lbryio/hub.git@dcd4d7a7a8de3ab41d9fb859b910c3b962eaa2fe' ] }, classifiers=[ From 9e610cc54c71f6cda21f28a8b37d1556d32efa88 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Fri, 11 Nov 2022 14:15:59 -0600 Subject: [PATCH 05/10] Update test for Hub rename of method stage_put() -> stash_put(). --- tests/integration/takeovers/test_resolve_command.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/integration/takeovers/test_resolve_command.py b/tests/integration/takeovers/test_resolve_command.py index 80f7bcf01a..74442fc399 100644 --- a/tests/integration/takeovers/test_resolve_command.py +++ b/tests/integration/takeovers/test_resolve_command.py @@ -1508,27 +1508,27 @@ async def get_trending_score(claim_id): COIN = int(1E8) self.assertEqual(self.conductor.spv_node.writer.height, 207) - self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put( + self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put( (208, bytes.fromhex(claim_id1)), (0, 10 * COIN) ) await self.generate(1) self.assertEqual(self.conductor.spv_node.writer.height, 208) self.assertEqual(1.7090807854206793, await get_trending_score(claim_id1)) - self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put( + self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put( (209, bytes.fromhex(claim_id1)), (10 * COIN, 100 * COIN) ) await self.generate(1) self.assertEqual(self.conductor.spv_node.writer.height, 209) self.assertEqual(2.2437974397778886, await get_trending_score(claim_id1)) - self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put( + self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put( (309, bytes.fromhex(claim_id1)), (100 * COIN, 1000000 * COIN) ) await self.generate(100) self.assertEqual(self.conductor.spv_node.writer.height, 309) self.assertEqual(5.157053472135866, await get_trending_score(claim_id1)) - self.conductor.spv_node.writer.db.prefix_db.trending_notification.stage_put( + self.conductor.spv_node.writer.db.prefix_db.trending_notification.stash_put( (409, bytes.fromhex(claim_id1)), (1000000 * COIN, 1 * COIN) ) From 2c20ad6c434a6b095f44a4d31735d780976996ef Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Fri, 11 Nov 2022 14:35:56 -0600 Subject: [PATCH 06/10] Add another zlib.error mapped to InvalidPasswordError. --- lbry/wallet/wallet.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lbry/wallet/wallet.py b/lbry/wallet/wallet.py index 1a2588ad33..7651a26803 100644 --- a/lbry/wallet/wallet.py +++ b/lbry/wallet/wallet.py @@ -182,6 +182,8 @@ def unpack(cls, password, encrypted): raise InvalidPasswordError() if "unknown compression method" in e.args[0].lower(): raise InvalidPasswordError() + if "invalid window size" in e.args[0].lower(): + raise InvalidPasswordError() raise return json.loads(decompressed) From 8b4c046d2809cb41d429305dcae4f646cca0af6e Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Fri, 11 Nov 2022 15:16:16 -0600 Subject: [PATCH 07/10] Try pyinstaller==4.6 to fix MacOS build failure. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 39991c1c71..df2650bfd6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -160,7 +160,7 @@ jobs: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} restore-keys: ${{ runner.os }}-pip- - - run: pip install pyinstaller==4.4 + - run: pip install pyinstaller==4.6 - run: pip install -e . - if: startsWith(github.ref, 'refs/tags/v') run: python docker/set_build.py From 001819d5c2097c9ea32c2638c54ec79c26a7b1ff Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Mon, 14 Nov 2022 11:05:47 -0600 Subject: [PATCH 08/10] Bump Hub to include fix for supports with wrong names. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 109f9b5fc6..bd468c687b 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ 'jsonschema==4.4.0', ], 'hub': [ - 'hub@git+https://github.com/lbryio/hub.git@dcd4d7a7a8de3ab41d9fb859b910c3b962eaa2fe' + 'hub@git+https://github.com/lbryio/hub.git@929448d64bcbe6c5e476757ec78456beaa85e56a' ] }, classifiers=[ From f64d507d39a2c46bb060cacaeed6641b67eb119c Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Mon, 21 Nov 2022 14:57:40 -0600 Subject: [PATCH 09/10] TEMP: Pin workflows to ubuntu-20.04 to work around missing ripemd160 issue. --- .github/workflows/main.yml | 10 +++++----- .github/workflows/release.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df2650bfd6..cb00b752a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ jobs: lint: name: lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 @@ -26,7 +26,7 @@ jobs: strategy: matrix: os: - - ubuntu-latest + - ubuntu-20.04 - macos-latest - windows-latest runs-on: ${{ matrix.os }} @@ -72,7 +72,7 @@ jobs: tests-integration: name: "tests / integration" - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: test: @@ -123,7 +123,7 @@ jobs: coverage: needs: ["tests-unit", "tests-integration"] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: finalize coverage report submission env: @@ -184,7 +184,7 @@ jobs: name: "release" if: startsWith(github.ref, 'refs/tags/v') needs: ["build"] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v1 - uses: actions/download-artifact@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9ccd0900a..c7049945cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: jobs: release: name: "slack notification" - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: LoveToKnow/slackify-markdown-action@v1.0.0 id: markdown From cc5f0b66301c56866f18fd650a91cb1818bdb29c Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Thu, 1 Dec 2022 18:07:56 -0300 Subject: [PATCH 10/10] handle remote exception on routing table ping --- lbry/dht/protocol/routing_table.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lbry/dht/protocol/routing_table.py b/lbry/dht/protocol/routing_table.py index 11b64b8f7a..cb5c55960b 100644 --- a/lbry/dht/protocol/routing_table.py +++ b/lbry/dht/protocol/routing_table.py @@ -8,6 +8,7 @@ from lbry import utils from lbry.dht import constants +from lbry.dht.error import RemoteException from lbry.dht.protocol.distance import Distance if typing.TYPE_CHECKING: from lbry.dht.peer import KademliaPeer, PeerManager @@ -395,7 +396,7 @@ async def add_peer(self, peer: 'KademliaPeer', probe: typing.Callable[['Kademlia try: await probe(to_replace) return False - except asyncio.TimeoutError: + except (asyncio.TimeoutError, RemoteException): log.debug("Replacing dead contact in bucket %i: %s:%i with %s:%i ", bucket_index, to_replace.address, to_replace.udp_port, peer.address, peer.udp_port) if to_replace in self.buckets[bucket_index]: