clvm_rs icon indicating copy to clipboard operation
clvm_rs copied to clipboard

Implement keccak256 operator and softfork

Open Rigidity opened this issue 1 year ago • 1 comments

Implements CHIP-36, using the implementation originally provided by @arvidn in https://github.com/Chia-Network/clvm_rs/pull/403 for CHIP-34.

New operators

There is 1 new operator enabled under softfork 1:

operator opcode
keccak256 64

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 avatar Oct 28 '24 20:10 Rigidity

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

coveralls-official[bot] avatar Oct 31 '24 04:10 coveralls-official[bot]

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

arvidn avatar Nov 01 '24 14:11 arvidn