From 3f85c2d627937bd23161957e96082d9e695e761d Mon Sep 17 00:00:00 2001 From: marcello33 Date: Thu, 19 Dec 2024 13:26:29 +0100 Subject: [PATCH 1/2] fix: commands for heimdall-v2 --- .github/integration-tests/smoke_test.sh | 2 +- src/express/commands/monitor.js | 14 ++++++-------- src/express/commands/send-signer-change.js | 2 +- src/express/commands/send-stake-update.js | 2 +- src/express/commands/send-staked-event.js | 2 +- src/express/commands/send-topupfee.js | 4 ++-- src/express/common/milestone-utils.js | 8 ++++---- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/integration-tests/smoke_test.sh b/.github/integration-tests/smoke_test.sh index 5ef75568..f792e373 100644 --- a/.github/integration-tests/smoke_test.sh +++ b/.github/integration-tests/smoke_test.sh @@ -25,7 +25,7 @@ do fi fi - checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id) + checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .checkpoint.id) if [ "$checkpointID" != "null" ]; then if [ $checkpointFound != "true" ]; then diff --git a/src/express/commands/monitor.js b/src/express/commands/monitor.js index 3a2b9dca..9bf9b73d 100644 --- a/src/express/commands/monitor.js +++ b/src/express/commands/monitor.js @@ -52,10 +52,8 @@ async function checkCheckpoint(ip) { const url = `http://${ip}:1317/checkpoints/count` const response = await fetch(url) const responseJson = await response.json() - if (responseJson.result) { - if (responseJson.result.result) { - return responseJson.result.result - } + if (responseJson.ack_count) { + return responseJson.ack_count } return 0 @@ -74,8 +72,8 @@ async function checkStateSyncTx(ip, id) { if (responseJson.error) { return undefined } else { - if (responseJson.result) { - return responseJson.result + if (responseJson.record) { + return responseJson.record } } @@ -89,8 +87,8 @@ async function getStateSyncTxList(ip, startTime, endTime) { if (responseJson.error) { return undefined } else { - if (responseJson.result) { - return responseJson.result + if (responseJson.record) { + return responseJson.record } } diff --git a/src/express/commands/send-signer-change.js b/src/express/commands/send-signer-change.js index e2464204..c87bf9ee 100644 --- a/src/express/commands/send-signer-change.js +++ b/src/express/commands/send-signer-change.js @@ -126,5 +126,5 @@ async function getValidatorSigner(doc, machine0, validatorID) { maxRetries ) const outObj = JSON.parse(out) - return outObj.result.signer + return outObj.validator.signer } diff --git a/src/express/commands/send-stake-update.js b/src/express/commands/send-stake-update.js index 57a41120..5176f23c 100644 --- a/src/express/commands/send-stake-update.js +++ b/src/express/commands/send-stake-update.js @@ -142,5 +142,5 @@ async function getValidatorPower(doc, machine0, validatorID) { maxRetries ) const outObj = JSON.parse(out) - return outObj.result.power + return outObj.validator.voting_power } diff --git a/src/express/commands/send-staked-event.js b/src/express/commands/send-staked-event.js index 8b08e8f5..c53f68c3 100644 --- a/src/express/commands/send-staked-event.js +++ b/src/express/commands/send-staked-event.js @@ -156,5 +156,5 @@ export async function checkValidatorsLength(doc, machine0) { maxRetries ) const outObj = JSON.parse(out) - return outObj.result.validators.length + return outObj.validator_set.validators.length } diff --git a/src/express/commands/send-topupfee.js b/src/express/commands/send-topupfee.js index 22c41190..30e66f9a 100644 --- a/src/express/commands/send-topupfee.js +++ b/src/express/commands/send-topupfee.js @@ -147,12 +147,12 @@ export async function sendTopUpFeeEvent(validatorID) { } async function getValidatorBalance(doc, machine0, valAddr) { - const command = `curl http://localhost:1317/bank/balances/${valAddr}` + const command = `curl http://localhost:1317/cosmos/bank/v1beta1/balances/${valAddr}` const out = await runSshCommandWithReturn( `${doc.ethHostUser}@${machine0}`, command, maxRetries ) const outObj = JSON.parse(out) - return outObj.result[0].amount + return outObj.balances[0].amount } diff --git a/src/express/common/milestone-utils.js b/src/express/common/milestone-utils.js index 65d0c3b8..1e7c25a9 100644 --- a/src/express/common/milestone-utils.js +++ b/src/express/common/milestone-utils.js @@ -417,11 +417,11 @@ export async function fetchLatestMilestone( } milestone = await checkLatestMilestone(host) - if (milestone.result) { + if (milestone.milestone) { // Check against last milestone (if present) if it's immediate next one or not if (lastMilestone) { if ( - Number(milestone.result.start_block) === + Number(milestone.milestone.start_block) === Number(lastMilestone.end_block) + 1 ) { break @@ -434,13 +434,13 @@ export async function fetchLatestMilestone( } else { console.log( `📍Invalid milestone received. Response: ${JSON.stringify( - milestone.result + milestone.milestone )}, count: ${count}` ) } } - const latestMilestone = milestone.result + const latestMilestone = milestone.milestone console.log( `📍Got milestone from heimdall. Start block: ${Number( latestMilestone.start_block From dea2ccf1069a538f48467515135f1cb1e8ab1cf0 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Thu, 19 Dec 2024 13:29:48 +0100 Subject: [PATCH 2/2] fix: linter/prettier --- src/setup/devnet/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/setup/devnet/index.js b/src/setup/devnet/index.js index af53372d..1c070944 100644 --- a/src/setup/devnet/index.js +++ b/src/setup/devnet/index.js @@ -893,7 +893,6 @@ export class Devnet { { stdio: getRemoteStdio() } ) - let nodeDir = `${this.testnetDir}/node${i}/` if (i >= this.config.numOfBorValidators) { nodeDir = `${this.testnetDir}/node${i + this.config.numOfErigonValidators}/`