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

Implement keccak256 operator and softfork #489

Merged
merged 6 commits into from
Nov 7, 2024
Merged

Conversation

Rigidity
Copy link
Contributor

@Rigidity Rigidity commented Oct 28, 2024

Implements CHIP-36, using the implementation originally provided by @arvidn in #403 for CHIP-34.

New operators

There is 1 new operator enabled under softfork 1:

operator opcode
keccak256 62

Cost

operator base cost per argument per byte
keccak256 50 160 2

As always, there's also a cost of 10 per byte that's allocated for the return value.

Activation

Since this is a softfork, the extension will only be available when the ENABLE_KECCAK flag is set, which it will be after the softfork activates.

The operators will only be available for programs (<prg>) executing under (softfork <cost> 1 <prg> <arg>)

Hard fork

There's an option to hard-fork these operators out of the softfork-guard by specifying ENABLE_KECCAK_OPS_OUTSIDE_GUARD.

Tests

The test vectors are generated using the python wheel from eth_hash.auto import keccak.

@Rigidity Rigidity marked this pull request as draft October 28, 2024 20:09
@Rigidity Rigidity requested a review from arvidn October 31, 2024 04:09
@Rigidity Rigidity marked this pull request as ready for review October 31, 2024 04:09
@Rigidity Rigidity changed the title Keccak256 update Implement keccak256 operator and softfork Oct 31, 2024
Copy link

coveralls-official bot commented Oct 31, 2024

Pull Request Test Coverage Report for Build 11730142584

Details

  • 29 of 29 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 93.406%

Totals Coverage Status
Change from base Build 11574796277: 0.06%
Covered Lines: 5595
Relevant Lines: 5990

💛 - Coveralls

src/run_program.rs Show resolved Hide resolved
src/run_program.rs Show resolved Hide resolved
arvidn
arvidn previously approved these changes Nov 1, 2024
@arvidn
Copy link
Contributor

arvidn commented Nov 1, 2024

did you generate the fuzzing corpus and run the fuzzer for a while?

arvidn
arvidn previously approved these changes Nov 7, 2024
@Rigidity Rigidity merged commit 1f0a145 into main Nov 7, 2024
29 checks passed
@Rigidity Rigidity deleted the keccak256-update branch November 7, 2024 20:02
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