|
@@ -44,10 +44,10 @@ use darkfi_dao_contract::{
|
|
|
DaoFunction,
|
|
DaoFunction,
|
|
|
};
|
|
};
|
|
|
use darkfi_sdk::{
|
|
use darkfi_sdk::{
|
|
|
|
|
+ bridgetree,
|
|
|
crypto::{
|
|
crypto::{
|
|
|
poseidon_hash, MerkleNode, MerkleTree, PublicKey, SecretKey, TokenId, DAO_CONTRACT_ID,
|
|
poseidon_hash, MerkleNode, MerkleTree, PublicKey, SecretKey, TokenId, DAO_CONTRACT_ID,
|
|
|
},
|
|
},
|
|
|
- incrementalmerkletree::{Position, Tree},
|
|
|
|
|
pasta::pallas,
|
|
pasta::pallas,
|
|
|
};
|
|
};
|
|
|
use darkfi_serial::{deserialize, serialize, SerialDecodable, SerialEncodable};
|
|
use darkfi_serial::{deserialize, serialize, SerialDecodable, SerialEncodable};
|
|
@@ -122,7 +122,7 @@ pub struct Dao {
|
|
|
/// DAO bulla blind
|
|
/// DAO bulla blind
|
|
|
pub bulla_blind: pallas::Base,
|
|
pub bulla_blind: pallas::Base,
|
|
|
/// Leaf position of the DAO in the Merkle tree of DAOs
|
|
/// Leaf position of the DAO in the Merkle tree of DAOs
|
|
|
- pub leaf_position: Option<Position>,
|
|
|
|
|
|
|
+ pub leaf_position: Option<bridgetree::Position>,
|
|
|
/// The transaction hash where the DAO was deployed
|
|
/// The transaction hash where the DAO was deployed
|
|
|
pub tx_hash: Option<blake3::Hash>,
|
|
pub tx_hash: Option<blake3::Hash>,
|
|
|
/// The call index in the transaction where the DAO was deployed
|
|
/// The call index in the transaction where the DAO was deployed
|
|
@@ -200,7 +200,7 @@ pub struct DaoProposal {
|
|
|
/// Proposal's bulla blind
|
|
/// Proposal's bulla blind
|
|
|
pub bulla_blind: pallas::Base,
|
|
pub bulla_blind: pallas::Base,
|
|
|
/// Leaf position of this proposal in the Merkle tree of proposals
|
|
/// Leaf position of this proposal in the Merkle tree of proposals
|
|
|
- pub leaf_position: Option<Position>,
|
|
|
|
|
|
|
+ pub leaf_position: Option<bridgetree::Position>,
|
|
|
/// Transaction hash where this proposal was proposed
|
|
/// Transaction hash where this proposal was proposed
|
|
|
pub tx_hash: Option<blake3::Hash>,
|
|
pub tx_hash: Option<blake3::Hash>,
|
|
|
/// call index in the transaction where this proposal was proposed
|
|
/// call index in the transaction where this proposal was proposed
|
|
@@ -1019,7 +1019,7 @@ impl Drk {
|
|
|
// have to make sure it's the same for everyone.
|
|
// have to make sure it's the same for everyone.
|
|
|
if confirm {
|
|
if confirm {
|
|
|
for new_bulla in new_dao_bullas {
|
|
for new_bulla in new_dao_bullas {
|
|
|
- daos_tree.append(&MerkleNode::from(new_bulla.0.inner()));
|
|
|
|
|
|
|
+ daos_tree.append(MerkleNode::from(new_bulla.0.inner()));
|
|
|
for dao in daos.iter_mut() {
|
|
for dao in daos.iter_mut() {
|
|
|
if dao.bulla() == new_bulla.0 {
|
|
if dao.bulla() == new_bulla.0 {
|
|
|
eprintln!(
|
|
eprintln!(
|
|
@@ -1027,7 +1027,7 @@ impl Drk {
|
|
|
new_bulla.0
|
|
new_bulla.0
|
|
|
);
|
|
);
|
|
|
// We have this DAO imported in our wallet. Add the metadata:
|
|
// We have this DAO imported in our wallet. Add the metadata:
|
|
|
- dao.leaf_position = daos_tree.witness();
|
|
|
|
|
|
|
+ dao.leaf_position = daos_tree.mark();
|
|
|
dao.tx_hash = new_bulla.1;
|
|
dao.tx_hash = new_bulla.1;
|
|
|
dao.call_index = Some(new_bulla.2);
|
|
dao.call_index = Some(new_bulla.2);
|
|
|
daos_to_confirm.push(dao.clone());
|
|
daos_to_confirm.push(dao.clone());
|
|
@@ -1036,7 +1036,7 @@ impl Drk {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
for proposal in new_dao_proposals {
|
|
for proposal in new_dao_proposals {
|
|
|
- proposals_tree.append(&MerkleNode::from(proposal.0.proposal_bulla));
|
|
|
|
|
|
|
+ proposals_tree.append(MerkleNode::from(proposal.0.proposal_bulla));
|
|
|
// FIXME: EncryptedNote2 should perhaps be something generic?
|
|
// FIXME: EncryptedNote2 should perhaps be something generic?
|
|
|
let enc_note = EncryptedNote2 {
|
|
let enc_note = EncryptedNote2 {
|
|
|
ciphertext: proposal.0.ciphertext,
|
|
ciphertext: proposal.0.ciphertext,
|
|
@@ -1062,7 +1062,7 @@ impl Drk {
|
|
|
amount: note.proposal.amount,
|
|
amount: note.proposal.amount,
|
|
|
token_id: note.proposal.token_id,
|
|
token_id: note.proposal.token_id,
|
|
|
bulla_blind: note.proposal.blind,
|
|
bulla_blind: note.proposal.blind,
|
|
|
- leaf_position: proposals_tree.witness(),
|
|
|
|
|
|
|
+ leaf_position: proposals_tree.mark(),
|
|
|
tx_hash: proposal.1,
|
|
tx_hash: proposal.1,
|
|
|
call_index: Some(proposal.2),
|
|
call_index: Some(proposal.2),
|
|
|
vote_id: None,
|
|
vote_id: None,
|