-
Notifications
You must be signed in to change notification settings - Fork 5
Adds a local clone of rust-secp256k1 #77
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
Conversation
097acbe to
478abf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an internal, stripped‐down clone of rust‑secp256k1 (named vlib‑secp256k1) and adjusts dependencies so that the bitcoin library now uses this new internal implementation. Key changes include:
- Introducing a new Cargo.toml and README for vlib‑secp256k1.
- Adding stub implementations (using todo!()) for various cryptographic methods (ECDSA, schnorr, scalar operations).
- Updating bitcoin’s dependency to reference the local vlib‑secp256k1 instead of the git‑based rust‑secp256k1.
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| libs/secp256k1/Cargo.toml | New package configuration for the internal vlib‑secp256k1 library. |
| libs/secp256k1/README.md | New README document for the internal library (contains a typo). |
| libs/secp256k1/src/ecdsa/mod.rs | Added full ECDSA implementation with several stubbed functions. |
| libs/secp256k1/src/sdk_helpers.rs | New helper functions for cryptographic computations using the SDK. |
| libs/secp256k1/src/context.rs | Introduced configurations for signing, verification, and all‑capabilities contexts. |
| libs/secp256k1/src/ecdsa/serialized_signature.rs | New type for handling DER‑serialized signatures without allocations. |
| libs/secp256k1/src/macros.rs | Macros for newtype and pretty‑printing implementations. |
| libs/secp256k1/src/scalar.rs | Scalar type implementation with basic operations and error handling. |
| libs/secp256k1/src/constants.rs | Constants for secp256k1 curve parameters and related crypto values. |
| libs/secp256k1/src/schnorr.rs | Schnorr signature support including (de)serialization and tests. |
| libs/bitcoin/src/lib.rs | Adjusted re‑exports to use the local vlib‑secp256k1 instead of full re‑export. |
| libs/bitcoin/Cargo.toml | Updated dependency settings to use the local vlib‑secp256k1 package. |
| app-sdk/src/bignum.rs | Operator overloads for BigNum/Mod arithmetic using the app‑sdk’s FFI. |
| app-sdk/src/curve.rs | Made Point fields public and added a new is_zero method to help verify the identity element. |
| app-sdk/src/lib.rs | Configured different heap sizes based on target architecture. |
| .cargo/config.toml (both in secp256k1 & bitcoin) | Configured environment for tests (setting RUST_TEST_THREADS). |
Comments suppressed due to low confidence (1)
libs/secp256k1/README.md:15
- The word "starded" appears to be a typo; it should be "started".
This folder starded from a fork of `rust-secp256k1`, at commit [31237ffd604b78baba4a90e35fe8a50c3f48a23b].
Also removed the features related to the Secp256k1 'context'. Most methods are replaced with a todo!() placeholder.
Added an internal sdk_helpers module to add utility functions that use the Vanadium app-sdk.
…make them more ergonomic to use
We only export the secp256k1.Secp256k1 type, since most functionality in this module is not currently implemented.
746a246 to
8726a23
Compare
Adds a local clone of rust-secp256k1
Puts a stripped down clone of
rust-secp256k1as an internal libraryvlib-secp256k1, and uses it as the dependency forvlib-bitcoinlibrary (in turn forked fromrust-bitcoin.rust-secp256k1is a Rust wrapper of the C-bindings of bitcoin-core's secp256k1 library; however, we can't really use it in Vanadium because we reimplement all the cryptography with ECALLs.By cloning it and reimplementing the functionality locally using the
app-sdk, we can minimize the required adaptations in rust-bitcoin.This PR adds only a stub of the library, as most functionality is replaced with a
todo!(). However, it already removes the internal craterust-secp256k1-sysand anything related to the FFI interface. That allows removing the C++ compiler from the build pipeline of the bitcoin v-app, which is amazing for the compilation time.Some features and other functionalities that are not relevant for Vanadium (like the 'recovery', 'ecdh' and 'ellswift' modules, or the
Secp256kcontext), are also removed fromvlib-secp256k1. Possibly, even more unused functionality could removed in the future (instead of implementing each and everytodo!()).