Skip to content

Implementation of RIP-7212 / EIP-7951#8750

Merged
garyschulte merged 8 commits intohyperledger:mainfrom
garyschulte:feature/rip-7212-eip-7951
Jun 26, 2025
Merged

Implementation of RIP-7212 / EIP-7951#8750
garyschulte merged 8 commits intohyperledger:mainfrom
garyschulte:feature/rip-7212-eip-7951

Conversation

@garyschulte
Copy link
Contributor

@garyschulte garyschulte commented Jun 5, 2025

PR description

Draft Implementation of RIP-7212 / EIP-7951.

Outstanding to-dos:

  • enable non-canonical/malleable signatures (needs besu-native and besu-native-ec changes)
  • benchmarking
  • check/verify malleable signatures with bouncycastle
  • add secp256r1 to mainnet required native libs
  • caching
  • security fixes:
    • address point-at-infinity
    • modular comparison

Fixed Issue(s)

fixes #8605
blocked by pr 270
blocked by pr 22

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@Gabriel-Trintinalia
Copy link
Contributor

🔥🔥🔥🔥🔥🔥🔥

@garyschulte garyschulte force-pushed the feature/rip-7212-eip-7951 branch from df00a07 to d6252b9 Compare June 5, 2025 03:09
@Gabriel-Trintinalia
Copy link
Contributor

ethereum/EIPs#9833

@garyschulte
Copy link
Contributor Author

Neither bouncycastle nor OpenSSL secp256r1 verify implementations are particularly performant:

➜  besu git:(feature/rip-7212-eip-7951) build/install/besu/bin/evmtool benchmark --nonative p256verify
besu/v25.6-develop-ae99fb9/osx-aarch_64/corretto-java-22
Benchmarks for p256Verify
Java secp256r1
p256verify  3,450 gas @1,284.5 µs /     2.7 MGps
➜  besu git:(feature/rip-7212-eip-7951) build/install/besu/bin/evmtool benchmark --native p256verify 
besu/v25.6-develop-ae99fb9/osx-aarch_64/corretto-java-22
Benchmarks for p256Verify
Native secp256r1
p256verify  3,450 gas @  693.7 µs /     5.0 MGps

@garyschulte garyschulte force-pushed the feature/rip-7212-eip-7951 branch from 0286b8c to d7895e0 Compare June 10, 2025 05:16
@Gabriel-Trintinalia Gabriel-Trintinalia added the Osaka Osaka fork related - part of Fusaka label Jun 10, 2025
@garyschulte garyschulte force-pushed the feature/rip-7212-eip-7951 branch 4 times, most recently from 021296b to e7bfdcb Compare June 10, 2025 20:21
@macfarla

This comment was marked as resolved.

@macfarla macfarla moved this to In Progress in Osaka Jun 11, 2025
@garyschulte garyschulte force-pushed the feature/rip-7212-eip-7951 branch 3 times, most recently from a20d5e2 to 0665ae5 Compare June 23, 2025 19:01
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte force-pushed the feature/rip-7212-eip-7951 branch from 0665ae5 to a8fabee Compare June 24, 2025 18:40
@garyschulte
Copy link
Contributor Author

garyschulte commented Jun 24, 2025

As far as I can tell, openssl and boringssl both implement the R' checks for point-at-infinity and R'.x % n ≡ r

I asked on eth r&d discord on the #cryptography channel to verify this assertion.

@garyschulte garyschulte marked this pull request as ready for review June 24, 2025 22:12
@garyschulte garyschulte force-pushed the feature/rip-7212-eip-7951 branch from 727be23 to f6dee81 Compare June 24, 2025 22:43
Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte force-pushed the feature/rip-7212-eip-7951 branch from f6dee81 to bb5f61a Compare June 25, 2025 00:26
@garyschulte garyschulte changed the title Draft implementation of RIP-7212 / EIP-7951 Implementation of RIP-7212 / EIP-7951 Jun 25, 2025
@garyschulte
Copy link
Contributor Author

this implementation utilizes openssl, and will be superseded by boringssl, but the supporting config, classes and tests will be leveraged by the future besu-native implementation of boringssl

Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte enabled auto-merge (squash) June 25, 2025 23:48
Copy link
Contributor

@Gabriel-Trintinalia Gabriel-Trintinalia left a comment

Choose a reason for hiding this comment

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

LGTM

@garyschulte garyschulte merged commit b67da4e into hyperledger:main Jun 26, 2025
48 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Osaka Jun 26, 2025
@garyschulte garyschulte deleted the feature/rip-7212-eip-7951 branch June 26, 2025 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Osaka Osaka fork related - part of Fusaka

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

RIP-7212: Precompile for secp256r1 Curve Support

3 participants