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

CHIA-255: implement CHIP-34 #403

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

CHIA-255: implement CHIP-34 #403

wants to merge 6 commits into from

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented May 10, 2024

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.

Copy link

coveralls-official bot commented May 10, 2024

Pull Request Test Coverage Report for Build 9096480917

Details

  • 90 of 92 (97.83%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 94.214%

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

💛 - Coveralls

src/base64_ops.rs Show resolved Hide resolved
src/base64_ops.rs Show resolved Hide resolved
src/base64_ops.rs Show resolved Hide resolved
fuzz/fuzz_targets/base64.rs Outdated Show resolved Hide resolved
fuzz/fuzz_targets/operators.rs Show resolved Hide resolved
@arvidn arvidn force-pushed the chip-34 branch 3 times, most recently from 4a7deff to e76160c Compare May 13, 2024 15:01
@arvidn arvidn marked this pull request as ready for review May 15, 2024 13:43
@arvidn arvidn requested a review from Rigidity May 15, 2024 13:43
Copy link
Contributor

@Rigidity Rigidity left a comment

Choose a reason for hiding this comment

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

Looks good to me (feel free to resolve these minor comments)

src/base64_ops.rs Show resolved Hide resolved
src/keccak256_ops.rs Show resolved Hide resolved
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.

None yet

2 participants