Skip to content

Show execute button on aproved proposal and not always like now #876

@Viterbo

Description

@Viterbo

Overview

We need to add precision to the way we calculate the necessary votes to determine if a proposal is approved or not. Currently what we do is just to assume all is approved and always show the execute button. We rely on the fact that the actual blockchain implementation checks everything perfectly and we are safe from any hack attempt. However, it is nicer to show the buttons only when they are available.

Related Issue: #856

Links

// Commenting this out, the logic is bad.
// BPs can be involved in non-BP proposals, so we can't just check if BPs are involved and then assume 2/3 + 1
// And if no BPs are involved, doesn't mean we need 100% approval, most msigs are 2/3 or 5/7, etc...
/*
if (activeProducers.value.length === 0) {
// No BPs are involved in the proposal, so we need to 100% of the requested approvals
isApproved.value = proposal.provided_approvals.length === totalRequestedApprovals;
} else {
// If BPs are involved, we need 2/3 (+1) of the BPs to approve the proposal
const approval = (activeProducers.value.length * 2 / 3) + 1;
isApproved.value = activeProducersApproved.value.length >= Math.floor(approval);
}
*/
isApproved.value = true;

Acceptance Criteria

  • if it's the case of approval for BPs, then the calculation is already correct:
    // If BPs are involved, we need 2/3 (+1) of the BPs to approve the proposal
    const approval = (activeProducers.value.length * 2 / 3) + 1;
    isApproved.value = activeProducersApproved.value.length >= Math.floor(approval);
  • if it's the case of approval for private parties, the calculated number should consider the weights of each vote and the minimum for that particular signer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions