smartcontract_log_parser.go
The function parseTransferOutAndCall is designed to unpack and process TransferOutAndCall events from the log data. However, the function lacks adequate validation after unpacking the event data. Specifically, if the event data is successfully unpacked but results in a struct (THORChainRouterTransferOutAndCall) that contains zero or invalid Amount, the function will still consider this as a valid event. This can lead to scenarios where transaction flows, particularly outflows, are not properly accounted for, potentially leading to financial loss if the Amount is zero or incorrectly calculated but processed as a valid transfer.
Code snippet:
Expected Behavior: After unpacking event data, there should be strict validations to ensure that the Amount and other critical fields are not only present but also valid (non-zero and correctly formatted). This will prevent incorrect transaction processing and potential fund losses.
Expected Behavior code snippet:
Logic:
Actual Behavior: The function does not perform post-unpacking validation for critical financial fields such as Amount. If these fields are zero or malformed, they may still be processed, leading to incorrect ledger entries and potential financial loss.
Actual Behavior code snippet:
Logic:
