hiero-ledger / hiero-ledger/hiero-consensus-node
Transaction failed with ArithmeticException on testnet
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
This **testnet** transaction is crashing with an ArithmeticException. Research reveals that the totalDebts in certain cases becomes zero. The fix is to not call `assessNonNetOfTransferForDebit` if the totalDebts is zero.
This crypto transfer [transaction](https://hashscan.io/testnet/transaction/1785436446.406705584) is the failure. It failed becuase it tried to transfer [the token](https://testnet.mirrornode.hedera.com/api/v1/tokens/0.0.9845850), which was created by
[this create token transaction](https://testnet.mirrornode.hedera.com/api/v1/transactions/0.0.9795422-1785435930-517640605).
This token was configured to have two custom fractional fees with two different collectors. One of them is exempt and the other isn't. In a transaction involving the first collector the total debts becomes zero because the first collector isn't charged (because they are involved in the transaction) and the second collector isn't charged because it is marked as exempt. This results in a total debt of zero which the assessNonNetOfTransferForDebit() function wasn't prepared to deal with. The solution is to not call this when the debt is zero.
[Slack thread](https://swirldslabs.slack.com/archives/C041G9J2067/p1785454462475529?thread_ts=1785436364.865199&cid=C041G9J2067)
```
error
2026-07-30 18:34:06.985 ERROR 191 DispatchProcessor - Possibly CATASTROPHIC failure - exception thrown while handling dispatchjava.lang.ArithmeticException: / by zero at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.AdjustmentUtils.safeFractionMultiply(AdjustmentUtils.java:54) at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.CustomFractionalFeeAssessor.assessNonNetOfTransferForDebit(CustomFractionalFeeAssessor.java:208) at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.CustomFractionalFeeAssessor.assessFractionalFees(CustomFractionalFeeAssessor.java:111) at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.CustomFeeAssessor.assess(CustomFeeAssessor.java:88) at com.hedera.node.app.service.token.impl.handlers.transfer.CustomFeeAssessmentStep.assessCustomFeesFrom(CustomFeeAssessmentStep.java:391) at com.hedera.node.app.service.token.impl.handlers.transfer.CustomFeeAssessmentStep.assessFees(CustomFeeAssessmentStep.java:192) at com.hedera.node.app.service.token.impl.handlers.transfer.CustomFeeAssessmentStep.assessCustomFees(CustomFeeAssessmentStep.java:131) at com.hedera.node.app.service.token.impl.handlers.transfer.TransferExecutor.executeCryptoTransfer(TransferExecutor.java:182) at com.hedera.node.app.service.token.impl.handlers.transfer.TransferExecutor.executeCryptoTransfer(TransferExecutor.java:158) at com.hedera.node.app.service.token.impl.handlers.CryptoTransferHandler.handle(CryptoTransferHandler.java:226) at com.hedera.node.app.workflows.dispatcher.TransactionDispatcher.dispatchHandle(TransactionDispatcher.java:221) at com.hedera.node.app.workflows.handle.DispatchProcessor.tryHandle(DispatchProcessor.java:167) at com.hedera.node.app.workflows.handle.DispatchProcessor.processDispatch(DispatchProcessor.java:139) at com.hedera.node.app.workflows.handle.HandleWorkflow.executeSubmittedParent(HandleWorkflow.java:879) at com.hedera.node.app.workflows.handle.HandleWorkflow.handlePlatformTransaction(HandleWorkflow.java:638) at com.hedera.node.app.workflows.handle.HandleWorkflow.handleEvents(HandleWorkflow.java:476) at com.hedera.node.app.workflows.handle.HandleWorkflow.handleRound(HandleWorkflow.java:394) at com.hedera.node.app.Hedera.onHandleConsensusRound(Hedera.java:1102) at com.swirlds.platform.eventhandling.DefaultTransactionHandler.doHandleConsensusRound(DefaultTransactionHandler.java:272) at com.swirlds.platform.eventhandling.DefaultTransactionHandler.handleConsensusRound(DefaultTransactionHandler.java:241) at com.swirlds.component.framework.component.ComponentWiring.lambda$bind$0(ComponentWiring.java:672) at com.swirlds.component.framework.wires.input.BindableInputWire.lambda$bind$0(BindableInputWire.java:96) at com.swirlds.component.framework.schedulers.internal.SequentialThreadTask.handle(SequentialThreadTask.java:19) at com.swirlds.component.framework.schedulers.internal.SequentialThreadTaskScheduler.run(SequentialThreadTaskScheduler.java:193) at java.base/java.lang.Thread.run(Thread.java:1474)
error
2026-07-30 18:34:06.977 ERROR 191 DispatchProcessor - Possibly CATASTROPHIC failure - exception thrown while handling dispatchjava.lang.ArithmeticException: / by zero at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.AdjustmentUtils.safeFractionMultiply(AdjustmentUtils.java:54) at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.CustomFractionalFeeAssessor.assessNonNetOfTransferForDebit(CustomFractionalFeeAssessor.java:208) at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.CustomFractionalFeeAssessor.assessFractionalFees(CustomFractionalFeeAssessor.java:111) at com.hedera.node.app.service.token.impl.handlers.transfer.customfees.CustomFeeAssessor.assess(CustomFeeAssessor.java:88) at com.hedera.node.app.service.token.impl.handlers.transfer.CustomFeeAssessmentStep.assessCustomFeesFrom(CustomFeeAssessmentStep.java:391) at com.hedera.node.app.service.token.impl.handlers.transfer.CustomFeeAssessmentStep.assessFees(CustomFeeAssessmentStep.java:192) at com.hedera.node.app.service.token.impl.handlers.transfer.CustomFeeAssessmentStep.assessCustomFees(CustomFeeAssessmentStep.java:131) at com.hedera.node.app.service.token.impl.handlers.transfer.TransferExecutor.executeCryptoTransfer(TransferExecutor.java:182) at com.hedera.node.app.service.token.impl.handlers.transfer.TransferExecutor.executeCryptoTransfer(TransferExecutor.java:158) at com.hedera.node.app.service.token.impl.handlers.CryptoTransferHandler.handle(CryptoTransferHandler.java:226) at com.hedera.node.app.workflows.dispatcher.TransactionDispatcher.dispatchHandle(TransactionDispatcher.java:221) at com.hedera.node.app.workflows.handle.DispatchProcessor.tryHandle(DispatchProcessor.java:167) at com.hedera.node.app.workflows.handle.DispatchProcessor.processDispatch(DispatchProcessor.java:139) at com.hedera.node.app.workflows.handle.HandleWorkflow.executeSubmittedParent(HandleWorkflow.java:879) at com.hedera.node.app.workflows.handle.HandleWorkflow.handlePlatformTransaction(HandleWorkflow.java:638) at com.hedera.node.app.workflows.handle.HandleWorkflow.handleEvents(HandleWorkflow.java:476) at com.hedera.node.app.workflows.handle.HandleWorkflow.handleRound(HandleWorkflow.java:394) at com.hedera.node.app.Hedera.onHandleConsensusRound(Hedera.java:1102) at com.swirlds.platform.eventhandling.DefaultTransactionHandler.doHandleConsensusRound(DefaultTransactionHandler.java:272) at com.swirlds.platform.eventhandling.DefaultTransactionHandler.handleConsensusRound(DefaultTransactionHandler.java:241) at com.swirlds.component.framework.component.ComponentWiring.lambda$bind$0(ComponentWiring.java:672) at com.swirlds.component.framework.wires.input.BindableInputWire.lambda$bind$0(BindableInputWire.java:96) at com.swirlds.component.framework.schedulers.internal.SequentialThreadTask.handle(SequentialThreadTask.java:19) at com.swirlds.component.framework.schedulers.internal.SequentialThreadTaskScheduler.run(SequentialThreadTaskScheduler.java:193) at java.base/java.lang.Thread.run(Thread.java:1474)
Search field names and values
```
Contributor guide
Research direction
Start in CustomFractionalFeeAssessor, especially assessFractionalFees and assessNonNetOfTransferForDebit, then review AdjustmentUtils.safeFractionMultiply using the stack trace locations. Verify that a zero totalDebts case skips the non-net-of-transfer assessment and no longer produces the ArithmeticException during the described custom-fee transfer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, blockchain
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100