Skip to content

Commit 1c4c24e

Browse files
Merge branch 'devnet4-contracts' into 7702-devnet-4-plus-t8ntool
2 parents 781c77e + 8b641de commit 1c4c24e

File tree

14 files changed

+80
-80
lines changed

14 files changed

+80
-80
lines changed

packages/block/src/header/constructors.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function createBlockHeader(headerData: HeaderData = {}, opts: BlockOption
2525
*/
2626
export function createBlockHeaderFromBytesArray(values: BlockHeaderBytes, opts: BlockOptions = {}) {
2727
const headerData = valuesArrayToHeaderData(values)
28-
const { number, baseFeePerGas, excessBlobGas, blobGasUsed, parentBeaconBlockRoot, requestsRoot } =
28+
const { number, baseFeePerGas, excessBlobGas, blobGasUsed, parentBeaconBlockRoot, requestsHash } =
2929
headerData
3030
const header = createBlockHeader(headerData, opts)
3131
if (header.common.isActivatedEIP(1559) && baseFeePerGas === undefined) {
@@ -48,8 +48,8 @@ export function createBlockHeaderFromBytesArray(values: BlockHeaderBytes, opts:
4848
throw new Error('invalid header. parentBeaconBlockRoot should be provided')
4949
}
5050

51-
if (header.common.isActivatedEIP(7685) && requestsRoot === undefined) {
52-
throw new Error('invalid header. requestsRoot should be provided')
51+
if (header.common.isActivatedEIP(7685) && requestsHash === undefined) {
52+
throw new Error('invalid header. requestsHash should be provided')
5353
}
5454
return header
5555
}
@@ -118,7 +118,7 @@ export function createBlockHeaderFromRPC(blockParams: JSONRPCBlock, options?: Bl
118118
blobGasUsed,
119119
excessBlobGas,
120120
parentBeaconBlockRoot,
121-
requestsRoot,
121+
requestsHash,
122122
} = blockParams
123123

124124
const blockHeader = new BlockHeader(
@@ -143,7 +143,7 @@ export function createBlockHeaderFromRPC(blockParams: JSONRPCBlock, options?: Bl
143143
blobGasUsed,
144144
excessBlobGas,
145145
parentBeaconBlockRoot,
146-
requestsRoot,
146+
requestsHash,
147147
},
148148
options,
149149
)

packages/block/src/header/header.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class BlockHeader {
6060
public readonly blobGasUsed?: bigint
6161
public readonly excessBlobGas?: bigint
6262
public readonly parentBeaconBlockRoot?: Uint8Array
63-
public readonly requestsRoot?: Uint8Array
63+
public readonly requestsHash?: Uint8Array
6464

6565
public readonly common: Common
6666

@@ -163,7 +163,7 @@ export class BlockHeader {
163163
parentBeaconBlockRoot: this.common.isActivatedEIP(4788) ? new Uint8Array(32) : undefined,
164164
// TODO: not sure what the default should be here becuase it would depends on activated EIPs
165165
// as even empty requests will produce data to sha hash
166-
requestsRoot: this.common.isActivatedEIP(7685) ? KECCAK256_RLP : undefined,
166+
requestsHash: this.common.isActivatedEIP(7685) ? KECCAK256_RLP : undefined,
167167
}
168168

169169
const baseFeePerGas =
@@ -177,8 +177,8 @@ export class BlockHeader {
177177
const parentBeaconBlockRoot =
178178
toType(headerData.parentBeaconBlockRoot, TypeOutput.Uint8Array) ??
179179
hardforkDefaults.parentBeaconBlockRoot
180-
const requestsRoot =
181-
toType(headerData.requestsRoot, TypeOutput.Uint8Array) ?? hardforkDefaults.requestsRoot
180+
const requestsHash =
181+
toType(headerData.requestsHash, TypeOutput.Uint8Array) ?? hardforkDefaults.requestsHash
182182

183183
if (!this.common.isActivatedEIP(1559) && baseFeePerGas !== undefined) {
184184
throw new Error('A base fee for a block can only be set with EIP1559 being activated')
@@ -206,8 +206,8 @@ export class BlockHeader {
206206
)
207207
}
208208

209-
if (!this.common.isActivatedEIP(7685) && requestsRoot !== undefined) {
210-
throw new Error('requestsRoot can only be provided with EIP 7685 activated')
209+
if (!this.common.isActivatedEIP(7685) && requestsHash !== undefined) {
210+
throw new Error('requestsHash can only be provided with EIP 7685 activated')
211211
}
212212

213213
this.parentHash = parentHash
@@ -230,7 +230,7 @@ export class BlockHeader {
230230
this.blobGasUsed = blobGasUsed
231231
this.excessBlobGas = excessBlobGas
232232
this.parentBeaconBlockRoot = parentBeaconBlockRoot
233-
this.requestsRoot = requestsRoot
233+
this.requestsHash = requestsHash
234234
this._genericFormatValidation()
235235
this._validateDAOExtraData()
236236

@@ -346,8 +346,8 @@ export class BlockHeader {
346346
}
347347

348348
if (this.common.isActivatedEIP(7685)) {
349-
if (this.requestsRoot === undefined) {
350-
const msg = this._errorMsg('EIP7685 block has no requestsRoot field')
349+
if (this.requestsHash === undefined) {
350+
const msg = this._errorMsg('EIP7685 block has no requestsHash field')
351351
throw new Error(msg)
352352
}
353353
}
@@ -628,7 +628,7 @@ export class BlockHeader {
628628
rawItems.push(this.parentBeaconBlockRoot!)
629629
}
630630
if (this.common.isActivatedEIP(7685)) {
631-
rawItems.push(this.requestsRoot!)
631+
rawItems.push(this.requestsHash!)
632632
}
633633

634634
return rawItems
@@ -770,7 +770,7 @@ export class BlockHeader {
770770
JSONDict.parentBeaconBlockRoot = bytesToHex(this.parentBeaconBlockRoot!)
771771
}
772772
if (this.common.isActivatedEIP(7685)) {
773-
JSONDict.requestsRoot = bytesToHex(this.requestsRoot!)
773+
JSONDict.requestsHash = bytesToHex(this.requestsHash!)
774774
}
775775
return JSONDict
776776
}

packages/block/src/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function valuesArrayToHeaderData(values: BlockHeaderBytes): HeaderData {
4747
blobGasUsed,
4848
excessBlobGas,
4949
parentBeaconBlockRoot,
50-
requestsRoot,
50+
requestsHash,
5151
] = values
5252

5353
if (values.length > 21) {
@@ -82,7 +82,7 @@ export function valuesArrayToHeaderData(values: BlockHeaderBytes): HeaderData {
8282
blobGasUsed,
8383
excessBlobGas,
8484
parentBeaconBlockRoot,
85-
requestsRoot,
85+
requestsHash,
8686
}
8787
}
8888

packages/block/src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export interface HeaderData {
108108
blobGasUsed?: BigIntLike
109109
excessBlobGas?: BigIntLike
110110
parentBeaconBlockRoot?: BytesLike
111-
requestsRoot?: BytesLike
111+
requestsHash?: BytesLike
112112
}
113113

114114
/**
@@ -191,7 +191,7 @@ export interface JSONHeader {
191191
blobGasUsed?: PrefixedHexString
192192
excessBlobGas?: PrefixedHexString
193193
parentBeaconBlockRoot?: PrefixedHexString
194-
requestsRoot?: PrefixedHexString
194+
requestsHash?: PrefixedHexString
195195
}
196196

197197
/*
@@ -225,7 +225,7 @@ export interface JSONRPCBlock {
225225
excessBlobGas?: PrefixedHexString // If EIP-4844 is enabled for this block, returns the excess blob gas for the block
226226
parentBeaconBlockRoot?: PrefixedHexString // If EIP-4788 is enabled for this block, returns parent beacon block root
227227
executionWitness?: VerkleExecutionWitness | null // If Verkle is enabled for this block
228-
requestsRoot?: PrefixedHexString // If EIP-7685 is enabled for this block, returns the requests root
228+
requestsHash?: PrefixedHexString // If EIP-7685 is enabled for this block, returns the requests root
229229
}
230230

231231
export type WithdrawalV1 = {

packages/block/test/eip7685block.spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,30 @@ const common = new Common({
4949
describe('7685 tests', () => {
5050
it('should instantiate block with defaults', () => {
5151
const block = createBlock({}, { common })
52-
assert.deepEqual(block.header.requestsRoot, KECCAK256_RLP)
52+
assert.deepEqual(block.header.requestsHash, KECCAK256_RLP)
5353
const block2 = new Block(undefined, undefined, undefined, undefined, { common })
54-
assert.deepEqual(block.header.requestsRoot, KECCAK256_RLP)
54+
assert.deepEqual(block.header.requestsHash, KECCAK256_RLP)
5555
assert.equal(block2.requests?.length, 0)
5656
})
5757
it('should instantiate a block with requests', async () => {
5858
const request = getRandomDepositRequest()
59-
const requestsRoot = genRequestsRoot([request], sha256)
59+
const requestsHash = genRequestsRoot([request], sha256)
6060
const block = createBlock(
6161
{
6262
requests: [request],
63-
header: { requestsRoot },
63+
header: { requestsHash },
6464
},
6565
{ common },
6666
)
6767
assert.equal(block.requests?.length, 1)
68-
assert.deepEqual(block.header.requestsRoot, requestsRoot)
68+
assert.deepEqual(block.header.requestsHash, requestsHash)
6969
})
70-
it('RequestsRootIsValid should return false when requestsRoot is invalid', async () => {
70+
it('RequestsRootIsValid should return false when requestsHash is invalid', async () => {
7171
const request = getRandomDepositRequest()
7272
const block = createBlock(
7373
{
7474
requests: [request],
75-
header: { requestsRoot: randomBytes(32) },
75+
header: { requestsHash: randomBytes(32) },
7676
},
7777
{ common },
7878
)
@@ -84,14 +84,14 @@ describe('7685 tests', () => {
8484
const request2 = getRandomDepositRequest()
8585
const request3 = getRandomWithdrawalRequest()
8686
const requests = [request1, request2, request3]
87-
const requestsRoot = genRequestsRoot(requests, sha256)
87+
const requestsHash = genRequestsRoot(requests, sha256)
8888

8989
// Construct block with requests in correct order
9090

9191
const block = createBlock(
9292
{
9393
requests,
94-
header: { requestsRoot },
94+
header: { requestsHash },
9595
},
9696
{ common },
9797
)
@@ -103,7 +103,7 @@ describe('7685 tests', () => {
103103
createBlock(
104104
{
105105
requests: [request1, request3, request2],
106-
header: { requestsRoot },
106+
header: { requestsHash },
107107
},
108108
{ common },
109109
),
@@ -119,23 +119,23 @@ describe('createWithdrawalFromBytesArray tests', () => {
119119
common,
120120
},
121121
)
122-
assert.deepEqual(block.header.requestsRoot, KECCAK256_RLP)
122+
assert.deepEqual(block.header.requestsHash, KECCAK256_RLP)
123123
})
124124
it('should construct a block with a valid requests array', async () => {
125125
const request1 = getRandomDepositRequest()
126126
const request2 = getRandomWithdrawalRequest()
127127
const request3 = getRandomWithdrawalRequest()
128128
const requests = [request1, request2, request3]
129-
const requestsRoot = genRequestsRoot(requests, sha256)
129+
const requestsHash = genRequestsRoot(requests, sha256)
130130
const serializedRequests = [request1.serialize(), request2.serialize(), request3.serialize()]
131131

132132
const block = createBlockFromBytesArray(
133-
[createBlockHeader({ requestsRoot }, { common }).raw(), [], [], [], serializedRequests],
133+
[createBlockHeader({ requestsHash }, { common }).raw(), [], [], [], serializedRequests],
134134
{
135135
common,
136136
},
137137
)
138-
assert.deepEqual(block.header.requestsRoot, requestsRoot)
138+
assert.deepEqual(block.header.requestsHash, requestsHash)
139139
assert.equal(block.requests?.length, 3)
140140
})
141141
})
@@ -146,11 +146,11 @@ describe('fromRPC tests', () => {
146146
const request2 = getRandomDepositRequest()
147147
const request3 = getRandomWithdrawalRequest()
148148
const requests = [request1, request2, request3]
149-
const requestsRoot = genRequestsRoot(requests, sha256)
149+
const requestsHash = genRequestsRoot(requests, sha256)
150150
const serializedRequests = [request1.serialize(), request2.serialize(), request3.serialize()]
151151

152152
const block = createBlockFromBytesArray(
153-
[createBlockHeader({ requestsRoot }, { common }).raw(), [], [], [], serializedRequests],
153+
[createBlockHeader({ requestsHash }, { common }).raw(), [], [], [], serializedRequests],
154154
{
155155
common,
156156
},

packages/blockchain/src/blockchain.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,8 @@ export class Blockchain implements BlockchainInterface {
581581
}
582582

583583
if (header.common.isActivatedEIP(7685)) {
584-
if (header.requestsRoot === undefined) {
585-
throw new Error(`requestsRoot must be provided when EIP-7685 is active`)
584+
if (header.requestsHash === undefined) {
585+
throw new Error(`requestsHash must be provided when EIP-7685 is active`)
586586
}
587587
}
588588
}

packages/blockchain/test/blockValidation.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ describe('[Blockchain]: Block validation tests', () => {
390390
})
391391
})
392392
describe('EIP 7685: requests field validation tests', () => {
393-
it('should throw when putting a block with an invalid requestsRoot', async () => {
393+
it('should throw when putting a block with an invalid requestsHash', async () => {
394394
const common = new Common({
395395
chain: Mainnet,
396396
hardfork: Hardfork.Cancun,
@@ -403,7 +403,7 @@ describe('EIP 7685: requests field validation tests', () => {
403403
{
404404
header: {
405405
number: 1n,
406-
requestsRoot: randomBytes(32),
406+
requestsHash: randomBytes(32),
407407
withdrawalsRoot: KECCAK256_RLP,
408408
parentHash: blockchain.genesisBlock.hash(),
409409
timestamp: blockchain.genesisBlock.header.timestamp + 1n,
@@ -413,13 +413,13 @@ describe('EIP 7685: requests field validation tests', () => {
413413
{ common },
414414
)
415415

416-
await expect(async () => blockchain.putBlock(block)).rejects.toThrow('invalid requestsRoot')
416+
await expect(async () => blockchain.putBlock(block)).rejects.toThrow('invalid requestsHash')
417417

418418
const blockWithRequest = createBlock(
419419
{
420420
header: {
421421
number: 1n,
422-
requestsRoot: randomBytes(32),
422+
requestsHash: randomBytes(32),
423423
withdrawalsRoot: KECCAK256_RLP,
424424
parentHash: blockchain.genesisBlock.hash(),
425425
timestamp: blockchain.genesisBlock.header.timestamp + 1n,
@@ -430,7 +430,7 @@ describe('EIP 7685: requests field validation tests', () => {
430430
{ common },
431431
)
432432
await expect(async () => blockchain.putBlock(blockWithRequest)).rejects.toThrow(
433-
'invalid requestsRoot',
433+
'invalid requestsHash',
434434
)
435435
})
436436
})

packages/client/src/rpc/modules/engine/util/newPayload.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ export const validate7685ExecutionRequests = (
140140
// Collect versioned hashes in the flat array `txVersionedHashes` to match with received
141141
const requests = executionRequests.map((req) => createCLRequest(hexToBytes(req)))
142142
const sha256Function = headBlock.common.customCrypto.sha256 ?? sha256
143-
const requestsRoot = genRequestsRoot(requests, sha256Function)
143+
const requestsHash = genRequestsRoot(requests, sha256Function)
144144

145-
if (!equalsBytes(requestsRoot, headBlock.header.requestsRoot!)) {
146-
validationError = `Invalid requestsRoot received=${bytesToHex(
147-
headBlock.header.requestsRoot!,
148-
)} expected=${bytesToHex(requestsRoot)}`
145+
if (!equalsBytes(requestsHash, headBlock.header.requestsHash!)) {
146+
validationError = `Invalid requestsHash received=${bytesToHex(
147+
headBlock.header.requestsHash!,
148+
)} expected=${bytesToHex(requestsHash)}`
149149
}
150150
return validationError
151151
}

packages/client/src/rpc/modules/eth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const toJSONRPCBlock = async (
152152
blobGasUsed: header.blobGasUsed,
153153
excessBlobGas: header.excessBlobGas,
154154
parentBeaconBlockRoot: header.parentBeaconBlockRoot,
155-
requestsRoot: header.requestsRoot,
155+
requestsHash: header.requestsHash,
156156
}
157157
}
158158

packages/vm/src/buildBlock.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ export class BlockBuilder {
343343
}
344344

345345
let requests
346-
let requestsRoot
346+
let requestsHash
347347
if (this.vm.common.isActivatedEIP(7685)) {
348348
const sha256Function = this.vm.common.customCrypto.sha256 ?? sha256
349349
requests = await accumulateRequests(this.vm, this.transactionResults)
350-
requestsRoot = genRequestsRoot(requests, sha256Function)
350+
requestsHash = genRequestsRoot(requests, sha256Function)
351351
}
352352

353353
// get stateRoot after all the accumulateRequests etc have been done
@@ -363,7 +363,7 @@ export class BlockBuilder {
363363
timestamp,
364364
// correct excessBlobGas should already be part of headerData used above
365365
blobGasUsed,
366-
requestsRoot,
366+
requestsHash,
367367
}
368368

369369
if (consensusType === ConsensusType.ProofOfWork) {

0 commit comments

Comments
 (0)