near-daos / sputnik-dao-contract

Smart contracts for https://app.astrodao.com
https://astrodao.com/
MIT License
108 stars 77 forks source link

sputnikdao2: RoleKind::Everyone, can't set ProposalStatus::Approved #77

Open Buckram123 opened 2 years ago

Buckram123 commented 2 years ago

Imagine that scenario:

  1. We have a policy like that:
    roles: [
            {
                name: "all",
                kind: "Everyone",
                permissions: ["*:AddProposal",
                    "*:VoteApprove"],
                vote_policy: {}
            }
    ];
    ...
    default_vote_policy:  
    {
            weight_kind: "TokenWeight",
    ....

    So all that matters is delegaions

  2. Delegaions on 'alice' >= threshold
  3. Some proposal
  4. And 'alice' tries to VoteApprove via act_proposal(). The issue is that this part is unreachable for RoleKind::Everyone(alice) https://github.com/near-daos/sputnik-dao-contract/blob/372df7d715c4c7c06ba14a3ba5b4db65f50b81f9/sputnikdao2/src/policy.rs#L383 Because of continue here. https://github.com/near-daos/sputnik-dao-contract/blob/372df7d715c4c7c06ba14a3ba5b4db65f50b81f9/sputnikdao2/src/policy.rs#L366

So RoleKind::Everyone can't execute proposal it seems