Skip to content

Commit 498d68c

Browse files
spencer-tbjochem-brouwer
authored andcommitted
packages: add requests hash to genesis block.
1 parent ea935e7 commit 498d68c

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

packages/blockchain/src/blockchain.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
BIGINT_1,
66
BIGINT_8,
77
KECCAK256_RLP,
8+
KECCAK256_RLP_RH,
89
Lock,
910
MapDB,
1011
bigIntToHex,
@@ -1313,6 +1314,7 @@ export class Blockchain implements BlockchainInterface {
13131314
number: 0,
13141315
stateRoot,
13151316
withdrawalsRoot: common.isActivatedEIP(4895) ? KECCAK256_RLP : undefined,
1317+
requestsHash: common.isActivatedEIP(7685) ? KECCAK256_RLP_RH : undefined,
13161318
}
13171319
if (common.consensusType() === 'poa') {
13181320
if (common.genesis().extraData) {

packages/common/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export interface GenesisBlockConfig {
5252
extraData: PrefixedHexString
5353
baseFeePerGas?: PrefixedHexString
5454
excessBlobGas?: PrefixedHexString
55+
requestsHash?: PrefixedHexString
5556
}
5657

5758
export interface HardforkTransitionConfig {

packages/common/src/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function parseGethParams(json: any) {
3838
coinbase,
3939
baseFeePerGas,
4040
excessBlobGas,
41+
requestsHash,
4142
extraData: unparsedExtraData,
4243
nonce: unparsedNonce,
4344
timestamp: unparsedTimestamp,
@@ -50,6 +51,7 @@ function parseGethParams(json: any) {
5051
coinbase: PrefixedHexString
5152
baseFeePerGas: PrefixedHexString
5253
excessBlobGas: PrefixedHexString
54+
requestsHash: PrefixedHexString
5355
extraData: string
5456
nonce: string
5557
timestamp: string
@@ -105,6 +107,7 @@ function parseGethParams(json: any) {
105107
coinbase,
106108
baseFeePerGas,
107109
excessBlobGas,
110+
requestsHash,
108111
},
109112
hardfork: undefined as string | undefined,
110113
hardforks: [] as ConfigHardfork[],

packages/util/src/constants.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ export const KECCAK256_RLP = hexToBytes(KECCAK256_RLP_S)
6767

6868
export const SHA256_NULL = sha256(new Uint8Array())
6969

70+
/**
71+
* Keccak-256 hash of the RLP of an empty requests hash
72+
*/
73+
export const KECCAK256_RLP_RH_S =
74+
'0x6036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5f'
75+
76+
/**
77+
* Keccak-256 hash of the RLP of an empty requests hash
78+
*/
79+
export const KECCAK256_RLP_RH = hexToBytes(KECCAK256_RLP_RH_S)
80+
7081
/**
7182
* RLP encoded empty string
7283
*/

0 commit comments

Comments
 (0)