@@ -17,7 +17,7 @@ import {
17
17
quantityToBigint ,
18
18
} from "../../eth1/provider/utils.js" ;
19
19
import { ExecutionPayloadStatus , BlobsBundle , PayloadAttributes , VersionedHashes } from "./interface.js" ;
20
- import { WithdrawalV1 , DepositReceiptV1 , ExecutionLayerExitV1 } from "./payloadIdCache.js" ;
20
+ import { WithdrawalV1 , DepositReceiptV1 , ExecutionLayerWithdrawalRequestV1 } from "./payloadIdCache.js" ;
21
21
22
22
/* eslint-disable @typescript-eslint/naming-convention */
23
23
@@ -119,14 +119,14 @@ export type ExecutionPayloadBodyRpc = {
119
119
transactions : DATA [ ] ;
120
120
withdrawals : WithdrawalV1 [ ] | null | undefined ;
121
121
depositReceipts : DepositReceiptV1 [ ] | null | undefined ;
122
- exits : ExecutionLayerExitV1 [ ] | null | undefined ;
122
+ withdrawalRequests : ExecutionLayerWithdrawalRequestV1 [ ] | null | undefined ;
123
123
} ;
124
124
125
125
export type ExecutionPayloadBody = {
126
126
transactions : bellatrix . Transaction [ ] ;
127
127
withdrawals : capella . Withdrawals | null ;
128
128
depositReceipts : electra . DepositReceipts | null ;
129
- exits : electra . ExecutionLayerExits | null ;
129
+ withdrawalRequests : electra . ExecutionLayerWithdrawalRequests | null ;
130
130
} ;
131
131
132
132
export type ExecutionPayloadRpc = {
@@ -149,7 +149,7 @@ export type ExecutionPayloadRpc = {
149
149
excessBlobGas ?: QUANTITY ; // DENEB
150
150
parentBeaconBlockRoot ?: QUANTITY ; // DENEB
151
151
depositReceipts ?: DepositReceiptRpc [ ] ; // ELECTRA
152
- exits ?: ExecutionLayerExitRpc [ ] ; // ELECTRA
152
+ withdrawalRequests ?: ExecutionLayerWithdrawalRequestRpc [ ] ; // ELECTRA
153
153
} ;
154
154
155
155
export type WithdrawalRpc = {
@@ -160,7 +160,7 @@ export type WithdrawalRpc = {
160
160
} ;
161
161
162
162
export type DepositReceiptRpc = DepositReceiptV1 ;
163
- export type ExecutionLayerExitRpc = ExecutionLayerExitV1 ;
163
+ export type ExecutionLayerWithdrawalRequestRpc = ExecutionLayerWithdrawalRequestV1 ;
164
164
165
165
export type VersionedHashesRpc = DATA [ ] ;
166
166
@@ -215,9 +215,9 @@ export function serializeExecutionPayload(fork: ForkName, data: allForks.Executi
215
215
216
216
// ELECTRA adds depositReceipts to the ExecutionPayload
217
217
if ( ForkSeq [ fork ] >= ForkSeq . electra ) {
218
- const { depositReceipts, exits } = data as electra . ExecutionPayload ;
218
+ const { depositReceipts, withdrawalRequests } = data as electra . ExecutionPayload ;
219
219
payload . depositReceipts = depositReceipts . map ( serializeDepositReceipt ) ;
220
- payload . exits = exits . map ( serializeExecutionLayerExit ) ;
220
+ payload . withdrawalRequests = withdrawalRequests . map ( serializeExecutionLayerWithdrawalRequest ) ;
221
221
}
222
222
223
223
return payload ;
@@ -306,7 +306,7 @@ export function parseExecutionPayload(
306
306
}
307
307
308
308
if ( ForkSeq [ fork ] >= ForkSeq . electra ) {
309
- const { depositReceipts, exits } = data ;
309
+ const { depositReceipts, withdrawalRequests } = data ;
310
310
// Geth can also reply with null
311
311
if ( depositReceipts == null ) {
312
312
throw Error (
@@ -315,12 +315,14 @@ export function parseExecutionPayload(
315
315
}
316
316
( executionPayload as electra . ExecutionPayload ) . depositReceipts = depositReceipts . map ( deserializeDepositReceipt ) ;
317
317
318
- if ( exits == null ) {
318
+ if ( withdrawalRequests == null ) {
319
319
throw Error (
320
- `exits missing for ${ fork } >= electra executionPayload number=${ executionPayload . blockNumber } hash=${ data . blockHash } `
320
+ `withdrawalRequests missing for ${ fork } >= electra executionPayload number=${ executionPayload . blockNumber } hash=${ data . blockHash } `
321
321
) ;
322
322
}
323
- ( executionPayload as electra . ExecutionPayload ) . exits = exits . map ( deserializeExecutionLayerExit ) ;
323
+ ( executionPayload as electra . ExecutionPayload ) . withdrawalRequests = withdrawalRequests . map (
324
+ deserializeExecutionLayerWithdrawalRequest
325
+ ) ;
324
326
}
325
327
326
328
return { executionPayload, executionPayloadValue, blobsBundle, shouldOverrideBuilder} ;
@@ -409,17 +411,23 @@ export function deserializeDepositReceipt(serialized: DepositReceiptRpc): electr
409
411
} as electra . DepositReceipt ;
410
412
}
411
413
412
- export function serializeExecutionLayerExit ( exit : electra . ExecutionLayerExit ) : ExecutionLayerExitRpc {
414
+ export function serializeExecutionLayerWithdrawalRequest (
415
+ withdrawalRequest : electra . ExecutionLayerWithdrawalRequest
416
+ ) : ExecutionLayerWithdrawalRequestRpc {
413
417
return {
414
- sourceAddress : bytesToData ( exit . sourceAddress ) ,
415
- validatorPubkey : bytesToData ( exit . validatorPubkey ) ,
418
+ sourceAddress : bytesToData ( withdrawalRequest . sourceAddress ) ,
419
+ validatorPubkey : bytesToData ( withdrawalRequest . validatorPubkey ) ,
420
+ amount : numToQuantity ( withdrawalRequest . amount ) ,
416
421
} ;
417
422
}
418
423
419
- export function deserializeExecutionLayerExit ( exit : ExecutionLayerExitRpc ) : electra . ExecutionLayerExit {
424
+ export function deserializeExecutionLayerWithdrawalRequest (
425
+ withdrawalRequest : ExecutionLayerWithdrawalRequestRpc
426
+ ) : electra . ExecutionLayerWithdrawalRequest {
420
427
return {
421
- sourceAddress : dataToBytes ( exit . sourceAddress , 20 ) ,
422
- validatorPubkey : dataToBytes ( exit . validatorPubkey , 48 ) ,
428
+ sourceAddress : dataToBytes ( withdrawalRequest . sourceAddress , 20 ) ,
429
+ validatorPubkey : dataToBytes ( withdrawalRequest . validatorPubkey , 48 ) ,
430
+ amount : quantityToNum ( withdrawalRequest . amount ) ,
423
431
} ;
424
432
}
425
433
@@ -429,7 +437,9 @@ export function deserializeExecutionPayloadBody(data: ExecutionPayloadBodyRpc |
429
437
transactions : data . transactions . map ( ( tran ) => dataToBytes ( tran , null ) ) ,
430
438
withdrawals : data . withdrawals ? data . withdrawals . map ( deserializeWithdrawal ) : null ,
431
439
depositReceipts : data . depositReceipts ? data . depositReceipts . map ( deserializeDepositReceipt ) : null ,
432
- exits : data . exits ? data . exits . map ( deserializeExecutionLayerExit ) : null ,
440
+ withdrawalRequests : data . withdrawalRequests
441
+ ? data . withdrawalRequests . map ( deserializeExecutionLayerWithdrawalRequest )
442
+ : null ,
433
443
}
434
444
: null ;
435
445
}
@@ -440,7 +450,9 @@ export function serializeExecutionPayloadBody(data: ExecutionPayloadBody | null)
440
450
transactions : data . transactions . map ( ( tran ) => bytesToData ( tran ) ) ,
441
451
withdrawals : data . withdrawals ? data . withdrawals . map ( serializeWithdrawal ) : null ,
442
452
depositReceipts : data . depositReceipts ? data . depositReceipts . map ( serializeDepositReceipt ) : null ,
443
- exits : data . exits ? data . exits . map ( serializeExecutionLayerExit ) : null ,
453
+ withdrawalRequests : data . withdrawalRequests
454
+ ? data . withdrawalRequests . map ( serializeExecutionLayerWithdrawalRequest )
455
+ : null ,
444
456
}
445
457
: null ;
446
458
}
0 commit comments