diff --git a/core/genesis/generated/halley/genesis b/core/genesis/generated/halley/genesis index 206975d561..ea2173f0b8 100644 Binary files a/core/genesis/generated/halley/genesis and b/core/genesis/generated/halley/genesis differ diff --git a/core/genesis/generated/main/genesis b/core/genesis/generated/main/genesis index 9910ffae5a..e3d7bd22eb 100644 Binary files a/core/genesis/generated/main/genesis and b/core/genesis/generated/main/genesis differ diff --git a/core/genesis/generated/proxima/genesis b/core/genesis/generated/proxima/genesis index 44f68ed388..4f2de2632f 100644 Binary files a/core/genesis/generated/proxima/genesis and b/core/genesis/generated/proxima/genesis differ diff --git a/vm/stdlib/compiled/latest/error_descriptions/error_descriptions.errmap b/vm/stdlib/compiled/latest/error_descriptions/error_descriptions.errmap index ffd277caa7..71df1cf654 100644 Binary files a/vm/stdlib/compiled/latest/error_descriptions/error_descriptions.errmap and b/vm/stdlib/compiled/latest/error_descriptions/error_descriptions.errmap differ diff --git a/vm/stdlib/compiled/latest/stdlib/18_Dao.mv b/vm/stdlib/compiled/latest/stdlib/18_Dao.mv index 5da73705cc..02329cfc63 100644 Binary files a/vm/stdlib/compiled/latest/stdlib/18_Dao.mv and b/vm/stdlib/compiled/latest/stdlib/18_Dao.mv differ diff --git a/vm/stdlib/modules/Dao.move b/vm/stdlib/modules/Dao.move index a9d7529d99..850dcf08ec 100644 --- a/vm/stdlib/modules/Dao.move +++ b/vm/stdlib/modules/Dao.move @@ -97,6 +97,7 @@ module Dao { const ERR_CONFIG_PARAM_INVALID: u64 = 1407; const ERR_VOTE_STATE_MISMATCH: u64 = 1408; const ERR_ACTION_MUST_EXIST: u64 = 1409; + const ERR_VOTED_OTHERS_ALREADY: u64 = 1410; /// plugin function, can only be called by token issuer. /// Any token who wants to has gov functionality @@ -271,7 +272,7 @@ module Dao { let sender = Signer::address_of(signer); let total_voted = if (exists>(sender)) { let my_vote = borrow_global_mut>(sender); - assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); assert(my_vote.agree == agree, Errors::invalid_state(ERR_VOTE_STATE_MISMATCH)); _cast_vote(proposal, my_vote, stake); @@ -372,7 +373,7 @@ module Dao { let my_vote = borrow_global_mut>(Signer::address_of(signer)); { assert(my_vote.proposer == proposer_address, Errors::invalid_argument(ERR_PROPOSER_MISMATCH)); - assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); }; // flip the vote @@ -465,7 +466,7 @@ module Dao { let my_vote = borrow_global_mut>(Signer::address_of(signer)); { assert(my_vote.proposer == proposer_address, Errors::invalid_argument(ERR_PROPOSER_MISMATCH)); - assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); }; // revoke vote on proposal let reverted_stake =_revoke_vote(proposal, my_vote, voting_power); @@ -556,7 +557,7 @@ module Dao { ); // these checks are still required. assert(proposer == proposer_address, Errors::requires_address(ERR_PROPOSER_MISMATCH)); - assert(id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); stake } @@ -791,7 +792,7 @@ module Dao { ): (bool, u128) acquires Vote { let vote = borrow_global>(voter); assert(vote.proposer == proposer_address, Errors::requires_address(ERR_PROPOSER_MISMATCH)); - assert(vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); (vote.agree, Token::value(&vote.stake)) } diff --git a/vm/stdlib/modules/doc/Dao.md b/vm/stdlib/modules/doc/Dao.md index 5f66c9b079..7f9bfcfe61 100644 --- a/vm/stdlib/modules/doc/Dao.md +++ b/vm/stdlib/modules/doc/Dao.md @@ -490,6 +490,15 @@ User vote info. + + + + +
const ERR_VOTED_OTHERS_ALREADY: u64 = 1410;
+
+ + + @@ -712,7 +721,7 @@ So think twice before casting vote. let sender = Signer::address_of(signer); let total_voted = if (exists<Vote<TokenT>>(sender)) { let my_vote = borrow_global_mut<Vote<TokenT>>(sender); - assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); assert(my_vote.agree == agree, Errors::invalid_state(ERR_VOTE_STATE_MISMATCH)); _cast_vote(proposal, my_vote, stake); @@ -811,7 +820,7 @@ Let user change their vote during the voting time. let my_vote = borrow_global_mut<Vote<TokenT>>(Signer::address_of(signer)); { assert(my_vote.proposer == proposer_address, Errors::invalid_argument(ERR_PROPOSER_MISMATCH)); - assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); }; // flip the vote @@ -904,7 +913,7 @@ Revoke some voting powers from vote on proposal_id of propose let my_vote = borrow_global_mut<Vote<TokenT>>(Signer::address_of(signer)); { assert(my_vote.proposer == proposer_address, Errors::invalid_argument(ERR_PROPOSER_MISMATCH)); - assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(my_vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); }; // revoke vote on proposal let reverted_stake =_revoke_vote(proposal, my_vote, voting_power); @@ -997,7 +1006,7 @@ Retrieve back my staked token voted for a proposal. ); // these checks are still required. assert(proposer == proposer_address, Errors::requires_address(ERR_PROPOSER_MISMATCH)); - assert(id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); stake } @@ -1287,7 +1296,7 @@ Get voter's vote info on proposal with proposal_id of propose ): (bool, u128) acquires Vote { let vote = borrow_global<Vote<TokenT>>(voter); assert(vote.proposer == proposer_address, Errors::requires_address(ERR_PROPOSER_MISMATCH)); - assert(vote.id == proposal_id, Errors::invalid_argument(ERR_PROPOSAL_ID_MISMATCH)); + assert(vote.id == proposal_id, Errors::invalid_argument(ERR_VOTED_OTHERS_ALREADY)); (vote.agree, Token::value(&vote.stake)) }