Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: efficient merkleprooflib saves 100s gas #624

Merged
merged 6 commits into from
Jun 14, 2022
Merged

feat: efficient merkleprooflib saves 100s gas #624

merged 6 commits into from
Jun 14, 2022

Conversation

shotaronowhere
Copy link
Contributor

Solidity reserves a 32-byte slots, with specific byte range: 0x00 - 0x3f (64 bytes): scratch space for hashing methods.

Using this scratch space and using in-line assembly for keccak256 hashing saves~ 100s of gas, maybe even ~1000s of gas for a proof length > 10.

@shotaronowhere
Copy link
Contributor Author

okay whoops the function should still be internal, I made it public for testing.

accidentally pushed with public scope for testing, should be internal as orginally written.
@gzeoneth
Copy link
Member

similar to OpenZeppelin/openzeppelin-contracts#3039

@cla-bot
Copy link

cla-bot bot commented Jun 3, 2022

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please sign the linked documents below to get yourself added. https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=b15c81cc-b5ea-42a6-9107-3992526f2898&env=na3&acct=6e152afc-6284-44af-a4c1-d8ef291db402&v=2

@gzeoneth
Copy link
Member

gzeoneth commented Jun 7, 2022

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Jun 7, 2022
@cla-bot
Copy link

cla-bot bot commented Jun 7, 2022

The cla-bot has been summoned, and re-checked this pull request!

@codecov
Copy link

codecov bot commented Jun 8, 2022

Codecov Report

Merging #624 (9bc6bc3) into master (1403b7a) will decrease coverage by 4.41%.
The diff coverage is 100.00%.

❗ Current head 9bc6bc3 differs from pull request most recent head dadf46b. Consider uploading reports for the commit dadf46b to get more accurate results

@@            Coverage Diff             @@
##           master     #624      +/-   ##
==========================================
- Coverage   52.04%   47.63%   -4.42%     
==========================================
  Files         225      213      -12     
  Lines       26375    22199    -4176     
  Branches      493      486       -7     
==========================================
- Hits        13727    10574    -3153     
+ Misses      11257    10254    -1003     
+ Partials     1391     1371      -20     

@gzeoneth
Copy link
Member

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Jun 13, 2022

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please sign the linked documents below to get yourself added. https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=b15c81cc-b5ea-42a6-9107-3992526f2898&env=na3&acct=6e152afc-6284-44af-a4c1-d8ef291db402&v=2

@cla-bot cla-bot bot removed the cla-signed label Jun 13, 2022
@cla-bot
Copy link

cla-bot bot commented Jun 13, 2022

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot
Copy link

cla-bot bot commented Jun 14, 2022

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please sign the linked documents below to get yourself added. https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=b15c81cc-b5ea-42a6-9107-3992526f2898&env=na3&acct=6e152afc-6284-44af-a4c1-d8ef291db402&v=2

@hkalodner
Copy link
Contributor

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Jun 14, 2022
@cla-bot
Copy link

cla-bot bot commented Jun 14, 2022

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM

@PlasmaPower PlasmaPower enabled auto-merge June 14, 2022 22:43
@PlasmaPower PlasmaPower merged commit ef1ea30 into OffchainLabs:master Jun 14, 2022
zacshowa pushed a commit to EspressoSystems/nitro-espresso-integration that referenced this pull request Nov 26, 2024
…b-simple-shotaro

feat: efficient merkleprooflib saves 100s gas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants