[WIP] Update embit to be compatible with secp256k1 v0.7.0 #99
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.
Overview
This branch represents a significant effort to update embit to work with the latest secp256k1 library (v0.7.0) and modernize the bindings implementation. This is not intended for direct merge but serves as a foundation for identifying and resolving compatibility issues between embit and the current secp256k1 implementation.
While this is still early work-in-progress, this branch is made public due to the critical importance of secp256k1 functionality for embit's integration with SeedSigner and (my guess) other downstream projects. The secp256k1 library is fundamental to Bitcoin cryptographic operations, making this update essential for maintaining compatibility with latest cryptographic standards.
Upon successful completion of this development, new precompiled secp256k1 v0.7.0 binaries will be generated and uploaded to the codebase.
Related: #97, SeedSigner/seedsigner-os#90
Objectives
Changes summary
Temporary Docker environment for source building
Dockerfile,run_tests.sh, temporary test files) are not intended for incorporation into the main codebase. They serve as temporary development tools to facilitate testing and debugging of the secp256k1 v0.7.0 integration.embitlibrary updatesKey technical changes
Updated Schnorr signature bindings
New structure for extra params
Function signature updates
schnorrsig_sign()now usessecp256k1_schnorrsig_sign_customas defaultschnorrsig_sign_32()maintains compatibility withsecp256k1_schnorrsig_sign32sign_schnorrinkey.pyfor compatibility with new bindings (matching BIP340's reference)Current status
Test failures
Several test cases are currently failing:
Currently focusing on...
Schnorr signature behavior: Determine if failures are due to:
Bindings: Verify that:
py_secp256k1 / key.py: Ensure compatibility with:
Testing this PR
I leave here how to create the setup for testing this PR, if anybody needs it.
Docker Environment
Detailed Commit History
a00a233 - Update test environment scripts and cleanup
run_tests.shtest_secp256k1.py,test_secp_comprehensive.py)6627e17 - Update schnorrsig_sign_custom bindings to be the default
src/embit/util/ctypes_secp256k1.pyto usesecp256k1_schnorrsig_sign_customas the primary signing functionschnorrsig_sign_3227b4e4e - Update Dockerfile
0e4f26c - secp256k1 v0.7.0
317a469 - Update test setup with seedsigner
run_tests.shwith SeedSigner integration capabilities823d1d5 - Adapt bindings and key.py
src/embit/util/ctypes_secp256k1.pywith new function signaturessrc/embit/util/key.pyfor compatibility103a1d7 - secp256k1 test environment
Dockerfilefor consistent testing across platformstest_secp256k1.py,test_secp_comprehensive.py)run_tests.shfor automated testing430c243 - Remove prebuilt
libsecp256k1_darwin_arm64.dyliblibsecp256k1_darwin_x86_64.dyliblibsecp256k1_linux_aarch64.solibsecp256k1_linux_armv6l.solibsecp256k1_linux_armv7l.solibsecp256k1_linux_x86_64.solibsecp256k1_windows_amd64.dll