Skip to content

Commit a3355d2

Browse files
committed
Rename musigPubkeyAdd to musigPubkeyAgg, remove unused adaptor parameter
1 parent 0e0b475 commit a3355d2

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

jni/c/headers/java/fr_acinq_secp256k1_Secp256k1CFunctions.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jni/c/src/fr_acinq_secp256k1_Secp256k1CFunctions.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256
11271127
* Method: secp256k1_musig_nonce_process
11281128
* Signature: (J[B[B[B[B)[B
11291129
*/
1130-
JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1musig_1nonce_1process(JNIEnv *penv, jclass clazz, jlong jctx, jbyteArray jaggnonce, jbyteArray jmsg32, jbyteArray jkeyaggcache, jbyteArray jadaptor)
1130+
JNIEXPORT jbyteArray JNICALL Java_fr_acinq_secp256k1_Secp256k1CFunctions_secp256k1_1musig_1nonce_1process(JNIEnv *penv, jclass clazz, jlong jctx, jbyteArray jaggnonce, jbyteArray jmsg32, jbyteArray jkeyaggcache)
11311131
{
11321132
secp256k1_context *ctx = (secp256k1_context *)jctx;
11331133
secp256k1_musig_keyagg_cache keyaggcache;

jni/src/main/java/fr/acinq/secp256k1/Secp256k1CFunctions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class Secp256k1CFunctions {
8787

8888
public static native byte[] secp256k1_musig_pubkey_xonly_tweak_add(long ctx, byte[] keyagg_cache, byte[] tweak32);
8989

90-
public static native byte[] secp256k1_musig_nonce_process(long ctx, byte[] aggnonce, byte[] msg32, byte[] keyagg_cache, byte[] adaptor);
90+
public static native byte[] secp256k1_musig_nonce_process(long ctx, byte[] aggnonce, byte[] msg32, byte[] keyagg_cache);
9191

9292
public static native byte[] secp256k1_musig_partial_sign(long ctx, byte[] secnonce, byte[] privkey, byte[] keyagg_cache, byte[] session);
9393

jni/src/main/kotlin/fr/acinq/secp256k1/NativeSecp256k1.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public object NativeSecp256k1 : Secp256k1 {
100100
return Secp256k1CFunctions.secp256k1_musig_nonce_agg(Secp256k1Context.getContext(), pubnonces)
101101
}
102102

103-
override fun musigPubkeyAdd(pubkeys: Array<ByteArray>, keyagg_cache: ByteArray?): ByteArray {
103+
override fun musigPubkeyAgg(pubkeys: Array<ByteArray>, keyagg_cache: ByteArray?): ByteArray {
104104
return Secp256k1CFunctions.secp256k1_musig_pubkey_agg(Secp256k1Context.getContext(), pubkeys, keyagg_cache)
105105
}
106106

@@ -112,8 +112,8 @@ public object NativeSecp256k1 : Secp256k1 {
112112
return Secp256k1CFunctions.secp256k1_musig_pubkey_xonly_tweak_add(Secp256k1Context.getContext(), keyagg_cache, tweak32)
113113
}
114114

115-
override fun musigNonceProcess(aggnonce: ByteArray, msg32: ByteArray, keyagg_cache: ByteArray, adaptor: ByteArray?): ByteArray {
116-
return Secp256k1CFunctions.secp256k1_musig_nonce_process(Secp256k1Context.getContext(), aggnonce, msg32, keyagg_cache, adaptor)
115+
override fun musigNonceProcess(aggnonce: ByteArray, msg32: ByteArray, keyagg_cache: ByteArray,): ByteArray {
116+
return Secp256k1CFunctions.secp256k1_musig_nonce_process(Secp256k1Context.getContext(), aggnonce, msg32, keyagg_cache)
117117
}
118118

119119
override fun musigPartialSign(secnonce: ByteArray, privkey: ByteArray, keyagg_cache: ByteArray, session: ByteArray): ByteArray {

src/commonMain/kotlin/fr/acinq/secp256k1/Secp256k1.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ public interface Secp256k1 {
157157

158158
public fun musigNonceAgg(pubnonces: Array<ByteArray>): ByteArray
159159

160-
public fun musigPubkeyAdd(pubkeys: Array<ByteArray>, keyagg_cache: ByteArray?): ByteArray
160+
public fun musigPubkeyAgg(pubkeys: Array<ByteArray>, keyagg_cache: ByteArray?): ByteArray
161161

162162
public fun musigPubkeyTweakAdd(keyagg_cache: ByteArray, tweak32: ByteArray): ByteArray
163163

164164
public fun musigPubkeyXonlyTweakAdd(keyagg_cache: ByteArray, tweak32: ByteArray): ByteArray
165165

166-
public fun musigNonceProcess(aggnonce: ByteArray, msg32: ByteArray, keyagg_cache: ByteArray, adaptor: ByteArray?): ByteArray
166+
public fun musigNonceProcess(aggnonce: ByteArray, msg32: ByteArray, keyagg_cache: ByteArray): ByteArray
167167

168168
public fun musigPartialSign(secnonce: ByteArray, privkey: ByteArray, keyagg_cache: ByteArray, session: ByteArray): ByteArray
169169

src/nativeMain/kotlin/fr/acinq/secp256k1/Secp256k1Native.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public object Secp256k1Native : Secp256k1 {
326326
}
327327
}
328328

329-
override fun musigPubkeyAdd(pubkeys: Array<ByteArray>, keyagg_cache: ByteArray?): ByteArray {
329+
override fun musigPubkeyAgg(pubkeys: Array<ByteArray>, keyagg_cache: ByteArray?): ByteArray {
330330
require(pubkeys.isNotEmpty())
331331
pubkeys.forEach { require(it.size == 33 || it.size == 65) }
332332
keyagg_cache?.let { require(it.size == Secp256k1.MUSIG2_PUBLIC_KEYAGG_CACHE_SIZE) }
@@ -371,7 +371,7 @@ public object Secp256k1Native : Secp256k1 {
371371
}
372372
}
373373

374-
override fun musigNonceProcess(aggnonce: ByteArray, msg32: ByteArray, keyagg_cache: ByteArray, adaptor: ByteArray?): ByteArray {
374+
override fun musigNonceProcess(aggnonce: ByteArray, msg32: ByteArray, keyagg_cache: ByteArray): ByteArray {
375375
require(aggnonce.size == Secp256k1.MUSIG2_PUBLIC_NONCE_SIZE)
376376
require(keyagg_cache.size == Secp256k1.MUSIG2_PUBLIC_KEYAGG_CACHE_SIZE)
377377
require(msg32.size == 32)

tests/src/commonTest/kotlin/fr/acinq/secp256k1/Secp256k1Test.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -402,19 +402,19 @@ class Secp256k1Test {
402402

403403
).map { Hex.decode(it) }
404404

405-
val agg1 = Secp256k1.musigPubkeyAdd(arrayOf(pubkeys[0], pubkeys[1], pubkeys[2]), null)
405+
val agg1 = Secp256k1.musigPubkeyAgg(arrayOf(pubkeys[0], pubkeys[1], pubkeys[2]), null)
406406
assertEquals("90539EEDE565F5D054F32CC0C220126889ED1E5D193BAF15AEF344FE59D4610C", Hex.encode(agg1).uppercase())
407407
val cache = ByteArray(197)
408-
val agg2 = Secp256k1.musigPubkeyAdd(arrayOf(pubkeys[0], pubkeys[1], pubkeys[2]), cache)
408+
val agg2 = Secp256k1.musigPubkeyAgg(arrayOf(pubkeys[0], pubkeys[1], pubkeys[2]), cache)
409409
assertEquals("90539EEDE565F5D054F32CC0C220126889ED1E5D193BAF15AEF344FE59D4610C", Hex.encode(agg2).uppercase())
410410

411-
val agg3 = Secp256k1.musigPubkeyAdd(arrayOf(pubkeys[2], pubkeys[1], pubkeys[0]), null)
411+
val agg3 = Secp256k1.musigPubkeyAgg(arrayOf(pubkeys[2], pubkeys[1], pubkeys[0]), null)
412412
assertEquals("6204DE8B083426DC6EAF9502D27024D53FC826BF7D2012148A0575435DF54B2B", Hex.encode(agg3).uppercase())
413413

414-
val agg4 = Secp256k1.musigPubkeyAdd(arrayOf(pubkeys[0], pubkeys[0], pubkeys[0]), null)
414+
val agg4 = Secp256k1.musigPubkeyAgg(arrayOf(pubkeys[0], pubkeys[0], pubkeys[0]), null)
415415
assertEquals("B436E3BAD62B8CD409969A224731C193D051162D8C5AE8B109306127DA3AA935", Hex.encode(agg4).uppercase())
416416

417-
val agg5 = Secp256k1.musigPubkeyAdd(arrayOf(pubkeys[0], pubkeys[0], pubkeys[1], pubkeys[1]), null)
417+
val agg5 = Secp256k1.musigPubkeyAgg(arrayOf(pubkeys[0], pubkeys[0], pubkeys[1], pubkeys[1]), null)
418418
assertEquals("69BC22BFA5D106306E48A20679DE1D7389386124D07571D0D872686028C26A3E", Hex.encode(agg5).uppercase())
419419
}
420420

@@ -426,7 +426,7 @@ class Secp256k1Test {
426426
"02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337"
427427
).map { Hex.decode(it) }.toTypedArray()
428428
val cache = ByteArray(197)
429-
val agg1 = Secp256k1.musigPubkeyAdd(pubkeys, cache)
429+
val agg1 = Secp256k1.musigPubkeyAgg(pubkeys, cache)
430430
assertEquals("b6d830642403fc82511aca5ff98a5e76fcef0f89bffc1aadbe78ee74cd5a5716", Hex.encode(agg1))
431431
val agg2 = Secp256k1.musigPubkeyTweakAdd(cache, Hex.decode("7468697320636f756c64206265206120424950333220747765616b2e2e2e2e00"))
432432
assertEquals("04791e4f22a21f19bd9798eceab92ad2ccc18f2d6660e91ae4c0709aaebf1aa9023701f468b0eddf8973495a5327f2169d9c6a50eb6a0f87c0fbee90a4067eb230", Hex.encode(agg2))
@@ -449,11 +449,11 @@ class Secp256k1Test {
449449
val aggnonce = Secp256k1.musigNonceAgg(pubnonces.toTypedArray())
450450

451451
val caches = (0 until 2).map { ByteArray(197) }
452-
val aggpubkey = Secp256k1.musigPubkeyAdd(pubkeys.toTypedArray(), caches[0])
453-
Secp256k1.musigPubkeyAdd(pubkeys.toTypedArray(), caches[1])
452+
val aggpubkey = Secp256k1.musigPubkeyAgg(pubkeys.toTypedArray(), caches[0])
453+
Secp256k1.musigPubkeyAgg(pubkeys.toTypedArray(), caches[1])
454454

455455
val msg32 = Hex.decode("0303030303030303030303030303030303030303030303030303030303030303")
456-
val sessions = (0 until 2).map { Secp256k1.musigNonceProcess(aggnonce, msg32, caches[it], null) }
456+
val sessions = (0 until 2).map { Secp256k1.musigNonceProcess(aggnonce, msg32, caches[it]) }
457457
val psigs = (0 until 2).map {
458458
val psig = Secp256k1.musigPartialSign(secnonces[it], privkeys[it], caches[it], sessions[it])
459459
val check = Secp256k1.musigPartialSigVerify(psig, pubnonces[it], pubkeys[it], caches[it], sessions[it])

0 commit comments

Comments
 (0)