From 6e279c84bbbc1e17f6fc7ef5df331f90c5f01171 Mon Sep 17 00:00:00 2001 From: Ali Behjati Date: Fri, 9 Dec 2022 14:53:01 +0100 Subject: [PATCH] Update the VAA hash to use payload hash (#422) * Update the VAA hash to use payload hash * Bugfix --- third_party/pyth/price-service/package-lock.json | 4 ++-- third_party/pyth/price-service/package.json | 2 +- third_party/pyth/price-service/src/listen.ts | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/third_party/pyth/price-service/package-lock.json b/third_party/pyth/price-service/package-lock.json index 5fcb48f1..b357cd58 100644 --- a/third_party/pyth/price-service/package-lock.json +++ b/third_party/pyth/price-service/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pythnetwork/pyth-price-service", - "version": "2.2.0", + "version": "2.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@pythnetwork/pyth-price-service", - "version": "2.2.0", + "version": "2.2.1", "license": "Apache-2.0", "dependencies": { "@certusone/wormhole-sdk": "^0.1.4", diff --git a/third_party/pyth/price-service/package.json b/third_party/pyth/price-service/package.json index 7f427309..5490c733 100644 --- a/third_party/pyth/price-service/package.json +++ b/third_party/pyth/price-service/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/pyth-price-service", - "version": "2.2.0", + "version": "2.2.1", "description": "Pyth Price Service", "main": "index.js", "scripts": { diff --git a/third_party/pyth/price-service/src/listen.ts b/third_party/pyth/price-service/src/listen.ts index 0a7e233b..1f3a1dfc 100644 --- a/third_party/pyth/price-service/src/listen.ts +++ b/third_party/pyth/price-service/src/listen.ts @@ -160,7 +160,11 @@ export class Listener implements PriceStore { async processVaa(vaa: Buffer) { const { parse_vaa } = await importCoreWasm(); - const vaaHash: VaaHash = createHash("md5").update(vaa).digest("base64"); + const parsedVaa = parse_vaa(vaa); + + const vaaHash: VaaHash = createHash("md5") + .update(Buffer.from(parsedVaa.payload)) + .digest("base64"); if (this.observedVaas.has(vaaHash)) { return; @@ -169,8 +173,6 @@ export class Listener implements PriceStore { this.observedVaas.set(vaaHash, true); this.promClient?.incReceivedVaa(); - const parsedVaa = parse_vaa(vaa); - let batchAttestation; try {