diff --git a/src/app/routes/reshare-dkg/ceremony-section.tsx b/src/app/routes/reshare-dkg/ceremony-section.tsx
index 1716a7387..3b62a75bf 100644
--- a/src/app/routes/reshare-dkg/ceremony-section.tsx
+++ b/src/app/routes/reshare-dkg/ceremony-section.tsx
@@ -2,7 +2,6 @@ import { Card, CardHeader } from "@/components/ui/card.tsx";
import { Text } from "@/components/ui/text.tsx";
import { Button } from "@/components/ui/button.tsx";
import { Alert, AlertDescription } from "@/components/ui/alert.tsx";
-import { useRegisterValidatorContext } from "@/guard/register-validator-guard.tsx";
import { LuCheck, LuCopy } from "react-icons/lu";
import CeremonySummary from "@/app/routes/create-cluster/ceremony-summary.tsx";
import { useQuery } from "@tanstack/react-query";
@@ -20,6 +19,8 @@ import { useCopyToClipboard } from "react-use";
import { CompletedBadge } from "@/components/ui/completed-badge.tsx";
import { useOperatorsDKGHealth } from "@/hooks/operator/use-operator-dkg-health.ts";
+const VALIDATOR_COUNT_THRESHOLD = 20;
+
const CeremonySection = ({
isEnabled,
isCompletedStep,
@@ -65,7 +66,8 @@ const CeremonySection = ({
]),
queryFn: async () => {
const proofsString =
- (reshareContext.proofsQuery.data?.validators || []).length > 20
+ (reshareContext.proofsQuery.data?.validators || []).length >
+ VALIDATOR_COUNT_THRESHOLD
? undefined
: JSON.stringify(
(reshareContext.proofsQuery?.data?.validators || []).map(
@@ -126,23 +128,26 @@ const CeremonySection = ({
{" "}
on the machine hosting the DKG client
-
-
- Please ensure you run the provided command from the
- directory containing the proofs.json file you wish to
- reshare. For additional details, refer to our{" "}
- {" "}
- .
-
-
+ {(reshareContext.proofsQuery.data?.validators || [])
+ .length > VALIDATOR_COUNT_THRESHOLD && (
+
+
+ Please ensure you run the provided command from the
+ directory containing the proofs.json file you wish to
+ reshare. For additional details, refer to our{" "}
+ {" "}
+ .
+
+
+ )}
)}
@@ -154,7 +159,7 @@ const CeremonySection = ({
-
+
)}
- {proofsQuery.isSuccess && proofsQuery.data?.validators && (
+ {proofsQuery.isSuccess && proofsQuery.data?.validators.length > 1 && (
> = ({
...props
@@ -33,6 +34,7 @@ export const ClusterValidatorsList: FC> = ({
const navigate = useNavigate();
const cluster = useCluster();
const { validators, infiniteQuery } = useInfiniteClusterValidators();
+ const [enabled] = useLocalStorage("reshareFlowEnabled", false);
return (
> = ({
Exit Validator
+ {enabled && (
+ <>
+
+ DKG
+
+ navigate("reshare")}>
+
+ Reshare
+
+ >
+ )}
diff --git a/src/hooks/use-validate-proofs.ts b/src/hooks/use-validate-proofs.ts
index a4826a21c..a5ebc7404 100644
--- a/src/hooks/use-validate-proofs.ts
+++ b/src/hooks/use-validate-proofs.ts
@@ -23,17 +23,24 @@ type ValidateProofsResult = {
validators: ProofsValidatorsType[];
};
-const validateProofs = (proofs: Proof[] | Proof[][], address: Address) =>
- proofs.every((proof: Proof | Proof[]) =>
- Array.isArray(proof)
- ? proof.every(
- (p: Proof) =>
- toChecksumAddress(`0x${p.proof.owner}`) === address &&
- p.proof.validator === proof[0].proof.validator,
- )
- : toChecksumAddress(`0x${proof.proof.owner}`) === address &&
- proof.proof.validator === (proofs as Proof[])[0].proof.validator,
- );
+const validateProofs = (proofs: Proof[] | Proof[][], address: Address) => {
+ try {
+ return proofs.every((proof: Proof | Proof[]) =>
+ Array.isArray(proof)
+ ? proof.every(
+ (p: Proof) =>
+ toChecksumAddress(`0x${p.proof.owner}`) === address &&
+ p.proof.validator === proof[0].proof.validator,
+ )
+ : toChecksumAddress(`0x${proof.proof.owner}`) === address &&
+ proof.proof.validator === (proofs as Proof[])[0].proof.validator,
+ );
+ } catch (e) {
+ throw new Error(
+ "The file you uploaded is incorrect, please upload proofs.json.",
+ );
+ }
+};
export const useValidateProofs = (files: File[]) => {
const account = useAccount();
@@ -58,14 +65,12 @@ export const useValidateProofs = (files: File[]) => {
refetchOnWindowFocus: false,
refetchOnReconnect: false,
queryFn: async () => {
- if (files.length === 0) {
- throw new Error("No file uploaded.");
- }
-
const file = files[0];
if (!file || file.type !== "application/json") {
- throw new Error("Please upload a valid JSON file.");
+ throw new Error(
+ "The file you uploaded is incorrect, please upload proofs.json.",
+ );
}
if (!account.address) {
@@ -77,7 +82,9 @@ export const useValidateProofs = (files: File[]) => {
const json = JSON.parse(fileContent);
const isValid = validateProofs(json, account.address);
if (!isValid) {
- throw new Error("Wrong proofs file.");
+ throw new Error(
+ "The file you uploaded is incorrect, please upload proofs.json.",
+ );
}
const allRegisteredValidators = await getAllValidators(
clusterHash || "",
@@ -91,9 +98,6 @@ export const useValidateProofs = (files: File[]) => {
if (
!allRegisteredValidators.data.includes(validatorPublicKey)
) {
- if (!Array.isArray(proof)) {
- throw new Error("No registered public keys found.");
- }
return acc;
}
if (Array.isArray(proof)) {
@@ -115,6 +119,10 @@ export const useValidateProofs = (files: File[]) => {
),
),
);
+
+ if (!validators.length) {
+ throw new Error("No registered validators found.");
+ }
state.dkgReshareState.selectedValidatorsCount = validators.length;
return {
diff --git a/src/lib/utils/keyshares.ts b/src/lib/utils/keyshares.ts
index bb6fb50ec..155b0d540 100644
--- a/src/lib/utils/keyshares.ts
+++ b/src/lib/utils/keyshares.ts
@@ -160,7 +160,7 @@ export const generateSSVKeysDockerCMD = ({
};
if (signatures) {
- return `docker pull bloxstaking/ssv-dkg:v${version} && docker run --rm -v ${dynamicFullPath}:/data -it "bloxstaking/ssv-dkg:v2.1.0" init --operatorIDs ${operatorIds} ${
+ return `docker pull bloxstaking/ssv-dkg:v${version} && docker run --rm -v ${dynamicFullPath}:/data -it "bloxstaking/ssv-dkg:v${version}" init --operatorIDs ${operatorIds} ${
newOperators?.length
? `--newOperatorsIDs ${sortOperators(newOperators)
.map((op) => op.id)
@@ -168,5 +168,5 @@ export const generateSSVKeysDockerCMD = ({
: ""
} --withdrawAddress ${withdrawalAddress} --owner ${account} --nonce ${nonce} --network ${chainName} ${proofsString ? `--proofsString ${proofsString}` : "--proofsFilePath /data/proofs.json"} --operatorsInfo ${newOperators ? getOperatorsData([...operators, ...newOperators]) : getOperatorsData(operators)} --signatures ${signatures} --outputPath /output --logLevel info --logFormat json --logLevelFormat capitalColor --logFilePath /data/debug.log --tlsInsecure`;
}
- return `docker pull bloxstaking/ssv-dkg:v2.1.0 && docker run --rm -v ${dynamicFullPath}:/data -it "bloxstaking/ssv-dkg:v2.1.0" init --owner ${account} --nonce ${nonce} --withdrawAddress ${withdrawalAddress} --operatorIDs ${operatorIds} --operatorsInfo ${getOperatorsData(sortedOperators)} --network ${chainName} --validators ${validatorsCount} --logFilePath /data/debug.log --outputPath /data`;
+ return `docker pull bloxstaking/ssv-dkg:v2.1.0 && docker run --rm -v ${dynamicFullPath}:/data -it "bloxstaking/ssv-dkg:v${version}" init --owner ${account} --nonce ${nonce} --withdrawAddress ${withdrawalAddress} --operatorIDs ${operatorIds} --operatorsInfo ${getOperatorsData(sortedOperators)} --network ${chainName} --validators ${validatorsCount} --logFilePath /data/debug.log --outputPath /data`;
};