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

Dev remove algorand participant #2813

Merged
merged 6 commits into from
Jun 2, 2024
Merged
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
8 changes: 1 addition & 7 deletions packages/grid_client/scripts/applications/algorand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
log("================= Getting deployment information =================");
}

async function cancel(client, vms) {

Check warning on line 19 in packages/grid_client/scripts/applications/algorand.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

'cancel' is defined but never used
const resultVM = await client.machines.delete(vms);
log("================= Canceling the deployment =================");
log(resultVM);
Expand Down Expand Up @@ -69,14 +69,8 @@
SSH_KEY: config.ssh_key,
// Select a network to work against.
NETWORK: "mainnet",
// Defualt, Relay, Participant, Indexer
// Default, Relay, Indexer
NODE_TYPE: "default",
// Account mnemonic is the private key of your Algorand wallet and it consists of 24 words, and these 3 options are only enabled on Participant.
//ACCOUNT_MNEMONICS: "",
// First Validation Block.
//FIRST_ROUND: "24000000",
// Last Validation Block
//LAST_ROUND: "26000000",
},
},
],
Expand Down
101 changes: 2 additions & 99 deletions packages/playground/src/weblets/tf_algorand.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,86 +56,12 @@
label="Node Type"
:items="[
{ title: 'Default', value: 'default' },
{ title: 'Participant', value: 'participant' },
{ title: 'Relay', value: 'relay' },
{ title: 'Indexer', value: 'indexer' },
]"
v-model="type"
/>
</input-tooltip>

<template v-if="type === 'participant'">
<input-validator
:value="account"
:rules="[
validators.required('Mnemonic is required.'),
value => {
return validators.isAlpha('Mnemonic can contain only alphabetic characters.')(value.replace(/\s/g, ''));
},
customAccountValidation,
]"
#="{ props }"
>
<input-tooltip
tooltip="Account mnemonic is the private key of your Algorand wallet and it consists of 24 words "
>
<v-text-field
label="Account Mnemonic"
placeholder="Algorand Account Mnemonic"
v-model.trim="account"
v-bind="props"
autofocus
counter
>
<template #counter>
<span :class="{ 'text-red': wordsLength > 25 }">{{ wordsLength }}</span>
/ 25
</template>
</v-text-field>
</input-tooltip>
</input-validator>

<input-validator
:value="firstRound"
:rules="[
validators.required('First round is required.'),
validators.isInt('First round must be a valid integer.'),
validators.min('First round must be greater than 0.', 1),
]"
#="{ props }"
>
<input-tooltip tooltip="First Validation Block.">
<v-text-field
label="First Round"
placeholder="First Validation Block"
v-model.number="firstRound"
v-bind="props"
type="number"
/>
</input-tooltip>
</input-validator>

<input-validator
:value="lastRound"
:rules="[
validators.required('Last round is required.'),
validators.isInt('Last round must be a valid integer.'),
customLastRoundValidation(validators),
]"
#="{ props }"
ref="lastRoundInput"
>
<input-tooltip tooltip="Last Validation Block">
<v-text-field
label="Last Round"
placeholder="Last Validation Block"
v-model.number="lastRound"
v-bind="props"
type="number"
/>
</input-tooltip>
</input-validator>
</template>
</AlgorandCapacity>

<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
Expand Down Expand Up @@ -184,15 +110,14 @@ import { computed, type Ref, ref, watch } from "vue";
import { manual } from "@/utils/manual";

import { useLayout } from "../components/weblet_layout.vue";
import { useGrid, useProfileManager } from "../stores";
import { type Flist, ProjectName, type Validators } from "../types";
import { useGrid } from "../stores";
import { type Flist, ProjectName } from "../types";
import { deployVM } from "../utils/deploy_vm";
import { generateName } from "../utils/strings";

const layout = useLayout();
const valid = ref(false);
const lastRoundInput = ref();
const profileManager = useProfileManager();
const flist: Flist = {
value: "https://hub.grid.tf/tf-official-apps/algorand-latest.flist",
entryPoint: "/sbin/zinit init",
Expand All @@ -205,8 +130,6 @@ const memory = ref() as Ref<number>;
const storage = ref() as Ref<number>;
const network = ref("mainnet");
const type = ref("default");
const account = ref("");
const wordsLength = computed(() => (account.value ? account.value.split(" ").length : 0));
const firstRound = ref(24000000);
const lastRound = ref(26000000);
const dedicated = ref(false);
Expand Down Expand Up @@ -260,13 +183,6 @@ async function deploy() {
{ key: "SSH_KEY", value: selectedSSHKeys.value },
{ key: "NETWORK", value: network.value },
{ key: "NODE_TYPE", value: type.value },
...(type.value === "participant"
? [
{ key: "ACCOUNT_MNEMONICS", value: account.value },
{ key: "FIRST_ROUND", value: firstRound.value.toString() },
{ key: "LAST_ROUND", value: lastRound.value.toString() },
]
: []),
],
},
],
Expand All @@ -280,19 +196,6 @@ async function deploy() {
}
}

function customAccountValidation(value: string) {
if (value.split(" ").length !== 25) {
return { message: "Mnemonic must have 25 words separated by spaces." };
}
}

function customLastRoundValidation(validators: Validators) {
return (value: string) => {
const min = firstRound.value;
return validators.min(`Last round must be greater than ${min}`, min + 1)(value);
};
}

function updateSSHkeyEnv(selectedKeys: string) {
selectedSSHKeys.value = selectedKeys;
}
Expand Down
Loading