diff --git a/bin/daod/src/demo.rs b/bin/daod/src/demo.rs index 6967bd7f9..718a12ba4 100644 --- a/bin/daod/src/demo.rs +++ b/bin/daod/src/demo.rs @@ -257,6 +257,7 @@ pub async fn demo() -> Result<()> { ///////////////////////////////////////////////////// ////// Create the DAO bulla ///////////////////////////////////////////////////// + debug!(target: "demo", "1. Creating DAO bulla"); //// Wallet @@ -308,6 +309,10 @@ pub async fn demo() -> Result<()> { //// Mint the initial supply of treasury token //// and send it all to the DAO directly /////////////////////////////////////////////////// + debug!(target: "demo", "2. Minting treasury token"); + + let state = states.lookup_mut::(&"Money".to_string()).unwrap(); + state.wallet_cache.track(dao_keypair.secret); //// Wallet @@ -399,6 +404,7 @@ pub async fn demo() -> Result<()> { //// Mint the governance token //// Send it to three hodlers /////////////////////////////////////////////////// + debug!(target: "demo", "3. Minting governance token"); //// Wallet @@ -534,6 +540,7 @@ pub async fn demo() -> Result<()> { // In order to make a valid vote, first the proposer must // meet a criteria for a minimum number of gov tokens /////////////////////////////////////////////////// + debug!(target: "demo", "4. Propose the vote"); //// Wallet diff --git a/bin/daod/src/money_contract/state.rs b/bin/daod/src/money_contract/state.rs index e740b572e..b80716cea 100644 --- a/bin/daod/src/money_contract/state.rs +++ b/bin/daod/src/money_contract/state.rs @@ -33,11 +33,13 @@ impl WalletCache { Self { cache: Vec::new() } } + /// Must be called at the start to begin tracking received coins for this secret. pub fn track(&mut self, secret: SecretKey) { self.cache.push((secret, Vec::new())); } /// Get all coins received by this secret key + /// track() must be called on this secret before calling this or the function will panic. pub fn get_received(&mut self, secret: &SecretKey) -> Vec { for (other_secret, own_coins) in self.cache.iter_mut() { if *secret == *other_secret { @@ -45,7 +47,7 @@ impl WalletCache { return std::mem::replace(own_coins, Vec::new()) } } - unreachable!(); + panic!("you forget to track() this secret!"); } pub fn try_decrypt_note( diff --git a/bin/daod/src/money_contract/transfer/validate.rs b/bin/daod/src/money_contract/transfer/validate.rs index b06b0d868..f6b7ce226 100644 --- a/bin/daod/src/money_contract/transfer/validate.rs +++ b/bin/daod/src/money_contract/transfer/validate.rs @@ -129,7 +129,7 @@ pub fn state_transition( nullifiers.push(input.revealed.nullifier); } - debug!(target: TARGET, "Verifying zk proofs"); + debug!(target: TARGET, "Verifying call data"); match call_data.verify(&func_call.proofs) { Ok(()) => { debug!(target: TARGET, "Verified successfully")