libwally-swift icon indicating copy to clipboard operation
libwally-swift copied to clipboard

Avoid dirty libwally-core submodule after build

Open Sjors opened this issue 2 years ago • 4 comments

Since #54 the build script switches from libsecp256k1-zkp to vanilla libsecp256k1 (and matching the commit used by Bitcoin Core). This uses libwally-core's --enable-standard-secp configure flag (introduced in https://github.com/ElementsProject/libwally-core/pull/301).

The problem is that this switch leaves the libwally-core submodule dirty.

One possible solution would be to patch libwally-core to use libsecp256k1 from a custom directory. In that case we could include it directly as a submodule in libwally-swift and ignore libwally-core's libsecp256k1-zkp submodule.

Not sure how involved this is, cc @jgriffiths.

Perhaps there's another approach that doesn't require an upstream change. The script could do some magic with symlinks, but meh...

Sjors avatar Apr 13 '22 15:04 Sjors

@Sjors

You could maybe use a secp from elsewhere by passing -I in $CFLAGS and -L in $LDFLAGS, assuming LIBADD_SECP256K1 in configure.ac doesn't need modifying to ensure you pick up the right object files. That would require that you configure and build secp separately with compatible options following the logic that wally uses to map its own state to secp's in AC_CONFIG_SUBDIRS in configure.ac.

That seems like a huge PITA though, when you can just store the HEAD commit before you change it before building, then make clean in the secp dir and check out the old HEAD again when done.

jgriffiths avatar Apr 14 '22 05:04 jgriffiths

Worth noting that the upgrade to 0.8.5 includes bip32 derivation directly from string paths, so you could remove your path parsing code in favour of using wallys if you wished to.

jgriffiths avatar Apr 14 '22 05:04 jgriffiths

Worth noting that the upgrade to 0.8.5 includes bip32 derivation directly from string paths, so you could remove your path parsing code in favour of using wallys if you wished to.

Nice, that should help clean up some code. Are you planning to implement the opposite direction as well? https://github.com/ElementsProject/libwally-core/issues/241

Sjors avatar Apr 14 '22 10:04 Sjors

Are you planning to implement the opposite direction as well?

At some point, yes - there is a backlog of wally features to implement and there hasn't been a lot of time to get to them, that situation should be improving now.

jgriffiths avatar Apr 14 '22 21:04 jgriffiths