From 8b7c85dd61c585d96e711deca5d0e014a5aa1d12 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 24 Jul 2023 10:44:25 -0400 Subject: [PATCH] fix: incorporate upstream https://github.com/lightclients/patronum/pull/23 reverts 91144cb5a2b5d05fd301b11501861aadd10a69b5 --- npm-shrinkwrap.json | 12 ++++++------ package.json | 12 ++++++------ src/client/utils.ts | 1 + src/client/verifyingProvider.ts | 9 +++++---- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 3709e9a..f05a200 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -12,13 +12,13 @@ "@chainsafe/bls": "7.1.1", "@chainsafe/blst": "0.2.9", "@chainsafe/ssz": "0.11.1", - "@ethereumjs/block": "4.3.0", - "@ethereumjs/blockchain": "6.3.0", + "@ethereumjs/block": "^4.3.0", + "@ethereumjs/blockchain": "^6.3.0", "@ethereumjs/common": "^3.2.0", - "@ethereumjs/trie": "5.1.0", - "@ethereumjs/tx": "4.2.0", - "@ethereumjs/util": "8.1.0", - "@ethereumjs/vm": "6.5.0", + "@ethereumjs/trie": "^5.1.0", + "@ethereumjs/tx": "^4.2.0", + "@ethereumjs/util": "^8.1.0", + "@ethereumjs/vm": "^6.5.0", "@lodestar/config": "1.9.1", "@lodestar/light-client": "1.9.1", "@lodestar/params": "1.9.1", diff --git a/package.json b/package.json index 92ef991..a2f084b 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,13 @@ "@chainsafe/bls": "7.1.1", "@chainsafe/blst": "0.2.9", "@chainsafe/ssz": "0.11.1", - "@ethereumjs/block": "4.3.0", - "@ethereumjs/blockchain": "6.3.0", + "@ethereumjs/block": "^4.3.0", + "@ethereumjs/blockchain": "^6.3.0", "@ethereumjs/common": "^3.2.0", - "@ethereumjs/trie": "5.1.0", - "@ethereumjs/tx": "4.2.0", - "@ethereumjs/util": "8.1.0", - "@ethereumjs/vm": "6.5.0", + "@ethereumjs/trie": "^5.1.0", + "@ethereumjs/tx": "^4.2.0", + "@ethereumjs/util": "^8.1.0", + "@ethereumjs/vm": "^6.5.0", "@lodestar/config": "1.9.1", "@lodestar/light-client": "1.9.1", "@lodestar/params": "1.9.1", diff --git a/src/client/utils.ts b/src/client/utils.ts index 0dc5578..467f600 100644 --- a/src/client/utils.ts +++ b/src/client/utils.ts @@ -34,6 +34,7 @@ export function headerDataFromWeb3Response(blockInfo: any): HeaderData { baseFeePerGas: blockInfo.baseFeePerGas ? BigInt(blockInfo.baseFeePerGas) : undefined, + withdrawalsRoot: blockInfo.withdrawalsRoot, }; } diff --git a/src/client/verifyingProvider.ts b/src/client/verifyingProvider.ts index cb34419..52e2499 100644 --- a/src/client/verifyingProvider.ts +++ b/src/client/verifyingProvider.ts @@ -3,7 +3,7 @@ import { IVerifyingProvider } from "#interfaces.js"; import _ from "lodash"; import { Trie } from "@ethereumjs/trie"; import rlp from "rlp"; -import { Chain, Common } from "@ethereumjs/common"; +import { Common, Chain, Hardfork } from "@ethereumjs/common"; import { Account, Address, @@ -84,6 +84,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider { ) { this.common = new Common({ chain, + hardfork: chain === Chain.Mainnet ? Hardfork.Shanghai : undefined, }); const _blockNumber = BigInt(blockNumber); this.latestBlockNumber = blockNumber; @@ -576,12 +577,12 @@ export default class VerifyingProvider implements IClientVerifyingProvider { } const headerData = headerDataFromWeb3Response(blockInfo); - const header = BlockHeader.fromHeaderData(headerData); + const header = new BlockHeader(headerData, { common: this.common }); if (!header.hash().equals(toBuffer(blockHash))) { - /* throw new Error( + throw new Error( `blockhash doesn't match the blockInfo provided by the RPC`, - );*/ + ); } this.blockHeaders[blockHash] = header; }