diff --git a/packages/blockchain/src/blockchain.ts b/packages/blockchain/src/blockchain.ts index a40ce99f67..54fe8a61c4 100644 --- a/packages/blockchain/src/blockchain.ts +++ b/packages/blockchain/src/blockchain.ts @@ -5,6 +5,7 @@ import { BIGINT_1, BIGINT_8, KECCAK256_RLP, + SHA256_EMPTY_RH, Lock, MapDB, bigIntToHex, @@ -1313,6 +1314,7 @@ export class Blockchain implements BlockchainInterface { number: 0, stateRoot, withdrawalsRoot: common.isActivatedEIP(4895) ? KECCAK256_RLP : undefined, + requestsHash: common.isActivatedEIP(7685) ? SHA256_EMPTY_RH : undefined, } if (common.consensusType() === 'poa') { if (common.genesis().extraData) { diff --git a/packages/common/src/types.ts b/packages/common/src/types.ts index 6176fb1b0e..7737ca4996 100644 --- a/packages/common/src/types.ts +++ b/packages/common/src/types.ts @@ -52,6 +52,7 @@ export interface GenesisBlockConfig { extraData: PrefixedHexString baseFeePerGas?: PrefixedHexString excessBlobGas?: PrefixedHexString + requestsHash?: PrefixedHexString } export interface HardforkTransitionConfig { diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index 6fcbc92f44..fc8ce1c23f 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -38,6 +38,7 @@ function parseGethParams(json: any) { coinbase, baseFeePerGas, excessBlobGas, + requestsHash, extraData: unparsedExtraData, nonce: unparsedNonce, timestamp: unparsedTimestamp, @@ -50,6 +51,7 @@ function parseGethParams(json: any) { coinbase: PrefixedHexString baseFeePerGas: PrefixedHexString excessBlobGas: PrefixedHexString + requestsHash: PrefixedHexString extraData: string nonce: string timestamp: string @@ -105,6 +107,7 @@ function parseGethParams(json: any) { coinbase, baseFeePerGas, excessBlobGas, + requestsHash, }, hardfork: undefined as string | undefined, hardforks: [] as ConfigHardfork[], diff --git a/packages/util/src/constants.ts b/packages/util/src/constants.ts index 25eb3f1ee1..d2798e90bd 100644 --- a/packages/util/src/constants.ts +++ b/packages/util/src/constants.ts @@ -67,6 +67,11 @@ export const KECCAK256_RLP = hexToBytes(KECCAK256_RLP_S) export const SHA256_NULL = sha256(new Uint8Array()) +/** + * SHA-256 hash of the RLP of an empty requests hash + */ +export const SHA256_EMPTY_RH = sha256(new Uint8Array([0, 1, 2])) + /** * RLP encoded empty string */