fix: use byteArrayEquals

This commit is contained in:
Derrick Hammer 2023-07-13 12:25:21 -04:00
parent b87017eb67
commit 157811b234
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 2 deletions

View File

@ -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),
)
);
}