Chia-Network / clvm_rs

Rust implementation of clvm
Apache License 2.0
67 stars 54 forks source link

CHIA-255: implement CHIP-34 #403

Closed arvidn closed 2 weeks ago

arvidn commented 2 months ago

this PR is best reviewed one commit at a time.

It implements CHIP-34.

new operators

There are 3 new operators enabled under softfork 1:

operator opcode
base64url_encode 62
base64url_decode 63
keccak256 64

cost

operator base cost per argument per byte
base64url_encode 40 130 2
base64url_decode 400 - 2
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_BASE64 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_BASE64_OPS_OUTSIDE_GUARD.

keccak-256

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

coveralls-official[bot] commented 2 months ago

Pull Request Test Coverage Report for Build 9096480917

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/base64_ops.rs 61 62 98.39%
src/chia_dialect.rs 7 8 87.5%
<!-- Total: 90 92 97.83% -->
Totals Coverage Status
Change from base Build 9096453504: 0.05%
Covered Lines: 5895
Relevant Lines: 6257

💛 - Coveralls
arvidn commented 2 weeks ago

these features were cancelled.