Skip to content

Commit c30a25a

Browse files
committed
beacon/blsync: fix engine API version selection
1 parent 05365d8 commit c30a25a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

beacon/blsync/engineclient.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,16 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
101101
params = []any{execData}
102102
)
103103
switch fork {
104-
case "electra":
104+
case "altair", "bellatrix":
105+
method = "engine_newPayloadV1"
106+
case "capella":
107+
method = "engine_newPayloadV2"
108+
case "deneb":
109+
method = "engine_newPayloadV3"
110+
parentBeaconRoot := event.BeaconHead.ParentRoot
111+
blobHashes := collectBlobHashes(event.Block)
112+
params = append(params, blobHashes, parentBeaconRoot)
113+
default: // electra, fulu and above
105114
method = "engine_newPayloadV4"
106115
parentBeaconRoot := event.BeaconHead.ParentRoot
107116
blobHashes := collectBlobHashes(event.Block)
@@ -110,15 +119,6 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
110119
hexRequests[i] = hexutil.Bytes(event.ExecRequests[i])
111120
}
112121
params = append(params, blobHashes, parentBeaconRoot, hexRequests)
113-
case "deneb":
114-
method = "engine_newPayloadV3"
115-
parentBeaconRoot := event.BeaconHead.ParentRoot
116-
blobHashes := collectBlobHashes(event.Block)
117-
params = append(params, blobHashes, parentBeaconRoot)
118-
case "capella":
119-
method = "engine_newPayloadV2"
120-
default:
121-
method = "engine_newPayloadV1"
122122
}
123123

124124
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
@@ -145,12 +145,12 @@ func (ec *engineClient) callForkchoiceUpdated(fork string, event types.ChainHead
145145

146146
var method string
147147
switch fork {
148-
case "deneb", "electra":
149-
method = "engine_forkchoiceUpdatedV3"
148+
case "altair", "bellatrix":
149+
method = "engine_forkchoiceUpdatedV1"
150150
case "capella":
151151
method = "engine_forkchoiceUpdatedV2"
152-
default:
153-
method = "engine_forkchoiceUpdatedV1"
152+
default: // deneb, electra, fulu and above
153+
method = "engine_forkchoiceUpdatedV3"
154154
}
155155

156156
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)

0 commit comments

Comments
 (0)