Skip to content

Commit

Permalink
governance: do not allow UndelegateClaim inside DaoSpend
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero authored and hdevalence committed Sep 22, 2023
1 parent 1b86c44 commit 49473c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions crates/core/app/src/action_handler/actions/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,26 @@ impl ActionHandler for ProposalSubmit {

for action in &parsed_transaction_plan.actions {
match action {
Spend(_) | Output(_) | Swap(_) | SwapClaim(_) | DelegatorVote(_) => {
Spend(_) | Output(_) | Swap(_) | SwapClaim(_) | DelegatorVote(_)
| UndelegateClaim(_) => {
// These actions all require proving, so they are banned from DAO spend
// proposals to prevent DoS attacks.
anyhow::bail!(
"invalid action in DAO spend proposal (would require proving)"
)
}
Delegate(_) | Undelegate(_) => {
// Delegation and undelegation is disallowed due to Undelegateclaim requiring proving.
anyhow::bail!(
"invalid action in DAO spend proposal (can't claim outputs of undelegation)"
)
}
ProposalSubmit(_) | ProposalWithdraw(_) | ProposalDepositClaim(_) => {
// These actions manipulate proposals, so they are banned from DAO spend
// actions because they could cause recursion.
anyhow::bail!("invalid action in DAO spend proposal (not allowed to manipulate proposals from within proposals)")
}
Delegate(_)
| Undelegate(_)
| UndelegateClaim(_)
| ValidatorDefinition(_)
ValidatorDefinition(_)
| IbcAction(_)
| ValidatorVote(_)
| PositionOpen(_)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use base64::{engine::general_purpose, Engine as _};
use std::str::FromStr;
use base64::{Engine as _, engine::{general_purpose}};

use ark_groth16::r1cs_to_qap::LibsnarkReduction;
use ark_r1cs_std::{prelude::*, uint8::UInt8};
Expand Down

0 comments on commit 49473c4

Please sign in to comment.