Fixed params order

This commit is contained in:
ZigaMr 2022-05-07 23:33:41 +02:00
parent 11ebac2336
commit b21ca9f873
3 changed files with 9 additions and 9 deletions

2
cli.py
View File

@ -48,7 +48,7 @@ async def inspect_block_command(block_number: int, rpc: str, type: str):
inspect_db_session = get_inspect_session() inspect_db_session = get_inspect_session()
trace_db_session = get_trace_session() trace_db_session = get_trace_session()
inspector = MEVInspector(rpc, inspect_db_session, trace_db_session, type_e) inspector = MEVInspector(rpc, type_e)
await inspector.inspect_single_block( await inspector.inspect_single_block(
inspect_db_session=inspect_db_session, inspect_db_session=inspect_db_session,

View File

@ -1,6 +1,6 @@
import asyncio import asyncio
import logging import logging
from typing import List, Optional from typing import List, Optional, Tuple
from aiohttp import TraceRequestStartParams from aiohttp import TraceRequestStartParams
from sqlalchemy import orm from sqlalchemy import orm
@ -42,7 +42,7 @@ async def create_from_block_number(
if type == RPCType.geth: if type == RPCType.geth:
block_json = await asyncio.gather(w3.eth.get_block(block_number)) block_json = await asyncio.gather(w3.eth.get_block(block_number))
else: else:
block_json = [] block_json = dict()
block_timestamp, receipts, traces, base_fee_per_gas = await asyncio.gather( 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_timestamp(w3, block_number, trace_db_session),
@ -81,7 +81,7 @@ async def _find_or_fetch_block_receipts(
block_number: int, block_number: int,
trace_db_session: Optional[orm.Session], trace_db_session: Optional[orm.Session],
type: RPCType, type: RPCType,
block_json: list = [] block_json: dict
) -> List[Receipt]: ) -> List[Receipt]:
if trace_db_session is not None: if trace_db_session is not None:
existing_block_receipts = _find_block_receipts(trace_db_session, block_number) existing_block_receipts = _find_block_receipts(trace_db_session, block_number)
@ -90,9 +90,9 @@ async def _find_or_fetch_block_receipts(
if type == RPCType.geth: if type == RPCType.geth:
geth_tx_receipts = await geth_get_tx_receipts_async( geth_tx_receipts = await geth_get_tx_receipts_async(
w3.provider, block_json[0]["transactions"] w3.provider, block_json["transactions"]
) )
receipts = geth_receipts_translator(block_json[0], geth_tx_receipts) receipts = geth_receipts_translator(block_json, geth_tx_receipts)
return await _fetch_block_receipts(w3, block_number) return await _fetch_block_receipts(w3, block_number)
@ -102,7 +102,7 @@ async def _find_or_fetch_block_traces(
block_number: int, block_number: int,
trace_db_session: Optional[orm.Session], trace_db_session: Optional[orm.Session],
type: RPCType, type: RPCType,
block_json: list = [] block_json: dict
) -> List[Trace]: ) -> List[Trace]:
if trace_db_session is not None: if trace_db_session is not None:
existing_block_traces = _find_block_traces(trace_db_session, block_number) existing_block_traces = _find_block_traces(trace_db_session, block_number)
@ -111,7 +111,7 @@ async def _find_or_fetch_block_traces(
if type == RPCType.geth: if type == RPCType.geth:
# Translate to parity format # Translate to parity format
traces = await geth_get_tx_traces_parity_format(w3.provider, block_json[0]) traces = await geth_get_tx_traces_parity_format(w3.provider, block_json)
return traces return traces
return await _fetch_block_traces(w3, block_number) return await _fetch_block_traces(w3, block_number)

View File

@ -110,8 +110,8 @@ class MEVInspector:
return await inspect_many_blocks( return await inspect_many_blocks(
inspect_db_session, inspect_db_session,
self.w3, self.w3,
self.type,
self.trace_classifier, self.trace_classifier,
self.type,
after_block_number, after_block_number,
before_block_number, before_block_number,
trace_db_session=trace_db_session, trace_db_session=trace_db_session,