Skip to content

✨ Added LibRLP.sol with clz#1535

Open
atarpara wants to merge 5 commits into
mainfrom
rlpclz
Open

✨ Added LibRLP.sol with clz#1535
atarpara wants to merge 5 commits into
mainfrom
rlpclz

Conversation

@atarpara
Copy link
Copy Markdown
Collaborator

Description

Describe the changes made in your pull request here.

Checklist

Ensure you completed all of the steps below before submitting your pull request:

  • Ran forge fmt?
  • Ran forge test?

Pull requests with an incomplete checklist will be thrown out.

@atarpara atarpara changed the title ✨ Added LibRLP with clz ✨ Added LibRLP.sol with clz May 30, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 30, 2026

Gas Snapshot Comparison Report

Generated at commit : d779940, Compared to commit : 166f85b

Contract Name Test Name Main Gas PR Gas Diff
LibRLPWithCLZTest testComputeAddressForLargeNonces() - 1750 -
testComputeAddressForSmallNonces() - 997 -
testComputeAddressOriginalForLargeNonces() - 3495 -
testComputeAddressOriginalForSmallNonces() - 2088 -
testRLPEncodeBytes() - 250090 -
testRLPEncodeBytes2() - 155904 -
testRLPEncodeList() - 735942 -
testRLPEncodeList2() - 810708 -
testRLPEncodeListEdgeCases() - 1807743 -
testRLPEncodeStringEdgeCases() - 20424 -
testRLPEncodeUint() - 1175570 -
testRLPPUint256() - 363834 -
test__codesize() - 18292 -

Copy link
Copy Markdown

@tekkac tekkac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave your PR a quick look. nice use of clz.

I found potential clz use in two more spots.
gas savings is minimal though (approx 6 gas per call)

Comment thread src/utils/clz/LibRLP.sol Outdated
Comment thread src/utils/clz/LibRLP.sol Outdated
@atarpara
Copy link
Copy Markdown
Collaborator Author

atarpara commented Jun 1, 2026

@tekkac thanks for review. Applied your all suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants