|
@@ -40,8 +40,8 @@ use darkfi_sdk::{
|
|
|
blockchain::{PidOutput, PreviousSlot, Slot},
|
|
blockchain::{PidOutput, PreviousSlot, Slot},
|
|
|
bridgetree,
|
|
bridgetree,
|
|
|
crypto::{
|
|
crypto::{
|
|
|
- pasta_prelude::Field, poseidon_hash, Keypair, MerkleNode, MerkleTree, Nullifier, PublicKey,
|
|
|
|
|
- SecretKey, TokenId,
|
|
|
|
|
|
|
+ pasta_prelude::Field, poseidon_hash, ContractId, Keypair, MerkleNode, MerkleTree,
|
|
|
|
|
+ Nullifier, PublicKey, SecretKey, TokenId,
|
|
|
},
|
|
},
|
|
|
pasta::pallas,
|
|
pasta::pallas,
|
|
|
};
|
|
};
|
|
@@ -58,6 +58,7 @@ mod consensus_proposal;
|
|
|
mod consensus_stake;
|
|
mod consensus_stake;
|
|
|
mod consensus_unstake;
|
|
mod consensus_unstake;
|
|
|
mod consensus_unstake_request;
|
|
mod consensus_unstake_request;
|
|
|
|
|
+mod contract_deploy;
|
|
|
mod dao_exec;
|
|
mod dao_exec;
|
|
|
mod dao_mint;
|
|
mod dao_mint;
|
|
|
mod dao_propose;
|
|
mod dao_propose;
|
|
@@ -77,8 +78,8 @@ pub fn init_logger() {
|
|
|
// We check this error so we can execute same file tests in parallel,
|
|
// We check this error so we can execute same file tests in parallel,
|
|
|
// otherwise second one fails to init logger here.
|
|
// otherwise second one fails to init logger here.
|
|
|
if simplelog::TermLogger::init(
|
|
if simplelog::TermLogger::init(
|
|
|
- simplelog::LevelFilter::Info,
|
|
|
|
|
- //simplelog::LevelFilter::Debug,
|
|
|
|
|
|
|
+ //simplelog::LevelFilter::Info,
|
|
|
|
|
+ simplelog::LevelFilter::Debug,
|
|
|
//simplelog::LevelFilter::Trace,
|
|
//simplelog::LevelFilter::Trace,
|
|
|
cfg.build(),
|
|
cfg.build(),
|
|
|
simplelog::TerminalMode::Mixed,
|
|
simplelog::TerminalMode::Mixed,
|
|
@@ -125,6 +126,7 @@ pub enum TxAction {
|
|
|
pub struct Wallet {
|
|
pub struct Wallet {
|
|
|
pub keypair: Keypair,
|
|
pub keypair: Keypair,
|
|
|
pub token_mint_authority: Keypair,
|
|
pub token_mint_authority: Keypair,
|
|
|
|
|
+ pub contract_deploy_authority: Keypair,
|
|
|
pub validator: ValidatorPtr,
|
|
pub validator: ValidatorPtr,
|
|
|
pub money_merkle_tree: MerkleTree,
|
|
pub money_merkle_tree: MerkleTree,
|
|
|
pub consensus_staked_merkle_tree: MerkleTree,
|
|
pub consensus_staked_merkle_tree: MerkleTree,
|
|
@@ -182,10 +184,12 @@ impl Wallet {
|
|
|
let spent_money_coins = vec![];
|
|
let spent_money_coins = vec![];
|
|
|
|
|
|
|
|
let token_mint_authority = Keypair::random(&mut OsRng);
|
|
let token_mint_authority = Keypair::random(&mut OsRng);
|
|
|
|
|
+ let contract_deploy_authority = Keypair::random(&mut OsRng);
|
|
|
|
|
|
|
|
Ok(Self {
|
|
Ok(Self {
|
|
|
keypair,
|
|
keypair,
|
|
|
token_mint_authority,
|
|
token_mint_authority,
|
|
|
|
|
+ contract_deploy_authority,
|
|
|
validator,
|
|
validator,
|
|
|
money_merkle_tree,
|
|
money_merkle_tree,
|
|
|
consensus_staked_merkle_tree,
|
|
consensus_staked_merkle_tree,
|
|
@@ -494,6 +498,11 @@ impl TestHarness {
|
|
|
TokenId::derive_public(holder.token_mint_authority.public)
|
|
TokenId::derive_public(holder.token_mint_authority.public)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ pub fn contract_id(&self, holder: &Holder) -> ContractId {
|
|
|
|
|
+ let holder = self.holders.get(holder).unwrap();
|
|
|
|
|
+ ContractId::derive_public(holder.contract_deploy_authority.public)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
pub fn statistics(&self) {
|
|
pub fn statistics(&self) {
|
|
|
info!("==================== Statistics ====================");
|
|
info!("==================== Statistics ====================");
|
|
|
for (action, tx_action_benchmark) in &self.tx_action_benchmarks {
|
|
for (action, tx_action_benchmark) in &self.tx_action_benchmarks {
|