From d838e5b6bac823146c6742fb942e57843feedfd0 Mon Sep 17 00:00:00 2001 From: tersec Date: Mon, 13 Feb 2023 12:03:38 +0100 Subject: [PATCH] remove unused phase0/altair-specific REST deserialization (#4605) --- .../block_quarantine.nim | 2 +- .../eth2_apis/eth2_rest_serialization.nim | 27 ------------------- beacon_chain/spec/eth2_apis/rest_types.nim | 6 ----- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/beacon_chain/consensus_object_pools/block_quarantine.nim b/beacon_chain/consensus_object_pools/block_quarantine.nim index 4d25a31b8..cce196854 100644 --- a/beacon_chain/consensus_object_pools/block_quarantine.nim +++ b/beacon_chain/consensus_object_pools/block_quarantine.nim @@ -88,7 +88,7 @@ func checkMissing*(quarantine: var Quarantine): seq[FetchRecord] = # TODO stew/sequtils2 template anyIt(s, pred: untyped): bool = - # https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/collections/sequtils.nim#L682-L704 + # https://github.com/nim-lang/Nim/blob/v1.6.10/lib/pure/collections/sequtils.nim#L753-L775 # without the items(...) var result = false for it {.inject.} in s: diff --git a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim index 3cba7eec9..e4f311dff 100644 --- a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim +++ b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim @@ -134,10 +134,6 @@ type Web3SignerSignatureResponse | Web3SignerStatusResponse - SszDecodeTypes* = - GetPhase0StateSszResponse | - GetPhase0BlockSszResponse - RestVersioned*[T] = object data*: T jsonVersion*: ConsensusFork @@ -2864,29 +2860,6 @@ proc decodeBytes*[T: DecodeTypes]( else: err("Content-Type not supported") -proc decodeBytes*[T: SszDecodeTypes]( - t: typedesc[T], - value: openArray[byte], - contentType: Opt[ContentTypeData], - updateRoot = true - ): RestResult[T] = - - if contentType.isNone() or - isWildCard(contentType.get().mediaType): - return err("Missing or incorrect Content-Type") - - let mediaType = contentType.get().mediaType - if mediaType == OctetStreamMediaType: - try: - var v: RestResult[T] - v.ok(T()) # This optimistically avoids an expensive genericAssign - readSszBytes(value, v.get(), updateRoot) - v - except SerializationError as exc: - err("Serialization error") - else: - err("Content-Type not supported") - proc encodeString*(value: string): RestResult[string] = ok(value) diff --git a/beacon_chain/spec/eth2_apis/rest_types.nim b/beacon_chain/spec/eth2_apis/rest_types.nim index 39be3cd9d..206edaca9 100644 --- a/beacon_chain/spec/eth2_apis/rest_types.nim +++ b/beacon_chain/spec/eth2_apis/rest_types.nim @@ -607,14 +607,8 @@ type serializedFieldName: "validator_registration".}: Web3SignerValidatorRegistration - GetBlockResponse* = DataEnclosedObject[phase0.SignedBeaconBlock] - GetStateResponse* = DataEnclosedObject[phase0.BeaconState] GetBlockV2Response* = ForkedSignedBeaconBlock GetStateV2Response* = ref ForkedHashedBeaconState - GetPhase0StateSszResponse* = phase0.BeaconState - GetAltairStateSszResponse* = altair.BeaconState - GetPhase0BlockSszResponse* = phase0.SignedBeaconBlock - GetAltairBlockSszResponse* = altair.SignedBeaconBlock RestRoot* = object root*: Eth2Digest