Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.32.0 #1419

Merged
merged 19 commits into from
Oct 29, 2024
Merged

v5.32.0 #1419

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion HomeUI/dist/css/8701.css → HomeUI/dist/css/8307.css

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion HomeUI/dist/js/2358.js

This file was deleted.

1 change: 1 addition & 0 deletions HomeUI/dist/js/8180.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions HomeUI/dist/js/8307.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion HomeUI/dist/js/8342.js

This file was deleted.

1 change: 0 additions & 1 deletion HomeUI/dist/js/8701.js

This file was deleted.

2 changes: 1 addition & 1 deletion HomeUI/dist/js/1169.js → HomeUI/dist/js/9138.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions HomeUI/dist/js/9367.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion HomeUI/dist/js/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions HomeUI/src/views/apps/GlobalApps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@
<b-col cols="12">
<b-pagination
v-model="appLocationOptions.currentPage"
:total-rows="appLocationOptions.totalRows"
:total-rows="appLocations?.length || 1"
:per-page="appLocationOptions.perPage"
align="center"
size="sm"
Expand Down Expand Up @@ -1183,7 +1183,7 @@
<b-col cols="12">
<b-pagination
v-model="appLocationOptions.currentPage"
:total-rows="appLocationOptions.totalRows"
:total-rows="appLocations?.length || 1"
:per-page="appLocationOptions.perPage"
align="center"
size="sm"
Expand Down
8 changes: 4 additions & 4 deletions HomeUI/src/views/apps/LocalApps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
<b-col cols="12">
<b-pagination
v-model="appLocationOptions.currentPage"
:total-rows="appLocationOptions.totalRows"
:total-rows="appLocations?.length || 1"
:per-page="appLocationOptions.perPage"
align="center"
size="sm"
Expand Down Expand Up @@ -1128,7 +1128,7 @@
<b-col cols="12">
<b-pagination
v-model="appLocationOptions.currentPage"
:total-rows="appLocationOptions.totalRows"
:total-rows="appLocations?.length || 1"
:per-page="appLocationOptions.perPage"
align="center"
size="sm"
Expand Down Expand Up @@ -1164,7 +1164,7 @@
<b-col cols="12">
<b-pagination
v-model="tableconfig.globalAvailable.currentPage"
:total-rows="tableconfig.globalAvailable.apps.length"
:total-rows="tableconfig?.globalAvailable?.apps?.length || 1"
:per-page="tableconfig.globalAvailable.perPage"
align="center"
size="sm"
Expand Down Expand Up @@ -1714,7 +1714,7 @@
<b-col cols="12">
<b-pagination
v-model="appLocationOptions.currentPage"
:total-rows="appLocationOptions.totalRows"
:total-rows="appLocations?.length || 1"
:per-page="appLocationOptions.perPage"
align="center"
size="sm"
Expand Down
110 changes: 103 additions & 7 deletions HomeUI/src/views/apps/marketplace/AppView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,48 @@
</b-form-select>
</b-form-group>
</div>
<div v-if="appData.selectInstances">
<b-form-group
v-if="appData.version >= 3"
label-cols="3"
label-cols-lg="20"
label="Instances"
label-for="appInstances"
>
<div class="mx-1">
{{ appInstances }}
</div>
<b-form-input
id="appInstances"
v-model="appInstances"
placeholder="Minimum number of application instances to be spawned"
type="range"
min="3"
max="100"
step="1"
/>
</b-form-group>
</div>
<b-form-group
v-if="appData.version >= 6"
label-cols="3"
label-cols-lg="20"
label="Period"
label-for="period"
>
<div class="mx-1">
{{ getExpireLabel }}
</div>
<b-form-input
id="period"
v-model="expirePosition"
placeholder="How long an application will live on Flux network"
type="range"
:min="0"
:max="3"
:step="1"
/>
</b-form-group>
<b-card style="padding: 0;">
<b-tabs @activate-tab="componentSelected">
<b-tab
Expand Down Expand Up @@ -875,13 +917,54 @@ export default {
const enterprisePublicKeys = ref([]);
const selectedGeolocation = ref(null);
const contact = ref(null);
const appInstances = ref(Number(3));
const appRegistrationSpecification = ref(null);
const tooltipText = ref('Copy to clipboard');
const copyButtonRef = ref(null);
const expireOptions = ref([]);
const expirePosition = ref(Number(0));
expireOptions.value = [
{
value: 22000,
label: '1 month',
time: 30 * 24 * 60 * 60 * 1000,
},
{
value: 66000,
label: '3 months',
time: 90 * 24 * 60 * 60 * 1000,
},
{
value: 132000,
label: '6 months',
time: 180 * 24 * 60 * 60 * 1000,
},
{
value: 264000,
label: '1 year',
time: 365 * 24 * 60 * 60 * 1000,
},
];

const config = computed(() => vm.$store.state.flux.config);
const validTill = computed(() => timestamp.value + 60 * 60 * 1000); // 1 hour
const subscribedTill = computed(() => timestamp.value + 30 * 24 * 60 * 60 * 1000 + 60 * 60 * 1000); // 1 month
const subscribedTill = computed(() => {
if (props.appData.version >= 6) {
const auxArray = expireOptions.value;
if (auxArray[expirePosition.value]) {
return Date.now() + auxArray[expirePosition.value].time + 60 * 60 * 1000;
}
}
const expTime = Date.now() + 30 * 24 * 60 * 60 * 1000 + 60 * 60 * 1000; // 1 month
return expTime;
});
const getExpireLabel = computed(() => {
const auxArray = expireOptions.value;
if (auxArray[expirePosition.value]) {
return auxArray[expirePosition.value].label;
}
return null;
});

const callbackValue = () => {
const { protocol, hostname, port } = window.location;
Expand Down Expand Up @@ -1359,9 +1442,8 @@ export default {
}
};
const autoSelectNodes = async () => {
const { instances } = props.appData;
const maxSamePubKeyNodes = +instances + 3;
const maxNumberOfNodes = +instances + Math.ceil(Math.max(7, +instances * 0.15));
const maxSamePubKeyNodes = +appInstances.value + 3;
const maxNumberOfNodes = +appInstances.value + Math.ceil(Math.max(7, +appInstances.value * 0.15));
const notSelectedEnterpriseNodes = await getEnterpriseNodes();
const nodesToSelect = [];
const selectedEnNodes = [];
Expand Down Expand Up @@ -1479,7 +1561,7 @@ export default {
name: appName,
description: props.appData.description,
owner: userZelid.value,
instances: props.appData.instances,
instances: appInstances.value,
compose: [],
};
if (props.appData.version >= 5) {
Expand All @@ -1505,7 +1587,8 @@ export default {
}
}
if (props.appData.version >= 6) {
appSpecification.expire = props.appData.expire || 22000;
const auxArray = expireOptions.value;
appSpecification.expire = auxArray[expirePosition.value].value || 22000;
}
if (props.appData.version >= 7) {
appSpecification.staticip = props.appData.staticip;
Expand Down Expand Up @@ -1623,7 +1706,17 @@ export default {
applicationPriceFluxDiscount.value = '';
const auxSpecsFormatted = JSON.parse(JSON.stringify(appSpecFormatted));
auxSpecsFormatted.priceUSD = props.appData.priceUSD;

console.log(auxSpecsFormatted.priceUSD);
if (appInstances.value && appInstances.value > 3) {
auxSpecsFormatted.priceUSD = Number(((auxSpecsFormatted.priceUSD * appInstances.value) / 3).toFixed(2));
}
if (expirePosition.value === '1') {
auxSpecsFormatted.priceUSD *= 3;
} else if (expirePosition.value === '2') {
auxSpecsFormatted.priceUSD *= 6;
} else if (expirePosition.value === '3') {
auxSpecsFormatted.priceUSD *= 12;
}
const response = await AppsService.appPriceUSDandFlux(auxSpecsFormatted);
if (response.data.status === 'error') {
throw new Error(response.data.data.message || response.data.data);
Expand Down Expand Up @@ -2107,6 +2200,7 @@ export default {
dataToSign,
selectedGeolocation,
contact,
appInstances,
signClient,
signature,
appPricePerDeployment,
Expand Down Expand Up @@ -2143,6 +2237,8 @@ export default {
confirmLaunchDialogCloseShowing,
confirmLaunchDialogFinish,
confirmLaunchDialogCancel,
expirePosition,
getExpireLabel,

currentComponent,
componentSelected,
Expand Down
5 changes: 2 additions & 3 deletions HomeUI/src/views/components/myApps/Locations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<b-col cols="12">
<b-pagination
v-model="appLocationOptions.currentPage"
:total-rows="appLocationOptions.totalRows"
:total-rows="appLocations?.length || 1"
:per-page="appLocationOptions.perPage"
align="center"
size="sm"
Expand Down Expand Up @@ -167,10 +167,9 @@ export default {
{ key: 'visit', label: '' },
],
appLocationOptions: {
perPage: 25,
perPage: 5,
pageOptions: [5, 10, 25, 50, 100],
currentPage: 1,
totalRows: 1,
filterOn: [],
filter: '',
},
Expand Down
21 changes: 21 additions & 0 deletions ZelBack/src/services/appsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -13183,6 +13183,25 @@ let nodeConfirmedOnLastCheck = true;
// eslint-disable-next-line consistent-return
async function monitorNodeStatus() {
try {
if (fluxNetworkHelper.getDosStateValue() >= 100) {
const installedAppsRes = await installedApps();
if (installedAppsRes.status !== 'success') {
throw new Error('monitorNodeStatus - Failed to get installed Apps');
}
const isNodeConfirmed = await generalService.isNodeStatusConfirmed();
const appsInstalled = installedAppsRes.data;
// eslint-disable-next-line no-restricted-syntax
for (const installedApp of appsInstalled) {
log.info(`monitorNodeStatus - Application ${installedApp.name} going to be removed from node as the node have DOS state over 100`);
log.warn(`monitorNodeStatus - Removing application ${installedApp.name} locally`);
// eslint-disable-next-line no-await-in-loop
await removeAppLocally(installedApp.name, null, true, false, isNodeConfirmed);
log.warn(`monitorNodeStatus - Application ${installedApp.name} locally removed`);
// eslint-disable-next-line no-await-in-loop
await serviceHelper.delay(60 * 1000); // wait for 1 min between each removal
}
await serviceHelper.delay(20 * 60 * 1000); // 20m delay before next check
}
const isNodeConfirmed = await generalService.isNodeStatusConfirmed();
if (!isNodeConfirmed) {
log.info('monitorNodeStatus - Node is not Confirmed');
Expand Down Expand Up @@ -13252,6 +13271,8 @@ async function monitorNodeStatus() {
monitorNodeStatus();
} catch (error) {
log.error(error);
await serviceHelper.delay(2 * 60 * 1000); // 2m delay before next check
monitorNodeStatus();
}
}

Expand Down
20 changes: 15 additions & 5 deletions ZelBack/src/services/fluxNetworkHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,22 +975,32 @@ async function checkDeterministicNodesCollisions() {
}, 60 * 1000);
return;
}
} else if (nodeStatus.data.status === 'CONFIRMED' && nodeCollateralDifferentIp) {
}
if (nodeStatus.data.status === 'CONFIRMED' && nodeCollateralDifferentIp) {
let errorCall = false;
const askingIP = nodeCollateralDifferentIp.ip.split(':')[0];
const askingIpPort = nodeCollateralDifferentIp.ip.split(':')[1] || '16127';
await serviceHelper.axiosGet(`http://${askingIP}:${askingIpPort}/flux/version`, axiosConfig).catch(errorCall = true);
if (!errorCall) {
log.error('Flux collision detection. Another ip:port is confirmed and reachable on flux network with the same collateral transaction information.');
log.error(`Flux collision detection. Node at ${askingIP}:${askingIpPort} is confirmed and reachable on flux network with the same collateral transaction information.`);
dosState = 100;
setDosMessage('Flux collision detection. Another ip:port is confirmed and reachable on flux network with the same collateral transaction information.');
setDosMessage(`Flux collision detection. Node at ${askingIP}:${askingIpPort} is confirmed and reachable on flux network with the same collateral transaction information.`);
setTimeout(() => {
checkDeterministicNodesCollisions();
}, 60 * 1000);
return;
}
const daemonResult = await daemonServiceWalletRpcs.createConfirmationTransaction();
log.info(`createConfirmationTransaction: ${JSON.stringify(daemonResult)}`);
errorCall = false;
await serviceHelper.delay(60 * 1000); // 60s await to double check the other machine is really offline or it just restarted or restarted fluxOs
await serviceHelper.axiosGet(`http://${askingIP}:${askingIpPort}/flux/version`, axiosConfig).catch(errorCall = true);
if (errorCall) {
const daemonResult = await daemonServiceWalletRpcs.createConfirmationTransaction();
log.info(`node was confirmed on a different machine ip - createConfirmationTransaction: ${JSON.stringify(daemonResult)}`);
if (getDosMessage().includes('is confirmed and reachable on flux network')) {
dosState = 0;
setDosMessage(null);
}
}
}
}
// early stages of the network or testnet
Expand Down
Loading
Loading