mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-02 13:23:10 +00:00
fix: logging fix 1
This commit is contained in:
parent
9807e77c57
commit
1f72b585df
@ -118,7 +118,7 @@ impl Account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn log(&self) {
|
pub fn log(&self) {
|
||||||
self.key_holder.log();
|
info!("Keys generated");
|
||||||
info!("Account address is {:?}", hex::encode(self.address));
|
info!("Account address is {:?}", hex::encode(self.address));
|
||||||
info!("Account balance is {:?}", self.balance);
|
info!("Account balance is {:?}", self.balance);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ use aes_gcm::{aead::Aead, AeadCore, Aes256Gcm, Key, KeyInit};
|
|||||||
use elliptic_curve::group::GroupEncoding;
|
use elliptic_curve::group::GroupEncoding;
|
||||||
use elliptic_curve::PrimeField;
|
use elliptic_curve::PrimeField;
|
||||||
use k256::{AffinePoint, FieldBytes, Scalar};
|
use k256::{AffinePoint, FieldBytes, Scalar};
|
||||||
|
use log::info;
|
||||||
use rand::{rngs::OsRng, RngCore};
|
use rand::{rngs::OsRng, RngCore};
|
||||||
|
|
||||||
use super::constants_types::{CipherText, Nonce};
|
use super::constants_types::{CipherText, Nonce};
|
||||||
@ -51,4 +52,8 @@ impl EphemeralKeyHolder {
|
|||||||
|
|
||||||
(cipher.encrypt(&nonce, data).unwrap(), nonce)
|
(cipher.encrypt(&nonce, data).unwrap(), nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn log(&self) {
|
||||||
|
info!("Ephemeral private key is {:?}", hex::encode(self.ephemeral_secret_key.to_bytes()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,21 +78,24 @@ impl AddressKeyHolder {
|
|||||||
|
|
||||||
pub fn log(&self) {
|
pub fn log(&self) {
|
||||||
info!(
|
info!(
|
||||||
"AddressKeyHolder top_secret_key_holder is {:?}",
|
"Secret spending key is {:?}",
|
||||||
self.top_secret_key_holder
|
hex::encode(self.top_secret_key_holder.secret_spending_key.to_bytes()),
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"AddressKeyHolder utxo_secret_key_holder is {:?}",
|
"Nulifier secret key is {:?}",
|
||||||
self.utxo_secret_key_holder
|
hex::encode(self.utxo_secret_key_holder.nullifier_secret_key.to_bytes()),
|
||||||
);
|
|
||||||
info!("AddressKeyHolder address is {:?}", self.address);
|
|
||||||
info!(
|
|
||||||
"AddressKeyHolder nullifer_public_key is {:?}",
|
|
||||||
self.nullifer_public_key
|
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"AddressKeyHolder viewing_public_key is {:?}",
|
"Viewing secret key is {:?}",
|
||||||
self.viewing_public_key
|
hex::encode(self.utxo_secret_key_holder.viewing_secret_key.to_bytes()),
|
||||||
|
);
|
||||||
|
info!(
|
||||||
|
"Nullifier public key is {:?}",
|
||||||
|
hex::encode(self.nullifer_public_key.to_bytes()),
|
||||||
|
);
|
||||||
|
info!(
|
||||||
|
"Viewing public key is {:?}",
|
||||||
|
hex::encode(self.viewing_public_key.to_bytes()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ pub struct SeedHolder {
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
///Secret spending key holder. Produces `UTXOSecretKeyHolder` objects.
|
///Secret spending key holder. Produces `UTXOSecretKeyHolder` objects.
|
||||||
pub struct TopSecretKeyHolder {
|
pub struct TopSecretKeyHolder {
|
||||||
secret_spending_key: Scalar,
|
pub secret_spending_key: Scalar,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|||||||
@ -165,9 +165,9 @@ impl NodeCore {
|
|||||||
let acc_map_read_guard = self.storage.read().await;
|
let acc_map_read_guard = self.storage.read().await;
|
||||||
|
|
||||||
let accout = acc_map_read_guard.acc_map.get(&acc).unwrap();
|
let accout = acc_map_read_guard.acc_map.get(&acc).unwrap();
|
||||||
accout.log();
|
|
||||||
|
|
||||||
let ephm_key_holder = &accout.produce_ephemeral_key_holder();
|
let ephm_key_holder = &accout.produce_ephemeral_key_holder();
|
||||||
|
ephm_key_holder.log();
|
||||||
|
|
||||||
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
|
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ impl NodeCore {
|
|||||||
.map(|hash_data| hash_data.try_into().unwrap())
|
.map(|hash_data| hash_data.try_into().unwrap())
|
||||||
.collect(),
|
.collect(),
|
||||||
nullifier_created_hashes: vec![],
|
nullifier_created_hashes: vec![],
|
||||||
execution_proof_private: serde_json::to_string(&receipt).unwrap(),
|
execution_proof_private: hex::encode(serde_json::to_vec(&receipt).unwrap()),
|
||||||
encoded_data: vec![(encoded_data.0, encoded_data.1.to_vec())],
|
encoded_data: vec![(encoded_data.0, encoded_data.1.to_vec())],
|
||||||
ephemeral_pub_key: eph_pub_key.to_vec(),
|
ephemeral_pub_key: eph_pub_key.to_vec(),
|
||||||
}
|
}
|
||||||
@ -226,7 +226,6 @@ impl NodeCore {
|
|||||||
let acc_map_read_guard = self.storage.read().await;
|
let acc_map_read_guard = self.storage.read().await;
|
||||||
|
|
||||||
let accout = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap();
|
let accout = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap();
|
||||||
accout.log();
|
|
||||||
|
|
||||||
let nullifier = generate_nullifiers(
|
let nullifier = generate_nullifiers(
|
||||||
&utxo,
|
&utxo,
|
||||||
@ -250,6 +249,7 @@ impl NodeCore {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let ephm_key_holder = &accout.produce_ephemeral_key_holder();
|
let ephm_key_holder = &accout.produce_ephemeral_key_holder();
|
||||||
|
ephm_key_holder.log();
|
||||||
|
|
||||||
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
|
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ impl NodeCore {
|
|||||||
.map(|hash_data| hash_data.try_into().unwrap())
|
.map(|hash_data| hash_data.try_into().unwrap())
|
||||||
.collect(),
|
.collect(),
|
||||||
nullifier_created_hashes: vec![nullifier.try_into().unwrap()],
|
nullifier_created_hashes: vec![nullifier.try_into().unwrap()],
|
||||||
execution_proof_private: serde_json::to_string(&receipt).unwrap(),
|
execution_proof_private: hex::encode(serde_json::to_vec(&receipt).unwrap()),
|
||||||
encoded_data,
|
encoded_data,
|
||||||
ephemeral_pub_key: eph_pub_key.to_vec(),
|
ephemeral_pub_key: eph_pub_key.to_vec(),
|
||||||
}
|
}
|
||||||
@ -299,7 +299,6 @@ impl NodeCore {
|
|||||||
let acc_map_read_guard = self.storage.read().await;
|
let acc_map_read_guard = self.storage.read().await;
|
||||||
|
|
||||||
let accout = acc_map_read_guard.acc_map.get(&acc).unwrap();
|
let accout = acc_map_read_guard.acc_map.get(&acc).unwrap();
|
||||||
accout.log();
|
|
||||||
|
|
||||||
let commitment_secrets = CommitmentSecrets {
|
let commitment_secrets = CommitmentSecrets {
|
||||||
value: balance,
|
value: balance,
|
||||||
@ -340,6 +339,7 @@ impl NodeCore {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let ephm_key_holder = &accout.produce_ephemeral_key_holder();
|
let ephm_key_holder = &accout.produce_ephemeral_key_holder();
|
||||||
|
ephm_key_holder.log();
|
||||||
|
|
||||||
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
|
let eph_pub_key = ephm_key_holder.generate_ephemeral_public_key().to_bytes();
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ impl NodeCore {
|
|||||||
.map(|hash_data| hash_data.try_into().unwrap())
|
.map(|hash_data| hash_data.try_into().unwrap())
|
||||||
.collect(),
|
.collect(),
|
||||||
nullifier_created_hashes: vec![nullifier.try_into().unwrap()],
|
nullifier_created_hashes: vec![nullifier.try_into().unwrap()],
|
||||||
execution_proof_private: serde_json::to_string(&receipt).unwrap(),
|
execution_proof_private: hex::encode(serde_json::to_vec(&receipt).unwrap()),
|
||||||
encoded_data,
|
encoded_data,
|
||||||
ephemeral_pub_key: eph_pub_key.to_vec(),
|
ephemeral_pub_key: eph_pub_key.to_vec(),
|
||||||
}
|
}
|
||||||
@ -401,7 +401,6 @@ impl NodeCore {
|
|||||||
.hash;
|
.hash;
|
||||||
|
|
||||||
let accout = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap();
|
let accout = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap();
|
||||||
accout.log();
|
|
||||||
|
|
||||||
let nullifier = generate_nullifiers(
|
let nullifier = generate_nullifiers(
|
||||||
&utxo,
|
&utxo,
|
||||||
@ -427,7 +426,7 @@ impl NodeCore {
|
|||||||
utxo_commitments_spent_hashes: vec![commitment_in],
|
utxo_commitments_spent_hashes: vec![commitment_in],
|
||||||
utxo_commitments_created_hashes: vec![],
|
utxo_commitments_created_hashes: vec![],
|
||||||
nullifier_created_hashes: vec![nullifier.try_into().unwrap()],
|
nullifier_created_hashes: vec![nullifier.try_into().unwrap()],
|
||||||
execution_proof_private: serde_json::to_string(&receipt).unwrap(),
|
execution_proof_private: hex::encode(serde_json::to_vec(&receipt).unwrap()),
|
||||||
encoded_data: vec![],
|
encoded_data: vec![],
|
||||||
ephemeral_pub_key: vec![],
|
ephemeral_pub_key: vec![],
|
||||||
}
|
}
|
||||||
@ -461,9 +460,12 @@ impl NodeCore {
|
|||||||
acc: AccountAddress,
|
acc: AccountAddress,
|
||||||
amount: u128,
|
amount: u128,
|
||||||
) -> Result<SendTxResponse> {
|
) -> Result<SendTxResponse> {
|
||||||
|
let tx = self.deposit_money_public(acc, amount);
|
||||||
|
tx.log();
|
||||||
|
|
||||||
Ok(self
|
Ok(self
|
||||||
.sequencer_client
|
.sequencer_client
|
||||||
.send_tx(self.deposit_money_public(acc, amount))
|
.send_tx(tx)
|
||||||
.await?)
|
.await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +525,6 @@ impl NodeCore {
|
|||||||
///Mint utxo, make it public
|
///Mint utxo, make it public
|
||||||
pub async fn subscenario_1(&mut self) {
|
pub async fn subscenario_1(&mut self) {
|
||||||
let acc_addr = self.create_new_account().await;
|
let acc_addr = self.create_new_account().await;
|
||||||
info!("Account created {acc_addr:?}");
|
|
||||||
|
|
||||||
let (resp, new_utxo_hash, comm_gen_hash) =
|
let (resp, new_utxo_hash, comm_gen_hash) =
|
||||||
self.send_private_mint_tx(acc_addr, 100).await.unwrap();
|
self.send_private_mint_tx(acc_addr, 100).await.unwrap();
|
||||||
@ -536,7 +537,6 @@ impl NodeCore {
|
|||||||
let mut write_guard = self.storage.write().await;
|
let mut write_guard = self.storage.write().await;
|
||||||
|
|
||||||
let acc = write_guard.acc_map.get_mut(&acc_addr).unwrap();
|
let acc = write_guard.acc_map.get_mut(&acc_addr).unwrap();
|
||||||
acc.log();
|
|
||||||
|
|
||||||
acc.utxo_tree
|
acc.utxo_tree
|
||||||
.get_item(new_utxo_hash)
|
.get_item(new_utxo_hash)
|
||||||
@ -560,7 +560,6 @@ impl NodeCore {
|
|||||||
let acc_map_read_guard = self.storage.read().await;
|
let acc_map_read_guard = self.storage.read().await;
|
||||||
|
|
||||||
let acc = acc_map_read_guard.acc_map.get(&acc_addr).unwrap();
|
let acc = acc_map_read_guard.acc_map.get(&acc_addr).unwrap();
|
||||||
acc.log();
|
|
||||||
|
|
||||||
acc.balance
|
acc.balance
|
||||||
};
|
};
|
||||||
@ -665,6 +664,7 @@ impl NodeCore {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.clone()
|
.clone()
|
||||||
};
|
};
|
||||||
|
new_utxo.log();
|
||||||
|
|
||||||
info!("User {acc_addr_rec:?} received new utxo {new_utxo:?}");
|
info!("User {acc_addr_rec:?} received new utxo {new_utxo:?}");
|
||||||
}
|
}
|
||||||
@ -711,6 +711,7 @@ impl NodeCore {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.clone()
|
.clone()
|
||||||
};
|
};
|
||||||
|
new_utxo.log();
|
||||||
|
|
||||||
info!("User {acc_addr_rec:?} received new utxo {new_utxo:?}");
|
info!("User {acc_addr_rec:?} received new utxo {new_utxo:?}");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,28 +108,28 @@ impl Transaction {
|
|||||||
self.utxo_commitments_spent_hashes
|
self.utxo_commitments_spent_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(|val| hex::encode(val.clone()))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"Transaction utxo_commitments_created_hashes is {:?}",
|
"Transaction utxo_commitments_created_hashes is {:?}",
|
||||||
self.utxo_commitments_created_hashes
|
self.utxo_commitments_created_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(|val| hex::encode(val.clone()))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"Transaction nullifier_created_hashes is {:?}",
|
"Transaction nullifier_created_hashes is {:?}",
|
||||||
self.nullifier_created_hashes
|
self.nullifier_created_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(|val| hex::encode(val.clone()))
|
||||||
);
|
.collect::<Vec<_>>()
|
||||||
info!(
|
|
||||||
"Transaction execution_proof_private is {:?}",
|
|
||||||
self.execution_proof_private
|
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"Transaction encoded_data is {:?}",
|
"Transaction encoded_data is {:?}",
|
||||||
self.encoded_data
|
self.encoded_data
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| (hex::encode(val.0.clone()), hex::encode(val.1.clone())))
|
.map(|val| (hex::encode(val.0.clone()), hex::encode(val.1.clone())))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"Transaction ephemeral_pub_key is {:?}",
|
"Transaction ephemeral_pub_key is {:?}",
|
||||||
|
|||||||
@ -73,7 +73,7 @@ impl UTXO {
|
|||||||
|
|
||||||
pub fn log(&self) {
|
pub fn log(&self) {
|
||||||
info!("UTXO hash is {:?}", hex::encode(self.hash));
|
info!("UTXO hash is {:?}", hex::encode(self.hash));
|
||||||
info!("UTXO owner is {:?}", self.owner);
|
info!("UTXO owner is {:?}", hex::encode(self.owner));
|
||||||
info!(
|
info!(
|
||||||
"UTXO nullifier is {:?}",
|
"UTXO nullifier is {:?}",
|
||||||
self.nullifier.clone().map(|val| hex::encode(val.utxo_hash))
|
self.nullifier.clone().map(|val| hex::encode(val.utxo_hash))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user