https://github.com/ethereum/consensus-specs/pull/3421 https://github.com/ethereum/execution-apis/pull/420 (#5147)
This commit is contained in:
parent
99264d7507
commit
b4c4f0955e
|
@ -51,8 +51,7 @@ proc initLightClient*(
|
|||
|
||||
if not blckPayload.block_hash.isZero:
|
||||
# engine_newPayloadV1
|
||||
discard await node.elManager.newExecutionPayload(
|
||||
blck.message.body)
|
||||
discard await node.elManager.newExecutionPayload(blck.message)
|
||||
|
||||
# Retain optimistic head for other `forkchoiceUpdated` callers.
|
||||
# May temporarily block `forkchoiceUpdatedV1` calls, e.g., Geth:
|
||||
|
|
|
@ -1059,10 +1059,12 @@ proc sendNewPayloadToSingleEL(connection: ELConnection,
|
|||
|
||||
proc sendNewPayloadToSingleEL(connection: ELConnection,
|
||||
payload: engine_api.ExecutionPayloadV3,
|
||||
versioned_hashes: seq[engine_api.VersionedHash]):
|
||||
versioned_hashes: seq[engine_api.VersionedHash],
|
||||
parent_beacon_block_root: FixedBytes[32]):
|
||||
Future[PayloadStatusV1] {.async.} =
|
||||
let rpcClient = await connection.connectedRpcClient()
|
||||
return await rpcClient.engine_newPayloadV3(payload, versioned_hashes)
|
||||
return await rpcClient.engine_newPayloadV3(
|
||||
payload, versioned_hashes, parent_beacon_block_root)
|
||||
|
||||
type
|
||||
StatusRelation = enum
|
||||
|
@ -1154,13 +1156,13 @@ proc processResponse[ELResponseType](
|
|||
url2 = connections[idx].engineUrl.url,
|
||||
status2 = status
|
||||
|
||||
proc sendNewPayload*(m: ELManager, blockBody: SomeForkyBeaconBlockBody):
|
||||
proc sendNewPayload*(m: ELManager, blck: SomeForkyBeaconBlock):
|
||||
Future[PayloadExecutionStatus] {.async.} =
|
||||
let
|
||||
earlyDeadline = sleepAsync(chronos.seconds 1)
|
||||
startTime = Moment.now
|
||||
deadline = sleepAsync(NEWPAYLOAD_TIMEOUT)
|
||||
payload = blockBody.execution_payload.asEngineExecutionPayload
|
||||
payload = blck.body.execution_payload.asEngineExecutionPayload
|
||||
requests = m.elConnections.mapIt:
|
||||
let req =
|
||||
when payload is engine_api.ExecutionPayloadV3:
|
||||
|
@ -1168,9 +1170,11 @@ proc sendNewPayload*(m: ELManager, blockBody: SomeForkyBeaconBlockBody):
|
|||
# Verify the execution payload is valid
|
||||
# [Modified in Deneb] Pass `versioned_hashes` to Execution Engine
|
||||
let versioned_hashes = mapIt(
|
||||
blockBody.blob_kzg_commitments,
|
||||
blck.body.blob_kzg_commitments,
|
||||
engine_api.VersionedHash(kzg_commitment_to_versioned_hash(it)))
|
||||
sendNewPayloadToSingleEL(it, payload, versioned_hashes)
|
||||
sendNewPayloadToSingleEL(
|
||||
it, payload, versioned_hashes,
|
||||
FixedBytes[32] blck.parent_root.data)
|
||||
elif payload is engine_api.ExecutionPayloadV1 or
|
||||
payload is engine_api.ExecutionPayloadV2:
|
||||
sendNewPayloadToSingleEL(it, payload)
|
||||
|
|
|
@ -303,11 +303,10 @@ from ../spec/datatypes/capella import
|
|||
from ../spec/datatypes/deneb import SignedBeaconBlock, asTrusted, shortLog
|
||||
|
||||
proc newExecutionPayload*(
|
||||
elManager: ELManager,
|
||||
blockBody: SomeForkyBeaconBlockBody):
|
||||
elManager: ELManager, blck: SomeForkyBeaconBlock):
|
||||
Future[Opt[PayloadExecutionStatus]] {.async.} =
|
||||
|
||||
template executionPayload: untyped = blockBody.execution_payload
|
||||
template executionPayload: untyped = blck.body.execution_payload
|
||||
|
||||
if not elManager.hasProperlyConfiguredConnection:
|
||||
if elManager.hasConnection:
|
||||
|
@ -322,7 +321,7 @@ proc newExecutionPayload*(
|
|||
executionPayload = shortLog(executionPayload)
|
||||
|
||||
try:
|
||||
let payloadStatus = await elManager.sendNewPayload(blockBody)
|
||||
let payloadStatus = await elManager.sendNewPayload(blck)
|
||||
|
||||
debug "newPayload: succeeded",
|
||||
parentHash = executionPayload.parent_hash,
|
||||
|
@ -349,7 +348,7 @@ proc getExecutionValidity(
|
|||
|
||||
try:
|
||||
let executionPayloadStatus = await elManager.newExecutionPayload(
|
||||
blck.message.body)
|
||||
blck.message)
|
||||
if executionPayloadStatus.isNone:
|
||||
return NewPayloadStatus.noResponse
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ programMain:
|
|||
template payload(): auto = blck.message.body.execution_payload
|
||||
|
||||
if elManager != nil and not payload.block_hash.isZero:
|
||||
discard await elManager.newExecutionPayload(blck.message.body)
|
||||
discard await elManager.newExecutionPayload(blck.message)
|
||||
discard await elManager.forkchoiceUpdated(
|
||||
headBlockHash = payload.block_hash,
|
||||
safeBlockHash = payload.block_hash, # stub value
|
||||
|
@ -124,7 +124,7 @@ programMain:
|
|||
template payload(): auto = blck.message.body.execution_payload
|
||||
|
||||
if elManager != nil and not payload.block_hash.isZero:
|
||||
discard await elManager.newExecutionPayload(blck.message.body)
|
||||
discard await elManager.newExecutionPayload(blck.message)
|
||||
discard await elManager.forkchoiceUpdated(
|
||||
headBlockHash = payload.block_hash,
|
||||
safeBlockHash = payload.block_hash, # stub value
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1f9fa11d0e63c16aa4ec30e1f7328ae61254d7d0
|
||||
Subproject commit 06ebe0ab1850bd0805fbf3933764adf4af058421
|
Loading…
Reference in New Issue