Fix for handling ids33 in JNI
This commit is contained in:
@@ -14,6 +14,7 @@ class FrostTest: BaseTest() {
|
||||
|
||||
tests.jsonObject["valid_share_gen_test_cases"]!!.jsonArray.forEach { validTestCases ->
|
||||
|
||||
println("Testing ${validTestCases.jsonObject["seed"]!!.jsonPrimitive.content}") // Hack to slow things down... :(
|
||||
val keyIndices = validTestCases.jsonObject["key_indices"]!!.jsonArray.map { it.jsonPrimitive.int }
|
||||
|
||||
val seed32 = Hex.decode(validTestCases.jsonObject["seed"]!!.jsonPrimitive.content)
|
||||
@@ -72,7 +73,7 @@ class FrostTest: BaseTest() {
|
||||
|
||||
signerShareGenTestCase.jsonObject["signers"]!!.jsonArray.forEachIndexed { signerIndex, signer ->
|
||||
val seed32 = Hex.decode(signer.jsonObject["seed"]!!.jsonPrimitive.content)
|
||||
println("Testing ${signer.jsonObject["seed"]!!.jsonPrimitive.content}")
|
||||
println("Testing ${signer.jsonObject["seed"]!!.jsonPrimitive.content}") // Hack to slow things down... :(
|
||||
// There seems to be a bug that causes a crash if we call frost_share_gen too often
|
||||
|
||||
val result = Secp256k1.frostSharesGen(
|
||||
@@ -424,7 +425,9 @@ class FrostTest: BaseTest() {
|
||||
fun `frost nonce process`() {
|
||||
val tests = readData("frost/frost_nonce_vectors.json")
|
||||
|
||||
val pubnonces = tests.jsonObject["signers"]!!.jsonArray.map {
|
||||
val threshold = tests.jsonObject["threshold"]!!.jsonPrimitive.int
|
||||
|
||||
val pubnonces = tests.jsonObject["signers"]!!.jsonArray.take(threshold).map {
|
||||
Hex.decode(it.jsonObject["pubnonce"]!!.jsonPrimitive.content)
|
||||
}
|
||||
|
||||
@@ -432,16 +435,19 @@ class FrostTest: BaseTest() {
|
||||
tests.jsonObject["aggregate_public_key"]!!.jsonPrimitive.content
|
||||
)
|
||||
|
||||
val pubkeys = tests.jsonObject["pubkeys"]!!.jsonArray.map { Hex.decode(it.jsonPrimitive.content) }
|
||||
val pubkeys = tests.jsonObject["pubkeys"]!!.jsonArray.take(threshold).map {
|
||||
Hex.decode(it.jsonPrimitive.content)
|
||||
}
|
||||
|
||||
val tweakCache = Hex.decode(
|
||||
tests.jsonObject["tweak_cache"]!!.jsonPrimitive.content
|
||||
)
|
||||
|
||||
tests.jsonObject["signers"]!!.jsonArray.forEachIndexed { signerIndex, signer ->
|
||||
tests.jsonObject["signers"]!!.jsonArray.take(threshold).forEachIndexed { signerIndex, signer ->
|
||||
|
||||
val session = Secp256k1.frostNonceProcess(
|
||||
pubnonces.toTypedArray(),
|
||||
threshold,
|
||||
msg32,
|
||||
aggregatePublicKey,
|
||||
pubkeys[signerIndex],
|
||||
@@ -463,11 +469,13 @@ class FrostTest: BaseTest() {
|
||||
val tests = readData("frost/frost_nonce_vectors.json")
|
||||
|
||||
|
||||
val threshold = tests.jsonObject["threshold"]!!.jsonPrimitive.int
|
||||
|
||||
val tweakCache = Hex.decode(
|
||||
tests.jsonObject["tweak_cache"]!!.jsonPrimitive.content
|
||||
)
|
||||
|
||||
tests.jsonObject["signers"]!!.jsonArray.forEachIndexed { signerIndex, signer ->
|
||||
tests.jsonObject["signers"]!!.jsonArray.take(threshold).forEachIndexed { signerIndex, signer ->
|
||||
|
||||
val secNonce = Hex.decode(
|
||||
signer.jsonObject["secnonce"]!!.jsonPrimitive.content
|
||||
@@ -500,11 +508,12 @@ class FrostTest: BaseTest() {
|
||||
fun `frost partial signature verify`() {
|
||||
val tests = readData("frost/frost_nonce_vectors.json")
|
||||
|
||||
val threshold = tests.jsonObject["threshold"]!!.jsonPrimitive.int
|
||||
val tweakCache = Hex.decode(
|
||||
tests.jsonObject["tweak_cache"]!!.jsonPrimitive.content
|
||||
)
|
||||
|
||||
tests.jsonObject["signers"]!!.jsonArray.forEach { signer ->
|
||||
tests.jsonObject["signers"]!!.jsonArray.take(threshold).forEach { signer ->
|
||||
val partialSignature = Hex.decode(
|
||||
signer.jsonObject["partial_signature"]!!.jsonPrimitive.content
|
||||
)
|
||||
@@ -539,11 +548,13 @@ class FrostTest: BaseTest() {
|
||||
fun `frost partial signature aggregation`() {
|
||||
val tests = readData("frost/frost_nonce_vectors.json")
|
||||
|
||||
val partialSignatures = tests.jsonObject["signers"]!!.jsonArray.map {
|
||||
val threshold = tests.jsonObject["threshold"]!!.jsonPrimitive.int
|
||||
|
||||
val partialSignatures = tests.jsonObject["signers"]!!.jsonArray.take(threshold).map {
|
||||
Hex.decode(it.jsonObject["partial_signature"]!!.jsonPrimitive.content)
|
||||
}
|
||||
|
||||
tests.jsonObject["signers"]!!.jsonArray.forEach { signer ->
|
||||
tests.jsonObject["signers"]!!.jsonArray.take(threshold).forEach { signer ->
|
||||
val session = Hex.decode(
|
||||
signer.jsonObject["session"]!!.jsonPrimitive.content
|
||||
)
|
||||
@@ -551,6 +562,7 @@ class FrostTest: BaseTest() {
|
||||
val aggregatedSignature = Secp256k1.frostPartialSignatureAggregate(
|
||||
session,
|
||||
partialSignatures.toTypedArray(),
|
||||
threshold
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
|
||||
@@ -8,45 +8,41 @@
|
||||
],
|
||||
"threshold": 3,
|
||||
"aggregate_public_key": "bd5561ef6dbff52d3f73b8cb0c065328988b71d3386d23890744a0dd6ad27c15",
|
||||
"aggregate_signature": "1c34b007ec896279304e7fbd80730991bd547b50b212fcdd983340c5392bfa6ede56bbf6dd50926cae1723119225572ac555dce37f9b0033a255ef233b5ac539",
|
||||
"aggregate_signature": "2fd5bc8fa46b0097f48e0b5734ec557a17a72f8c5989bdf5f387f01b5edc149f02a340d5ca0348b54448aecc67c1bdd532e43f5295a5382e063fe7b4425259ac",
|
||||
"session_id": "7FB9E0E687ADA1EEBF7ECFE2F21E73EBDB51A7D450948DFE8D76D7F2D1007671",
|
||||
"tweak_cache": "40252e41157cd26adda0440789236d38d3718b982853060ccbb8733f2df5bf6def6155bdeefcc6b83fe690d621b793b08f5b1562a7bef628c4db33f2d0b3f3bf2f541aaa000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"signers": [
|
||||
{
|
||||
"partial_signature": "12a1bb40ef57c0be9c00641ad59c406a2b8b2624227c48f43291516fc906d935",
|
||||
"session": "5c11a803011c34b007ec896279304e7fbd80730991bd547b50b212fcdd983340c5392bfa6ee8d4b3288f9364e296c1516a09aa3e34605421a6536e2eaf2a341343b9a76443b59b5c7df0aebbb9fab718c312d862c85d4b25aeb20de84d3ef1a1aad667c3360000000000000000000000000000000000000000000000000000000000000000",
|
||||
"partial_signature": "82b98b609479595b861db8704b1b1af5d34defb52fb75023a2fb53a8c66e8ba7",
|
||||
"session": "5c11a803002fd5bc8fa46b0097f48e0b5734ec557a17a72f8c5989bdf5f387f01b5edc149fe6d54b152392da71ec234b35804aeb36c6829cb0a0201aa7a94ec586a1147f0c18901c3b3d604349539d6cd24a2c1e7a676a7bce95cb810dbc346133c117a7a60000000000000000000000000000000000000000000000000000000000000000",
|
||||
"secnonce": "847d4625fe87e00f9562351a9b7de8fc2420caba09535db177fc4fbac5b69b84c8700ae143946a0fffff4083d6377ee19a6448a55241160fbc7c793aace02f289a2fec8f",
|
||||
"pubnonce": "03203a0450540686854df68f6c1d15661772e4d05c4442ee1e437d86842779ef2202d03839fd99faf7a11ccc319a9adc965c5e094ca3728455059a4911ae96192fae",
|
||||
"aggregate_share": "1cfa28492e84e945343f1167401cdce061202a59e47e050c0c2f7f0c56e8e148",
|
||||
"public_share": "0493effba7e50d3885bb0c4665149abd4fd13622047412f1da4c0e3754ecb1a9183aaadfdf0f2f82e24641e6ed7a0f7ee22a4a8a47c6d2df66daad37a4880fffe2"
|
||||
},
|
||||
{
|
||||
"partial_signature": "d504eaf51c4985f1f1c6d1fcaef0b4d934752e1e4bfd76cd86c6baed0d915e21",
|
||||
"session": "5c11a803011c34b007ec896279304e7fbd80730991bd547b50b212fcdd983340c5392bfa6ee8d4b3288f9364e296c1516a09aa3e34605421a6536e2eaf2a341343b9a7644376dba5ba367ff93f06b8230cbbab6b608a175463168ea0a9ee175b7909f438b80000000000000000000000000000000000000000000000000000000000000000",
|
||||
"partial_signature": "62bb46458d4307cc96280159873fac35285e65049196c0df03954da79e7924e5",
|
||||
"session": "5c11a803002fd5bc8fa46b0097f48e0b5734ec557a17a72f8c5989bdf5f387f01b5edc149fe6d54b152392da71ec234b35804aeb36c6829cb0a0201aa7a94ec586a1147f0c69b1d2e667d72b4a220100d9229740f24d9891f55f41918a07831d382aeba5e80000000000000000000000000000000000000000000000000000000000000000",
|
||||
"secnonce": "847d4625e6af707cb69026251afdfc2570a3fbdbbc7e72530354f0777fe2192c6aa8b23969172508dff48f7a21827935cce2ed019c570bb5552f9a3269a8ec34cfd23e2c",
|
||||
"pubnonce": "035c8f36d2cf868b9ccab3221b3f5eca64d60469a50245d6edc3b4f4bfb4358892023e832dcc0b5b55562ef6f1536679a2e996827747d3b824ca335daf00d51ab788",
|
||||
"aggregate_share": "dd82fcc1806f1a968228c794a7001c18d209871fb3441bae80fd8229f6a9b0dd",
|
||||
"public_share": "048482e27b533879d4f3d68bdb2038bf9480d4ce4cc614d7133238e55179c65a175c684afb7f983e60139542b80f0f12815f3194082f07c93e1f87f3cd1b1c0d8b"
|
||||
},
|
||||
{
|
||||
"partial_signature": "0e82e07de474c83387118c9b353b7ebbeeabd0279645d6ae499546df3b301d59",
|
||||
"session": "5c11a803011c34b007ec896279304e7fbd80730991bd547b50b212fcdd983340c5392bfa6ee8d4b3288f9364e296c1516a09aa3e34605421a6536e2eaf2a341343b9a764436bc4ab3b7a585b2a759366523cb83fb2ff8b166e2503abd0f24ec58868bde3440000000000000000000000000000000000000000000000000000000000000000",
|
||||
"partial_signature": "1d2e6f2fa846e78d2802f5029566f6a8f1e6c77f839fc7671f81a4f0ada0ea61",
|
||||
"session": "5c11a803002fd5bc8fa46b0097f48e0b5734ec557a17a72f8c5989bdf5f387f01b5edc149fe6d54b152392da71ec234b35804aeb36c6829cb0a0201aa7a94ec586a1147f0c7c15772acc75c702d2cb960a98c793090de73e18e5fd5dbf08818afcab855fa10000000000000000000000000000000000000000000000000000000000000000",
|
||||
"secnonce": "847d4625bd32503f81d016175829db4df8475660c77e28cf6dc7bc8b2f6e3fe6f67282b1cf81dcf2dabd867053461cf602f3e3345f42119066f4c493b85a0744ae7beb08",
|
||||
"pubnonce": "028b80bb46028338d41101deacd7910e09ba148f75d2c01e9f8f767fa9cdcbbc7e02b0cec1ba331750a22bf3bb8d1b724bd2874f7f0c19c70227f64c463c8c6bcab2",
|
||||
"aggregate_share": "5fe629d5f34fdb3ea2f6e545fc3d2cf1f5ce23a504b144e6ebe928793cc85cb4",
|
||||
"public_share": "04d71784b58d8958141f8f405d56026f214a736e73f9c1f70776fc2e49f4e90fc0a9396bcc7471a83caf4076a18cb6ab4264aa37174ca19e142259aa5f6bb7fea3"
|
||||
},
|
||||
{
|
||||
"partial_signature": "c7158af40413f8174d38a36ae83737f633f183c45e83ec9caa88afe9e0ed9a4a",
|
||||
"session": "5c11a803011c34b007ec896279304e7fbd80730991bd547b50b212fcdd983340c5392bfa6ee8d4b3288f9364e296c1516a09aa3e34605421a6536e2eaf2a341343b9a7644347dededd1bcf6c4294a994e867475e5c52ef861b240fe8ff717fe73f6bf0426b0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"secnonce": "847d4625f2128d893c4b8b62818bbc972d158b0aa96b08dcacba149dd7517b7fc7ddb89b70234941338c242dbca6e27ebf337ae458381ef83bea4ba2baab8df3d7f6b773",
|
||||
"pubnonce": "030b4d942e88b7674819f3020c290db1162beda60bae05964bb344378166ec61a20221e3e76bfa50c22b98832d451d51e3b7cdef420a2b06e9a29373449aa77aa46c",
|
||||
"aggregate_share": "71181e5b46742333f12672d85d0e1472770a082f0a62d3d204c9e191fb45ef91",
|
||||
"public_share": "04ec0fb2b4c1ac2d9b761f32cb2972e6d6fb74ed4195d872aeaaf4306bb64eb465580d03102849363ec49c3d1eecdd239337d0a66cdfc4d74c29c824c0f941832a"
|
||||
},
|
||||
{
|
||||
"partial_signature": "2117aa4ee9268b714c05bcf3f025ab33fd67119bcba01d62b4b24a8a18db1781",
|
||||
"session": "5c11a803011c34b007ec896279304e7fbd80730991bd547b50b212fcdd983340c5392bfa6ee8d4b3288f9364e296c1516a09aa3e34605421a6536e2eaf2a341343b9a76443dad0efbc20454b2dc409cb6c7cfec24e3d45d3d417de97e47df531e11ef188450000000000000000000000000000000000000000000000000000000000000000",
|
||||
"secnonce": "847d4625ee1f0f41a485d2399b024b05d9a9b7cbb846cf107dcbfa125a136448cbd20441a5bbea0b8908781249bbd7a5f6c429e1678338d8a2f5a9095a85fd541cb49884",
|
||||
"pubnonce": "034a67a3dbe320486110fac55f4e7ef4f5c5216766b8e4d635c6f1119a5c5e75a3026ada48e6491d2c9890f65fd3f9d675f644df9224b5beb5fc41b2934bc28d9bcc",
|
||||
"aggregate_share": "15bc5e3eeb4ec318a718b3015b78e8496cc5ede81c05727936ade625532dce55",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"bf0eaac669eac6ac43d094bb2e07e4fa7fd4b1d317188c690aad7ea211b49bdb",
|
||||
"00c266074c34720f6d9a8511e4ec82bed44e104f93f20d9bbfbff8e2edf44400"
|
||||
],
|
||||
|
||||
"vss_commitment": [
|
||||
"04bc2f60d5a7494d506e6517c49db2104b05e087536ccb1cb2730282f469782bb93e2c0029d733beeea75120e831ed71255adde4ddbd0be049419572502d7b73b9",
|
||||
"04ced2029d64827253175b5382cb327123fd2cdcdb5b2092e66020e9b6ece639f675029e36604347735eef9bf64137474b14d92d2996e67f5721705ee574c916a1",
|
||||
|
||||
Reference in New Issue
Block a user