Fix nrpc edge cases (#2692)
* fix: engineAPI unable to connect * fix: pre-merge situation
This commit is contained in:
parent
d6eb8c36f5
commit
e3b0edd397
|
@ -130,20 +130,18 @@ proc syncToEngineApi(conf: NRpcConf) {.async.} =
|
|||
# And exchange the capabilities for a test communication
|
||||
web3 = await engineUrl.newWeb3()
|
||||
rpcClient = web3.provider
|
||||
data =
|
||||
|
||||
try:
|
||||
await rpcClient.exchangeCapabilities(
|
||||
let data = await rpcClient.exchangeCapabilities(
|
||||
@[
|
||||
"engine_forkchoiceUpdatedV1",
|
||||
"engine_getPayloadBodiesByHash", "engine_getPayloadBodiesByRangeV1",
|
||||
"engine_getPayloadV1", "engine_newPayloadV1",
|
||||
"engine_forkchoiceUpdatedV1", "engine_getPayloadBodiesByHash",
|
||||
"engine_getPayloadBodiesByRangeV1", "engine_getPayloadV1", "engine_newPayloadV1",
|
||||
]
|
||||
)
|
||||
notice "Communication with the EL Success", data = data
|
||||
except CatchableError as exc:
|
||||
error "Error Connecting to the EL Engine API", error = exc.msg
|
||||
@[]
|
||||
|
||||
notice "Communication with the EL Success", data = data
|
||||
quit(QuitFailure)
|
||||
|
||||
# Get the latest block number from the EL rest api
|
||||
template elBlockNumber(): uint64 =
|
||||
|
@ -163,6 +161,12 @@ proc syncToEngineApi(conf: NRpcConf) {.async.} =
|
|||
|
||||
notice "Current block number", number = currentBlockNumber
|
||||
|
||||
# Check for pre-merge situation
|
||||
if currentBlockNumber <= lastEra1Block:
|
||||
notice "Pre-merge, nrpc syncer works post-merge",
|
||||
blocknumber = currentBlockNumber, lastPoWBlock = lastEra1Block
|
||||
quit(QuitSuccess)
|
||||
|
||||
# Load the latest state from the CL
|
||||
var
|
||||
(finalizedBlck, _) = client.getELBlockFromBeaconChain(
|
||||
|
@ -216,9 +220,7 @@ proc syncToEngineApi(conf: NRpcConf) {.async.} =
|
|||
)
|
||||
debug "Making new payload call for Deneb"
|
||||
payloadResponse = await rpcClient.newPayload(
|
||||
payload,
|
||||
versioned_hashes,
|
||||
forkyBlck.message.parent_root.to(Hash32),
|
||||
payload, versioned_hashes, forkyBlck.message.parent_root.to(Hash32)
|
||||
)
|
||||
notice "Payload status", response = payloadResponse
|
||||
|
||||
|
|
Loading…
Reference in New Issue