From 1b2aacc862992a62a73e2368fa745ccbf63f8bf4 Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:53:32 -0500 Subject: [PATCH 01/10] initialize pq-keys branch --- .../key_management/key_tree/keys_public.rs | 70 +++++++--- wallet/configs/debug/wallet_config.json | 9 +- wallet/src/chain_storage.rs | 130 +++++++++--------- 3 files changed, 122 insertions(+), 87 deletions(-) diff --git a/key_protocol/src/key_management/key_tree/keys_public.rs b/key_protocol/src/key_management/key_tree/keys_public.rs index 28814398..8018f4b8 100644 --- a/key_protocol/src/key_management/key_tree/keys_public.rs +++ b/key_protocol/src/key_management/key_tree/keys_public.rs @@ -5,6 +5,7 @@ use crate::key_management::key_tree::traits::KeyNode; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ChildKeysPublic { + pub cssk: nssa::PrivateKey, pub csk: nssa::PrivateKey, pub cpk: nssa::PublicKey, pub ccc: [u8; 32], @@ -21,7 +22,7 @@ impl ChildKeysPublic { std::cmp::Ordering::Greater => { // BIP-032 compatibility requires 1-byte header from the public_key; // Not stored in `self.cpk.value()` - let sk = secp256k1::SecretKey::from_byte_array(*self.csk.value()) + let sk = secp256k1::SecretKey::from_byte_array(*self.cssk.value()) .expect("32 bytes, within curve order"); let pk = secp256k1::PublicKey::from_secret_key(&secp256k1::Secp256k1::new(), &sk); hash_input.extend_from_slice(&secp256k1::PublicKey::serialize(&pk)); @@ -32,7 +33,7 @@ impl ChildKeysPublic { // Harden _ => { hash_input.extend_from_slice(&[0u8]); - hash_input.extend_from_slice(self.csk.value()); + hash_input.extend_from_slice(self.cssk.value()); hash_input.extend_from_slice(&cci.to_be_bytes()); hmac_sha512::HMAC::mac(hash_input, self.ccc) @@ -45,11 +46,13 @@ impl KeyNode for ChildKeysPublic { fn root(seed: [u8; 64]) -> Self { let hash_value = hmac_sha512::HMAC::mac(seed, "LEE_master_pub"); - let csk = nssa::PrivateKey::try_new(*hash_value.first_chunk::<32>().unwrap()).unwrap(); + let cssk = nssa::PrivateKey::try_new(*hash_value.first_chunk::<32>().unwrap()).unwrap(); + let csk = nssa::PrivateKey::tweak(cssk.value()).unwrap(); let ccc = *hash_value.last_chunk::<32>().unwrap(); let cpk = nssa::PublicKey::new_from_private_key(&csk); Self { + cssk, csk, cpk, ccc, @@ -60,20 +63,22 @@ impl KeyNode for ChildKeysPublic { fn nth_child(&self, cci: u32) -> Self { let hash_value = self.compute_hash_value(cci); - let csk = secp256k1::SecretKey::from_byte_array( + let cssk = secp256k1::SecretKey::from_byte_array( *hash_value .first_chunk::<32>() .expect("hash_value is 64 bytes, must be safe to get first 32"), ) .unwrap(); - let csk = nssa::PrivateKey::try_new( - csk.add_tweak(&Scalar::from_be_bytes(*self.csk.value()).unwrap()) + let cssk = nssa::PrivateKey::try_new( + cssk.add_tweak(&Scalar::from_be_bytes(*self.cssk.value()).unwrap()) .expect("Expect a valid Scalar") .secret_bytes(), ) .unwrap(); + let csk = nssa::PrivateKey::tweak(cssk.value()).unwrap(); + if secp256k1::constants::CURVE_ORDER < *csk.value() { panic!("Secret key cannot exceed curve order"); } @@ -85,6 +90,7 @@ impl KeyNode for ChildKeysPublic { let cpk = nssa::PublicKey::new_from_private_key(&csk); Self { + cssk, csk, cpk, ccc, @@ -132,19 +138,26 @@ mod tests { 13, 146, 126, 232, 239, 113, 9, 194, 219, 190, 48, 187, 155, ]; - let expected_csk: PrivateKey = PrivateKey::try_new([ + let expected_cssk: PrivateKey = PrivateKey::try_new([ 40, 35, 239, 19, 53, 178, 250, 55, 115, 12, 34, 3, 153, 153, 72, 170, 190, 36, 172, 36, 202, 148, 181, 228, 35, 222, 58, 84, 156, 24, 146, 86, ]) .unwrap(); + let expected_csk: PrivateKey = PrivateKey::try_new([ + 207, 4, 246, 223, 104, 72, 19, 85, 14, 122, 194, 82, 32, 163, 60, 57, 8, 25, 209, 91, + 254, 107, 76, 238, 31, 68, 236, 192, 154, 78, 105, 118, + ]) + .unwrap(); + let expected_cpk: PublicKey = PublicKey::try_new([ - 219, 141, 130, 105, 11, 203, 187, 124, 112, 75, 223, 22, 11, 164, 153, 127, 59, 247, - 244, 166, 75, 66, 242, 224, 35, 156, 161, 75, 41, 51, 76, 245, + 188, 163, 203, 45, 151, 154, 230, 254, 123, 114, 158, 130, 19, 182, 164, 143, 150, 131, + 176, 7, 27, 58, 204, 116, 5, 247, 0, 255, 111, 160, 52, 201, ]) .unwrap(); assert!(expected_ccc == keys.ccc); + assert!(expected_cssk == keys.cssk); assert!(expected_csk == keys.csk); assert!(expected_cpk == keys.cpk); } @@ -166,19 +179,26 @@ mod tests { 130, 126, 123, 20, 90, 34, 173, 209, 101, 248, 155, 36, ]; - let expected_csk: PrivateKey = PrivateKey::try_new([ + let expected_cssk: PrivateKey = PrivateKey::try_new([ 9, 65, 33, 228, 25, 82, 219, 117, 91, 217, 11, 223, 144, 85, 246, 26, 123, 216, 107, 213, 33, 52, 188, 22, 198, 246, 71, 46, 245, 174, 16, 47, ]) .unwrap(); + let expected_csk: PrivateKey = PrivateKey::try_new([ + 100, 37, 212, 81, 40, 233, 72, 156, 177, 139, 50, 114, 136, 157, 202, 132, 203, 246, + 252, 242, 13, 81, 42, 100, 159, 240, 187, 252, 202, 108, 25, 105, + ]) + .unwrap(); + let expected_cpk: PublicKey = PublicKey::try_new([ - 142, 143, 238, 159, 105, 165, 224, 252, 108, 62, 53, 209, 176, 219, 249, 38, 90, 241, - 201, 81, 194, 146, 236, 5, 83, 152, 238, 243, 138, 16, 229, 15, + 210, 59, 119, 137, 21, 153, 82, 22, 195, 82, 12, 16, 80, 156, 125, 199, 19, 173, 46, + 224, 213, 144, 165, 126, 70, 129, 171, 141, 77, 212, 108, 233, ]) .unwrap(); assert!(expected_ccc == child_keys.ccc); + assert!(expected_cssk == child_keys.cssk); assert!(expected_csk == child_keys.csk); assert!(expected_cpk == child_keys.cpk); } @@ -200,19 +220,26 @@ mod tests { 16, 28, 79, 80, 232, 216, 101, 145, 19, 101, 220, 217, 141, ]; - let expected_csk: PrivateKey = PrivateKey::try_new([ + let expected_cssk: PrivateKey = PrivateKey::try_new([ 185, 147, 32, 242, 145, 91, 123, 77, 42, 33, 134, 84, 12, 165, 117, 70, 158, 201, 95, 153, 14, 12, 92, 235, 128, 156, 194, 169, 68, 35, 165, 127, ]) .unwrap(); + let expected_csk: PrivateKey = PrivateKey::try_new([ + 215, 157, 181, 165, 200, 92, 8, 103, 239, 104, 39, 41, 150, 199, 17, 205, 77, 179, 188, + 27, 168, 216, 198, 12, 94, 11, 72, 131, 148, 44, 166, 128, + ]) + .unwrap(); + let expected_cpk: PublicKey = PublicKey::try_new([ - 119, 16, 145, 121, 97, 244, 186, 35, 136, 34, 140, 171, 206, 139, 11, 208, 207, 121, - 158, 45, 28, 22, 140, 98, 161, 179, 212, 173, 238, 220, 2, 34, + 210, 66, 25, 100, 233, 50, 82, 94, 139, 83, 39, 52, 196, 241, 123, 248, 177, 10, 249, + 206, 71, 167, 198, 5, 202, 184, 178, 148, 106, 231, 214, 235, ]) .unwrap(); assert!(expected_ccc == child_keys.ccc); + assert!(expected_cssk == child_keys.cssk); assert!(expected_csk == child_keys.csk); assert!(expected_cpk == child_keys.cpk); } @@ -234,19 +261,26 @@ mod tests { 58, 215, 40, 246, 111, 166, 113, 183, 145, 173, 11, 27, 182, ]; - let expected_csk: PrivateKey = PrivateKey::try_new([ + let expected_cssk: PrivateKey = PrivateKey::try_new([ 223, 29, 87, 189, 126, 24, 117, 225, 190, 57, 0, 143, 207, 168, 231, 139, 170, 192, 81, 254, 126, 10, 115, 42, 141, 157, 70, 171, 199, 231, 198, 132, ]) .unwrap(); + let expected_csk: PrivateKey = PrivateKey::try_new([ + 35, 70, 190, 115, 134, 106, 151, 84, 164, 16, 139, 204, 100, 203, 36, 219, 91, 200, 6, + 52, 120, 67, 35, 82, 14, 197, 163, 27, 248, 162, 129, 159, + ]) + .unwrap(); + let expected_cpk: PublicKey = PublicKey::try_new([ - 96, 123, 245, 51, 214, 216, 215, 205, 70, 145, 105, 221, 166, 169, 122, 27, 94, 112, - 228, 110, 249, 177, 85, 173, 180, 248, 185, 199, 112, 246, 83, 33, + 61, 182, 68, 167, 177, 158, 173, 101, 79, 212, 191, 179, 169, 131, 220, 232, 123, 203, + 235, 244, 72, 251, 159, 98, 215, 85, 103, 49, 124, 137, 98, 39, ]) .unwrap(); assert!(expected_ccc == child_keys.ccc); + assert!(expected_cssk == child_keys.cssk); assert!(expected_csk == child_keys.csk); assert!(expected_cpk == child_keys.cpk); } diff --git a/wallet/configs/debug/wallet_config.json b/wallet/configs/debug/wallet_config.json index a3f025bd..3f366765 100644 --- a/wallet/configs/debug/wallet_config.json +++ b/wallet/configs/debug/wallet_config.json @@ -8,18 +8,19 @@ "initial_accounts": [ { "Public": { - "account_id": "DZJA7kNNqoYsBiDFSdjpQwzQbAg9SXHcVe7ruwW11Xqh", + "account_id": "KfDnqyHg5VVyhxnZyA9q3nCaJnuCscFogSDDC473Aqh", "pub_sign_key": [ - 106, 164, 195, 101, 105, 155, 137, 217, 99, 239, 133, 165, 152, 104, 185, 97, 43, 96, 1, 249, 7, 80, 180, 151, 6, 98, 166, 39, 118, 51, 46, 129 + 188, 163, 203, 45, 151, 154, 230, 254, 123, 114, 158, 130, 19, 182, 164, 143, 150, 131, 176, 7, 27, 58, 204, 116, 5, 247, 0, 255, 111, 160, 52, 201 ] } }, { "Public": { - "account_id": "gyaTLqDhi1b3W7xbSiZw1ToZMqJdHHgigTpK2hiZWS8", + "account_id": "HcHYYUFwwyGyRQKincqNbpPHf3XYoMthq4LkfNymoZF3", "pub_sign_key": [ - 194, 118, 30, 134, 242, 177, 171, 11, 64, 74, 249, 10, 99, 97, 126, 66, 154, 44, 229, 34, 200, 226, 178, 57, 185, 252, 130, 170, 23, 90, 68, 56 + 210, 59, 119, 137, 21, 153, 82, 22, 195, 82, 12, 16, 80, 156, 125, 199, 19, 173, 46, 224, 213, 144, 165, 126, 70, 129, 171, 141, 77, 212, 108, 233 ] + } }, { diff --git a/wallet/src/chain_storage.rs b/wallet/src/chain_storage.rs index 4961ee55..d1b4caaa 100644 --- a/wallet/src/chain_storage.rs +++ b/wallet/src/chain_storage.rs @@ -170,40 +170,40 @@ mod tests { let initial_acc1 = serde_json::from_str( r#"{ "Public": { - "account_id": "DZJA7kNNqoYsBiDFSdjpQwzQbAg9SXHcVe7ruwW11Xqh", + "account_id": "KfDnqyHg5VVyhxnZyA9q3nCaJnuCscFogSDDC473Aqh", "pub_sign_key": [ - 106, + 188, + 163, + 203, + 45, + 151, + 154, + 230, + 254, + 123, + 114, + 158, + 130, + 19, + 182, 164, - 195, - 101, - 105, - 155, - 137, - 217, - 99, - 239, - 133, - 165, - 152, - 104, - 185, - 97, - 43, - 96, - 1, - 249, - 7, - 80, - 180, - 151, - 6, - 98, - 166, - 39, - 118, - 51, - 46, - 129 + 143, + 150, + 131, + 176, + 7, + 27, + 58, + 204, + 116, + 5, + 247, + 0, + 255, + 111, + 160, + 52, + 201 ] } }"#, @@ -213,40 +213,40 @@ mod tests { let initial_acc2 = serde_json::from_str( r#"{ "Public": { - "account_id": "7wHg9sbJwc6h3NP1S9bekfAzB8CHifEcxKswCKUt3YQo", + "account_id": "HcHYYUFwwyGyRQKincqNbpPHf3XYoMthq4LkfNymoZF3", "pub_sign_key": [ - 113, - 121, - 64, - 177, - 204, - 85, - 229, - 214, - 178, - 6, - 109, - 191, - 29, - 154, - 63, - 38, - 242, - 18, - 244, - 219, - 8, - 208, - 35, - 136, - 23, - 127, - 207, - 237, - 216, - 169, - 190, - 27 + 210, + 59, + 119, + 137, + 21, + 153, + 82, + 22, + 195, + 82, + 12, + 16, + 80, + 156, + 125, + 199, + 19, + 173, + 46, + 224, + 213, + 144, + 165, + 126, + 70, + 129, + 171, + 141, + 77, + 212, + 108, + 233 ] } }"#, From bbb9613e062d7dac1e5de12445eacce0de968adc Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Thu, 26 Feb 2026 17:07:45 -0500 Subject: [PATCH 02/10] minor update --- nssa/src/signature/private_key.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nssa/src/signature/private_key.rs b/nssa/src/signature/private_key.rs index 667fc306..4536bbe3 100644 --- a/nssa/src/signature/private_key.rs +++ b/nssa/src/signature/private_key.rs @@ -1,4 +1,5 @@ use rand::{Rng, rngs::OsRng}; +use risc0_zkvm::sha::{Impl, Sha256}; use serde::{Deserialize, Serialize}; use crate::error::NssaError; @@ -35,6 +36,25 @@ impl PrivateKey { pub fn value(&self) -> &[u8; 32] { &self.0 } + + pub fn tweak(value: &[u8; 32]) -> Result { + assert!(Self::is_valid_key(*value)); + + let sk = secp256k1::SecretKey::from_byte_array(*value).unwrap(); + + let mut bytes = vec![]; + let pk = secp256k1::PublicKey::from_secret_key(&secp256k1::Secp256k1::new(), &sk); + bytes.extend_from_slice(&secp256k1::PublicKey::serialize(&pk)); + let hashed: [u8; 32] = Impl::hash_bytes(&bytes).as_bytes().try_into().unwrap(); + + let tweaked_sk = PrivateKey::try_new( + sk.add_tweak(&secp256k1::Scalar::from_be_bytes(hashed).unwrap()) + .expect("Expect a valid Scalar") + .secret_bytes(), + ); + + tweaked_sk + } } #[cfg(test)] From 8dd2b238a5a96f20945c0d90ef582c50003e847d Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Thu, 26 Feb 2026 19:07:04 -0500 Subject: [PATCH 03/10] fixed lint and unit test --- key_protocol/src/key_management/key_tree/mod.rs | 4 ++-- nssa/src/signature/private_key.rs | 6 ++---- wallet/configs/debug/wallet_config.json | 4 ++-- wallet/src/chain_storage.rs | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/key_protocol/src/key_management/key_tree/mod.rs b/key_protocol/src/key_management/key_tree/mod.rs index ead60595..d0381221 100644 --- a/key_protocol/src/key_management/key_tree/mod.rs +++ b/key_protocol/src/key_management/key_tree/mod.rs @@ -345,8 +345,8 @@ mod tests { assert!(tree.key_map.contains_key(&ChainIndex::root())); assert!(tree.account_id_map.contains_key(&AccountId::new([ - 172, 82, 222, 249, 164, 16, 148, 184, 219, 56, 92, 145, 203, 220, 251, 89, 214, 178, - 38, 30, 108, 202, 251, 241, 148, 200, 125, 185, 93, 227, 189, 247 + 10, 231, 159, 65, 236, 46, 205, 5, 172, 89, 250, 29, 123, 195, 212, 137, 155, 111, 40, + 120, 53, 28, 124, 54, 224, 170, 119, 208, 2, 72, 75, 50 ]))); } diff --git a/nssa/src/signature/private_key.rs b/nssa/src/signature/private_key.rs index 4536bbe3..d7bd6598 100644 --- a/nssa/src/signature/private_key.rs +++ b/nssa/src/signature/private_key.rs @@ -47,13 +47,11 @@ impl PrivateKey { bytes.extend_from_slice(&secp256k1::PublicKey::serialize(&pk)); let hashed: [u8; 32] = Impl::hash_bytes(&bytes).as_bytes().try_into().unwrap(); - let tweaked_sk = PrivateKey::try_new( + PrivateKey::try_new( sk.add_tweak(&secp256k1::Scalar::from_be_bytes(hashed).unwrap()) .expect("Expect a valid Scalar") .secret_bytes(), - ); - - tweaked_sk + ) } } diff --git a/wallet/configs/debug/wallet_config.json b/wallet/configs/debug/wallet_config.json index 3f366765..e2dd6dc2 100644 --- a/wallet/configs/debug/wallet_config.json +++ b/wallet/configs/debug/wallet_config.json @@ -8,7 +8,7 @@ "initial_accounts": [ { "Public": { - "account_id": "KfDnqyHg5VVyhxnZyA9q3nCaJnuCscFogSDDC473Aqh", + "account_id": "GLuGnLWZahxEEMPWKhu2r2LYhdBzTB2EFPsNPUpg7KKc", "pub_sign_key": [ 188, 163, 203, 45, 151, 154, 230, 254, 123, 114, 158, 130, 19, 182, 164, 143, 150, 131, 176, 7, 27, 58, 204, 116, 5, 247, 0, 255, 111, 160, 52, 201 ] @@ -16,7 +16,7 @@ }, { "Public": { - "account_id": "HcHYYUFwwyGyRQKincqNbpPHf3XYoMthq4LkfNymoZF3", + "account_id": "8wbZV1W1b6P2ShtsgJTh9p2uwjZ6KR6P6qc5u3uRvKPH", "pub_sign_key": [ 210, 59, 119, 137, 21, 153, 82, 22, 195, 82, 12, 16, 80, 156, 125, 199, 19, 173, 46, 224, 213, 144, 165, 126, 70, 129, 171, 141, 77, 212, 108, 233 ] diff --git a/wallet/src/chain_storage.rs b/wallet/src/chain_storage.rs index d1b4caaa..6123bcc2 100644 --- a/wallet/src/chain_storage.rs +++ b/wallet/src/chain_storage.rs @@ -170,7 +170,7 @@ mod tests { let initial_acc1 = serde_json::from_str( r#"{ "Public": { - "account_id": "KfDnqyHg5VVyhxnZyA9q3nCaJnuCscFogSDDC473Aqh", + "account_id": "GLuGnLWZahxEEMPWKhu2r2LYhdBzTB2EFPsNPUpg7KKc", "pub_sign_key": [ 188, 163, @@ -213,7 +213,7 @@ mod tests { let initial_acc2 = serde_json::from_str( r#"{ "Public": { - "account_id": "HcHYYUFwwyGyRQKincqNbpPHf3XYoMthq4LkfNymoZF3", + "account_id": "8wbZV1W1b6P2ShtsgJTh9p2uwjZ6KR6P6qc5u3uRvKPH", "pub_sign_key": [ 210, 59, From 081e890917149124c7d6971c828c94972f86087c Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Fri, 27 Feb 2026 18:59:05 -0500 Subject: [PATCH 04/10] update configs --- indexer/service/configs/indexer_config.json | 126 ++-- .../configs/debug/sequencer_config.json | 130 ++-- .../configs/docker/sequencer_config.json | 124 ++-- wallet/configs/debug/wallet_config.json | 553 ++++++++++++++--- wallet/src/chain_storage.rs | 128 ++-- wallet/src/config.rs | 582 ++++++++++++------ 6 files changed, 1113 insertions(+), 530 deletions(-) diff --git a/indexer/service/configs/indexer_config.json b/indexer/service/configs/indexer_config.json index 247caa8e..8b1b3c5e 100644 --- a/indexer/service/configs/indexer_config.json +++ b/indexer/service/configs/indexer_config.json @@ -11,49 +11,49 @@ "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", "initial_accounts": [ { - "account_id": "BLgCRDXYdQPMMWVHYRFGQZbgeHx9frkipa8GtpG2Syqy", + "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", "balance": 10000 }, { - "account_id": "Gj1mJy5W7J5pfmLRujmQaLfLMWidNxQ6uwnhb666ZwHw", + "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", "balance": 20000 } ], "initial_commitments": [ { "npk": [ - 63, - 202, - 178, + 139, + 19, + 158, + 11, + 155, 231, - 183, - 82, - 237, - 212, - 216, - 221, - 215, - 255, - 153, - 101, - 177, - 161, - 254, - 210, - 128, - 122, - 54, - 190, - 230, - 151, - 183, - 64, - 225, - 229, - 113, - 1, + 85, + 206, + 132, 228, - 97 + 220, + 114, + 145, + 89, + 113, + 156, + 238, + 142, + 242, + 74, + 182, + 91, + 43, + 100, + 6, + 190, + 31, + 15, + 31, + 88, + 96, + 204 ], "account": { "program_owner": [ @@ -73,38 +73,38 @@ }, { "npk": [ - 192, - 251, - 166, - 243, - 167, - 236, - 84, - 249, - 35, - 136, - 130, + 173, + 134, + 33, + 223, + 54, + 226, + 10, + 71, + 215, + 254, + 143, 172, - 219, - 225, - 161, - 139, - 229, - 89, - 243, - 125, - 194, - 213, - 209, - 30, - 23, - 174, - 100, + 24, 244, - 124, - 74, - 140, - 47 + 243, + 208, + 65, + 112, + 118, + 70, + 217, + 240, + 69, + 100, + 129, + 3, + 121, + 25, + 213, + 132, + 42, + 45 ], "account": { "program_owner": [ @@ -157,4 +157,4 @@ 37, 37 ] -} +} \ No newline at end of file diff --git a/sequencer_runner/configs/debug/sequencer_config.json b/sequencer_runner/configs/debug/sequencer_config.json index b53124c2..a2306dee 100644 --- a/sequencer_runner/configs/debug/sequencer_config.json +++ b/sequencer_runner/configs/debug/sequencer_config.json @@ -20,50 +20,50 @@ "indexer_rpc_url": "ws://localhost:8779", "initial_accounts": [ { - "account_id": "6iArKUXxhUJqS7kCaPNhwMWt3ro71PDyBj7jwAyE2VQV", + "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", "balance": 10000 }, { - "account_id": "7wHg9sbJwc6h3NP1S9bekfAzB8CHifEcxKswCKUt3YQo", + "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", "balance": 20000 } ], "initial_commitments": [ { - "npk":[ - 177, - 64, - 1, + "npk": [ + 139, + 19, + 158, 11, - 87, - 38, - 254, - 159, + 155, 231, - 165, - 1, - 94, - 64, - 137, - 243, - 76, - 249, - 101, - 251, - 129, - 33, - 101, - 189, - 30, - 42, - 11, - 191, - 34, - 103, - 186, - 227, - 230 - ] , + 85, + 206, + 132, + 228, + 220, + 114, + 145, + 89, + 113, + 156, + 238, + 142, + 242, + 74, + 182, + 91, + 43, + 100, + 6, + 190, + 31, + 15, + 31, + 88, + 96, + 204 + ], "account": { "program_owner": [ 0, @@ -82,38 +82,38 @@ }, { "npk": [ - 32, - 67, - 72, - 164, - 106, - 53, - 66, - 239, - 141, - 15, - 52, - 230, - 136, - 177, - 2, - 236, - 207, - 243, + 173, 134, - 135, - 210, - 143, - 87, - 232, + 33, + 223, + 54, + 226, + 10, + 71, 215, - 128, - 194, - 120, - 113, - 224, - 4, - 165 + 254, + 143, + 172, + 24, + 244, + 243, + 208, + 65, + 112, + 118, + 70, + 217, + 240, + 69, + 100, + 129, + 3, + 121, + 25, + 213, + 132, + 42, + 45 ], "account": { "program_owner": [ @@ -166,4 +166,4 @@ 37, 37 ] -} +} \ No newline at end of file diff --git a/sequencer_runner/configs/docker/sequencer_config.json b/sequencer_runner/configs/docker/sequencer_config.json index ce79f4e2..45cef1b6 100644 --- a/sequencer_runner/configs/docker/sequencer_config.json +++ b/sequencer_runner/configs/docker/sequencer_config.json @@ -20,49 +20,49 @@ "indexer_rpc_url": "ws://localhost:8779", "initial_accounts": [ { - "account_id": "6iArKUXxhUJqS7kCaPNhwMWt3ro71PDyBj7jwAyE2VQV", + "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", "balance": 10000 }, { - "account_id": "7wHg9sbJwc6h3NP1S9bekfAzB8CHifEcxKswCKUt3YQo", + "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", "balance": 20000 } ], "initial_commitments": [ { "npk": [ - 63, - 202, - 178, + 139, + 19, + 158, + 11, + 155, 231, - 183, - 82, - 237, - 212, - 216, - 221, - 215, - 255, - 153, - 101, - 177, - 161, - 254, - 210, - 128, - 122, - 54, - 190, - 230, - 151, - 183, - 64, - 225, - 229, - 113, - 1, + 85, + 206, + 132, 228, - 97 + 220, + 114, + 145, + 89, + 113, + 156, + 238, + 142, + 242, + 74, + 182, + 91, + 43, + 100, + 6, + 190, + 31, + 15, + 31, + 88, + 96, + 204 ], "account": { "program_owner": [ @@ -82,38 +82,38 @@ }, { "npk": [ - 192, - 251, - 166, - 243, - 167, - 236, - 84, - 249, - 35, - 136, - 130, + 173, + 134, + 33, + 223, + 54, + 226, + 10, + 71, + 215, + 254, + 143, 172, - 219, - 225, - 161, - 139, - 229, - 89, - 243, - 125, - 194, - 213, - 209, - 30, - 23, - 174, - 100, + 24, 244, - 124, - 74, - 140, - 47 + 243, + 208, + 65, + 112, + 118, + 70, + 217, + 240, + 69, + 100, + 129, + 3, + 121, + 25, + 213, + 132, + 42, + 45 ], "account": { "program_owner": [ diff --git a/wallet/configs/debug/wallet_config.json b/wallet/configs/debug/wallet_config.json index e2dd6dc2..3f77d265 100644 --- a/wallet/configs/debug/wallet_config.json +++ b/wallet/configs/debug/wallet_config.json @@ -1,86 +1,479 @@ { - "override_rust_log": null, - "sequencer_addr": "http://127.0.0.1:3040", - "seq_poll_timeout": "30s", - "seq_tx_poll_max_blocks": 15, - "seq_poll_max_retries": 10, - "seq_block_poll_max_amount": 100, - "initial_accounts": [ - { - "Public": { - "account_id": "GLuGnLWZahxEEMPWKhu2r2LYhdBzTB2EFPsNPUpg7KKc", - "pub_sign_key": [ - 188, 163, 203, 45, 151, 154, 230, 254, 123, 114, 158, 130, 19, 182, 164, 143, 150, 131, 176, 7, 27, 58, 204, 116, 5, 247, 0, 255, 111, 160, 52, 201 - ] - } - }, - { - "Public": { - "account_id": "8wbZV1W1b6P2ShtsgJTh9p2uwjZ6KR6P6qc5u3uRvKPH", - "pub_sign_key": [ - 210, 59, 119, 137, 21, 153, 82, 22, 195, 82, 12, 16, 80, 156, 125, 199, 19, 173, 46, 224, 213, 144, 165, 126, 70, 129, 171, 141, 77, 212, 108, 233 - ] - - } - }, + "override_rust_log": null, + "sequencer_addr": "http://127.0.0.1:3040", + "seq_poll_timeout": "30s", + "seq_tx_poll_max_blocks": 15, + "seq_poll_max_retries": 10, + "seq_block_poll_max_amount": 100, + "initial_accounts": [ { - "Private": { - "account_id": "HWkW5qd4XK3me6sCAb4bfPj462k33DjtKtEcYpuzNwB", - "account": { - "program_owner": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "balance": 10000, - "data": [], - "nonce": 0 + "Public": { + "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + "pub_sign_key": [ + 3, + 217, + 68, + 59, + 58, + 39, + 27, + 77, + 102, + 214, + 182, + 35, + 220, + 146, + 92, + 88, + 125, + 120, + 95, + 92, + 96, + 132, + 73, + 53, + 44, + 6, + 28, + 190, + 203, + 155, + 196, + 56 + ] + } }, - "key_chain": { - "secret_spending_key": [14, 202, 241, 109, 32, 181, 152, 140, 76, 153, 108, 57, 77, 192, 181, 97, 108, 144, 122, 45, 219, 5, 203, 193, 82, 123, 83, 34, 250, 214, 137, 63], - "private_key_holder": { - "nullifier_secret_key": [174, 56, 101, 30, 248, 249, 100, 0, 122, 199, 209, 246, 58, 163, 223, 146, 59, 143, 78, 95, 41, 186, 106, 187, 53, 63, 75, 244, 233, 185, 110, 199], - "viewing_secret_key": [251, 85, 223, 73, 142, 127, 134, 132, 185, 210, 100, 103, 198, 108, 229, 80, 176, 211, 249, 114, 110, 7, 225, 17, 7, 69, 204, 32, 47, 242, 103, 247] - }, - "nullifer_public_key": [139, 19, 158, 11, 155, 231, 85, 206, 132, 228, 220, 114, 145, 89, 113, 156, 238, 142, 242, 74, 182, 91, 43, 100, 6, 190, 31, 15, 31, 88, 96, 204], - "viewing_public_key": [3, 136, 153, 50, 191, 184, 135, 36, 29, 107, 57, 9, 218, 135, 249, 213, 118, 215, 118, 173, 30, 137, 116, 77, 17, 86, 62, 154, 31, 173, 19, 167, 211] - } - } - }, - { - "Private": { - "account_id": "HUpbRQ1vEcZv5y6TDYv9tpt1VA64ji2v4RDLJfK2rpZn", - "account": { - "program_owner": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "balance": 20000, - "data": [], - "nonce": 0 + { + "Public": { + "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + "pub_sign_key": [ + 167, + 65, + 139, + 108, + 159, + 127, + 141, + 227, + 127, + 252, + 137, + 193, + 25, + 65, + 127, + 143, + 27, + 203, + 56, + 226, + 251, + 60, + 32, + 143, + 195, + 225, + 39, + 160, + 29, + 20, + 135, + 232 + ] + } }, - "key_chain": { - "secret_spending_key": [32, 162, 244, 221, 2, 133, 168, 250, 240, 52, 92, 187, 157, 116, 249, 203, 143, 194, 214, 112, 115, 142, 153, 78, 241, 173, 103, 242, 192, 196, 29, 133], - "private_key_holder": { - "nullifier_secret_key": [188, 235, 121, 54, 131, 206, 7, 215, 94, 231, 102, 22, 12, 27, 253, 161, 248, 206, 41, 160, 206, 149, 5, 217, 127, 235, 154, 230, 198, 232, 102, 31], - "viewing_secret_key": [89, 116, 140, 122, 211, 179, 190, 229, 18, 94, 56, 235, 48, 99, 104, 228, 111, 72, 231, 18, 247, 97, 110, 60, 238, 138, 0, 25, 92, 44, 30, 145] - }, - "nullifer_public_key": [173, 134, 33, 223, 54, 226, 10, 71, 215, 254, 143, 172, 24, 244, 243, 208, 65, 112, 118, 70, 217, 240, 69, 100, 129, 3, 121, 25, 213, 132, 42, 45], - "viewing_public_key": [2, 43, 42, 253, 112, 83, 195, 164, 26, 141, 92, 28, 224, 120, 155, 119, 225, 1, 45, 42, 245, 172, 134, 136, 52, 183, 170, 96, 115, 212, 114, 120, 37] + { + "Private": { + "account_id": "HWkW5qd4XK3me6sCAb4bfPj462k33DjtKtEcYpuzNwB", + "account": { + "program_owner": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "balance": 10000, + "data": [], + "nonce": 0 + }, + "key_chain": { + "secret_spending_key": [ + 14, + 202, + 241, + 109, + 32, + 181, + 152, + 140, + 76, + 153, + 108, + 57, + 77, + 192, + 181, + 97, + 108, + 144, + 122, + 45, + 219, + 5, + 203, + 193, + 82, + 123, + 83, + 34, + 250, + 214, + 137, + 63 + ], + "private_key_holder": { + "nullifier_secret_key": [ + 174, + 56, + 101, + 30, + 248, + 249, + 100, + 0, + 122, + 199, + 209, + 246, + 58, + 163, + 223, + 146, + 59, + 143, + 78, + 95, + 41, + 186, + 106, + 187, + 53, + 63, + 75, + 244, + 233, + 185, + 110, + 199 + ], + "viewing_secret_key": [ + 251, + 85, + 223, + 73, + 142, + 127, + 134, + 132, + 185, + 210, + 100, + 103, + 198, + 108, + 229, + 80, + 176, + 211, + 249, + 114, + 110, + 7, + 225, + 17, + 7, + 69, + 204, + 32, + 47, + 242, + 103, + 247 + ] + }, + "nullifier_public_key": [ + 139, + 19, + 158, + 11, + 155, + 231, + 85, + 206, + 132, + 228, + 220, + 114, + 145, + 89, + 113, + 156, + 238, + 142, + 242, + 74, + 182, + 91, + 43, + 100, + 6, + 190, + 31, + 15, + 31, + 88, + 96, + 204 + ], + "viewing_public_key": [ + 3, + 136, + 153, + 50, + 191, + 184, + 135, + 36, + 29, + 107, + 57, + 9, + 218, + 135, + 249, + 213, + 118, + 215, + 118, + 173, + 30, + 137, + 116, + 77, + 17, + 86, + 62, + 154, + 31, + 173, + 19, + 167, + 211 + ] + } + } + }, + { + "Private": { + "account_id": "HUpbRQ1vEcZv5y6TDYv9tpt1VA64ji2v4RDLJfK2rpZn", + "account": { + "program_owner": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "balance": 20000, + "data": [], + "nonce": 0 + }, + "key_chain": { + "secret_spending_key": [ + 32, + 162, + 244, + 221, + 2, + 133, + 168, + 250, + 240, + 52, + 92, + 187, + 157, + 116, + 249, + 203, + 143, + 194, + 214, + 112, + 115, + 142, + 153, + 78, + 241, + 173, + 103, + 242, + 192, + 196, + 29, + 133 + ], + "private_key_holder": { + "nullifier_secret_key": [ + 188, + 235, + 121, + 54, + 131, + 206, + 7, + 215, + 94, + 231, + 102, + 22, + 12, + 27, + 253, + 161, + 248, + 206, + 41, + 160, + 206, + 149, + 5, + 217, + 127, + 235, + 154, + 230, + 198, + 232, + 102, + 31 + ], + "viewing_secret_key": [ + 89, + 116, + 140, + 122, + 211, + 179, + 190, + 229, + 18, + 94, + 56, + 235, + 48, + 99, + 104, + 228, + 111, + 72, + 231, + 18, + 247, + 97, + 110, + 60, + 238, + 138, + 0, + 25, + 92, + 44, + 30, + 145 + ] + }, + "nullifier_public_key": [ + 173, + 134, + 33, + 223, + 54, + 226, + 10, + 71, + 215, + 254, + 143, + 172, + 24, + 244, + 243, + 208, + 65, + 112, + 118, + 70, + 217, + 240, + 69, + 100, + 129, + 3, + 121, + 25, + 213, + 132, + 42, + 45 + ], + "viewing_public_key": [ + 2, + 43, + 42, + 253, + 112, + 83, + 195, + 164, + 26, + 141, + 92, + 28, + 224, + 120, + 155, + 119, + 225, + 1, + 45, + 42, + 245, + 172, + 134, + 136, + 52, + 183, + 170, + 96, + 115, + 212, + 114, + 120, + 37 + ] + } + } } - } - } - ], - "basic_auth": null + ], + "basic_auth": null } \ No newline at end of file diff --git a/wallet/src/chain_storage.rs b/wallet/src/chain_storage.rs index 6123bcc2..8832729a 100644 --- a/wallet/src/chain_storage.rs +++ b/wallet/src/chain_storage.rs @@ -170,40 +170,40 @@ mod tests { let initial_acc1 = serde_json::from_str( r#"{ "Public": { - "account_id": "GLuGnLWZahxEEMPWKhu2r2LYhdBzTB2EFPsNPUpg7KKc", + "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", "pub_sign_key": [ - 188, - 163, - 203, - 45, - 151, - 154, - 230, - 254, - 123, - 114, - 158, - 130, - 19, - 182, - 164, - 143, - 150, - 131, - 176, - 7, - 27, + 3, + 217, + 68, + 59, 58, - 204, - 116, - 5, - 247, - 0, - 255, - 111, - 160, - 52, - 201 + 39, + 27, + 77, + 102, + 214, + 182, + 35, + 220, + 146, + 92, + 88, + 125, + 120, + 95, + 92, + 96, + 132, + 73, + 53, + 44, + 6, + 28, + 190, + 203, + 155, + 196, + 56 ] } }"#, @@ -213,40 +213,40 @@ mod tests { let initial_acc2 = serde_json::from_str( r#"{ "Public": { - "account_id": "8wbZV1W1b6P2ShtsgJTh9p2uwjZ6KR6P6qc5u3uRvKPH", + "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", "pub_sign_key": [ - 210, - 59, - 119, - 137, - 21, - 153, - 82, - 22, - 195, - 82, - 12, - 16, - 80, - 156, - 125, - 199, - 19, - 173, - 46, - 224, - 213, - 144, - 165, - 126, - 70, - 129, - 171, - 141, - 77, - 212, + 167, + 65, + 139, 108, - 233 + 159, + 127, + 141, + 227, + 127, + 252, + 137, + 193, + 25, + 65, + 127, + 143, + 27, + 203, + 56, + 226, + 251, + 60, + 32, + 143, + 195, + 225, + 39, + 160, + 29, + 20, + 135, + 232 ] } }"#, diff --git a/wallet/src/config.rs b/wallet/src/config.rs index 3780a065..caa3eaba 100644 --- a/wallet/src/config.rs +++ b/wallet/src/config.rs @@ -214,88 +214,88 @@ impl Default for WalletConfig { basic_auth: None, initial_accounts: { let init_acc_json = r#" - [ + [ { "Public": { - "account_id": "6iArKUXxhUJqS7kCaPNhwMWt3ro71PDyBj7jwAyE2VQV", + "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", "pub_sign_key": [ - 16, - 162, - 106, - 154, - 236, - 125, - 52, - 184, - 35, - 100, - 238, - 174, - 69, - 197, - 41, + 3, + 217, + 68, + 59, + 58, + 39, + 27, 77, - 187, - 10, - 118, - 75, - 0, - 11, - 148, - 238, - 185, - 181, - 133, - 17, + 102, + 214, + 182, + 35, 220, - 72, - 124, - 77 + 146, + 92, + 88, + 125, + 120, + 95, + 92, + 96, + 132, + 73, + 53, + 44, + 6, + 28, + 190, + 203, + 155, + 196, + 56 ] } }, { "Public": { - "account_id": "7wHg9sbJwc6h3NP1S9bekfAzB8CHifEcxKswCKUt3YQo", + "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", "pub_sign_key": [ - 113, - 121, - 64, - 177, - 204, - 85, - 229, - 214, - 178, - 6, - 109, - 191, - 29, - 154, - 63, - 38, - 242, - 18, - 244, - 219, - 8, - 208, - 35, - 136, - 23, + 167, + 65, + 139, + 108, + 159, 127, - 207, - 237, - 216, - 169, - 190, - 27 + 141, + 227, + 127, + 252, + 137, + 193, + 25, + 65, + 127, + 143, + 27, + 203, + 56, + 226, + 251, + 60, + 32, + 143, + 195, + 225, + 39, + 160, + 29, + 20, + 135, + 232 ] } }, { "Private": { - "account_id": "FpdcxBrMkHWqXCBQ6FG98eYfWGY6jWZRsKNSi1FwDMxy", + "account_id": "HWkW5qd4XK3me6sCAb4bfPj462k33DjtKtEcYpuzNwB", "account": { "program_owner": [ 0, @@ -313,151 +313,184 @@ impl Default for WalletConfig { }, "key_chain": { "secret_spending_key": [ - 239, - 27, - 159, - 83, - 199, - 194, - 132, - 33, - 20, - 28, - 217, - 103, - 101, - 57, - 27, - 125, - 84, - 57, - 19, - 86, - 98, - 135, - 161, - 221, - 108, - 125, + 14, + 202, + 241, + 109, + 32, + 181, 152, - 174, - 161, - 64, - 16, - 200 + 140, + 76, + 153, + 108, + 57, + 77, + 192, + 181, + 97, + 108, + 144, + 122, + 45, + 219, + 5, + 203, + 193, + 82, + 123, + 83, + 34, + 250, + 214, + 137, + 63 ], "private_key_holder": { "nullifier_secret_key": [ - 71, - 195, - 16, - 119, + 174, + 56, + 101, + 30, + 248, + 249, + 100, 0, - 98, - 35, - 106, - 139, - 82, - 145, - 50, - 27, - 140, - 206, - 19, - 53, 122, - 166, - 76, - 195, - 0, - 16, - 19, - 21, + 199, + 209, + 246, + 58, + 163, + 223, + 146, + 59, 143, - 155, - 119, - 9, - 200, - 81, - 105 + 78, + 95, + 41, + 186, + 106, + 187, + 53, + 63, + 75, + 244, + 233, + 185, + 110, + 199 ], "viewing_secret_key": [ - 5, - 117, - 221, - 27, - 236, - 199, - 53, - 22, + 251, + 85, + 223, + 73, + 142, + 127, + 134, + 132, + 185, + 210, + 100, + 103, + 198, + 108, + 229, + 80, + 176, + 211, 249, - 231, - 98, - 147, - 213, - 116, - 191, - 82, - 188, - 148, - 175, - 98, - 139, - 52, - 232, - 249, - 220, - 217, - 83, - 58, - 112, - 155, - 197, - 196 + 114, + 110, + 7, + 225, + 17, + 7, + 69, + 204, + 32, + 47, + 242, + 103, + 247 ] }, - "nullifer_public_key": [ - 177, - 64, - 1, + "nullifier_public_key": [ + 139, + 19, + 158, 11, - 87, - 38, - 254, - 159, + 155, 231, - 165, - 1, - 94, - 64, - 137, - 243, - 76, - 249, - 101, - 251, - 129, - 33, - 101, - 189, - 30, - 42, - 11, - 191, - 34, - 103, - 186, - 227, - 230 + 85, + 206, + 132, + 228, + 220, + 114, + 145, + 89, + 113, + 156, + 238, + 142, + 242, + 74, + 182, + 91, + 43, + 100, + 6, + 190, + 31, + 15, + 31, + 88, + 96, + 204 ], "viewing_public_key": [ - 2, 69, 126, 43, 158, 209, 172, 144, 23, 185, 208, 25, 163, 166, 176, 200, 225, 251, 106, 211, 4, 199, 112, 243, 207, 144, 135, 56, 157, 167, 32, 219, 38] + 3, + 136, + 153, + 50, + 191, + 184, + 135, + 36, + 29, + 107, + 57, + 9, + 218, + 135, + 249, + 213, + 118, + 215, + 118, + 173, + 30, + 137, + 116, + 77, + 17, + 86, + 62, + 154, + 31, + 173, + 19, + 167, + 211 + ] } } }, { "Private": { - "account_id": "E8HwiTyQe4H9HK7icTvn95HQMnzx49mP9A2ddtMLpNaN", + "account_id": "HUpbRQ1vEcZv5y6TDYv9tpt1VA64ji2v4RDLJfK2rpZn", "account": { "program_owner": [ 0, @@ -475,26 +508,183 @@ impl Default for WalletConfig { }, "key_chain": { "secret_spending_key": [ - 48, 175, 124, 10, 230, 240, 166, 14, 249, 254, 157, 226, 208, 124, 122, 177, 203, 139, 192, 180, 43, 120, 55, 151, 50, 21, 113, 22, 254, 83, 148, 56], + 32, + 162, + 244, + 221, + 2, + 133, + 168, + 250, + 240, + 52, + 92, + 187, + 157, + 116, + 249, + 203, + 143, + 194, + 214, + 112, + 115, + 142, + 153, + 78, + 241, + 173, + 103, + 242, + 192, + 196, + 29, + 133 + ], "private_key_holder": { "nullifier_secret_key": [ - 99, 82, 190, 140, 234, 10, 61, 163, 15, 211, 179, 54, 70, 166, 87, 5, 182, 68, 117, 244, 217, 23, 99, 9, 4, 177, 230, 125, 109, 91, 160, 30 + 188, + 235, + 121, + 54, + 131, + 206, + 7, + 215, + 94, + 231, + 102, + 22, + 12, + 27, + 253, + 161, + 248, + 206, + 41, + 160, + 206, + 149, + 5, + 217, + 127, + 235, + 154, + 230, + 198, + 232, + 102, + 31 ], "viewing_secret_key": [ - 205, 32, 76, 251, 255, 236, 96, 119, 61, 111, 65, 100, 75, 218, 12, 22, 17, 170, 55, 226, 21, 154, 161, 34, 208, 74, 27, 1, 119, 13, 88, 128 + 89, + 116, + 140, + 122, + 211, + 179, + 190, + 229, + 18, + 94, + 56, + 235, + 48, + 99, + 104, + 228, + 111, + 72, + 231, + 18, + 247, + 97, + 110, + 60, + 238, + 138, + 0, + 25, + 92, + 44, + 30, + 145 ] }, - "nullifer_public_key": [ - 32, 67, 72, 164, 106, 53, 66, 239, 141, 15, 52, 230, 136, 177, 2, 236, 207, 243, 134, 135, 210, 143, 87, 232, 215, 128, 194, 120, 113, 224, 4, 165 + "nullifier_public_key": [ + 173, + 134, + 33, + 223, + 54, + 226, + 10, + 71, + 215, + 254, + 143, + 172, + 24, + 244, + 243, + 208, + 65, + 112, + 118, + 70, + 217, + 240, + 69, + 100, + 129, + 3, + 121, + 25, + 213, + 132, + 42, + 45 ], "viewing_public_key": [ - 2, 79, 110, 46, 203, 29, 206, 205, 18, 86, 27, 189, 104, 103, 113, 181, 110, 53, 78, 172, 11, 171, 190, 18, 126, 214, 81, 77, 192, 154, 58, 195, 238 + 2, + 43, + 42, + 253, + 112, + 83, + 195, + 164, + 26, + 141, + 92, + 28, + 224, + 120, + 155, + 119, + 225, + 1, + 45, + 42, + 245, + 172, + 134, + 136, + 52, + 183, + 170, + 96, + 115, + 212, + 114, + 120, + 37 ] } } } ] - "#; + "#; serde_json::from_str(init_acc_json).unwrap() }, } From 271d495812e1526cbccc62171559e77c29d4a5ba Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:48:24 -0500 Subject: [PATCH 05/10] add necessary typo back --- wallet/configs/debug/wallet_config.json | 4 ++-- wallet/src/config.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wallet/configs/debug/wallet_config.json b/wallet/configs/debug/wallet_config.json index 3f77d265..f973712e 100644 --- a/wallet/configs/debug/wallet_config.json +++ b/wallet/configs/debug/wallet_config.json @@ -207,7 +207,7 @@ 247 ] }, - "nullifier_public_key": [ + "nullifer_public_key": [ 139, 19, 158, @@ -402,7 +402,7 @@ 145 ] }, - "nullifier_public_key": [ + "nullifer_public_key": [ 173, 134, 33, diff --git a/wallet/src/config.rs b/wallet/src/config.rs index caa3eaba..59cf66e8 100644 --- a/wallet/src/config.rs +++ b/wallet/src/config.rs @@ -416,7 +416,7 @@ impl Default for WalletConfig { 247 ] }, - "nullifier_public_key": [ + "nullifer_public_key": [ 139, 19, 158, @@ -611,7 +611,7 @@ impl Default for WalletConfig { 145 ] }, - "nullifier_public_key": [ + "nullifer_public_key": [ 173, 134, 33, From b5f7ceb84c183450bed3632e631c859fcaec019d Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Mon, 16 Mar 2026 09:28:39 -0400 Subject: [PATCH 06/10] updated configs --- indexer/service/configs/indexer_config.json | 4 +- .../configs/debug/sequencer_config.json | 6 +- .../configs/docker/sequencer_config.json | 4 +- wallet/configs/debug/wallet_config.json | 128 +++++++++--------- wallet/src/chain_storage.rs | 124 ++++++++--------- wallet/src/config.rs | 128 +++++++++--------- 6 files changed, 197 insertions(+), 197 deletions(-) diff --git a/indexer/service/configs/indexer_config.json b/indexer/service/configs/indexer_config.json index 8b1b3c5e..8b68d062 100644 --- a/indexer/service/configs/indexer_config.json +++ b/indexer/service/configs/indexer_config.json @@ -11,11 +11,11 @@ "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", "initial_accounts": [ { - "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + "account_id": "jZvdpERLqEkzk6CAz6vDuDJ1wx5aoyFpDa1VFmRvuPX", "balance": 10000 }, { - "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + "account_id": "3jQfsyRyvVpBfdkZegf8QpjfcDq1M5RAXB4H4eJ4kTtf", "balance": 20000 } ], diff --git a/sequencer_runner/configs/debug/sequencer_config.json b/sequencer_runner/configs/debug/sequencer_config.json index 8491c2a1..e60833d8 100644 --- a/sequencer_runner/configs/debug/sequencer_config.json +++ b/sequencer_runner/configs/debug/sequencer_config.json @@ -1,5 +1,5 @@ { - "home": ".", + "home": "./sequencer_runner", "override_rust_log": null, "genesis_id": 1, "is_genesis_random": true, @@ -20,11 +20,11 @@ "indexer_rpc_url": "ws://localhost:8779", "initial_accounts": [ { - "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + "account_id": "jZvdpERLqEkzk6CAz6vDuDJ1wx5aoyFpDa1VFmRvuPX", "balance": 10000 }, { - "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + "account_id": "3jQfsyRyvVpBfdkZegf8QpjfcDq1M5RAXB4H4eJ4kTtf", "balance": 20000 } ], diff --git a/sequencer_runner/configs/docker/sequencer_config.json b/sequencer_runner/configs/docker/sequencer_config.json index 45cef1b6..8589786e 100644 --- a/sequencer_runner/configs/docker/sequencer_config.json +++ b/sequencer_runner/configs/docker/sequencer_config.json @@ -20,11 +20,11 @@ "indexer_rpc_url": "ws://localhost:8779", "initial_accounts": [ { - "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + "account_id": "jZvdpERLqEkzk6CAz6vDuDJ1wx5aoyFpDa1VFmRvuPX", "balance": 10000 }, { - "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + "account_id": "3jQfsyRyvVpBfdkZegf8QpjfcDq1M5RAXB4H4eJ4kTtf", "balance": 20000 } ], diff --git a/wallet/configs/debug/wallet_config.json b/wallet/configs/debug/wallet_config.json index f973712e..c4218137 100644 --- a/wallet/configs/debug/wallet_config.json +++ b/wallet/configs/debug/wallet_config.json @@ -8,79 +8,79 @@ "initial_accounts": [ { "Public": { - "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + "account_id": "jZvdpERLqEkzk6CAz6vDuDJ1wx5aoyFpDa1VFmRvuPX", "pub_sign_key": [ - 3, - 217, - 68, - 59, - 58, - 39, - 27, - 77, + 157, 102, - 214, - 182, - 35, - 220, - 146, - 92, - 88, - 125, - 120, - 95, - 92, - 96, - 132, - 73, - 53, - 44, - 6, + 173, + 116, + 76, + 167, + 130, + 165, + 77, + 104, + 14, + 233, + 114, + 43, + 180, + 98, + 59, + 187, + 165, 28, - 190, + 80, + 130, + 126, + 164, + 224, + 181, 203, - 155, - 196, - 56 + 53, + 31, + 168, + 169, + 23 ] } }, { "Public": { - "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + "account_id": "3jQfsyRyvVpBfdkZegf8QpjfcDq1M5RAXB4H4eJ4kTtf", "pub_sign_key": [ - 167, - 65, - 139, - 108, - 159, - 127, - 141, - 227, - 127, - 252, + 230, + 17, + 4, + 52, + 87, + 162, + 72, 137, - 193, - 25, - 65, - 127, - 143, - 27, - 203, - 56, - 226, - 251, - 60, - 32, - 143, - 195, - 225, - 39, - 160, - 29, - 20, - 135, - 232 + 119, + 205, + 163, + 211, + 118, + 157, + 15, + 164, + 67, + 12, + 124, + 50, + 159, + 23, + 184, + 6, + 109, + 154, + 2, + 219, + 147, + 239, + 125, + 20 ] } }, @@ -333,7 +333,7 @@ 133 ], "private_key_holder": { - "nullifier_secret_key": [ + "nullifer_secret_key": [ 188, 235, 121, @@ -402,7 +402,7 @@ 145 ] }, - "nullifer_public_key": [ + "nullifier_public_key": [ 173, 134, 33, diff --git a/wallet/src/chain_storage.rs b/wallet/src/chain_storage.rs index 8832729a..65800568 100644 --- a/wallet/src/chain_storage.rs +++ b/wallet/src/chain_storage.rs @@ -170,40 +170,40 @@ mod tests { let initial_acc1 = serde_json::from_str( r#"{ "Public": { - "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + "account_id": "jZvdpERLqEkzk6CAz6vDuDJ1wx5aoyFpDa1VFmRvuPX", "pub_sign_key": [ - 3, - 217, - 68, - 59, - 58, - 39, - 27, - 77, + 157, 102, - 214, - 182, - 35, - 220, - 146, - 92, - 88, - 125, - 120, - 95, - 92, - 96, - 132, - 73, - 53, - 44, - 6, + 173, + 116, + 76, + 167, + 130, + 165, + 77, + 104, + 14, + 233, + 114, + 43, + 180, + 98, + 59, + 187, + 165, 28, - 190, + 80, + 130, + 126, + 164, + 224, + 181, 203, - 155, - 196, - 56 + 53, + 31, + 168, + 169, + 23 ] } }"#, @@ -213,40 +213,40 @@ mod tests { let initial_acc2 = serde_json::from_str( r#"{ "Public": { - "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + "account_id": "3jQfsyRyvVpBfdkZegf8QpjfcDq1M5RAXB4H4eJ4kTtf", "pub_sign_key": [ - 167, - 65, - 139, - 108, - 159, - 127, - 141, - 227, - 127, - 252, + 230, + 17, + 4, + 52, + 87, + 162, + 72, 137, - 193, - 25, - 65, - 127, - 143, - 27, - 203, - 56, - 226, - 251, - 60, - 32, - 143, - 195, - 225, - 39, - 160, - 29, - 20, - 135, - 232 + 119, + 205, + 163, + 211, + 118, + 157, + 15, + 164, + 67, + 12, + 124, + 50, + 159, + 23, + 184, + 6, + 109, + 154, + 2, + 219, + 147, + 239, + 125, + 20 ] } }"#, diff --git a/wallet/src/config.rs b/wallet/src/config.rs index 59cf66e8..5e6d373e 100644 --- a/wallet/src/config.rs +++ b/wallet/src/config.rs @@ -217,79 +217,79 @@ impl Default for WalletConfig { [ { "Public": { - "account_id": "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + "account_id": "jZvdpERLqEkzk6CAz6vDuDJ1wx5aoyFpDa1VFmRvuPX", "pub_sign_key": [ - 3, - 217, - 68, - 59, - 58, - 39, - 27, - 77, + 157, 102, - 214, - 182, - 35, - 220, - 146, - 92, - 88, - 125, - 120, - 95, - 92, - 96, - 132, - 73, - 53, - 44, - 6, + 173, + 116, + 76, + 167, + 130, + 165, + 77, + 104, + 14, + 233, + 114, + 43, + 180, + 98, + 59, + 187, + 165, 28, - 190, + 80, + 130, + 126, + 164, + 224, + 181, 203, - 155, - 196, - 56 + 53, + 31, + 168, + 169, + 23 ] } }, { "Public": { - "account_id": "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + "account_id": "3jQfsyRyvVpBfdkZegf8QpjfcDq1M5RAXB4H4eJ4kTtf", "pub_sign_key": [ - 167, - 65, - 139, - 108, - 159, - 127, - 141, - 227, - 127, - 252, + 230, + 17, + 4, + 52, + 87, + 162, + 72, 137, - 193, - 25, - 65, - 127, - 143, - 27, - 203, - 56, - 226, - 251, - 60, - 32, - 143, - 195, - 225, - 39, - 160, - 29, - 20, - 135, - 232 + 119, + 205, + 163, + 211, + 118, + 157, + 15, + 164, + 67, + 12, + 124, + 50, + 159, + 23, + 184, + 6, + 109, + 154, + 2, + 219, + 147, + 239, + 125, + 20 ] } }, @@ -542,7 +542,7 @@ impl Default for WalletConfig { 133 ], "private_key_holder": { - "nullifier_secret_key": [ + "nullifer_secret_key": [ 188, 235, 121, @@ -611,7 +611,7 @@ impl Default for WalletConfig { 145 ] }, - "nullifer_public_key": [ + "nullifier_public_key": [ 173, 134, 33, From 2e4f7c6f96b34ccbbf04765b5ea1697630a882e1 Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Tue, 17 Mar 2026 16:10:33 -0400 Subject: [PATCH 07/10] fixed typo --- wallet/configs/debug/wallet_config.json | 4 ++-- wallet/src/config.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wallet/configs/debug/wallet_config.json b/wallet/configs/debug/wallet_config.json index c4218137..6c4c9f84 100644 --- a/wallet/configs/debug/wallet_config.json +++ b/wallet/configs/debug/wallet_config.json @@ -207,7 +207,7 @@ 247 ] }, - "nullifer_public_key": [ + "nullifier_public_key": [ 139, 19, 158, @@ -333,7 +333,7 @@ 133 ], "private_key_holder": { - "nullifer_secret_key": [ + "nullifier_secret_key": [ 188, 235, 121, diff --git a/wallet/src/config.rs b/wallet/src/config.rs index 5e6d373e..8ef4458c 100644 --- a/wallet/src/config.rs +++ b/wallet/src/config.rs @@ -416,7 +416,7 @@ impl Default for WalletConfig { 247 ] }, - "nullifer_public_key": [ + "nullifier_public_key": [ 139, 19, 158, @@ -542,7 +542,7 @@ impl Default for WalletConfig { 133 ], "private_key_holder": { - "nullifer_secret_key": [ + "nullifier_secret_key": [ 188, 235, 121, From 1bcdc6638f72b2bd8236882533ce19a4c1bc0a17 Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Fri, 20 Mar 2026 10:29:31 -0400 Subject: [PATCH 08/10] fmt --- key_protocol/src/key_management/key_tree/keys_public.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/key_protocol/src/key_management/key_tree/keys_public.rs b/key_protocol/src/key_management/key_tree/keys_public.rs index d0a035cc..d7c4f7cd 100644 --- a/key_protocol/src/key_management/key_tree/keys_public.rs +++ b/key_protocol/src/key_management/key_tree/keys_public.rs @@ -66,7 +66,7 @@ impl KeyNode for ChildKeysPublic { ) .unwrap(); - let cssk = nssa::PrivateKey::try_new( + let cssk = nssa::PrivateKey::try_new({ cssk.add_tweak(&Scalar::from_be_bytes(*self.cssk.value()).unwrap()) .expect("Expect a valid Scalar") .secret_bytes() From b2e99c4a8fe3ee038b204d54d8202667c4bdaa54 Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Fri, 20 Mar 2026 11:16:29 -0400 Subject: [PATCH 09/10] clippy fixes --- indexer/service/configs/indexer_config.json | 4 +- nssa/src/signature/private_key.rs | 9 +- wallet/src/chain_storage.rs | 134 ++++++-------------- 3 files changed, 45 insertions(+), 102 deletions(-) diff --git a/indexer/service/configs/indexer_config.json b/indexer/service/configs/indexer_config.json index 8b68d062..30ae0e64 100644 --- a/indexer/service/configs/indexer_config.json +++ b/indexer/service/configs/indexer_config.json @@ -1,6 +1,6 @@ { - "home": "./indexer/service", - "consensus_info_polling_interval": "60s", + "home": ".", + "consensus_info_polling_interval": "1s", "bedrock_client_config": { "addr": "http://localhost:8080", "backoff": { diff --git a/nssa/src/signature/private_key.rs b/nssa/src/signature/private_key.rs index 5a8a7dd9..ecb38749 100644 --- a/nssa/src/signature/private_key.rs +++ b/nssa/src/signature/private_key.rs @@ -1,5 +1,6 @@ use std::str::FromStr; +use risc0_zkvm::sha::{Impl, Sha256 as _}; use rand::{Rng as _, rngs::OsRng}; use serde_with::{DeserializeFromStr, SerializeDisplay}; @@ -64,15 +65,15 @@ impl PrivateKey { pub fn tweak(value: &[u8; 32]) -> Result { assert!(Self::is_valid_key(*value)); - let sk = secp256k1::SecretKey::from_byte_array(*value).unwrap(); + let sk = secp256k1::SecretKey::from_byte_array(*value).expect("Expect a valid secret key"); let mut bytes = vec![]; let pk = secp256k1::PublicKey::from_secret_key(&secp256k1::Secp256k1::new(), &sk); bytes.extend_from_slice(&secp256k1::PublicKey::serialize(&pk)); - let hashed: [u8; 32] = Impl::hash_bytes(&bytes).as_bytes().try_into().unwrap(); + let hashed: [u8; 32] = Impl::hash_bytes(&bytes).as_bytes().try_into().expect("Sha256 outputs a 32-byte array"); - PrivateKey::try_new( - sk.add_tweak(&secp256k1::Scalar::from_be_bytes(hashed).unwrap()) + Self::try_new( + sk.add_tweak(&secp256k1::Scalar::from_be_bytes(hashed).expect("Expect a valid secp256k1 Scalar")) .expect("Expect a valid Scalar") .secret_bytes(), ) diff --git a/wallet/src/chain_storage.rs b/wallet/src/chain_storage.rs index 65800568..a88e0b8b 100644 --- a/wallet/src/chain_storage.rs +++ b/wallet/src/chain_storage.rs @@ -20,6 +20,10 @@ pub struct WalletChainStore { } impl WalletChainStore { + #[expect( + clippy::wildcard_enum_match_arm, + reason = "We perform search for specific variants only" + )] pub fn new( config: WalletConfig, persistent_accounts: Vec, @@ -157,110 +161,48 @@ impl WalletChainStore { #[cfg(test)] mod tests { + use std::str::FromStr as _; + use key_protocol::key_management::key_tree::{ - keys_private::ChildKeysPrivate, keys_public::ChildKeysPublic, traits::KeyNode, + keys_private::ChildKeysPrivate, keys_public::ChildKeysPublic, traits::KeyNode as _, }; + use nssa::PrivateKey; use super::*; use crate::config::{ - InitialAccountData, PersistentAccountDataPrivate, PersistentAccountDataPublic, + InitialAccountData, InitialAccountDataPublic, PersistentAccountDataPrivate, + PersistentAccountDataPublic, }; fn create_initial_accounts() -> Vec { - let initial_acc1 = serde_json::from_str( - r#"{ - "Public": { - "account_id": "jZvdpERLqEkzk6CAz6vDuDJ1wx5aoyFpDa1VFmRvuPX", - "pub_sign_key": [ - 157, - 102, - 173, - 116, - 76, - 167, - 130, - 165, - 77, - 104, - 14, - 233, - 114, - 43, - 180, - 98, - 59, - 187, - 165, - 28, - 80, - 130, - 126, - 164, - 224, - 181, - 203, - 53, - 31, - 168, - 169, - 23 - ] - } - }"#, - ) - .unwrap(); - - let initial_acc2 = serde_json::from_str( - r#"{ - "Public": { - "account_id": "3jQfsyRyvVpBfdkZegf8QpjfcDq1M5RAXB4H4eJ4kTtf", - "pub_sign_key": [ - 230, - 17, - 4, - 52, - 87, - 162, - 72, - 137, - 119, - 205, - 163, - 211, - 118, - 157, - 15, - 164, - 67, - 12, - 124, - 50, - 159, - 23, - 184, - 6, - 109, - 154, - 2, - 219, - 147, - 239, - 125, - 20 - ] - } - }"#, - ) - .unwrap(); - - let initial_accounts = vec![initial_acc1, initial_acc2]; - - initial_accounts + vec![ + InitialAccountData::Public(InitialAccountDataPublic { + account_id: nssa::AccountId::from_str( + "CbgR6tj5kWx5oziiFptM7jMvrQeYY3Mzaao6ciuhSr2r", + ) + .unwrap(), + pub_sign_key: PrivateKey::try_new([ + 127, 39, 48, 152, 242, 91, 113, 230, 192, 5, 169, 81, 159, 38, 120, 218, 141, + 28, 127, 1, 246, 162, 119, 120, 226, 217, 148, 138, 189, 249, 1, 251, + ]) + .unwrap(), + }), + InitialAccountData::Public(InitialAccountDataPublic { + account_id: nssa::AccountId::from_str( + "2RHZhw9h534Zr3eq2RGhQete2Hh667foECzXPmSkGni2", + ) + .unwrap(), + pub_sign_key: PrivateKey::try_new([ + 244, 52, 248, 116, 23, 32, 1, 69, 134, 174, 67, 53, 109, 42, 236, 98, 87, 218, + 8, 98, 34, 246, 4, 221, 183, 93, 105, 115, 59, 134, 252, 76, + ]) + .unwrap(), + }), + ] } fn create_sample_wallet_config() -> WalletConfig { WalletConfig { - override_rust_log: None, sequencer_addr: "http://127.0.0.1".parse().unwrap(), seq_poll_timeout: std::time::Duration::from_secs(12), seq_tx_poll_max_blocks: 5, @@ -281,19 +223,19 @@ mod tests { chain_index: ChainIndex::root(), data: public_data, }), - PersistentAccountData::Private(PersistentAccountDataPrivate { + PersistentAccountData::Private(Box::new(PersistentAccountDataPrivate { account_id: private_data.account_id(), chain_index: ChainIndex::root(), data: private_data, - }), + })), ] } #[test] - fn test_new_initializes_correctly() { + fn new_initializes_correctly() { let config = create_sample_wallet_config(); let accs = create_sample_persistent_accounts(); - let _ = WalletChainStore::new(config.clone(), accs, HashMap::new()).unwrap(); + let _ = WalletChainStore::new(config, accs, HashMap::new()).unwrap(); } } From 8b061a848adf7a773aa5c0b3a800b8865f0a93a7 Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Fri, 20 Mar 2026 11:21:16 -0400 Subject: [PATCH 10/10] fmt --- nssa/src/signature/private_key.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nssa/src/signature/private_key.rs b/nssa/src/signature/private_key.rs index ecb38749..72c392db 100644 --- a/nssa/src/signature/private_key.rs +++ b/nssa/src/signature/private_key.rs @@ -1,7 +1,7 @@ use std::str::FromStr; -use risc0_zkvm::sha::{Impl, Sha256 as _}; use rand::{Rng as _, rngs::OsRng}; +use risc0_zkvm::sha::{Impl, Sha256 as _}; use serde_with::{DeserializeFromStr, SerializeDisplay}; use crate::error::NssaError; @@ -70,12 +70,17 @@ impl PrivateKey { let mut bytes = vec![]; let pk = secp256k1::PublicKey::from_secret_key(&secp256k1::Secp256k1::new(), &sk); bytes.extend_from_slice(&secp256k1::PublicKey::serialize(&pk)); - let hashed: [u8; 32] = Impl::hash_bytes(&bytes).as_bytes().try_into().expect("Sha256 outputs a 32-byte array"); + let hashed: [u8; 32] = Impl::hash_bytes(&bytes) + .as_bytes() + .try_into() + .expect("Sha256 outputs a 32-byte array"); Self::try_new( - sk.add_tweak(&secp256k1::Scalar::from_be_bytes(hashed).expect("Expect a valid secp256k1 Scalar")) - .expect("Expect a valid Scalar") - .secret_bytes(), + sk.add_tweak( + &secp256k1::Scalar::from_be_bytes(hashed).expect("Expect a valid secp256k1 Scalar"), + ) + .expect("Expect a valid Scalar") + .secret_bytes(), ) } }