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

editVaa: Fix Guardian address comparison #4165

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions clients/js/src/cmds/editVaa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import { ethers } from "ethers";
import yargs from "yargs";
import { NETWORK_OPTIONS, NETWORKS } from "../consts";
import { parse, Payload, serialiseVAA, sign, Signature, VAA } from "../vaa";
import { contracts, Network } from "@wormhole-foundation/sdk-base";
import { contracts, Network, platformToAddressFormat } from "@wormhole-foundation/sdk-base";
import { getNetwork } from "../utils";
import { UniversalAddress } from "@wormhole-foundation/sdk";

export const command = "edit-vaa";
export const desc = "Edits or generates a VAA";
Expand Down Expand Up @@ -256,8 +257,12 @@ const getSigsFromWormscanData = (
for (let data in wormscanData) {
let guardianAddr = wormscanData[data].guardianAddr;
let gsi = -1;

for (let idx = 0; idx < guardianSet.length; idx++) {
if (guardianSet[idx] === guardianAddr) {
const normalizedGuardianFromSet = new UniversalAddress(guardianSet[idx], platformToAddressFormat("Evm"));
const normalizedGuardianAddr = new UniversalAddress(guardianAddr, platformToAddressFormat("Evm"));

if (normalizedGuardianAddr.equals(normalizedGuardianFromSet)) {
gsi = idx;
break;
}
Expand Down
Loading