Skip to content

Commit 0303764

Browse files
authored
client: fix getpayloadv4 to return execution requests as well on retry (#4066)
* client: fix getpayloadv4 to return execution requests as well on retry * spell check * spell
1 parent 83ce851 commit 0303764

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

config/cspell-ts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@
639639
"bytevector",
640640
"blobschedule",
641641
"hoodi",
642-
"peerdas"
642+
"peerdas",
643+
"getpayload"
643644
]
644645
}

packages/client/src/miner/pendingBlock.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class PendingBlock {
6464

6565
pendingPayloads: Map<string, BlockBuilder> = new Map()
6666
blobsBundles: Map<string, BlobsBundle> = new Map()
67+
executionRequests: Map<string, CLRequest<CLRequestType>[]> = new Map()
6768

6869
private skipHardForkValidation?: boolean
6970

@@ -232,6 +233,7 @@ export class PendingBlock {
232233
// Remove from pendingPayloads
233234
this.pendingPayloads.delete(payloadId)
234235
this.blobsBundles.delete(payloadId)
236+
this.executionRequests.delete(payloadId)
235237
}
236238

237239
/**
@@ -262,6 +264,7 @@ export class PendingBlock {
262264
builder.transactionReceipts,
263265
builder.minerValue,
264266
this.blobsBundles.get(payloadId),
267+
this.executionRequests.get(payloadId),
265268
]
266269
}
267270
const { vm, headerData } = builder as unknown as { vm: VM; headerData: HeaderData }
@@ -293,6 +296,9 @@ export class PendingBlock {
293296
const { skippedByAddErrors, blobTxs } = await this.addTransactions(builder, txs)
294297

295298
const { block, requests } = await builder.build()
299+
if (requests !== undefined) {
300+
this.executionRequests.set(payloadId, requests)
301+
}
296302

297303
// Construct blobs bundle
298304
const blobs = block.common.isActivatedEIP(4844)

packages/client/test/rpc/engine/newPayloadV4.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,17 @@ describe(`${method}: call with executionPayloadV4`, () => {
201201
await service.txPool.add(depositTx, true)
202202

203203
res = await rpc.request('engine_getPayloadV4', [payloadId])
204-
const { executionPayload, executionRequests } = res.result
204+
const getPayloadResult = res.result
205+
// recall getpayload to verify if all of cached payload is returned
206+
res = await rpc.request('engine_getPayloadV4', [payloadId])
207+
const getPayloadRetryResult = res.result
208+
const hasAllKeys = Object.keys(getPayloadResult).reduce(
209+
(acc, key) => acc && Object.keys(getPayloadRetryResult).includes(key),
210+
true,
211+
)
212+
assert(hasAllKeys === true, 'all cached data should be returned on retry')
205213

214+
const { executionPayload, executionRequests } = getPayloadResult
206215
assert.strictEqual(
207216
executionRequests?.length,
208217
1,

0 commit comments

Comments
 (0)