Skip to content

Commit 1e78ef6

Browse files
committed
eth/catalyst: add engine_forkchoiceUpdatedWithWitnessV4
1 parent 9bd1d36 commit 1e78ef6

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

eth/catalyst/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ var caps = []string{
9191
"engine_forkchoiceUpdatedWithWitnessV1",
9292
"engine_forkchoiceUpdatedWithWitnessV2",
9393
"engine_forkchoiceUpdatedWithWitnessV3",
94+
"engine_forkchoiceUpdatedWithWitnessV4",
9495
"engine_exchangeTransitionConfigurationV1",
9596
"engine_getPayloadV1",
9697
"engine_getPayloadV2",

eth/catalyst/witness.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV3(update engine.Forkchoice
8484
return api.forkchoiceUpdated(update, params, engine.PayloadV3, true)
8585
}
8686

87+
// ForkchoiceUpdatedWithWitnessV4 is analogous to ForkchoiceUpdatedV4, only it
88+
// generates an execution witness too if block building was requested.
89+
func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV4(update engine.ForkchoiceStateV1, params *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) {
90+
if params != nil {
91+
switch {
92+
case params.Withdrawals == nil:
93+
return engine.STATUS_INVALID, attributesErr("missing withdrawals")
94+
case params.BeaconRoot == nil:
95+
return engine.STATUS_INVALID, attributesErr("missing beacon root")
96+
case !api.checkFork(params.Timestamp, forks.Eip7805):
97+
return engine.STATUS_INVALID, unsupportedForkErr("fcuV4 must only be called for eip7805 payloads")
98+
}
99+
}
100+
return api.forkchoiceUpdated(update, params, engine.PayloadV4, true)
101+
}
102+
87103
// NewPayloadWithWitnessV1 is analogous to NewPayloadV1, only it also generates
88104
// and returns a stateless witness after running the payload.
89105
func (api *ConsensusAPI) NewPayloadWithWitnessV1(params engine.ExecutableData) (engine.PayloadStatusV1, error) {

0 commit comments

Comments
 (0)