mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-28 11:50:45 +00:00
rm engine_exchangeTransitionConfigurationV1 support (#3067)
This commit is contained in:
parent
f513e1dc53
commit
b417dd1986
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
||||
# Copyright (c) 2023-2025 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||
@ -11,7 +11,6 @@ import
|
||||
./api_handler/api_utils,
|
||||
./api_handler/api_getpayload,
|
||||
./api_handler/api_getbodies,
|
||||
./api_handler/api_exchangeconf,
|
||||
./api_handler/api_newpayload,
|
||||
./api_handler/api_forkchoice
|
||||
|
||||
@ -26,6 +25,5 @@ export
|
||||
getPayloadV4,
|
||||
getPayloadBodiesByHash,
|
||||
getPayloadBodiesByRange,
|
||||
exchangeConf,
|
||||
newPayload,
|
||||
forkchoiceUpdated
|
||||
|
@ -1,71 +0,0 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2023-2025 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||
# at your option.
|
||||
# This file may not be copied, modified, or distributed except according to
|
||||
# those terms.
|
||||
|
||||
import
|
||||
std/[strutils],
|
||||
eth/common/[base, headers, hashes],
|
||||
../beacon_engine,
|
||||
web3/execution_types,
|
||||
chronicles
|
||||
|
||||
{.push gcsafe, raises:[CatchableError].}
|
||||
|
||||
proc exchangeConf*(ben: BeaconEngineRef,
|
||||
conf: TransitionConfigurationV1):
|
||||
TransitionConfigurationV1 =
|
||||
trace "Engine API request received",
|
||||
meth = "exchangeTransitionConfigurationV1",
|
||||
ttd = conf.terminalTotalDifficulty,
|
||||
number = uint64(conf.terminalBlockNumber),
|
||||
blockHash = conf.terminalBlockHash
|
||||
|
||||
let
|
||||
com = ben.com
|
||||
db = com.db
|
||||
ttd = com.ttd
|
||||
|
||||
if ttd.isNone:
|
||||
raise newException(ValueError, "invalid ttd: EL (none) CL ($1)" % [
|
||||
$conf.terminalTotalDifficulty])
|
||||
|
||||
if conf.terminalTotalDifficulty != ttd.get:
|
||||
raise newException(ValueError, "invalid ttd: EL ($1) CL ($2)" % [
|
||||
$ttd.get, $conf.terminalTotalDifficulty])
|
||||
|
||||
let
|
||||
terminalBlockNumber = base.BlockNumber conf.terminalBlockNumber
|
||||
terminalBlockHash = conf.terminalBlockHash
|
||||
|
||||
if terminalBlockHash != default(Hash32):
|
||||
let headerHash = db.baseTxFrame().getBlockHash(terminalBlockNumber).valueOr:
|
||||
raise newException(ValueError, "cannot get terminal block hash, number $1, msg: $2" %
|
||||
[$terminalBlockNumber, error])
|
||||
|
||||
if terminalBlockHash != headerHash:
|
||||
raise newException(ValueError, "invalid terminal block hash, got $1 want $2" %
|
||||
[$terminalBlockHash, $headerHash])
|
||||
|
||||
let header = db.baseTxFrame().getBlockHeader(headerHash).valueOr:
|
||||
raise newException(ValueError, "cannot get terminal block header, hash $1, msg: $2" %
|
||||
[$terminalBlockHash, error])
|
||||
|
||||
return TransitionConfigurationV1(
|
||||
terminalTotalDifficulty: ttd.get,
|
||||
terminalBlockHash : headerHash,
|
||||
terminalBlockNumber : Quantity(header.number)
|
||||
)
|
||||
|
||||
if terminalBlockNumber != 0'u64:
|
||||
raise newException(ValueError, "invalid terminal block number: $1" % [
|
||||
$terminalBlockNumber])
|
||||
|
||||
if terminalBlockHash != default(Hash32):
|
||||
raise newException(ValueError, "invalid terminal block hash, no terminal header set")
|
||||
|
||||
TransitionConfigurationV1(terminalTotalDifficulty: ttd.get)
|
@ -1,5 +1,5 @@
|
||||
# Nimbus
|
||||
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
||||
# Copyright (c) 2021-2025 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||
@ -29,7 +29,6 @@ const supportedMethods: HashSet[string] =
|
||||
"engine_getPayloadV2",
|
||||
"engine_getPayloadV3",
|
||||
"engine_getPayloadV4",
|
||||
"engine_exchangeTransitionConfigurationV1",
|
||||
"engine_forkchoiceUpdatedV1",
|
||||
"engine_forkchoiceUpdatedV2",
|
||||
"engine_forkchoiceUpdatedV3",
|
||||
@ -76,10 +75,6 @@ proc setupEngineAPI*(engine: BeaconEngineRef, server: RpcServer) =
|
||||
server.rpc("engine_getPayloadV4") do(payloadId: Bytes8) -> GetPayloadV4Response:
|
||||
return engine.getPayloadV4(payloadId)
|
||||
|
||||
server.rpc("engine_exchangeTransitionConfigurationV1") do(
|
||||
conf: TransitionConfigurationV1) -> TransitionConfigurationV1:
|
||||
return engine.exchangeConf(conf)
|
||||
|
||||
server.rpc("engine_forkchoiceUpdatedV1") do(update: ForkchoiceStateV1,
|
||||
attrs: Opt[PayloadAttributesV1]) -> ForkchoiceUpdatedResponse:
|
||||
return engine.forkchoiceUpdated(Version.V1, update, attrs.payloadAttributes)
|
||||
|
Loading…
x
Reference in New Issue
Block a user