diff --git a/nethermind/idealis/rpc/starknet/classes.py b/nethermind/idealis/rpc/starknet/classes.py index 093bc07..e7009ce 100644 --- a/nethermind/idealis/rpc/starknet/classes.py +++ b/nethermind/idealis/rpc/starknet/classes.py @@ -14,6 +14,7 @@ from nethermind.idealis.types.starknet.core import Transaction from nethermind.idealis.types.starknet.enums import StarknetTxType from nethermind.starknet_abi.dispatch import DecodingDispatcher, StarknetAbi +from nethermind.starknet_abi.exceptions import InvalidCalldataError from nethermind.starknet_abi.utils import starknet_keccak CONSTRUCTOR_SIGNATURE = starknet_keccak(b"constructor") @@ -117,12 +118,19 @@ def get_contract_deployments( logger.error(f"Cannot Parse transaction response into ContractDeployment: {transaction}") continue - decoded = decoding_dispatcher.decode_function( - calldata=[int.from_bytes(b) for b in transaction.calldata], - result=[], - function_selector=CONSTRUCTOR_SIGNATURE, - class_hash=transaction.class_hash, - ) + try: + decoded = decoding_dispatcher.decode_function( + calldata=[int.from_bytes(b) for b in transaction.calldata], + result=[], + function_selector=CONSTRUCTOR_SIGNATURE, + class_hash=transaction.class_hash, + ) + except InvalidCalldataError as e: + logger.error( + f"Decode Error while Parsing Contract Deployment for Transaction " + f"0x{transaction.transaction_hash.hex()}: {e}" + ) + decoded = None contract_deployments.append( ContractDeployment(