lbryio / lbry-sdk

The LBRY SDK for building decentralized, censorship resistant, monetized, digital content apps.
https://lbry.com
MIT License
7.19k stars 482 forks source link

test_sync_with_encryption_and_password_change : "zlib.error: Error -3 while decompressing data: incorrect header check" instead of InvalidPasswordError #3658

Closed moodyjon closed 2 years ago

moodyjon commented 2 years ago

https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true

======================================================================
[3608](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3609)
ERROR: test_sync_with_encryption_and_password_change (integration.blockchain.test_wallet_commands.WalletEncryptionAndSynchronization)
[3609](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3610)
----------------------------------------------------------------------
[3610](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3611)
Traceback (most recent call last):
[3611](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3612)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/testcase.py", line 145, in run
[3612](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3613)
    self.loop.run_until_complete(maybe_coroutine)
[3613](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3614)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
[3614](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3615)
    return future.result()
[3615](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3616)
  File "/home/runner/work/lbry-sdk/lbry-sdk/tests/integration/blockchain/test_wallet_commands.py", line 389, in test_sync_with_encryption_and_password_change
[3616](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3617)
    await daemon.jsonrpc_sync_apply('password', data=data['data'], blocking=True)
[3617](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3618)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/extras/daemon/daemon.py", line 1994, in jsonrpc_sync_apply
[3618](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3619)
    added_accounts, merged_accounts = wallet.merge(self.wallet_manager, password, data)
[3619](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3620)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/wallet/wallet.py", line 181, in merge
[3620](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3621)
    decrypted_data = self.unpack(password, data)
[3621](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3622)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/wallet/wallet.py", line 174, in unpack
[3622](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3623)
    decompressed = zlib.decompress(decrypted)
[3623](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3624)
zlib.error: Error -3 while decompressing data: incorrect header check
[3624](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3625)

[3625](https://github.com/moodyjon/lbry-sdk/runs/8281333893?check_suite_focus=true#step:11:3626)
----------------------------------------------------------------------

Evidently the decrypted data appears to pass initial checks, but because the password is wrong, it's actually bad data that zlib cannot decompress.

        # need to use new password2 in sync_apply
        with self.assertRaises(InvalidPasswordError):
            await daemon.jsonrpc_sync_apply('password', data=data['data'], blocking=True)
moodyjon commented 2 years ago

Another: https://github.com/moodyjon/lbry-sdk/actions/runs/3040633979/jobs/4896909954

moodyjon commented 2 years ago

A variant with slightly different error string:

zlib.error: Error -3 while decompressing data: unknown compression method

https://github.com/moodyjon/lbry-sdk/actions/runs/3091639309/jobs/5001957283

moodyjon commented 1 year ago

Another one just discovered:

======================================================================
[470](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:471)
ERROR: test_sync_with_encryption_and_password_change (integration.blockchain.test_wallet_commands.WalletEncryptionAndSynchronization)
[471](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:472)
----------------------------------------------------------------------
[472](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:473)
Traceback (most recent call last):
[473](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:474)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/testcase.py", line 145, in run
[474](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:475)
    self.loop.run_until_complete(maybe_coroutine)
[475](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:476)
  File "/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
[476](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:477)
    return future.result()
[477](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:478)
  File "/home/runner/work/lbry-sdk/lbry-sdk/tests/integration/blockchain/test_wallet_commands.py", line 398, in test_sync_with_encryption_and_password_change
[478](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:479)
    await daemon.jsonrpc_sync_apply(bad_guess, data=data['data'], blocking=True)
[479](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:480)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/extras/daemon/daemon.py", line 1993, in jsonrpc_sync_apply
[480](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:481)
    added_accounts, merged_accounts = wallet.merge(self.wallet_manager, password, data)
[481](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:482)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/wallet/wallet.py", line 195, in merge
[482](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:483)
    decrypted_data = self.unpack(password, data)
[483](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:484)
  File "/home/runner/work/lbry-sdk/lbry-sdk/lbry/wallet/wallet.py", line 179, in unpack
[484](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:485)
    decompressed = zlib.decompress(decrypted)
[485](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:486)
zlib.error: Error -3 while decompressing data: invalid window size
[486](https://github.com/moodyjon/lbry-sdk/actions/runs/3447738325/jobs/5754062366#step:11:487)