mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-04 18:54:56 +00:00
deprecate req/resp GetMetaData v1 (#4608)
This commit is contained in:
parent
59e41dc65d
commit
f9022618f0
@ -47,9 +47,7 @@ proc initLightClient*(
|
||||
dag = node.dag.head.bid,
|
||||
wallSlot = node.currentSlot
|
||||
withBlck(signedBlock):
|
||||
when stateFork == ConsensusFork.EIP4844:
|
||||
debugRaiseAssert $eip4844ImplementationMissing & ": beacon_node_light_client.nim:initLightClient"
|
||||
elif stateFork >= ConsensusFork.Bellatrix:
|
||||
when stateFork >= ConsensusFork.Bellatrix:
|
||||
if blck.message.is_execution_block:
|
||||
template payload(): auto = blck.message.body.execution_payload
|
||||
|
||||
|
@ -216,16 +216,6 @@ type
|
||||
NetRes*[T] = Result[T, Eth2NetworkingError]
|
||||
## This is type returned from all network requests
|
||||
|
||||
func phase0metadata*(node: Eth2Node): phase0.MetaData =
|
||||
phase0.MetaData(
|
||||
seq_number: node.metadata.seq_number,
|
||||
attnets: node.metadata.attnets)
|
||||
|
||||
func toAltairMetadata(phase0: phase0.MetaData): altair.MetaData =
|
||||
altair.MetaData(
|
||||
seq_number: phase0.seq_number,
|
||||
attnets: phase0.attnets)
|
||||
|
||||
const
|
||||
clientId* = "Nimbus beacon node " & fullVersionStr
|
||||
|
||||
@ -2082,15 +2072,10 @@ proc updatePeerMetadata(node: Eth2Node, peerId: PeerId) {.async.} =
|
||||
let newMetadata =
|
||||
try:
|
||||
tryGet(await peer.getMetadata_v2())
|
||||
except CatchableError:
|
||||
let metadataV1 =
|
||||
try: tryGet(await peer.getMetaData())
|
||||
except CatchableError as exc:
|
||||
debug "Failed to retrieve metadata from peer!", peerId, msg=exc.msg
|
||||
peer.failedMetadataRequests.inc()
|
||||
return
|
||||
|
||||
toAltairMetadata(metadataV1)
|
||||
except CatchableError as exc:
|
||||
debug "Failed to retrieve metadata from peer!", peerId, msg=exc.msg
|
||||
peer.failedMetadataRequests.inc()
|
||||
return
|
||||
|
||||
peer.metadata = some(newMetadata)
|
||||
peer.failedMetadataRequests = 0
|
||||
|
@ -129,11 +129,6 @@ type
|
||||
|
||||
body*: BeaconBlockBody
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/phase0/p2p-interface.md#metadata
|
||||
MetaData* = object
|
||||
seq_number*: uint64
|
||||
attnets*: AttnetBits
|
||||
|
||||
SigVerifiedBeaconBlock* = object
|
||||
## A BeaconBlock that contains verified signatures
|
||||
## but that has not been verified for state transition
|
||||
|
@ -305,9 +305,10 @@ p2pProtocol BeaconSync(version = 1,
|
||||
{.libp2pProtocol("ping", 1, isRequired = true).} =
|
||||
return peer.network.metadata.seq_number
|
||||
|
||||
proc getMetaData(peer: Peer): phase0.MetaData
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/altair/p2p-interface.md#transitioning-from-v1-to-v2
|
||||
proc getMetaData(peer: Peer): uint64
|
||||
{.libp2pProtocol("metadata", 1, isRequired = true).} =
|
||||
return peer.network.phase0metadata
|
||||
raise newException(InvalidInputsError, "GetMetaData v1 unsupported")
|
||||
|
||||
proc getMetadata_v2(peer: Peer): altair.MetaData
|
||||
{.libp2pProtocol("metadata", 2, isRequired = true).} =
|
||||
|
Loading…
x
Reference in New Issue
Block a user