Skip to content

Commit

Permalink
add skip error to contract deployment decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
elicbarbieri committed Oct 17, 2024
1 parent f6cd89b commit dfce1ba
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions nethermind/idealis/rpc/starknet/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit dfce1ba

Please sign in to comment.