Skip to content

Commit 1507a93

Browse files
authored
Merge pull request #853 from telosnetwork/develop-hotfix-2
Develop Hotfix 2
2 parents d7b8252 + 90a88d5 commit 1507a93

4 files changed

Lines changed: 42 additions & 23 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This includes following key features:
3838
- BP Voting and Governance
3939
- Premium Name bids
4040

41-
Following, excelent products can be taken as reference points for further features:
41+
Following, excellent products can be taken as reference points for further features:
4242

4343
- [EOS Authority](https://eosauthority.com/)
4444
- [Blocks](https://bloks.io/)
@@ -112,7 +112,7 @@ app running at localhost:4000
112112

113113
[Vue 2 documentation](https://vuejs.org/v2/api/)
114114

115-
[Vue 3 documenation](https://v3.vuejs.org/)
115+
[Vue 3 documentation](https://v3.vuejs.org/)
116116

117117
[Testing Quasar with Jest](https://github.com/quasarframework/quasar-testing/tree/next/packages/unit-jest)
118118

src/config/ConfigManager.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,23 @@ export default class ConfigManager {
9696
}
9797

9898
private findChain(chainName: string) {
99-
const fromMainnet = this.mainnets.find(
99+
let fromMainnet = this.mainnets.find(
100100
c => c.getName() === chainName,
101101
);
102102
if (fromMainnet) {
103103
return fromMainnet;
104+
} else {
105+
fromMainnet = this.testnets.find(c => c.getName() === chainName);
104106
}
105107

106-
return this.testnets.find(c => c.getName() === chainName);
108+
if (fromMainnet) {
109+
return fromMainnet;
110+
} else {
111+
if (typeof chainName === 'string') {
112+
throw new Error(`Chain '${chainName}' not found`);
113+
} else {
114+
throw new Error('CHAIN_NAME env variable not found');
115+
}
116+
}
107117
}
108118
}

src/pages/ProposalItem.vue

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export default defineComponent({
4040
4141
const multsigTransactionData = ref<Action[]>([]);
4242
const requestedApprovalsRows = ref<RequestedApprovals[]>([]);
43+
const activeProducers = ref<RequestedApprovals[]>([]);
44+
const activeProducersApproved = ref<RequestedApprovals[]>([]);
4345
4446
const requestedApprovalsColumns = [
4547
{
@@ -99,15 +101,7 @@ export default defineComponent({
99101
!isCanceled.value
100102
));
101103
102-
const producersApprovalStatus = computed(() => {
103-
const allProducers = requestedApprovalsRows.value.filter(
104-
item => item.isBp,
105-
);
106-
const producersHaveAlreadyApproved = allProducers.filter(
107-
item => item.status,
108-
);
109-
return `${producersHaveAlreadyApproved.length}/${allProducers.length}`;
110-
});
104+
const producersApprovalStatus = computed(() => `${activeProducersApproved.value.length}/${activeProducers.value.length}`);
111105
112106
function handleError(e: unknown, defaultMessage: string) {
113107
const error = JSON.parse(JSON.stringify(e)) as Error;
@@ -282,7 +276,6 @@ export default defineComponent({
282276
proposer.value = proposal.proposer;
283277
284278
const totalRequestedApprovals = proposal.provided_approvals.length + proposal.requested_approvals.length;
285-
isApproved.value = proposal.provided_approvals.length === totalRequestedApprovals;
286279
approvalStatus.value = `${proposal.provided_approvals.length}/${totalRequestedApprovals}`;
287280
isExecuted.value = proposal.executed;
288281
@@ -302,6 +295,22 @@ export default defineComponent({
302295
requestedApprovalsRows.value = requestedApprovalsRowsValue;
303296
multsigTransactionData.value = multsigTransactionDataValue;
304297
298+
activeProducers.value = requestedApprovalsRows.value.filter(
299+
item => item.isBp,
300+
);
301+
activeProducersApproved.value = activeProducers.value.filter(
302+
item => item.status,
303+
);
304+
305+
if (activeProducers.value.length === 0) {
306+
// No BPs are involved in the proposal, so we need to 100% of the requested approvals
307+
isApproved.value = proposal.provided_approvals.length === totalRequestedApprovals;
308+
} else {
309+
// If BPs are involved, we need 2/3 (+1) of the BPs to approve the proposal
310+
const approval = (activeProducers.value.length * 2 / 3) + 1;
311+
isApproved.value = activeProducersApproved.value.length >= Math.floor(approval);
312+
}
313+
305314
const transactions = await handleTransactionHistory(proposal.block_num);
306315
307316
isCanceled.value = transactions.some(

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5616,9 +5616,9 @@ flatted@^3.1.0:
56165616
integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==
56175617

56185618
follow-redirects@^1.0.0, follow-redirects@^1.14.0:
5619-
version "1.15.4"
5620-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
5621-
integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==
5619+
version "1.15.6"
5620+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
5621+
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
56225622

56235623
for-in@^1.0.2:
56245624
version "1.0.2"
@@ -6423,9 +6423,9 @@ ip-regex@^4.1.0:
64236423
integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==
64246424

64256425
ip@^1.1.5:
6426-
version "1.1.8"
6427-
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48"
6428-
integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==
6426+
version "1.1.9"
6427+
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396"
6428+
integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==
64296429

64306430
ipaddr.js@1.9.1:
64316431
version "1.9.1"
@@ -11618,9 +11618,9 @@ webpack-chain@6.5.1:
1161811618
javascript-stringify "^2.0.1"
1161911619

1162011620
webpack-dev-middleware@^5.3.1:
11621-
version "5.3.3"
11622-
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz#efae67c2793908e7311f1d9b06f2a08dcc97e51f"
11623-
integrity sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==
11621+
version "5.3.4"
11622+
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz#eb7b39281cbce10e104eb2b8bf2b63fce49a3517"
11623+
integrity sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==
1162411624
dependencies:
1162511625
colorette "^2.0.10"
1162611626
memfs "^3.4.3"

0 commit comments

Comments
 (0)