add RPC signature; add type constraints on proposeBlockMEV (#5498)

This commit is contained in:
tersec 2023-10-12 11:49:48 +00:00 committed by GitHub
parent 40616b6243
commit eeac00d08e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -245,6 +245,12 @@ proc publishBlindedBlock*(body: capella_mev.SignedBlindedBeaconBlock):
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
proc publishBlindedBlock*(body: deneb_mev.SignedBlindedBeaconBlockContents):
RestPlainResponse {.
rest, endpoint: "/eth/v1/beacon/blinded_blocks",
meth: MethodPost.}
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
proc publishSszBlindedBlock*(
client: RestClientRef,
blck: ForkySignedBeaconBlock

View File

@ -730,10 +730,7 @@ proc getBlindedBlockParts[EPH: ForkyExecutionPayloadHeader](
# processing does not work directly using blinded blocks, fix up transactions
# root after running the state transition function on an otherwise equivalent
# non-blinded block without transactions.
when EPH is bellatrix.ExecutionPayloadHeader:
type PayloadType = bellatrix.ExecutionPayloadForSigning
let withdrawals_root = Opt.none Eth2Digest
elif EPH is capella.ExecutionPayloadHeader:
when EPH is capella.ExecutionPayloadHeader:
type PayloadType = capella.ExecutionPayloadForSigning
let withdrawals_root =
Opt.some executionPayloadHeader.get.blindedBlckPart.withdrawals_root
@ -810,7 +807,9 @@ proc getBuilderBid[
return ok (unsignedBlindedBlock.get, bidValue)
proc proposeBlockMEV(
node: BeaconNode, payloadBuilderClient: RestClientRef, blindedBlock: auto):
node: BeaconNode, payloadBuilderClient: RestClientRef,
blindedBlock: capella_mev.SignedBlindedBeaconBlock |
deneb_mev.SignedBlindedBeaconBlockContents):
Future[Result[BlockRef, string]] {.async.} =
let unblindedBlockRef = await node.unblindAndRouteBlockMEV(
payloadBuilderClient, blindedBlock)