Protect against decode errors
This commit is contained in:
parent
28081de807
commit
68f5144959
@ -2,6 +2,7 @@ from typing import Dict, Optional
|
|||||||
|
|
||||||
from hexbytes import HexBytes
|
from hexbytes import HexBytes
|
||||||
from eth_abi import decode_abi
|
from eth_abi import decode_abi
|
||||||
|
from eth_abi.exceptions import InsufficientDataBytes, NonEmptyPaddingBytes
|
||||||
|
|
||||||
from mev_inspect.schemas.abi import ABI, ABIFunctionDescription
|
from mev_inspect.schemas.abi import ABI, ABIFunctionDescription
|
||||||
from mev_inspect.schemas.call_data import CallData
|
from mev_inspect.schemas.call_data import CallData
|
||||||
@ -27,7 +28,10 @@ class ABIDecoder:
|
|||||||
names = [input.name for input in func.inputs]
|
names = [input.name for input in func.inputs]
|
||||||
types = [input.type for input in func.inputs]
|
types = [input.type for input in func.inputs]
|
||||||
|
|
||||||
|
try:
|
||||||
decoded = decode_abi(types, params)
|
decoded = decode_abi(types, params)
|
||||||
|
except (InsufficientDataBytes, NonEmptyPaddingBytes):
|
||||||
|
return None
|
||||||
|
|
||||||
return CallData(
|
return CallData(
|
||||||
function_name=func.name,
|
function_name=func.name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user