Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 0 additions & 4 deletions src/app/routes/reshare-dkg/reshare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ const Reshare = () => {
? health.data?.every(
({ isHealthy, isEthClientConnected, isOutdated, isMismatchId }) =>
isHealthy && isEthClientConnected && !isOutdated && !isMismatchId,
) ||
health.data?.every(
({ isHealthy, isOutdated, isMismatchId }) =>
isHealthy && isOutdated && !isMismatchId,
)
: health.data?.every(
({ isHealthy, isMismatchId }) => isHealthy && !isMismatchId,
Expand Down
19 changes: 12 additions & 7 deletions src/hooks/operator/use-reshare-signature-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,25 @@ export const useReshareSignaturePayload = ({
const nonce = await getOwnerNonce(ownerAddress);
const chainId = FORKS[getChainId(config)];
const payload = (proofsQuery.data?.validators || []).map(
({ publicKey, proofs }) => ({
messageData: {
({ publicKey, proofs }, index: number) => {
const messageData: MessageData = {
publicKey,
oldOperators: context.dkgReshareState.operators,
chainId,
withdrawalCredentials: withdrawAddress,
ownerAddress,
nonce,
nonce: nonce + index,
amount: DEFAULT_AMOUNT,
} as MessageData,
proofs: proofs,
}),
};
if (context.dkgReshareState.newOperators.length) {
messageData.newOperators = context.dkgReshareState.newOperators;
}
return {
messageData,
proofs,
};
},
);

return sign.signMessageAsync({
message: getSignaturePayload(payload),
});
Expand Down
9 changes: 8 additions & 1 deletion src/hooks/use-validate-proofs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ export const useValidateProofs = (files: File[]) => {
);
}
state.dkgReshareState.selectedValidatorsCount = validators.length;

if (
json.every((proof: Proof | Proof[]) => Array.isArray(proof)) &&
json.length > validators.length
) {
throw new Error(
"proofs.json must only contain validators that are registered.",
);
}
return {
proofs: json,
validators,
Expand Down
9 changes: 5 additions & 4 deletions src/lib/utils/dkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ const serializedResignMessage = (message: {
const serializedReshareMessage = (message: {
messageData: MessageData;
proofs: ProofType[];
}) =>
ReshareMessageType.serialize({
}) => {
return ReshareMessageType.serialize({
Reshare: {
ValidatorPubKey: parseHexToBuffer(message.messageData.publicKey),
OldOperators: message.messageData.oldOperators.map(
Expand All @@ -134,8 +134,8 @@ const serializedReshareMessage = (message: {
PubKey: Buffer.from(op.public_key),
}),
),
OldT: message.messageData.oldOperators.length % 3,
NewT: (message.messageData.newOperators || []).length % 3,
OldT: Number(message.messageData.oldOperators.length % 3),
NewT: Number((message.messageData.newOperators || []).length % 3),
Fork: parseHexToBuffer(message.messageData.chainId).slice(0, 4),
WithdrawalCredentials: parseHexToBuffer(
message.messageData.withdrawalCredentials,
Expand All @@ -154,6 +154,7 @@ const serializedReshareMessage = (message: {
Signature: parseHexToBuffer(proof.signature),
})),
});
};

export const getSignaturePayload = (
data: {
Expand Down
Loading