From 157811b2348fa94d5d6b076219f34b3b340a50ac Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 13 Jul 2023 12:25:21 -0400 Subject: [PATCH] fix: use byteArrayEquals --- src/client/verifyingProvider.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/verifyingProvider.ts b/src/client/verifyingProvider.ts index 71c6d53..f3449b8 100644 --- a/src/client/verifyingProvider.ts +++ b/src/client/verifyingProvider.ts @@ -45,7 +45,7 @@ import { RPCTx, } from "./types.js"; import { keccak256 } from "ethereum-cryptography/keccak"; -import { fromHexString } from "@chainsafe/ssz"; +import { byteArrayEquals, fromHexString } from "@chainsafe/ssz"; import { RPC } from "#client/rpc.js"; export interface IClientVerifyingProvider extends IVerifyingProvider { @@ -640,7 +640,10 @@ export default class VerifyingProvider implements IClientVerifyingProvider { private verifyCodeHash(code: Bytes, codeHash: Bytes32): boolean { return ( (code === "0x" && codeHash === "0x" + KECCAK256_NULL_S) || - keccak256(fromHexString(codeHash)) === fromHexString(codeHash) + byteArrayEquals( + keccak256(fromHexString(codeHash)), + fromHexString(codeHash), + ) ); }