diff --git a/src/contract/dao/src/entrypoint.rs b/src/contract/dao/src/entrypoint.rs index 26490b0b6..708d40e9b 100644 --- a/src/contract/dao/src/entrypoint.rs +++ b/src/contract/dao/src/entrypoint.rs @@ -83,7 +83,7 @@ fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult { }; // Set up the entries in the header table - match db_get(dao_info_db, &serialize(&DAO_CONTRACT_KEY_DAO_MERKLE_TREE))? { + match db_get(dao_info_db, DAO_CONTRACT_KEY_DAO_MERKLE_TREE)? { Some(bytes) => { // We found some bytes, try to deserialize into a tree. // For now, if this doesn't work, we bail. @@ -99,7 +99,7 @@ fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult { tree_data.write_u32(0)?; tree.encode(&mut tree_data)?; - db_set(dao_info_db, &serialize(&DAO_CONTRACT_KEY_DAO_MERKLE_TREE), &tree_data)?; + db_set(dao_info_db, DAO_CONTRACT_KEY_DAO_MERKLE_TREE, &tree_data)?; } } @@ -130,11 +130,7 @@ fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult { }; // Update db version - db_set( - dao_info_db, - &serialize(&DAO_CONTRACT_KEY_DB_VERSION), - &serialize(&env!("CARGO_PKG_VERSION")), - )?; + db_set(dao_info_db, DAO_CONTRACT_KEY_DB_VERSION, &serialize(&env!("CARGO_PKG_VERSION")))?; Ok(()) } diff --git a/src/contract/dao/src/entrypoint/mint.rs b/src/contract/dao/src/entrypoint/mint.rs index 24f37aef7..b29836280 100644 --- a/src/contract/dao/src/entrypoint/mint.rs +++ b/src/contract/dao/src/entrypoint/mint.rs @@ -103,8 +103,8 @@ pub(crate) fn dao_mint_process_update(cid: ContractId, update: DaoMintUpdate) -> merkle_add( info_db, roots_db, - &serialize(&DAO_CONTRACT_KEY_LATEST_DAO_ROOT), - &serialize(&DAO_CONTRACT_KEY_DAO_MERKLE_TREE), + DAO_CONTRACT_KEY_LATEST_DAO_ROOT, + DAO_CONTRACT_KEY_DAO_MERKLE_TREE, &dao, )?; diff --git a/src/contract/dao/src/entrypoint/propose.rs b/src/contract/dao/src/entrypoint/propose.rs index abda52afb..482946d44 100644 --- a/src/contract/dao/src/entrypoint/propose.rs +++ b/src/contract/dao/src/entrypoint/propose.rs @@ -134,7 +134,7 @@ pub(crate) fn dao_propose_process_instruction( // Snapshot the latest Money Mekrle tree let money_info_db = db_lookup(*MONEY_CONTRACT_ID, MONEY_CONTRACT_INFO_TREE)?; - let Some(data) = db_get(money_info_db, &serialize(&MONEY_CONTRACT_LATEST_COIN_ROOT))? else { + let Some(data) = db_get(money_info_db, MONEY_CONTRACT_LATEST_COIN_ROOT)? else { msg!("[Dao::Propose] Error: Failed to fetch latest Money Merkle root"); return Err(ContractError::Internal) }; diff --git a/src/contract/dao/src/lib.rs b/src/contract/dao/src/lib.rs index ac8d069e4..bace1a504 100644 --- a/src/contract/dao/src/lib.rs +++ b/src/contract/dao/src/lib.rs @@ -66,9 +66,9 @@ pub const DAO_CONTRACT_DB_PROPOSAL_BULLAS: &str = "dao_proposals"; pub const DAO_CONTRACT_DB_VOTE_NULLIFIERS: &str = "dao_vote_nullifiers"; // These are keys inside the info tree -pub const DAO_CONTRACT_KEY_DB_VERSION: &str = "db_version"; -pub const DAO_CONTRACT_KEY_DAO_MERKLE_TREE: &str = "dao_merkle_tree"; -pub const DAO_CONTRACT_KEY_LATEST_DAO_ROOT: &str = "dao_last_root"; +pub const DAO_CONTRACT_KEY_DB_VERSION: &[u8] = b"db_version"; +pub const DAO_CONTRACT_KEY_DAO_MERKLE_TREE: &[u8] = b"dao_merkle_tree"; +pub const DAO_CONTRACT_KEY_LATEST_DAO_ROOT: &[u8] = b"dao_last_root"; /// zkas dao mint circuit namespace pub const DAO_CONTRACT_ZKAS_DAO_MINT_NS: &str = "DaoMint";