Skip to content

Commit

Permalink
rename ExitV1 to WithdrawalRequestV1
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec committed May 14, 2024
1 parent a00b28a commit 2d0539b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions tests/test_execution_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ suite "Execution types tests":
index: 9.Quantity
)

exit = ExitV1(
exit = WithdrawalRequestV1(
sourceAddress: address(7),
validatorPublicKey: FixedBytes[48].conv(9)
)
Expand Down Expand Up @@ -176,7 +176,7 @@ suite "Execution types tests":
check bad41.version == Version.V4

var bad42 = v4
bad42.exits = none(seq[ExitV1])
bad42.exits = none(seq[WithdrawalRequestV1])
check bad42.version == Version.V4

let v41 = bad41.V4
Expand All @@ -185,7 +185,7 @@ suite "Execution types tests":

let v42 = bad42.V4
check v42.depositReceipts == v4.depositReceipts.get
check v42.exits == newSeq[ExitV1]()
check v42.exits == newSeq[WithdrawalRequestV1]()

# roundtrip
let v4p = v4.V4
Expand All @@ -198,4 +198,4 @@ suite "Execution types tests":

# response roundtrip
let rv3p = resv4.V4
check rv3p == rv3p.getPayloadResponse.V4
check rv3p == rv3p.getPayloadResponse.V4
2 changes: 1 addition & 1 deletion web3/conversions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ derefType(ReceiptObject).useDefaultSerializationIn JrpcConv

WithdrawalV1.useDefaultSerializationIn JrpcConv
DepositReceiptV1.useDefaultSerializationIn JrpcConv
ExitV1.useDefaultSerializationIn JrpcConv
WithdrawalRequestV1.useDefaultSerializationIn JrpcConv
ExecutionPayloadV1.useDefaultSerializationIn JrpcConv
ExecutionPayloadV2.useDefaultSerializationIn JrpcConv
ExecutionPayloadV1OrV2.useDefaultSerializationIn JrpcConv
Expand Down
11 changes: 6 additions & 5 deletions web3/engine_api_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ type
address*: Address
amount*: Quantity

# https://github.com/ethereum/execution-apis/blob/90a46e9137c89d58e818e62fa33a0347bba50085/src/engine/prague.md#depositreceiptv1
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/prague.md#depositrequestv1
DepositReceiptV1* = object
pubkey*: FixedBytes[48]
withdrawalCredentials*: FixedBytes[32]
amount*: Quantity
signature*: FixedBytes[96]
index*: Quantity

# https://github.com/ethereum/execution-apis/blob/90a46e9137c89d58e818e62fa33a0347bba50085/src/engine/prague.md#exitv1
ExitV1* = object
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/prague.md#withdrawalrequestv1
WithdrawalRequestV1* = object
sourceAddress*: Address
validatorPublicKey*: FixedBytes[48]
amount*: Quantity

# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#executionpayloadv1
ExecutionPayloadV1* = object
Expand Down Expand Up @@ -123,7 +124,7 @@ type
blobGasUsed*: Quantity
excessBlobGas*: Quantity

# https://github.com/ethereum/execution-apis/blob/90a46e9137c89d58e818e62fa33a0347bba50085/src/engine/prague.md#executionpayloadv4
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/prague.md#executionpayloadv4
ExecutionPayloadV4* = object
parentHash*: Hash256
feeRecipient*: Address
Expand All @@ -143,7 +144,7 @@ type
blobGasUsed*: Quantity
excessBlobGas*: Quantity
depositReceipts*: seq[DepositReceiptV1]
exits*: seq[ExitV1]
exits*: seq[WithdrawalRequestV1]

SomeExecutionPayload* =
ExecutionPayloadV1 |
Expand Down
7 changes: 3 additions & 4 deletions web3/execution_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type
blobGasUsed*: Option[Quantity]
excessBlobGas*: Option[Quantity]
depositReceipts*: Option[seq[DepositReceiptV1]]
exits*: Option[seq[ExitV1]]
exits*: Option[seq[WithdrawalRequestV1]]

PayloadAttributes* = object
timestamp*: Quantity
Expand Down Expand Up @@ -273,7 +273,7 @@ func V4*(p: ExecutionPayload): ExecutionPayloadV4 =
blobGasUsed: p.blobGasUsed.get(0.Quantity),
excessBlobGas: p.excessBlobGas.get(0.Quantity),
depositReceipts: p.depositReceipts.get(newSeq[DepositReceiptV1]()),
exits: p.exits.get(newSeq[ExitV1]())
exits: p.exits.get(newSeq[WithdrawalRequestV1]())
)

func V1*(p: ExecutionPayloadV1OrV2): ExecutionPayloadV1 =
Expand Down Expand Up @@ -461,5 +461,4 @@ func getPayloadResponse*(x: GetPayloadV4Response): GetPayloadResponse =
blockValue: some(x.blockValue),
blobsBundle: some(x.blobsBundle),
shouldOverrideBuilder: some(x.shouldOverrideBuilder)
)

)

0 comments on commit 2d0539b

Please sign in to comment.