refactor(trie): remove unused RLP utilities - #21
Merged
SeriousCoding789 merged 2 commits intoSep 22, 2026
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Little-Peony
force-pushed
the
clean_rlp
branch
from
September 22, 2026 06:38
a47a27c to
ff0eaee
Compare
SeriousCoding789
merged commit Sep 22, 2026
899ff2c
into
SeriousCoding789:clear_rlp
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Removes the RLP utilities under
framework/src/main/java/org/tron/core/capsule/utilsthat nothing calls, and trims the one file still in use down to what is actually reachable.RLP is Ethereum's serialization format, inherited from the original ethereumJ fork. TRON serializes transactions, blocks and accounts with protobuf, so RLP has no role in them — a block's
txTrieRootis a plain SHA-256 Merkle tree (BlockCapsule.calcMerkleRoot→MerkleTree), which never touches RLP.The one thing RLP is still needed for is
accountStateRoot(not activated). That root is produced byorg.tron.core.trie.TrieImpl, a Merkle Patricia Trie whose node layout is defined in terms of RLP-encoded lists, so the encoder has to stay to keep that format intact.RLPElement,RLPItem,RLPList,DecodeResult(reachable only from the removedRLPmethods), andTxInputUtil/TxOutputUtil(UTXO-era leftovers), plus their four tests.RLP.javafrom 1216 to 284 lines.TrieImpluses four entry points; the reachability closure from those keeps six constants,EMPTY_ELEMENT_RLP, bothencodeListoverloads,decodeLazyList,verifyLengthand the nestedLList. The other 34 methods go.FastByteComparisons.org.tron.common.utils.FastByteComparisonsalready exists and is what nine other files use;TrieImplnow calls it.capsule/utilsgoes from eight files to one. 15 files changed, +52 / −1509.Why are these changes required?
Most of this code has never had a caller in TRON. Carrying a full second serialization codec, in a package named for capsule utilities, costs review attention on every audit and blurs where the trie's real dependencies begin.
Behaviour: unchanged.
Everything retained is what
accountStateRootdepends on, so two properties were verified rather than assumed:RLP.javaare byte-identical to the previous version. BothencodeListoverloads, bothdecodeLazyListoverloads,verifyLength,LListand its five methods, and all six constants were compared against the pre-change file; none was rewritten. The encoder emits the same bytes, so account-state root hashes cannot move.FastByteComparisonsare the same implementation.equalByteandisEqualare bothb1.length == b2.length && compareTo(b1, 0, b1.length, b2, 0, b2.length) == 0, delegating to the sameLexicographicalComparerHolder.BEST_COMPARER.Tests: the four deleted tests covered only deleted classes.
TrieTestgains a case forTrieImpl.equals, which is the one changed line the previous revision left uncovered.