hiero-ledger / hiero-ledger/hiero-consensus-node
refactor: make sure all the rules for system accounts <1000 are in one place
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
Specifically the fact that accounts <=750 do not accept transfers into them. **Except for 0.0.359** which is the HTS system contract, and only then for its method(s) to create tokens. _That_ one account in that one circumstance does accept a transfer.
See [the comment here in `CustomMessageCallProcessor.start()`](https://github.com/hashgraph/hedera-services/blob/c082f56d5d4e696f1bf06740afce8d4546177131/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/processors/CustomMessageCallProcessor.java#L117).
The refactor I suggest is to find the place (probably in token service) where all the other rules for system accounts (<= 1000) but especially the no-transfer-rule for <=750 is and:
- expose that to smart contract service
- give it a callback argument of a method to call to further validate/invalidate the transfer
- call it from the smart contract service
Goal would be so that a _reader_ of the code looking at the rules for transfers into system contracts, over there where it is mostly done (token service?), would immediately see that there was a way in that method to handle exceptional cases, and then would be easily able to track down the caller in the smart contract service where the callback method/lambda would immediately say exactly what the exception was.
As opposed to right now where the smart contract service just goes ahead and does the transfer, or not, according to its rules, and there's only a comment to explain it. (It's a nice comment, complete and descriptive, but it isn't code and it isn't really easily found by someone looking to see what those rules for <750 are.)
Contributor guide
Research direction
Start with the comment in hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/processors/CustomMessageCallProcessor.java and trace the existing system-account transfer handling into token service. Identify where the <=750 rule and other <=1000 rules live, then verify that the caller's exceptional 0.0.359 token-creation case is explicit and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, blockchain
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100