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

ABI update, partial merge #421

Merged
merged 20 commits into from
Oct 3, 2023
Merged

ABI update, partial merge #421

merged 20 commits into from
Oct 3, 2023

Conversation

jgriffiths
Copy link
Contributor

Merging the low hanging fruit of the ABI update changes before tackling the difficult parts.

jgriffiths and others added 20 commits October 3, 2023 09:22
… ABI compliance

As wally is now being installed as a global shared library by at least
one distro (Gentoo), update how the ABI is handled to ensure that
elements and non-elements builds are compatible at the C structure
level:

1. By default, Elements support is now enabled.
2. By default, if Elements support is disabled, the C structs defining
   library types retain the extra Elements members.
3. Allow removing the extra members by configuring with
   --disable-elements --disable-elements-abi. The caller must define
   WALLY_ABI_NO_ELEMENTS before including any wally headers. This
   configuration can be used for Bitcoin-only embedded environments,
   but must not be used when installing wally as a system shared
   library.

Currently elements specific functions remain undefined in the wally
headers unless BUILD_ELEMENTS is defined by the caller. Note that the
Python and Javascript wrappers are unaffected as these releases always
enabled elements.

Callers can determine if the library was compiled with elements support
by calling wally_is_elements_build().
Future error handling will support extended error codes via these
functions which are user-overridable in order to support thread safety.
Make the structure changes now without using them so we can avoid an ABI
version bump once implemented.
…s (1)

Part 1, header changes.

As with the previous c-struct change, by default Elements is enabled and
elements functions are exported from the library. Using
--disable-elements now leaves the Elements functions available, but
calling them will always return WALLY_ERROR.

This behaviour allows installing a system-wide wally built without
Elements support which applications can gracefully detect at runtime via
wally_is_elements_build() and handle by degrading functionality or
failing to start.

To compile the Elements functions out completely, the user must configure
with --disable-elements-abi and define WALLY_ABI_NO_ELEMENTS when including
library headers. This allows e.g. embeddeded/static builds to eliminate
all Elements code entirely.

As before, WALLY_ABI_NO_ELEMENTS builds must not be installed as
system-wide shared libraries. Doing so may result in either memory
corruption at runtime (if no Elements code is used) or linker errors on
startup due to missing Elements calls.
…s (2)

Part 2, source changes, move psbt_blind into the elements ABI, regenerate wrappers.
The POSIX Shell 'test' built-in does not define a '==' operator. It
works if /bin/sh happens to be Bash, but that is non-standard.
SWIG generates code with unused parameters that trigger hundreds of warnings.
Quoting jgriffiths:
> --enable-openssl-tests is no longer supported in secp and should be removed

Suggested-by: Jon Griffiths <[email protected]> (@jgriffiths)
See: #414 (comment)
libsecp256k1 dropped support for bignum in October 2020.

See: bitcoin-core/secp256k1@1f233b3
Starting up a JVM is not a lightweight affair. For this reason,
typically all Java source files are compiled by a single invocation of
javac. Use GNU Make's "grouped targets" feature to specify that all Java
class files are produced by a single execution of the recipe. Further,
avoid compiling the test classes if tests are disabled.
Extracted from a patch by Matt Whitlock <[email protected]>.

Also reduce the include directories given for python wheel building.
@jgriffiths jgriffiths merged commit 11433c9 into master Oct 3, 2023
4 checks passed
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.

2 participants