hiero-ledger / hiero-ledger/hiero-consensus-node
Optimize `CryptoTransferValidator.validateTokenTransfers()` for single crypto transfer
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
From @OlegMazurov:
> In most cases (single transfer), all those HashSets are created and populated for nothing. A fast path should be possible while the slow path (current implementation) would cover the generic case.
## Background
While doing its validations, `CryptoTransferValidator.validateTokenTransfers()` function maintains a few `HashSet`s for its calculations. The code is correct, but not optimized for the majority case–transfer of a single token.
This ticket is to optimize by removing the unneeded `HashSet`s for the majority case.
## Dependencies
Work with @OlegMazurov to verify performance benefit
Contributor guide
Research direction
Start at CryptoTransferValidator.validateTokenTransfers() and inspect how the HashSets are created and populated for single versus generic token transfers. Work with @OlegMazurov to establish the performance baseline and verify the optimized path preserves validation behavior and improves the single-transfer case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- blockchain
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100