Quellcode durchsuchen

dao: remove redundant ended, we delete proposals from the DB. getting them will fail after they're ended.

x vor 2 Jahren
Ursprung
Commit
86a117cd38

+ 0 - 2
src/contract/dao/proof/dao-vote-main.zk

@@ -58,8 +58,6 @@ circuit "DaoVoteMain" {
 		proposal_blind,
 		proposal_blind,
 	);
 	);
 	constrain_instance(proposal_bulla);
 	constrain_instance(proposal_bulla);
-	# TODO: We need to check the proposal isn't invalidated
-	# that is expired or already executed.
 
 
 	# Normally we call this yes vote
 	# Normally we call this yes vote
 	# Pedersen commitment for vote option
 	# Pedersen commitment for vote option

+ 0 - 5
src/contract/dao/src/entrypoint/exec.rs

@@ -155,11 +155,6 @@ pub(crate) fn dao_exec_process_instruction(
     };
     };
     let proposal: DaoProposalMetadata = deserialize(&data)?;
     let proposal: DaoProposalMetadata = deserialize(&data)?;
 
 
-    if proposal.ended {
-        msg!("[Dao::Exec] Error: Proposal {:?} ended", params.proposal);
-        return Err(DaoError::ProposalEnded.into())
-    }
-
     // 3. Check yes_vote commit and all_vote_commit are the same as in BlindAggregateVote
     // 3. Check yes_vote commit and all_vote_commit are the same as in BlindAggregateVote
     if proposal.vote_aggregate.yes_vote_commit != params.blind_total_vote.yes_vote_commit ||
     if proposal.vote_aggregate.yes_vote_commit != params.blind_total_vote.yes_vote_commit ||
         proposal.vote_aggregate.all_vote_commit != params.blind_total_vote.all_vote_commit
         proposal.vote_aggregate.all_vote_commit != params.blind_total_vote.all_vote_commit

+ 0 - 1
src/contract/dao/src/entrypoint/propose.rs

@@ -161,7 +161,6 @@ pub(crate) fn dao_propose_process_update(
     let proposal_metadata = DaoProposalMetadata {
     let proposal_metadata = DaoProposalMetadata {
         vote_aggregate: DaoBlindAggregateVote::default(),
         vote_aggregate: DaoBlindAggregateVote::default(),
         snapshot_root: update.snapshot_root,
         snapshot_root: update.snapshot_root,
-        ended: false,
     };
     };
 
 
     // Set the new proposal in the db
     // Set the new proposal in the db

+ 1 - 6
src/contract/dao/src/entrypoint/vote.rs

@@ -123,15 +123,10 @@ pub(crate) fn dao_vote_process_instruction(
         return Err(DaoError::ProposalNonexistent.into())
         return Err(DaoError::ProposalNonexistent.into())
     };
     };
 
 
-    // Get the current votes, and additionally confirm proposal hasn't ended
+    // Get the current votes
     // TODO: Proposals should have a set length of time
     // TODO: Proposals should have a set length of time
     let mut proposal_metadata: DaoProposalMetadata = deserialize(&data)?;
     let mut proposal_metadata: DaoProposalMetadata = deserialize(&data)?;
 
 
-    if proposal_metadata.ended {
-        msg!("[Dao::Vote] Error: Proposal ended: {:?}", params.proposal_bulla);
-        return Err(DaoError::ProposalEnded.into())
-    }
-
     // Check the Merkle root and nullifiers for the input coins are valid
     // Check the Merkle root and nullifiers for the input coins are valid
     let money_nullifier_db = db_lookup(*MONEY_CONTRACT_ID, MONEY_CONTRACT_NULLIFIERS_TREE)?;
     let money_nullifier_db = db_lookup(*MONEY_CONTRACT_ID, MONEY_CONTRACT_NULLIFIERS_TREE)?;
     let dao_vote_nullifier_db = db_lookup(cid, DAO_CONTRACT_DB_VOTE_NULLIFIERS)?;
     let dao_vote_nullifier_db = db_lookup(cid, DAO_CONTRACT_DB_VOTE_NULLIFIERS)?;

+ 0 - 2
src/contract/dao/src/model.rs

@@ -236,8 +236,6 @@ pub struct DaoProposalMetadata {
     pub vote_aggregate: DaoBlindAggregateVote,
     pub vote_aggregate: DaoBlindAggregateVote,
     /// Snapshotted Merkle root in the Money state
     /// Snapshotted Merkle root in the Money state
     pub snapshot_root: MerkleNode,
     pub snapshot_root: MerkleNode,
-    /// Proposal closed
-    pub ended: bool,
 }
 }
 
 
 /// Parameters for `Dao::Vote`
 /// Parameters for `Dao::Vote`