Used black and pylint to reformat

This commit is contained in:
ZigaMr 2022-05-10 01:34:50 +02:00
parent 4b660e96a7
commit 19c80bd963
4 changed files with 23 additions and 16 deletions

2
cli.py
View File

@ -21,7 +21,6 @@ from mev_inspect.queue.tasks import (
)
from mev_inspect.s3_export import export_block
from mev_inspect.utils import RPCType
#from mev_inspect.prices import fetch_all_supported_prices
RPC_URL_ENV = "RPC_URL"
@ -56,6 +55,7 @@ async def inspect_block_command(block_number: int, rpc: str, type: str):
block=block_number,
)
def convert_str_to_enum(type: str) -> RPCType:
if type == "parity":
return RPCType.parity

View File

@ -2,7 +2,6 @@ import asyncio
import logging
import os
import sys
import traceback
import dramatiq
from aiohttp_retry import ExponentialRetry, RetryClient
@ -31,6 +30,7 @@ logger = logging.getLogger(__name__)
# lag to make sure the blocks we see are settled
BLOCK_NUMBER_LAG = 5
def convert_str_to_enum(type: str) -> RPCType:
if type == "parity":
return RPCType.parity
@ -38,6 +38,7 @@ def convert_str_to_enum(type: str) -> RPCType:
return RPCType.geth
raise ValueError
@coro
async def run():
rpc = os.getenv("RPC_URL")
@ -134,4 +135,3 @@ if __name__ == "__main__":
run()
except Exception as e:
logger.error(e)

View File

@ -45,12 +45,20 @@ async def create_from_block_number(
block_timestamp, receipts, traces, base_fee_per_gas = await asyncio.gather(
_find_or_fetch_block_timestamp(w3, block_number, trace_db_session),
_find_or_fetch_block_receipts(w3, block_number, trace_db_session, type, block_json),
_find_or_fetch_block_traces(w3, block_number, trace_db_session, type, block_json),
_find_or_fetch_block_receipts(
w3, block_number, trace_db_session, type, block_json
),
_find_or_fetch_block_traces(
w3, block_number, trace_db_session, type, block_json
),
_find_or_fetch_base_fee_per_gas(w3, block_number, trace_db_session),
)
miner_address = _get_miner_address_from_traces(traces) if type == RPCType.parity else block_json.miner
miner_address = (
_get_miner_address_from_traces(traces)
if type == RPCType.parity
else block_json.miner
)
return Block(
block_number=block_number,
@ -80,7 +88,7 @@ async def _find_or_fetch_block_receipts(
block_number: int,
trace_db_session: Optional[orm.Session],
type: RPCType,
block_json: dict
block_json: dict,
) -> List[Receipt]:
if trace_db_session is not None:
existing_block_receipts = _find_block_receipts(trace_db_session, block_number)
@ -102,7 +110,7 @@ async def _find_or_fetch_block_traces(
block_number: int,
trace_db_session: Optional[orm.Session],
type: RPCType,
block_json: dict
block_json: dict,
) -> List[Trace]:
if trace_db_session is not None:
existing_block_traces = _find_block_traces(trace_db_session, block_number)
@ -290,7 +298,6 @@ def unwrap_tx_trace_for_parity(
)
)
except Exception as e:
breakpoint()
logger.warn(f"error while unwraping tx trace for parity {e}")
return []

View File

@ -110,7 +110,7 @@ async def inspect_many_blocks(
w3=w3,
block_number=block_number,
trace_db_session=trace_db_session,
type=type
type=type,
)
logger.info(f"Block: {block_number} -- Total traces: {len(block.traces)}")