Просмотр исходного кода

contract/consensus: updated based on master rebase

aggstam 3 лет назад
Родитель
Сommit
448eb80c4d
3 измененных файлов с 84 добавлено и 107 удалено
  1. 69 17
      Cargo.lock
  2. 10 46
      src/contract/consensus/src/entrypoint.rs
  3. 5 44
      src/contract/consensus/tests/harness.rs

+ 69 - 17
Cargo.lock

@@ -1196,7 +1196,7 @@ dependencies = [
  "futures",
  "futures",
  "futures-rustls 0.24.0",
  "futures-rustls 0.24.0",
  "halo2_gadgets",
  "halo2_gadgets",
- "halo2_proofs",
+ "halo2_proofs 0.3.0",
  "hex",
  "hex",
  "indexmap",
  "indexmap",
  "indicatif",
  "indicatif",
@@ -1242,7 +1242,7 @@ dependencies = [
  "darkfi-sdk",
  "darkfi-sdk",
  "darkfi-serial",
  "darkfi-serial",
  "getrandom",
  "getrandom",
- "halo2_proofs",
+ "halo2_proofs 0.2.0",
  "log",
  "log",
  "rand",
  "rand",
  "simplelog",
  "simplelog",
@@ -1262,7 +1262,7 @@ dependencies = [
  "darkfi-sdk",
  "darkfi-sdk",
  "darkfi-serial",
  "darkfi-serial",
  "getrandom",
  "getrandom",
- "halo2_proofs",
+ "halo2_proofs 0.3.0",
  "log",
  "log",
  "rand",
  "rand",
  "simplelog",
  "simplelog",
@@ -1300,7 +1300,7 @@ dependencies = [
  "darkfi-sdk",
  "darkfi-sdk",
  "darkfi-serial",
  "darkfi-serial",
  "getrandom",
  "getrandom",
- "halo2_proofs",
+ "halo2_proofs 0.3.0",
  "log",
  "log",
  "rand",
  "rand",
  "simplelog",
  "simplelog",
@@ -1319,12 +1319,12 @@ dependencies = [
  "chacha20poly1305",
  "chacha20poly1305",
  "darkfi-serial",
  "darkfi-serial",
  "halo2_gadgets",
  "halo2_gadgets",
- "halo2_proofs",
+ "halo2_proofs 0.3.0",
  "incrementalmerkletree",
  "incrementalmerkletree",
  "lazy_static",
  "lazy_static",
  "num-bigint",
  "num-bigint",
  "num-traits",
  "num-traits",
- "pasta_curves",
+ "pasta_curves 0.5.1",
  "rand",
  "rand",
  "rand_core 0.6.4",
  "rand_core 0.6.4",
  "sha2",
  "sha2",
@@ -1340,7 +1340,7 @@ dependencies = [
  "darkfi-derive",
  "darkfi-derive",
  "futures-lite",
  "futures-lite",
  "incrementalmerkletree",
  "incrementalmerkletree",
- "pasta_curves",
+ "pasta_curves 0.5.1",
  "url",
  "url",
 ]
 ]
 
 
@@ -1925,6 +1925,17 @@ dependencies = [
  "simd-adler32",
  "simd-adler32",
 ]
 ]
 
 
+[[package]]
+name = "ff"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160"
+dependencies = [
+ "bitvec",
+ "rand_core 0.6.4",
+ "subtle",
+]
+
 [[package]]
 [[package]]
 name = "ff"
 name = "ff"
 version = "0.13.0"
 version = "0.13.0"
@@ -2336,13 +2347,24 @@ dependencies = [
  "wasm-bindgen",
  "wasm-bindgen",
 ]
 ]
 
 
+[[package]]
+name = "group"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7"
+dependencies = [
+ "ff 0.12.1",
+ "rand_core 0.6.4",
+ "subtle",
+]
+
 [[package]]
 [[package]]
 name = "group"
 name = "group"
 version = "0.13.0"
 version = "0.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
 checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
 dependencies = [
 dependencies = [
- "ff",
+ "ff 0.13.0",
  "rand_core 0.6.4",
  "rand_core 0.6.4",
  "subtle",
  "subtle",
 ]
 ]
@@ -2355,11 +2377,11 @@ checksum = "126a150072b0c38c7b573fe3eaf0af944a7fed09e154071bf2436d3f016f7230"
 dependencies = [
 dependencies = [
  "arrayvec",
  "arrayvec",
  "bitvec",
  "bitvec",
- "ff",
- "group",
- "halo2_proofs",
+ "ff 0.13.0",
+ "group 0.13.0",
+ "halo2_proofs 0.3.0",
  "lazy_static",
  "lazy_static",
- "pasta_curves",
+ "pasta_curves 0.5.1",
  "plotters",
  "plotters",
  "proptest",
  "proptest",
  "rand",
  "rand",
@@ -2367,6 +2389,21 @@ dependencies = [
  "uint",
  "uint",
 ]
 ]
 
 
+[[package]]
+name = "halo2_proofs"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cff771b9a2445cd2545c9ef26d863c290fbb44ae440c825a20eb7156f67a949a"
+dependencies = [
+ "blake2b_simd",
+ "ff 0.12.1",
+ "group 0.12.1",
+ "pasta_curves 0.4.1",
+ "rand_core 0.6.4",
+ "rayon",
+ "tracing",
+]
+
 [[package]]
 [[package]]
 name = "halo2_proofs"
 name = "halo2_proofs"
 version = "0.3.0"
 version = "0.3.0"
@@ -2374,10 +2411,10 @@ source = "git+https://github.com/parazyd/halo2?branch=v3#09c57c6b6531f212ad687cd
 dependencies = [
 dependencies = [
  "backtrace",
  "backtrace",
  "blake2b_simd",
  "blake2b_simd",
- "ff",
- "group",
+ "ff 0.13.0",
+ "group 0.13.0",
  "maybe-rayon",
  "maybe-rayon",
- "pasta_curves",
+ "pasta_curves 0.5.1",
  "plotters",
  "plotters",
  "rand_core 0.6.4",
  "rand_core 0.6.4",
  "tabbycat",
  "tabbycat",
@@ -3090,6 +3127,21 @@ dependencies = [
  "windows-sys 0.45.0",
  "windows-sys 0.45.0",
 ]
 ]
 
 
+[[package]]
+name = "pasta_curves"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5cc65faf8e7313b4b1fbaa9f7ca917a0eed499a9663be71477f87993604341d8"
+dependencies = [
+ "blake2b_simd",
+ "ff 0.12.1",
+ "group 0.12.1",
+ "lazy_static",
+ "rand",
+ "static_assertions",
+ "subtle",
+]
+
 [[package]]
 [[package]]
 name = "pasta_curves"
 name = "pasta_curves"
 version = "0.5.1"
 version = "0.5.1"
@@ -3097,8 +3149,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d3e57598f73cc7e1b2ac63c79c517b31a0877cd7c402cdcaa311b5208de7a095"
 checksum = "d3e57598f73cc7e1b2ac63c79c517b31a0877cd7c402cdcaa311b5208de7a095"
 dependencies = [
 dependencies = [
  "blake2b_simd",
  "blake2b_simd",
- "ff",
- "group",
+ "ff 0.13.0",
+ "group 0.13.0",
  "lazy_static",
  "lazy_static",
  "rand",
  "rand",
  "static_assertions",
  "static_assertions",

+ 10 - 46
src/contract/consensus/src/entrypoint.rs

@@ -16,7 +16,6 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-<<<<<<< HEAD
 use darkfi_money_contract::{
 use darkfi_money_contract::{
     model::{ConsensusStakeUpdateV1, ConsensusUnstakeUpdateV1},
     model::{ConsensusStakeUpdateV1, ConsensusUnstakeUpdateV1},
     CONSENSUS_CONTRACT_COINS_TREE, CONSENSUS_CONTRACT_COIN_MERKLE_TREE,
     CONSENSUS_CONTRACT_COINS_TREE, CONSENSUS_CONTRACT_COIN_MERKLE_TREE,
@@ -27,24 +26,13 @@ use darkfi_money_contract::{
 };
 };
 use darkfi_sdk::{
 use darkfi_sdk::{
     crypto::{ContractId, MerkleTree},
     crypto::{ContractId, MerkleTree},
-    db::{db_init, db_lookup, db_set, set_return_data, SMART_CONTRACT_ZKAS_DB_NAME},
+    db::{db_init, db_lookup, db_set, set_return_data, zkas_db_set},
     error::{ContractError, ContractResult},
     error::{ContractError, ContractResult},
     msg, ContractCall,
     msg, ContractCall,
 };
 };
 use darkfi_serial::{deserialize, serialize, Encodable, WriteExt};
 use darkfi_serial::{deserialize, serialize, Encodable, WriteExt};
 
 
 use crate::{model::ConsensusRewardUpdateV1, ConsensusFunction};
 use crate::{model::ConsensusRewardUpdateV1, ConsensusFunction};
-=======
-use darkfi_sdk::{
-    crypto::ContractId,
-    db::{db_init, db_lookup, set_return_data, SMART_CONTRACT_ZKAS_DB_NAME},
-    error::{ContractError, ContractResult},
-    msg, ContractCall,
-};
-use darkfi_serial::deserialize;
-
-use crate::{model::ConsensusStakeUpdateV1, ConsensusFunction};
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
 
 
 /// `Consensus::Stake` functions
 /// `Consensus::Stake` functions
 mod stake_v1;
 mod stake_v1;
@@ -53,7 +41,6 @@ use stake_v1::{
     consensus_stake_process_update_v1,
     consensus_stake_process_update_v1,
 };
 };
 
 
-<<<<<<< HEAD
 /// `Consensus::ProposalBurn` functions
 /// `Consensus::ProposalBurn` functions
 mod proposal_burn_v1;
 mod proposal_burn_v1;
 use proposal_burn_v1::{
 use proposal_burn_v1::{
@@ -82,8 +69,6 @@ use unstake_v1::{
     consensus_unstake_process_update_v1,
     consensus_unstake_process_update_v1,
 };
 };
 
 
-=======
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
 darkfi_sdk::define_contract!(
 darkfi_sdk::define_contract!(
     init: init_contract,
     init: init_contract,
     exec: process_instruction,
     exec: process_instruction,
@@ -96,27 +81,18 @@ darkfi_sdk::define_contract!(
 /// with initial data if necessary. This is also the place where we bundle the zkas
 /// with initial data if necessary. This is also the place where we bundle the zkas
 /// circuits that are to be used with functions provided by the contract.
 /// circuits that are to be used with functions provided by the contract.
 fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult {
 fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult {
-    // The zkas circuit can simply be embedded in the wasm and set up by
-    // the initialization. Note that the tree should then be called "zkas".
-    // The lookups can be done by `contract_id+_zkas+namespace`.
-    // TODO: For the zkas tree, external host checks should be done to ensure
-    //       that the bincode is actually valid and not arbitrary.
-<<<<<<< HEAD
-    let zkas_db = match db_lookup(cid, SMART_CONTRACT_ZKAS_DB_NAME) {
-=======
-    let _zkas_db = match db_lookup(cid, SMART_CONTRACT_ZKAS_DB_NAME) {
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
-        Ok(v) => v,
-        Err(_) => db_init(cid, SMART_CONTRACT_ZKAS_DB_NAME)?,
-    };
-
-<<<<<<< HEAD
+    // zkas circuits can simply be embedded in the wasm and set up by using
+    // respective db functions. The special `zkas db` operations exist in
+    // order to be able to verify the circuits being bundled and enforcing
+    // a specific tree inside sled, and also creation of VerifyingKey.
     let money_mint_v1_bincode = include_bytes!("../../money/proof/mint_v1.zk.bin");
     let money_mint_v1_bincode = include_bytes!("../../money/proof/mint_v1.zk.bin");
     let money_burn_v1_bincode = include_bytes!("../../money/proof/burn_v1.zk.bin");
     let money_burn_v1_bincode = include_bytes!("../../money/proof/burn_v1.zk.bin");
     let reward_v1_bincode = include_bytes!("../proof/reward_v1.zk.bin");
     let reward_v1_bincode = include_bytes!("../proof/reward_v1.zk.bin");
-    db_set(zkas_db, &serialize(&MONEY_CONTRACT_ZKAS_MINT_NS_V1), &money_mint_v1_bincode[..])?;
-    db_set(zkas_db, &serialize(&MONEY_CONTRACT_ZKAS_BURN_NS_V1), &money_burn_v1_bincode[..])?;
-    db_set(zkas_db, &serialize(&CONSENSUS_CONTRACT_ZKAS_REWARD_NS_V1), &reward_v1_bincode[..])?;
+
+    // For that, we use `zkas_db_set` and pass in the bincode.
+    zkas_db_set(&money_mint_v1_bincode[..])?;
+    zkas_db_set(&money_burn_v1_bincode[..])?;
+    zkas_db_set(&reward_v1_bincode[..])?;
 
 
     // Set up a database tree to hold Merkle roots of all coins
     // Set up a database tree to hold Merkle roots of all coins
     // k=MerkleNode, v=[]
     // k=MerkleNode, v=[]
@@ -160,9 +136,6 @@ fn init_contract(cid: ContractId, _ix: &[u8]) -> ContractResult {
         &serialize(&CONSENSUS_CONTRACT_DB_VERSION),
         &serialize(&CONSENSUS_CONTRACT_DB_VERSION),
         &serialize(&env!("CARGO_PKG_VERSION")),
         &serialize(&env!("CARGO_PKG_VERSION")),
     )?;
     )?;
-=======
-    // TODO: implement
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
 
 
     Ok(())
     Ok(())
 }
 }
@@ -186,7 +159,6 @@ fn get_metadata(cid: ContractId, ix: &[u8]) -> ContractResult {
             let metadata = consensus_stake_get_metadata_v1(cid, call_idx, calls)?;
             let metadata = consensus_stake_get_metadata_v1(cid, call_idx, calls)?;
             Ok(set_return_data(&metadata)?)
             Ok(set_return_data(&metadata)?)
         }
         }
-<<<<<<< HEAD
         ConsensusFunction::ProposalBurnV1 => {
         ConsensusFunction::ProposalBurnV1 => {
             let metadata = consensus_proposal_burn_get_metadata_v1(cid, call_idx, calls)?;
             let metadata = consensus_proposal_burn_get_metadata_v1(cid, call_idx, calls)?;
             Ok(set_return_data(&metadata)?)
             Ok(set_return_data(&metadata)?)
@@ -203,8 +175,6 @@ fn get_metadata(cid: ContractId, ix: &[u8]) -> ContractResult {
             let metadata = consensus_unstake_get_metadata_v1(cid, call_idx, calls)?;
             let metadata = consensus_unstake_get_metadata_v1(cid, call_idx, calls)?;
             Ok(set_return_data(&metadata)?)
             Ok(set_return_data(&metadata)?)
         }
         }
-=======
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
     }
     }
 }
 }
 
 
@@ -228,7 +198,6 @@ fn process_instruction(cid: ContractId, ix: &[u8]) -> ContractResult {
             let update_data = consensus_stake_process_instruction_v1(cid, call_idx, calls)?;
             let update_data = consensus_stake_process_instruction_v1(cid, call_idx, calls)?;
             Ok(set_return_data(&update_data)?)
             Ok(set_return_data(&update_data)?)
         }
         }
-<<<<<<< HEAD
         ConsensusFunction::ProposalBurnV1 => {
         ConsensusFunction::ProposalBurnV1 => {
             let update_data = consensus_proposal_burn_process_instruction_v1(cid, call_idx, calls)?;
             let update_data = consensus_proposal_burn_process_instruction_v1(cid, call_idx, calls)?;
             Ok(set_return_data(&update_data)?)
             Ok(set_return_data(&update_data)?)
@@ -246,8 +215,6 @@ fn process_instruction(cid: ContractId, ix: &[u8]) -> ContractResult {
             let update_data = consensus_unstake_process_instruction_v1(cid, call_idx, calls)?;
             let update_data = consensus_unstake_process_instruction_v1(cid, call_idx, calls)?;
             Ok(set_return_data(&update_data)?)
             Ok(set_return_data(&update_data)?)
         }
         }
-=======
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
     }
     }
 }
 }
 
 
@@ -261,7 +228,6 @@ fn process_update(cid: ContractId, update_data: &[u8]) -> ContractResult {
             let update: ConsensusStakeUpdateV1 = deserialize(&update_data[1..])?;
             let update: ConsensusStakeUpdateV1 = deserialize(&update_data[1..])?;
             Ok(consensus_stake_process_update_v1(cid, update)?)
             Ok(consensus_stake_process_update_v1(cid, update)?)
         }
         }
-<<<<<<< HEAD
         ConsensusFunction::ProposalBurnV1 => {
         ConsensusFunction::ProposalBurnV1 => {
             let update: ConsensusUnstakeUpdateV1 = deserialize(&update_data[1..])?;
             let update: ConsensusUnstakeUpdateV1 = deserialize(&update_data[1..])?;
             Ok(consensus_proposal_burn_process_update_v1(cid, update)?)
             Ok(consensus_proposal_burn_process_update_v1(cid, update)?)
@@ -278,7 +244,5 @@ fn process_update(cid: ContractId, update_data: &[u8]) -> ContractResult {
             let update: ConsensusUnstakeUpdateV1 = deserialize(&update_data[1..])?;
             let update: ConsensusUnstakeUpdateV1 = deserialize(&update_data[1..])?;
             Ok(consensus_unstake_process_update_v1(cid, update)?)
             Ok(consensus_unstake_process_update_v1(cid, update)?)
         }
         }
-=======
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
     }
     }
 }
 }

+ 5 - 44
src/contract/consensus/tests/harness.rs

@@ -22,6 +22,7 @@ use darkfi::{
         ValidatorState, ValidatorStatePtr, TESTNET_BOOTSTRAP_TIMESTAMP, TESTNET_GENESIS_HASH_BYTES,
         ValidatorState, ValidatorStatePtr, TESTNET_BOOTSTRAP_TIMESTAMP, TESTNET_GENESIS_HASH_BYTES,
         TESTNET_GENESIS_TIMESTAMP, TESTNET_INITIAL_DISTRIBUTION,
         TESTNET_GENESIS_TIMESTAMP, TESTNET_INITIAL_DISTRIBUTION,
     },
     },
+    runtime::vm_runtime::SMART_CONTRACT_ZKAS_DB_NAME,
     tx::Transaction,
     tx::Transaction,
     wallet::{WalletDb, WalletPtr},
     wallet::{WalletDb, WalletPtr},
     zk::{empty_witnesses, halo2::Field, ProvingKey, ZkCircuit},
     zk::{empty_witnesses, halo2::Field, ProvingKey, ZkCircuit},
@@ -34,26 +35,20 @@ use darkfi_sdk::{
     crypto::{
     crypto::{
         Keypair, MerkleTree, PublicKey, CONSENSUS_CONTRACT_ID, DARK_TOKEN_ID, MONEY_CONTRACT_ID,
         Keypair, MerkleTree, PublicKey, CONSENSUS_CONTRACT_ID, DARK_TOKEN_ID, MONEY_CONTRACT_ID,
     },
     },
+<<<<<<< HEAD
 =======
 =======
     crypto::{Keypair, MerkleTree, PublicKey, DARK_TOKEN_ID, MONEY_CONTRACT_ID},
     crypto::{Keypair, MerkleTree, PublicKey, DARK_TOKEN_ID, MONEY_CONTRACT_ID},
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
-    db::SMART_CONTRACT_ZKAS_DB_NAME,
     pasta::pallas,
     pasta::pallas,
     ContractCall,
     ContractCall,
 };
 };
-use darkfi_serial::{serialize, Encodable};
+use darkfi_serial::{deserialize, serialize, Encodable};
 use log::warn;
 use log::warn;
 use rand::rngs::OsRng;
 use rand::rngs::OsRng;
 
 
 use darkfi_money_contract::{
 use darkfi_money_contract::{
     client::transfer_v1::TransferCallBuilder, model::MoneyTransferParamsV1, MoneyFunction,
     client::transfer_v1::TransferCallBuilder, model::MoneyTransferParamsV1, MoneyFunction,
-<<<<<<< HEAD
     CONSENSUS_CONTRACT_ZKAS_REWARD_NS_V1, MONEY_CONTRACT_ZKAS_BURN_NS_V1,
     CONSENSUS_CONTRACT_ZKAS_REWARD_NS_V1, MONEY_CONTRACT_ZKAS_BURN_NS_V1,
     MONEY_CONTRACT_ZKAS_MINT_NS_V1,
     MONEY_CONTRACT_ZKAS_MINT_NS_V1,
-=======
-    MONEY_CONTRACT_ZKAS_BURN_NS_V1, MONEY_CONTRACT_ZKAS_MINT_NS_V1,
-    MONEY_CONTRACT_ZKAS_TOKEN_FRZ_NS_V1, MONEY_CONTRACT_ZKAS_TOKEN_MINT_NS_V1,
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
 };
 };
 
 
 pub fn init_logger() {
 pub fn init_logger() {
@@ -78,10 +73,7 @@ pub struct Wallet {
     pub keypair: Keypair,
     pub keypair: Keypair,
     pub state: ValidatorStatePtr,
     pub state: ValidatorStatePtr,
     pub merkle_tree: MerkleTree,
     pub merkle_tree: MerkleTree,
-<<<<<<< HEAD
     pub consensus_merkle_tree: MerkleTree,
     pub consensus_merkle_tree: MerkleTree,
-=======
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
     pub wallet: WalletPtr,
     pub wallet: WalletPtr,
     pub coins: Vec<OwnCoin>,
     pub coins: Vec<OwnCoin>,
     pub spent_coins: Vec<OwnCoin>,
     pub spent_coins: Vec<OwnCoin>,
@@ -106,30 +98,18 @@ impl Wallet {
         .await?;
         .await?;
 
 
         let merkle_tree = MerkleTree::new(100);
         let merkle_tree = MerkleTree::new(100);
-<<<<<<< HEAD
         let consensus_merkle_tree = MerkleTree::new(100);
         let consensus_merkle_tree = MerkleTree::new(100);
-=======
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
 
 
         let coins = vec![];
         let coins = vec![];
         let spent_coins = vec![];
         let spent_coins = vec![];
 
 
-<<<<<<< HEAD
         Ok(Self { keypair, state, merkle_tree, consensus_merkle_tree, wallet, coins, spent_coins })
         Ok(Self { keypair, state, merkle_tree, consensus_merkle_tree, wallet, coins, spent_coins })
-=======
-        Ok(Self { keypair, state, merkle_tree, wallet, coins, spent_coins })
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
     }
     }
 }
 }
 
 
 pub struct ConsensusTestHarness {
 pub struct ConsensusTestHarness {
     pub faucet: Wallet,
     pub faucet: Wallet,
     pub alice: Wallet,
     pub alice: Wallet,
-<<<<<<< HEAD
-=======
-    pub bob: Wallet,
-    pub charlie: Wallet,
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
     pub proving_keys: HashMap<&'static str, (ProvingKey, ZkBinary)>,
     pub proving_keys: HashMap<&'static str, (ProvingKey, ZkBinary)>,
 }
 }
 
 
@@ -142,23 +122,10 @@ impl ConsensusTestHarness {
         let alice_kp = Keypair::random(&mut OsRng);
         let alice_kp = Keypair::random(&mut OsRng);
         let alice = Wallet::new(alice_kp, &faucet_pubkeys).await?;
         let alice = Wallet::new(alice_kp, &faucet_pubkeys).await?;
 
 
-<<<<<<< HEAD
         // Get the zkas circuits and build proving keys
         // Get the zkas circuits and build proving keys
         let mut proving_keys = HashMap::new();
         let mut proving_keys = HashMap::new();
         let alice_sled = alice.state.read().await.blockchain.sled_db.clone();
         let alice_sled = alice.state.read().await.blockchain.sled_db.clone();
         let mut db_handle = alice.state.read().await.blockchain.contracts.lookup(
         let mut db_handle = alice.state.read().await.blockchain.contracts.lookup(
-=======
-        let bob_kp = Keypair::random(&mut OsRng);
-        let bob = Wallet::new(bob_kp, &faucet_pubkeys).await?;
-
-        let charlie_kp = Keypair::random(&mut OsRng);
-        let charlie = Wallet::new(charlie_kp, &faucet_pubkeys).await?;
-
-        // Get the zkas circuits and build proving keys
-        let mut proving_keys = HashMap::new();
-        let alice_sled = alice.state.read().await.blockchain.sled_db.clone();
-        let db_handle = alice.state.read().await.blockchain.contracts.lookup(
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
             &alice_sled,
             &alice_sled,
             &MONEY_CONTRACT_ID,
             &MONEY_CONTRACT_ID,
             SMART_CONTRACT_ZKAS_DB_NAME,
             SMART_CONTRACT_ZKAS_DB_NAME,
@@ -166,7 +133,8 @@ impl ConsensusTestHarness {
 
 
         macro_rules! mkpk {
         macro_rules! mkpk {
             ($ns:expr) => {
             ($ns:expr) => {
-                let zkbin = db_handle.get(&serialize(&$ns))?.unwrap();
+                let zkas_bytes = db_handle.get(&serialize(&$ns))?.unwrap();
+                let (zkbin, _): (Vec<u8>, Vec<u8>) = deserialize(&zkas_bytes)?;
                 let zkbin = ZkBinary::decode(&zkbin)?;
                 let zkbin = ZkBinary::decode(&zkbin)?;
                 let witnesses = empty_witnesses(&zkbin);
                 let witnesses = empty_witnesses(&zkbin);
                 let circuit = ZkCircuit::new(witnesses, zkbin.clone());
                 let circuit = ZkCircuit::new(witnesses, zkbin.clone());
@@ -177,7 +145,6 @@ impl ConsensusTestHarness {
 
 
         mkpk!(MONEY_CONTRACT_ZKAS_MINT_NS_V1);
         mkpk!(MONEY_CONTRACT_ZKAS_MINT_NS_V1);
         mkpk!(MONEY_CONTRACT_ZKAS_BURN_NS_V1);
         mkpk!(MONEY_CONTRACT_ZKAS_BURN_NS_V1);
-<<<<<<< HEAD
 
 
         db_handle = alice.state.read().await.blockchain.contracts.lookup(
         db_handle = alice.state.read().await.blockchain.contracts.lookup(
             &alice_sled,
             &alice_sled,
@@ -189,12 +156,6 @@ impl ConsensusTestHarness {
         mkpk!(CONSENSUS_CONTRACT_ZKAS_REWARD_NS_V1);
         mkpk!(CONSENSUS_CONTRACT_ZKAS_REWARD_NS_V1);
 
 
         Ok(Self { faucet, alice, proving_keys })
         Ok(Self { faucet, alice, proving_keys })
-=======
-        mkpk!(MONEY_CONTRACT_ZKAS_TOKEN_MINT_NS_V1);
-        mkpk!(MONEY_CONTRACT_ZKAS_TOKEN_FRZ_NS_V1);
-
-        Ok(Self { faucet, alice, bob, charlie, proving_keys })
->>>>>>> 2b38600b8a (contract/consensus: laid foundation)
     }
     }
 
 
     pub fn airdrop_native(
     pub fn airdrop_native(