Procházet zdrojové kódy

fixed growing negative pid value, signed d, abs p, i

mohab metwally před 3 roky
rodič
revize
aa0b15bb83
3 změnil soubory, kde provedl 89 přidání a 78 odebrání
  1. 6 6
      src/consensus/leadcoin.rs
  2. 42 31
      src/consensus/state.rs
  3. 41 41
      src/consensus/validator.rs

+ 6 - 6
src/consensus/leadcoin.rs

@@ -27,7 +27,7 @@ use darkfi_sdk::{
 };
 };
 use halo2_proofs::{arithmetic::Field, circuit::Value};
 use halo2_proofs::{arithmetic::Field, circuit::Value};
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
-use log::debug;
+use log::{debug,info};
 use rand::rngs::OsRng;
 use rand::rngs::OsRng;
 
 
 use super::constants::EPOCH_LENGTH;
 use super::constants::EPOCH_LENGTH;
@@ -128,7 +128,7 @@ impl LeadCoin {
         let pk = Self::util_pk(coin1_sk_root, tau);
         let pk = Self::util_pk(coin1_sk_root, tau);
         // Derive the nonce for coin2
         // Derive the nonce for coin2
         let coin2_seed = Self::util_derived_rho(coin1_sk_root, pallas::Base::from(seed));
         let coin2_seed = Self::util_derived_rho(coin1_sk_root, pallas::Base::from(seed));
-        debug!("coin2_seed[{}]: {:?}", slot_index, coin2_seed);
+        info!("coin2_seed[{}]: {:?}", slot_index, coin2_seed);
         let coin1_commitment =
         let coin1_commitment =
             Self::commitment(pk, pallas::Base::from(value), pallas::Base::from(seed), coin1_blind);
             Self::commitment(pk, pallas::Base::from(value), pallas::Base::from(seed), coin1_blind);
         // Hash its coordinates to get a base field element
         // Hash its coordinates to get a base field element
@@ -192,7 +192,7 @@ impl LeadCoin {
 
 
     /// Derive election seeds from given parameters
     /// Derive election seeds from given parameters
     pub fn election_seeds(eta: pallas::Base, slot: pallas::Base) -> (pallas::Base, pallas::Base) {
     pub fn election_seeds(eta: pallas::Base, slot: pallas::Base) -> (pallas::Base, pallas::Base) {
-        debug!("election_seeds: eta: {:?}, slot: {:?}", eta, slot);
+        info!("election_seeds: eta: {:?}, slot: {:?}", eta, slot);
         let election_seed_nonce = pallas::Base::from(3);
         let election_seed_nonce = pallas::Base::from(3);
         let election_seed_lead = pallas::Base::from(22);
         let election_seed_lead = pallas::Base::from(22);
 
 
@@ -286,8 +286,8 @@ impl LeadCoin {
         let value = pallas::Base::from(self.value);
         let value = pallas::Base::from(self.value);
         let target = sigma1 * value + sigma2 * value * value;
         let target = sigma1 * value + sigma2 * value * value;
 
 
-        debug!("is_leader(): y = {:?}", y);
-        debug!("is_leader(): T = {:?}", target);
+        info!("is_leader(): y = {:?}", y);
+        info!("is_leader(): T = {:?}", target);
 
 
         let first_winning = y < target;
         let first_winning = y < target;
         first_winning
         first_winning
@@ -317,7 +317,7 @@ impl LeadCoin {
         &self,
         &self,
         coin_commitment_tree: &mut BridgeTree<MerkleNode, MERKLE_DEPTH>,
         coin_commitment_tree: &mut BridgeTree<MerkleNode, MERKLE_DEPTH>,
     ) -> LeadCoin {
     ) -> LeadCoin {
-        debug!("derive_coin(): Deriving new coin!");
+        info!("derive_coin(): Deriving new coin!");
         let derived_c1_rho = self.derived_rho();
         let derived_c1_rho = self.derived_rho();
         let blind = pallas::Scalar::random(&mut OsRng);
         let blind = pallas::Scalar::random(&mut OsRng);
         let derived_c2_cm = Self::commitment(
         let derived_c2_cm = Self::commitment(

+ 42 - 31
src/consensus/state.rs

@@ -34,6 +34,7 @@ use super::{
 };
 };
 
 
 use crate::{blockchain::Blockchain, net, tx::Transaction, util::time::Timestamp, Error, Result};
 use crate::{blockchain::Blockchain, net, tx::Transaction, util::time::Timestamp, Error, Result};
+use dashu::base::Abs;
 
 
 /// This struct represents the information required by the consensus algorithm
 /// This struct represents the information required by the consensus algorithm
 pub struct ConsensusState {
 pub struct ConsensusState {
@@ -206,7 +207,7 @@ impl ConsensusState {
 
 
     /// return 2-term target approximation sigma coefficients.
     /// return 2-term target approximation sigma coefficients.
     pub fn sigmas(&mut self) -> (pallas::Base, pallas::Base) {
     pub fn sigmas(&mut self) -> (pallas::Base, pallas::Base) {
-        let f = self.win_prob_with_full_stake();
+        let f = self.win_inv_prob_with_full_stake();
 
 
         // Generate sigmas
         // Generate sigmas
         let mut total_stake = self.total_stake(); // Only used for fine-tuning
         let mut total_stake = self.total_stake(); // Only used for fine-tuning
@@ -216,8 +217,8 @@ impl ConsensusState {
         if total_stake == 0 {
         if total_stake == 0 {
             total_stake = constants::GENESIS_TOTAL_STAKE;
             total_stake = constants::GENESIS_TOTAL_STAKE;
         }
         }
-        debug!("sigmas(): f: {}", f);
-        debug!("sigmas(): stake: {}", total_stake);
+        info!("sigmas(): f: {}", f);
+        info!("sigmas(): stake: {}", total_stake);
         let one = constants::FLOAT10_ONE.clone();
         let one = constants::FLOAT10_ONE.clone();
         let two = constants::FLOAT10_TWO.clone();
         let two = constants::FLOAT10_TWO.clone();
         let field_p = Float10::from_str_native(constants::P)
         let field_p = Float10::from_str_native(constants::P)
@@ -340,7 +341,7 @@ impl ConsensusState {
             }
             }
         }
         }
         self.leaders_history.push(count);
         self.leaders_history.push(count);
-        debug!("extend_leaders_history(): Current leaders history: {:?}", self.leaders_history);
+        info!("extend_leaders_history(): Current leaders history: {:?}", self.leaders_history);
         Float10::try_from(count as i64).unwrap().with_precision(constants::RADIX_BITS).value()
         Float10::try_from(count as i64).unwrap().with_precision(constants::RADIX_BITS).value()
     }
     }
 
 
@@ -348,10 +349,15 @@ impl ConsensusState {
         let target = constants::FLOAT10_ONE.clone();
         let target = constants::FLOAT10_ONE.clone();
         target - feedback
         target - feedback
     }
     }
+
     fn f_dif(&mut self) -> Float10 {
     fn f_dif(&mut self) -> Float10 {
         Self::pid_error(self.extend_leaders_history())
         Self::pid_error(self.extend_leaders_history())
     }
     }
 
 
+    fn weighted_f_dif(&mut self) -> Float10 {
+        constants::KP.clone() * self.f_dif()
+    }
+
     fn f_der(&self) -> Float10 {
     fn f_der(&self) -> Float10 {
         let len = self.leaders_history.len();
         let len = self.leaders_history.len();
         let last = Float10::try_from(self.leaders_history[len - 1] as i64)
         let last = Float10::try_from(self.leaders_history[len - 1] as i64)
@@ -369,40 +375,45 @@ impl ConsensusState {
         der
         der
     }
     }
 
 
+    fn weighted_f_der(&self) -> Float10 {
+        constants::KD.clone() * self.f_der()
+    }
+
     fn f_int(&self) -> Float10 {
     fn f_int(&self) -> Float10 {
         let mut sum = constants::FLOAT10_ZERO.clone();
         let mut sum = constants::FLOAT10_ZERO.clone();
         let lead_history_len = self.leaders_history.len();
         let lead_history_len = self.leaders_history.len();
         let history_begin_index = if lead_history_len > 10 { lead_history_len - 10 } else { 0 };
         let history_begin_index = if lead_history_len > 10 { lead_history_len - 10 } else { 0 };
 
 
         for lf in &self.leaders_history[history_begin_index..] {
         for lf in &self.leaders_history[history_begin_index..] {
-            sum += Self::pid_error(Float10::try_from(lf.clone()).unwrap());
+            sum += Self::pid_error(Float10::try_from(lf.clone()).unwrap()).abs();
         }
         }
         sum
         sum
     }
     }
 
 
+    fn weighted_f_int(&self) -> Float10 {
+        constants::KI.clone() * self.f_int()
+    }
+
+
     fn pid(p: Float10, i: Float10, d: Float10) -> Float10 {
     fn pid(p: Float10, i: Float10, d: Float10) -> Float10 {
-        constants::KP.clone() * p + constants::KI.clone() * i + constants::KD.clone() * d
+        constants::KP.clone() * p.abs() + constants::KI.clone() * i + constants::KD.clone() * d
     }
     }
 
 
-    /// the probability of winnig lottery having all the stake
+    /// the probability inverse of winnig lottery having all the stake
     /// returns f
     /// returns f
-    fn win_prob_with_full_stake(&mut self) -> Float10 {
-        let p = self.f_dif();
-        let i = self.f_int();
-        let d = self.f_der();
-        debug!("win_prob_with_full_stake(): PID P: {:?}", p);
-        debug!("win_prob_with_full_stake(): PID I: {:?}", i);
-        debug!("win_prob_with_full_stake(): PID D: {:?}", d);
-        let mut f = Self::pid(p, i, d);
-        debug!("win_prob_with_full_stake(): PID f: {}", f);
-        f = if f >= constants::FLOAT10_ONE.clone() {
-            constants::MAX_F.clone()
-        } else if f <= constants::FLOAT10_ZERO.clone() {
-            constants::MIN_F.clone()
-        } else {
-            f
-        };
-        debug!("win_prob_with_full_stake(): PID clipped f: {}", f);
+    fn win_inv_prob_with_full_stake(&mut self) -> Float10 {
+        let p = self.weighted_f_dif();
+        let i = self.weighted_f_int();
+        let d = self.weighted_f_der();
+        info!("win_inv_prob_with_full_stake(): PID P: {:?}", p);
+        info!("win_inv_prob_with_full_stake(): PID I: {:?}", i);
+        info!("win_inv_prob_with_full_stake(): PID D: {:?}", d);
+        let mut f = p+i+d;
+        info!("win_inv_prob_with_full_stake(): PID f: {}", f);
+        if f==constants::FLOAT10_ZERO.clone() {
+            return constants::MIN_F.clone()
+        }
+        info!("win_inv_prob_with_full_stake(): PID clipped f: {}", f);
         f
         f
     }
     }
 
 
@@ -496,7 +507,7 @@ impl ConsensusState {
             if proposal.block.header.previous != last_block ||
             if proposal.block.header.previous != last_block ||
                 proposal.block.header.slot <= last_slot
                 proposal.block.header.slot <= last_slot
             {
             {
-                debug!("find_extended_chain_index(): Proposal doesn't extend any known chain");
+                info!("find_extended_chain_index(): Proposal doesn't extend any known chain");
                 return Ok(-2)
                 return Ok(-2)
             }
             }
 
 
@@ -511,7 +522,7 @@ impl ConsensusState {
             return Ok(chain_index)
             return Ok(chain_index)
         }
         }
 
 
-        debug!("find_extended_chain_index(): Proposal to fork a forkchain was received.");
+        info!("find_extended_chain_index(): Proposal to fork a forkchain was received.");
         let mut chain = self.forks[chain_index as usize].clone();
         let mut chain = self.forks[chain_index as usize].clone();
         // We keep all proposals until the one it extends
         // We keep all proposals until the one it extends
         chain.sequence.drain((state_checkpoint_index + 1)..);
         chain.sequence.drain((state_checkpoint_index + 1)..);
@@ -538,16 +549,16 @@ impl ConsensusState {
         // Check if we found longest fork to extract sequence from
         // Check if we found longest fork to extract sequence from
         match index {
         match index {
             -1 => {
             -1 => {
-                debug!("set_leader_history(): No fork exists.");
+                info!("set_leader_history(): No fork exists.");
             }
             }
             _ => {
             _ => {
-                debug!("set_leader_history(): Checking last proposal of fork: {}", index);
+                info!("set_leader_history(): Checking last proposal of fork: {}", index);
                 let last_proposal = &self.forks[index as usize].sequence.last().unwrap().proposal;
                 let last_proposal = &self.forks[index as usize].sequence.last().unwrap().proposal;
                 if last_proposal.block.header.slot == self.current_slot() {
                 if last_proposal.block.header.slot == self.current_slot() {
                     // Replacing our last history element with the leaders one
                     // Replacing our last history element with the leaders one
                     self.leaders_history.pop();
                     self.leaders_history.pop();
                     self.leaders_history.push(last_proposal.block.lead_info.leaders);
                     self.leaders_history.push(last_proposal.block.lead_info.leaders);
-                    debug!("set_leader_history(): New leaders history: {:?}", self.leaders_history);
+                    info!("set_leader_history(): New leaders history: {:?}", self.leaders_history);
                     return
                     return
                 }
                 }
             }
             }
@@ -778,14 +789,14 @@ impl Fork {
         previous: &StateCheckpoint,
         previous: &StateCheckpoint,
     ) -> bool {
     ) -> bool {
         if state_checkpoint.proposal.block.header.previous == self.genesis_block {
         if state_checkpoint.proposal.block.header.previous == self.genesis_block {
-            debug!("check_checkpoint(): Genesis block proposal provided.");
+            info!("check_checkpoint(): Genesis block proposal provided.");
             return false
             return false
         }
         }
 
 
         if state_checkpoint.proposal.block.header.previous != previous.proposal.hash ||
         if state_checkpoint.proposal.block.header.previous != previous.proposal.hash ||
             state_checkpoint.proposal.block.header.slot <= previous.proposal.block.header.slot
             state_checkpoint.proposal.block.header.slot <= previous.proposal.block.header.slot
         {
         {
-            debug!("check_checkpoint(): Provided state checkpoint proposal is invalid.");
+            info!("check_checkpoint(): Provided state checkpoint proposal is invalid.");
             return false
             return false
         }
         }
 
 

+ 41 - 41
src/consensus/validator.rs

@@ -174,14 +174,14 @@ impl ValidatorState {
             // When deployed, we can do a lookup for the zkas circuits and
             // When deployed, we can do a lookup for the zkas circuits and
             // initialize verifying keys for them.
             // initialize verifying keys for them.
             info!("Creating ZK verifying keys for {} zkas circuits", nc.0);
             info!("Creating ZK verifying keys for {} zkas circuits", nc.0);
-            debug!("Looking up zkas db for {} (ContractID: {})", nc.0, nc.1);
+            info!("Looking up zkas db for {} (ContractID: {})", nc.0, nc.1);
             let zkas_db = blockchain.contracts.lookup(&blockchain.sled_db, &nc.1, ZKAS_DB_NAME)?;
             let zkas_db = blockchain.contracts.lookup(&blockchain.sled_db, &nc.1, ZKAS_DB_NAME)?;
 
 
             let mut vks = vec![];
             let mut vks = vec![];
             for i in zkas_db.iter() {
             for i in zkas_db.iter() {
-                debug!("Iterating over zkas db");
+                info!("Iterating over zkas db");
                 let (zkas_ns, zkas_bincode) = i?;
                 let (zkas_ns, zkas_bincode) = i?;
-                debug!("Deserializing namespace");
+                info!("Deserializing namespace");
                 let zkas_ns: String = deserialize(&zkas_ns)?;
                 let zkas_ns: String = deserialize(&zkas_ns)?;
                 info!("Creating VerifyingKey for zkas circuit with namespace {}", zkas_ns);
                 info!("Creating VerifyingKey for zkas circuit with namespace {}", zkas_ns);
                 let zkbin = ZkBinary::decode(&zkas_bincode)?;
                 let zkbin = ZkBinary::decode(&zkas_bincode)?;
@@ -229,17 +229,17 @@ impl ValidatorState {
         };
         };
 
 
         if self.unconfirmed_txs.contains(&tx) || tx_in_txstore {
         if self.unconfirmed_txs.contains(&tx) || tx_in_txstore {
-            debug!("append_tx(): We have already seen this tx.");
+            info!("append_tx(): We have already seen this tx.");
             return false
             return false
         }
         }
 
 
-        debug!("append_tx(): Starting state transition validation");
+        info!("append_tx(): Starting state transition validation");
         if let Err(e) = self.verify_transactions(&[tx.clone()], false).await {
         if let Err(e) = self.verify_transactions(&[tx.clone()], false).await {
             error!("append_tx(): Failed to verify transaction: {}", e);
             error!("append_tx(): Failed to verify transaction: {}", e);
             return false
             return false
         };
         };
 
 
-        debug!("append_tx(): Appended tx to mempool");
+        info!("append_tx(): Appended tx to mempool");
         self.unconfirmed_txs.push(tx);
         self.unconfirmed_txs.push(tx);
         true
         true
     }
     }
@@ -502,7 +502,7 @@ impl ValidatorState {
 
 
         // Validate state transition against canonical state
         // Validate state transition against canonical state
         // TODO: This should be validated against fork state
         // TODO: This should be validated against fork state
-        debug!("receive_proposal(): Starting state transition validation");
+        info!("receive_proposal(): Starting state transition validation");
         if let Err(e) = self.verify_transactions(&proposal.block.txs, false).await {
         if let Err(e) = self.verify_transactions(&proposal.block.txs, false).await {
             error!("receive_proposal(): Transaction verifications failed: {}", e);
             error!("receive_proposal(): Transaction verifications failed: {}", e);
             return Err(e.into())
             return Err(e.into())
@@ -551,7 +551,7 @@ impl ValidatorState {
     /// slot checkpoints until current slot are apppended to canonical state.
     /// slot checkpoints until current slot are apppended to canonical state.
     pub async fn chain_finalization(&mut self) -> Result<(Vec<BlockInfo>, Vec<SlotCheckpoint>)> {
     pub async fn chain_finalization(&mut self) -> Result<(Vec<BlockInfo>, Vec<SlotCheckpoint>)> {
         let slot = self.consensus.current_slot();
         let slot = self.consensus.current_slot();
-        debug!("chain_finalization(): Started finalization check for slot: {}", slot);
+        info!("chain_finalization(): Started finalization check for slot: {}", slot);
         // Set last slot finalization check occured to current slot
         // Set last slot finalization check occured to current slot
         self.consensus.checked_finalization = slot;
         self.consensus.checked_finalization = slot;
 
 
@@ -589,16 +589,16 @@ impl ValidatorState {
         // Check if we found any fork to finalize
         // Check if we found any fork to finalize
         match fork_index {
         match fork_index {
             -2 => {
             -2 => {
-                debug!("chain_finalization(): Eligible forks with same height exist, nothing to finalize.");
+                info!("chain_finalization(): Eligible forks with same height exist, nothing to finalize.");
                 self.consensus.set_leader_history(index_for_history);
                 self.consensus.set_leader_history(index_for_history);
                 return Ok((vec![], vec![]))
                 return Ok((vec![], vec![]))
             }
             }
             -1 => {
             -1 => {
-                debug!("chain_finalization(): All chains have less than 3 proposals, nothing to finalize.");
+                info!("chain_finalization(): All chains have less than 3 proposals, nothing to finalize.");
                 self.consensus.set_leader_history(index_for_history);
                 self.consensus.set_leader_history(index_for_history);
                 return Ok((vec![], vec![]))
                 return Ok((vec![], vec![]))
             }
             }
-            _ => debug!("chain_finalization(): Chain {} can be finalized!", fork_index),
+            _ => info!("chain_finalization(): Chain {} can be finalized!", fork_index),
         }
         }
 
 
         // Starting finalization
         // Starting finalization
@@ -634,7 +634,7 @@ impl ValidatorState {
             // TODO: These state transitions have already been checked. (I wrote this, but where?)
             // TODO: These state transitions have already been checked. (I wrote this, but where?)
             // TODO: FIXME: The state transitions have already been written, they have to be in memory
             // TODO: FIXME: The state transitions have already been written, they have to be in memory
             //              until this point.
             //              until this point.
-            debug!(target: "consensus", "Applying state transition for finalized block");
+            info!(target: "consensus", "Applying state transition for finalized block");
             if let Err(e) = self.verify_transactions(&proposal.txs, true).await {
             if let Err(e) = self.verify_transactions(&proposal.txs, true).await {
                 error!(target: "consensus", "Finalized block transaction verifications failed: {}", e);
                 error!(target: "consensus", "Finalized block transaction verifications failed: {}", e);
                 return Err(e)
                 return Err(e)
@@ -713,7 +713,7 @@ impl ValidatorState {
     /// Validate and append to canonical state received blocks.
     /// Validate and append to canonical state received blocks.
     pub async fn receive_blocks(&mut self, blocks: &[BlockInfo]) -> Result<()> {
     pub async fn receive_blocks(&mut self, blocks: &[BlockInfo]) -> Result<()> {
         // Verify state transitions for all blocks and their respective transactions.
         // Verify state transitions for all blocks and their respective transactions.
-        debug!("receive_blocks(): Starting state transition validations");
+        info!("receive_blocks(): Starting state transition validations");
         for block in blocks {
         for block in blocks {
             if let Err(e) = self.verify_transactions(&block.txs, false).await {
             if let Err(e) = self.verify_transactions(&block.txs, false).await {
                 error!("receive_blocks(): Transaction verifications failed: {}", e);
                 error!("receive_blocks(): Transaction verifications failed: {}", e);
@@ -721,8 +721,8 @@ impl ValidatorState {
             }
             }
         }
         }
 
 
-        debug!("receive_blocks(): All state transitions passed");
-        debug!("receive_blocks(): Appending blocks to ledger");
+        info!("receive_blocks(): All state transitions passed");
+        info!("receive_blocks(): Appending blocks to ledger");
         self.blockchain.add(blocks)?;
         self.blockchain.add(blocks)?;
 
 
         Ok(())
         Ok(())
@@ -734,7 +734,7 @@ impl ValidatorState {
         match self.blockchain.has_block(&block) {
         match self.blockchain.has_block(&block) {
             Ok(v) => {
             Ok(v) => {
                 if v {
                 if v {
-                    debug!("receive_finalized_block(): Existing block received");
+                    info!("receive_finalized_block(): Existing block received");
                     return Ok(false)
                     return Ok(false)
                 }
                 }
             }
             }
@@ -744,7 +744,7 @@ impl ValidatorState {
             }
             }
         };
         };
 
 
-        debug!("receive_finalized_block(): Executing state transitions");
+        info!("receive_finalized_block(): Executing state transitions");
         self.receive_blocks(&[block.clone()]).await?;
         self.receive_blocks(&[block.clone()]).await?;
 
 
         // TODO: Don't hardcode this:
         // TODO: Don't hardcode this:
@@ -754,7 +754,7 @@ impl ValidatorState {
         info!("consensus: Sending notification about finalized block");
         info!("consensus: Sending notification about finalized block");
         blocks_subscriber.notify(notif).await;
         blocks_subscriber.notify(notif).await;
 
 
-        debug!("receive_finalized_block(): Removing block transactions from unconfirmed_txs");
+        info!("receive_finalized_block(): Removing block transactions from unconfirmed_txs");
         self.remove_txs(&block.txs)?;
         self.remove_txs(&block.txs)?;
 
 
         Ok(true)
         Ok(true)
@@ -768,7 +768,7 @@ impl ValidatorState {
             match self.blockchain.has_block(block) {
             match self.blockchain.has_block(block) {
                 Ok(v) => {
                 Ok(v) => {
                     if v {
                     if v {
-                        debug!("receive_sync_blocks(): Existing block received");
+                        info!("receive_sync_blocks(): Existing block received");
                         continue
                         continue
                     }
                     }
                     new_blocks.push(block.clone());
                     new_blocks.push(block.clone());
@@ -781,11 +781,11 @@ impl ValidatorState {
         }
         }
 
 
         if new_blocks.is_empty() {
         if new_blocks.is_empty() {
-            debug!("receive_sync_blocks(): no new blocks to append");
+            info!("receive_sync_blocks(): no new blocks to append");
             return Ok(())
             return Ok(())
         }
         }
 
 
-        debug!("receive_sync_blocks(): Executing state transitions");
+        info!("receive_sync_blocks(): Executing state transitions");
         self.receive_blocks(&new_blocks[..]).await?;
         self.receive_blocks(&new_blocks[..]).await?;
 
 
         // TODO: Don't hardcode this:
         // TODO: Don't hardcode this:
@@ -809,10 +809,10 @@ impl ValidatorState {
     // TODO: This should be paralellized as if even one tx in the batch fails to verify,
     // TODO: This should be paralellized as if even one tx in the batch fails to verify,
     //       we can drop everything.
     //       we can drop everything.
     pub async fn verify_transactions(&self, txs: &[Transaction], write: bool) -> Result<()> {
     pub async fn verify_transactions(&self, txs: &[Transaction], write: bool) -> Result<()> {
-        debug!("Verifying {} transaction(s)", txs.len());
+        info!("Verifying {} transaction(s)", txs.len());
         for tx in txs {
         for tx in txs {
             let tx_hash = blake3::hash(&serialize(tx));
             let tx_hash = blake3::hash(&serialize(tx));
-            debug!("Verifying transaction {}", tx_hash);
+            info!("Verifying transaction {}", tx_hash);
 
 
             // Table of public inputs used for ZK proof verification
             // Table of public inputs used for ZK proof verification
             let mut zkp_table = vec![];
             let mut zkp_table = vec![];
@@ -823,10 +823,10 @@ impl ValidatorState {
 
 
             // Iterate over all calls to get the metadata
             // Iterate over all calls to get the metadata
             for (idx, call) in tx.calls.iter().enumerate() {
             for (idx, call) in tx.calls.iter().enumerate() {
-                debug!("Executing contract call {}", idx);
+                info!("Executing contract call {}", idx);
                 let wasm = match self.blockchain.wasm_bincode.get(call.contract_id) {
                 let wasm = match self.blockchain.wasm_bincode.get(call.contract_id) {
                     Ok(v) => {
                     Ok(v) => {
-                        debug!("Found wasm bincode for {}", call.contract_id);
+                        info!("Found wasm bincode for {}", call.contract_id);
                         v
                         v
                     }
                     }
                     Err(e) => {
                     Err(e) => {
@@ -856,7 +856,7 @@ impl ValidatorState {
                         }
                         }
                     };
                     };
 
 
-                debug!("Executing \"metadata\" call");
+                info!("Executing \"metadata\" call");
                 let metadata = match runtime.metadata(&payload) {
                 let metadata = match runtime.metadata(&payload) {
                     Ok(v) => v,
                     Ok(v) => v,
                     Err(e) => {
                     Err(e) => {
@@ -885,16 +885,16 @@ impl ValidatorState {
                 };
                 };
 
 
                 // TODO: Make sure we've read all the bytes above.
                 // TODO: Make sure we've read all the bytes above.
-                debug!("Successfully executed \"metadata\" call");
+                info!("Successfully executed \"metadata\" call");
                 zkp_table.push(zkp_pub);
                 zkp_table.push(zkp_pub);
                 sig_table.push(sig_pub);
                 sig_table.push(sig_pub);
 
 
                 // After getting the metadata, we run the "exec" function with the same
                 // After getting the metadata, we run the "exec" function with the same
                 // runtime and the same payload.
                 // runtime and the same payload.
-                debug!("Executing \"exec\" call");
+                info!("Executing \"exec\" call");
                 match runtime.exec(&payload) {
                 match runtime.exec(&payload) {
                     Ok(v) => {
                     Ok(v) => {
-                        debug!("Successfully executed \"exec\" call");
+                        info!("Successfully executed \"exec\" call");
                         updates.push(v);
                         updates.push(v);
                     }
                     }
                     Err(e) => {
                     Err(e) => {
@@ -911,9 +911,9 @@ impl ValidatorState {
             // When we're done looping and executing over the tx's contract calls, we
             // When we're done looping and executing over the tx's contract calls, we
             // move on with verification. First we verify the signatures as that's
             // move on with verification. First we verify the signatures as that's
             // cheaper, and then finally we verify the ZK proofs.
             // cheaper, and then finally we verify the ZK proofs.
-            debug!("Verifying signatures for transaction {}", tx_hash);
+            info!("Verifying signatures for transaction {}", tx_hash);
             match tx.verify_sigs(sig_table) {
             match tx.verify_sigs(sig_table) {
-                Ok(()) => debug!("Signatures verification for tx {} successful", tx_hash),
+                Ok(()) => info!("Signatures verification for tx {} successful", tx_hash),
                 Err(e) => {
                 Err(e) => {
                     error!("Signature verification for tx {} failed: {}", tx_hash, e);
                     error!("Signature verification for tx {} failed: {}", tx_hash, e);
                     return Err(e.into())
                     return Err(e.into())
@@ -924,9 +924,9 @@ impl ValidatorState {
             // verifying keys, but if we do not find them, we'll generate them
             // verifying keys, but if we do not find them, we'll generate them
             // inside of this function. This can be kinda expensive, so open to
             // inside of this function. This can be kinda expensive, so open to
             // alternatives.
             // alternatives.
-            debug!("Verifying ZK proofs for transaction {}", tx_hash);
+            info!("Verifying ZK proofs for transaction {}", tx_hash);
             match tx.verify_zkps(self.verifying_keys.clone(), zkp_table).await {
             match tx.verify_zkps(self.verifying_keys.clone(), zkp_table).await {
-                Ok(()) => debug!("ZK proof verification for tx {} successful", tx_hash),
+                Ok(()) => info!("ZK proof verification for tx {} successful", tx_hash),
                 Err(e) => {
                 Err(e) => {
                     error!("ZK proof verrification for tx {} failed: {}", tx_hash, e);
                     error!("ZK proof verrification for tx {} failed: {}", tx_hash, e);
                     return Err(e.into())
                     return Err(e.into())
@@ -937,7 +937,7 @@ impl ValidatorState {
             // apply the state updates.
             // apply the state updates.
             assert!(tx.calls.len() == updates.len());
             assert!(tx.calls.len() == updates.len());
             if write {
             if write {
-                debug!("Performing state updates");
+                info!("Performing state updates");
                 for (call, update) in tx.calls.iter().zip(updates.iter()) {
                 for (call, update) in tx.calls.iter().zip(updates.iter()) {
                     // For this we instantiate the runtimes again.
                     // For this we instantiate the runtimes again.
                     // TODO: Optimize this
                     // TODO: Optimize this
@@ -945,7 +945,7 @@ impl ValidatorState {
                     //       and verification and these.
                     //       and verification and these.
                     let wasm = match self.blockchain.wasm_bincode.get(call.contract_id) {
                     let wasm = match self.blockchain.wasm_bincode.get(call.contract_id) {
                         Ok(v) => {
                         Ok(v) => {
-                            debug!("Found wasm bincode for {}", call.contract_id);
+                            info!("Found wasm bincode for {}", call.contract_id);
                             v
                             v
                         }
                         }
                         Err(e) => {
                         Err(e) => {
@@ -969,10 +969,10 @@ impl ValidatorState {
                             }
                             }
                         };
                         };
 
 
-                    debug!("Executing \"apply\" call");
+                    info!("Executing \"apply\" call");
                     match runtime.apply(&update) {
                     match runtime.apply(&update) {
                         // TODO: FIXME: This should be done in an atomic tx/batch
                         // TODO: FIXME: This should be done in an atomic tx/batch
-                        Ok(()) => debug!("State update applied successfully"),
+                        Ok(()) => info!("State update applied successfully"),
                         Err(e) => {
                         Err(e) => {
                             error!("Failed to apply state update: {}", e);
                             error!("Failed to apply state update: {}", e);
                             return Err(e.into())
                             return Err(e.into())
@@ -980,10 +980,10 @@ impl ValidatorState {
                     };
                     };
                 }
                 }
             } else {
             } else {
-                debug!("Skipping apply of state updates because write=false");
+                info!("Skipping apply of state updates because write=false");
             }
             }
 
 
-            debug!("Transaction {} verified successfully", tx_hash);
+            info!("Transaction {} verified successfully", tx_hash);
         }
         }
 
 
         Ok(())
         Ok(())
@@ -994,7 +994,7 @@ impl ValidatorState {
         &mut self,
         &mut self,
         slot_checkpoints: &[SlotCheckpoint],
         slot_checkpoints: &[SlotCheckpoint],
     ) -> Result<()> {
     ) -> Result<()> {
-        debug!("receive_slot_checkpoints(): Appending slot checkpoints to ledger");
+        info!("receive_slot_checkpoints(): Appending slot checkpoints to ledger");
         self.blockchain.add_slot_checkpoints(slot_checkpoints)?;
         self.blockchain.add_slot_checkpoints(slot_checkpoints)?;
 
 
         Ok(())
         Ok(())
@@ -1009,7 +1009,7 @@ impl ValidatorState {
         match self.blockchain.has_slot_checkpoint(&slot_checkpoint) {
         match self.blockchain.has_slot_checkpoint(&slot_checkpoint) {
             Ok(v) => {
             Ok(v) => {
                 if v {
                 if v {
-                    debug!(
+                    info!(
                         "receive_finalized_slot_checkpoints(): Existing slot checkpoint received"
                         "receive_finalized_slot_checkpoints(): Existing slot checkpoint received"
                     );
                     );
                     return Ok(false)
                     return Ok(false)