mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
dao: remove redundant ended, we delete proposals from the DB. getting them will fail after they're ended.
This commit is contained in:
@@ -58,8 +58,6 @@ circuit "DaoVoteMain" {
|
||||
proposal_blind,
|
||||
);
|
||||
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
|
||||
# Pedersen commitment for vote option
|
||||
|
||||
@@ -155,11 +155,6 @@ pub(crate) fn dao_exec_process_instruction(
|
||||
};
|
||||
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
|
||||
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
|
||||
|
||||
@@ -161,7 +161,6 @@ pub(crate) fn dao_propose_process_update(
|
||||
let proposal_metadata = DaoProposalMetadata {
|
||||
vote_aggregate: DaoBlindAggregateVote::default(),
|
||||
snapshot_root: update.snapshot_root,
|
||||
ended: false,
|
||||
};
|
||||
|
||||
// Set the new proposal in the db
|
||||
|
||||
@@ -123,15 +123,10 @@ pub(crate) fn dao_vote_process_instruction(
|
||||
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
|
||||
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
|
||||
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)?;
|
||||
|
||||
@@ -236,8 +236,6 @@ pub struct DaoProposalMetadata {
|
||||
pub vote_aggregate: DaoBlindAggregateVote,
|
||||
/// Snapshotted Merkle root in the Money state
|
||||
pub snapshot_root: MerkleNode,
|
||||
/// Proposal closed
|
||||
pub ended: bool,
|
||||
}
|
||||
|
||||
/// Parameters for `Dao::Vote`
|
||||
|
||||
Reference in New Issue
Block a user