Skip to content

Commit 90bd6b5

Browse files
committed
Fixed stakeValidators when run without uuid option
1 parent 41f9414 commit 90bd6b5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

contracts/tasks/validator.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ const registerValidators = async ({
185185
break;
186186
}
187187

188+
if (currentState.state === "validator_registered") {
189+
log(
190+
`Validator has been registered. Run the stakeValidators task to stake the validator`
191+
);
192+
break;
193+
}
194+
188195
await sleep(1000);
189196
}
190197
};
@@ -216,7 +223,7 @@ const stakeValidators = async ({
216223
}) => {
217224
let currentState;
218225
if (!uuid) {
219-
let currentState = await getState(store);
226+
currentState = await getState(store);
220227
log("currentState", currentState);
221228

222229
if (!currentState) {
@@ -488,7 +495,8 @@ const p2pRequest = async (url, api_key, method, body) => {
488495

489496
const response = await rawResponse.json();
490497
if (response.error != null) {
491-
log("Call to P2P API failed with response:", response);
498+
log(`Call to P2P API failed: ${method} ${url}`);
499+
log(`response: `, response);
492500
throw new Error(
493501
`Failed to call to P2P API. Error: ${JSON.stringify(response.error)}`
494502
);
@@ -657,6 +665,9 @@ const confirmValidatorRegistered = async (
657665
p2p_base_url
658666
) => {
659667
const doConfirmation = async () => {
668+
if (!uuid) {
669+
throw Error(`UUID is required to get validator status.`);
670+
}
660671
const response = await p2pRequest(
661672
`https://${p2p_base_url}/api/v1/eth/staking/ssv/request/status/${uuid}`,
662673
p2p_api_key,
@@ -705,6 +716,9 @@ const getDepositData = async (
705716
p2p_base_url
706717
) => {
707718
const doConfirmation = async () => {
719+
if (!uuid) {
720+
throw Error(`UUID is required to get deposit data.`);
721+
}
708722
const response = await p2pRequest(
709723
`https://${p2p_base_url}/api/v1/eth/staking/ssv/request/deposit-data/${uuid}`,
710724
p2p_api_key,

0 commit comments

Comments
 (0)