From 80bff2fa454b84c989fb73fe68c03460696d539b Mon Sep 17 00:00:00 2001 From: narodnik Date: Thu, 11 Aug 2022 10:17:15 +0200 Subject: [PATCH] daod bugfix, use ** for deref any since the any is & --- bin/daod/src/demo.rs | 7 ++++++- doc/src/architecture/smart_contracts.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/daod/src/demo.rs b/bin/daod/src/demo.rs index 5c8a43dea..e0b9de41d 100644 --- a/bin/daod/src/demo.rs +++ b/bin/daod/src/demo.rs @@ -35,6 +35,10 @@ use darkfi::{ zk::circuit::{BurnContract, MintContract}, }; +fn type_of(_: &T) -> &'static str { + std::any::type_name::() +} + /// The state machine, held in memory. struct MemoryState { /// The entire Merkle tree state @@ -184,6 +188,7 @@ mod dao_contract { /// ``` pub mod mint { use darkfi::crypto::keypair::PublicKey; + use log::debug; use pasta_curves::pallas; use std::{ any::{Any, TypeId}, @@ -243,7 +248,7 @@ mod dao_contract { let func_call = &parent_tx.func_calls[func_call_index]; let call_data = &func_call.call_data; - assert_eq!((&*call_data).type_id(), TypeId::of::()); + assert_eq!((&**call_data).type_id(), TypeId::of::()); let func_call = func_call.call_data.downcast_ref::(); Ok(Update {}) } diff --git a/doc/src/architecture/smart_contracts.md b/doc/src/architecture/smart_contracts.md index f22e2c17e..2e6ce2279 100644 --- a/doc/src/architecture/smart_contracts.md +++ b/doc/src/architecture/smart_contracts.md @@ -127,7 +127,7 @@ mod dao_contract { // So we know the tx is well formed. // we can elide this with macro magic - assert_eq((&*call_data).type_id(), TypeId::of::()); + assert_eq((&**call_data).type_id(), TypeId::of::()); let func_call = func_call.call_data.downcast_ref::(); ...