diff --git a/Dockerfile b/Dockerfile index 9f1df45..d516d4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,5 @@ COPY generate_liabilities.py /app/generate_liabilities.py COPY validate_liabilities.py /app/validate_liabilities.py COPY test/test_liabilities.py /app/test_liabilities.py RUN python /app/test_liabilities.py -RUN black --check /app/*.py +RUN ruff check /app/*.py +RUN ruff format --check /app/*.py diff --git a/requirements.dev.txt b/requirements.dev.txt index 2569c7e..ca98c5d 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,4 +1,3 @@ -black==22.8.0 click==8.0.4 mypy-extensions==1.0.0 packaging==21.3 @@ -6,3 +5,4 @@ pathspec==0.9.0 platformdirs==2.4.0 tomli==1.2.3 typing_extensions==4.1.1 +ruff==0.5.7 diff --git a/test/test_reserves.py b/test/test_reserves.py index 1d05295..b73474a 100644 --- a/test/test_reserves.py +++ b/test/test_reserves.py @@ -50,7 +50,7 @@ def wait_until_alive(self): time.sleep(1) self.version = self.getnetworkinfo([])["version"] break - except Exception as e: + except Exception: logging.info("Bitcoin server not responding, sleeping for retry.") @@ -211,7 +211,7 @@ def test_reserves(self): "--result-file", proof_hash + "_result.json", ] - output = subprocess.check_output(run_args).decode("utf-8") + subprocess.check_output(run_args).decode("utf-8") # Check output file's value with open(proof_hash + "_result.json") as f: @@ -230,7 +230,7 @@ def test_reserves(self): "regtest://user:password@127.0.0.1:18443", "--reconsider", ] - output = subprocess.check_output(run_args).decode("utf-8") + subprocess.check_output(run_args).decode("utf-8") while self.bitcoin.getblockcount([]) != tip_height: time.sleep(0.1) self.assertEqual(self.bitcoin.getbestblockhash([]), tip_hash) diff --git a/validate_liabilities.py b/validate_liabilities.py index fe9c8d8..ef37f3c 100644 --- a/validate_liabilities.py +++ b/validate_liabilities.py @@ -103,7 +103,6 @@ def validate_liabilities(block_height, tree, account, nonce, account_nonce, args ) # Next validate tree up to root, printing out single proof - proof_vector = [] current_index = leaf_index proof_nodes = [] # [us, parent, ..., n-parent, root] diff --git a/validate_reserves.py b/validate_reserves.py index 7558ab2..8f2d2ea 100755 --- a/validate_reserves.py +++ b/validate_reserves.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 import argparse -import copy from collections import Counter import decimal import json @@ -51,7 +50,7 @@ def wait_until_alive(self): time.sleep(1) self.version = self.getnetworkinfo([])["version"] break - except Exception as e: + except Exception: logging.exception("Bitcoin server not responding, sleeping for retry.") @@ -139,7 +138,6 @@ def compile_proofs(proof_data): script = script[2:] found_vanitykey = 0 found_pubkeys = 0 - wrong_keys = False ordered_pubkeys = [] while len(script) > 4: if script[:2] != pubkey_sep: @@ -236,7 +234,7 @@ def validate_proofs(bitcoin, proof_data, chunk_size=60000): block_hash = bitcoin.getblockhash([proof_data["height"]]) try: bitcoin.getblock([block_hash]) - except Exception as e: + except Exception: if "pruned": raise Exception( "Looks like your node has pruned beyond the reserve snapshot; bailing."