Skip to content

Commit 8cea604

Browse files
committed
packages: add requests hash to genesis block.
1 parent f487448 commit 8cea604

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
@@ -6,6 +6,7 @@ import {
66
BIGINT_1,
77
BIGINT_8,
88
KECCAK256_RLP,
9+
KECCAK256_RLP_RH,
910
Lock,
1011
MapDB,
1112
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
@@ -48,6 +48,7 @@ export interface GenesisBlockConfig {
4848
extraData: PrefixedHexString
4949
baseFeePerGas?: PrefixedHexString
5050
excessBlobGas?: PrefixedHexString
51+
requestsHash?: PrefixedHexString
5152
}
5253

5354
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
@@ -64,6 +64,17 @@ export const KECCAK256_RLP_S = '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cad
6464
*/
6565
export const KECCAK256_RLP = hexToBytes(KECCAK256_RLP_S)
6666

67+
/**
68+
* Keccak-256 hash of the RLP of an empty requests hash
69+
*/
70+
export const KECCAK256_RLP_RH_S =
71+
'0x6036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5f'
72+
73+
/**
74+
* Keccak-256 hash of the RLP of an empty requests hash
75+
*/
76+
export const KECCAK256_RLP_RH = hexToBytes(KECCAK256_RLP_RH_S)
77+
6778
/**
6879
* RLP encoded empty string
6980
*/

0 commit comments

Comments
 (0)