-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
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
open-block-explorer/src/pages/ProposalItem.vue
Lines 304 to 318 in a413715
| // 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
Labels
No labels