feat(crypto): add secp256r1 precompile and curve abstraction#19
Closed
Federico2014 wants to merge 98 commits intodevelopfrom
Closed
feat(crypto): add secp256r1 precompile and curve abstraction#19Federico2014 wants to merge 98 commits intodevelopfrom
Federico2014 wants to merge 98 commits intodevelopfrom
Conversation
feat(doc): update expired information for readme
fix(CheckStyle): only fix CheckStyle
…to volatile-modifier
1. Bump commons-io from 2.11.0 to 2.18.0 to fix CVE-2024-47554. 2. Bump jackson-databind from 2.13.4.2 to 2.18.3 to fix CVE-2023-35116, CVE-2025-52999. 3. Bump java-util from 1.8.0 to 3.2.0 to fix CVE-2023-34610. 4. Bump libp2p from 2.2.5 to 2.2.6. 5. Bump jetty from 9.4.53 to 9.4.57 to fix CVE-2024-8184. 6. Bump spring from 5.3.18 to 5.3.39 to fix CVE-2023-20863, CVE-2024-38820, CVE-2022-22968, CVE-2022-22970. 7. Remove spring-tx, spring-web, hamcrest-junit, guice, java-sizeof, vavr.
…oting_window_period
feat(doc): update readme for telegram groups and doc link
1. add missed config 2. update seed ip list
resolve implicit narrowing conversion and information exposure issues
…oting_window_period
…ronprotocol#6453) * feat(db): optimize the compatibility of obtaining transaction information
…6460) Add 30-seconds timeout rule as a workaround to prevent GRPC unit tests hanging at ThreadlessExecutor.waitAndDrain
* replace the Exception with TronError * remove plaintext key
…tronprotocol#6472) * feat(db/rocksdb): improve resource management with try-with-resources * feat(db/rocksdb):reactor code for ReadOptions and Options
…nprotocol#6476) - Add StatusPrinter for error details in load() - Restore default logger config in TronErrorTest
* update libp2p from 2.2.6 to 2.2.7 * add pom file
* fix(doc): update x86 java start params
…col#6486) * remove peer from PeerManager after testcase * add coverage of NodeInfoServiceTest
…newFilter, eth_newBlockFilter (tronprotocol#6495)
feat(*): disable market transaction
…estruct_restriction func(vm): optimize selfdestruct restriction
|
Important Review skippedToo many files! This PR contains 300 files, which is 150 over the limit of 150. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (300)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds secp256r1 (P-256/NIST) elliptic curve support to java-tron, including a new TVM precompiled contract for on-chain secp256r1 signature verification (RIP-7212 compatible).
CurveParamsinterface (cryptomodule) to abstract EC curve parameters, makingECKeycurve-agnosticSecp256k1ParamsandSecp256r1Paramssingletons implementingCurveParams— curve parameters are initialized once at class load timeECKeywith curve-parameterized constructors and factory methods (new ECKey(CurveParams),ECKey.fromPrivate(bytes, CurveParams)) so the same key operations work on both curvesECKeyPairGeneratorto acceptCurveParamsPrecompiledContracts.Secp256R1at address0x100, energy cost 6900 — accepts a 128-byte input(hash || r || s || pubkey_x || pubkey_y)and returns0x01on valid signature,0x00otherwiseWhy are these changes required?
secp256r1 (also known as P-256) is the curve used by WebAuthn / passkeys and hardware security modules (e.g., Apple Secure Enclave, Android Keystore). Providing an on-chain precompile enables smart contracts to verify passkey signatures without prohibitive gas costs, which is the same motivation as RIP-7212.
Breaking Changes: None — all existing secp256k1 behavior is unchanged. The curve-parameterized APIs are additive.
This PR has been tested by:
ECKeyR1Test(curve params, sign/verify, malleability, address recovery),Secp256R1ContractTest(test vectors JSON)./gradlew clean build -x test)Extra details
Precompile address
0x100(256) matches the RIP-7212 / Polygon/Optimism convention for secp256r1 verification.Summary by cubic
Add secp256r1 (P-256) support and a new precompile for on-chain signature verification to enable passkey/WebAuthn signatures in smart contracts.
ECKeyis now curve-agnostic via a new curve abstraction, with no breaking changes.CurveParamsabstraction withSecp256k1ParamsandSecp256r1Params, makingECKeycurve-agnostic.ECKeyconstructors/factories to accept curve params; updatedECKeyPairGeneratorto useCurveParams.PrecompiledContracts.Secp256R1at address0x100(energy cost 6900); accepts 128-byte input(hash || r || s || pubkey_x || pubkey_y)and returns0x01on valid signatures,0x00otherwise; RIP-7212 compatible.cryptohelperRsvandVMConstant.SIG_LENGTHfor consistent signature handling.secp256k1behavior is unchanged.Written for commit b1426e6. Summary will update on new commits.