From e79a4bb04b22d5dfc0862eab8e852bad3c3dcfb2 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Thu, 22 Jul 2021 14:33:11 -0400 Subject: [PATCH 1/4] Add github actions for precommit and tests --- .github/workflows | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows diff --git a/.github/workflows b/.github/workflows new file mode 100644 index 0000000..00523be --- /dev/null +++ b/.github/workflows @@ -0,0 +1,25 @@ +name: Python package + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements_dev.txt + - name: Run precommit + run: | + pre-commit run --all-files + - name: Test with unittest + run: | + python -m unittest tests/*.py From 744df80311485899eb817bc8a0c86c8bdba5f681 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Thu, 22 Jul 2021 14:35:23 -0400 Subject: [PATCH 2/4] Add github actions for precommit and tests --- .github/{workflows => workflows/github-actions.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflows => workflows/github-actions.yml} (100%) diff --git a/.github/workflows b/.github/workflows/github-actions.yml similarity index 100% rename from .github/workflows rename to .github/workflows/github-actions.yml From 3feaf4392903b58b25e26d8446c23f05bc367000 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Thu, 22 Jul 2021 14:39:28 -0400 Subject: [PATCH 3/4] Fix whitespace --- .github/workflows/github-actions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 00523be..6f18025 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -15,11 +15,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements_dev.txt + pip install -r requirements.txt + pip install -r requirements_dev.txt - name: Run precommit run: | pre-commit run --all-files - name: Test with unittest run: | - python -m unittest tests/*.py + python -m unittest tests/*.py From d182b8d8d2cf608b88cd57a73c10822812ec1108 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Thu, 22 Jul 2021 15:08:36 -0400 Subject: [PATCH 4/4] Update mypy version - fix mypy failure --- .pre-commit-config.yaml | 2 +- mev_inspect/block.py | 4 ++-- requirements_dev.txt | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bea15aa..9690c10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: language: system types: [python] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.770 + rev: v0.910 hooks: - id: 'mypy' additional_dependencies: diff --git a/mev_inspect/block.py b/mev_inspect/block.py index 77ae962..821f031 100644 --- a/mev_inspect/block.py +++ b/mev_inspect/block.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import List +from typing import Any, Dict, List from web3 import Web3 @@ -50,7 +50,7 @@ def fetch_block(w3, base_provider, block_number: int) -> Block: block_logs = w3.eth.get_logs({"blockHash": block_hash}) ## Get gas used by individual txs and store them too - txs_gas_data = {} + txs_gas_data: Dict[str, Dict[str, Any]] = {} for transaction in block_data["transactions"]: tx_hash = (transaction.hash).hex() diff --git a/requirements_dev.txt b/requirements_dev.txt index e3f61f9..86600ba 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,2 +1,3 @@ pre-commit==2.13.0 pylint==2.9.3 +mypy==0.910