getPayloadV2 support for capella (#4457)

* getPayloadV2 support for capella

* check execution payload type more rigorously
This commit is contained in:
tersec 2023-01-04 19:13:17 +00:00 committed by GitHub
parent 44aa1f5152
commit ec01065555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View File

@ -543,8 +543,9 @@ proc getBlockByNumber*(p: Web3DataProviderRef,
except ValueError as exc: raiseAssert exc.msg # Never fails
p.web3.provider.eth_getBlockByNumber(hexNumber, false)
proc getPayload*(p: Eth1Monitor,
payloadId: bellatrix.PayloadID): Future[engine_api.ExecutionPayloadV1] =
proc getPayloadV1*(
p: Eth1Monitor, payloadId: bellatrix.PayloadID):
Future[engine_api.ExecutionPayloadV1] =
# Eth1 monitor can recycle connections without (external) warning; at least,
# don't crash.
if p.isNil or p.dataProvider.isNil:
@ -554,6 +555,18 @@ proc getPayload*(p: Eth1Monitor,
p.dataProvider.web3.provider.engine_getPayloadV1(FixedBytes[8] payloadId)
proc getPayloadV2*(
p: Eth1Monitor, payloadId: bellatrix.PayloadID):
Future[engine_api.ExecutionPayloadV2] =
# Eth1 monitor can recycle connections without (external) warning; at least,
# don't crash.
if p.isNil or p.dataProvider.isNil:
let epr = newFuture[engine_api.ExecutionPayloadV2]("getPayload")
epr.complete(default(engine_api.ExecutionPayloadV2))
return epr
p.dataProvider.web3.provider.engine_getPayloadV2(FixedBytes[8] payloadId)
proc newPayload*(p: Eth1Monitor, payload: engine_api.ExecutionPayloadV1):
Future[PayloadStatusV1] =
# Eth1 monitor can recycle connections without (external) warning; at least,

View File

@ -319,10 +319,15 @@ proc get_execution_payload[EP](
else:
when EP is bellatrix.ExecutionPayload:
asConsensusExecutionPayload(
await execution_engine.getPayload(payload_id.get))
else:
debugRaiseAssert $capellaImplementationMissing & ": implement getPayload V2"
await execution_engine.getPayloadV1(payload_id.get))
elif EP is capella.ExecutionPayload:
asConsensusExecutionPayload(
await execution_engine.getPayloadV2(payload_id.get))
elif EP is eip4844.ExecutionPayload:
debugRaiseAssert $eip4844ImplementationMissing & ": get_execution_payload"
default(EP)
else:
static: doAssert "unknown execution payload type"
proc getFeeRecipient(node: BeaconNode,
pubkey: ValidatorPubKey,