From 42c4ea109c2996f65d0a392faeb3506b592d808d Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Fri, 23 Aug 2024 12:18:06 +0200 Subject: [PATCH] Revert "stop testing broken upstream version-2-0" (#6506) * Revert "stop testing broken upstream version-2-0 (#6499)" This reverts commit 2be7eba25a36a14950e977b9441930d252d7975f. * fix field warning template --- .github/workflows/ci.yml | 12 +++++- .../eth2_apis/eth2_rest_serialization.nim | 42 +++++++++---------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3db4bac79..bb3025379 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,8 +35,18 @@ jobs: cpu: amd64 - os: windows cpu: amd64 - branch: [~] + branch: [~, upstream/version-2-0] + exclude: + - target: + os: macos + branch: upstream/version-2-0 + - target: + os: windows + branch: upstream/version-2-0 include: + - branch: upstream/version-2-0 + branch-short: version-2-0 + nimflags-extra: --mm:refc - target: os: linux builder: ['self-hosted','ubuntu-22.04'] diff --git a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim index 96da33953..9433938df 100644 --- a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim +++ b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim @@ -1397,12 +1397,12 @@ proc readValue*( raiseUnexpectedValue( reader, "Expected a valid hex string with " & $value.len() & " bytes") -template unrecognizedFieldWarning = +template unrecognizedFieldWarning(fieldNameParam, typeNameParam: string) = # TODO: There should be a different notification mechanism for informing the # caller of a deserialization routine for unexpected fields. # The chonicles import in this module should be removed. trace "JSON field not recognized by the current version of Nimbus. Consider upgrading", - fieldName, typeName = typetraits.name(typeof value) + fieldName = fieldNameParam, typeName = typeNameParam template unrecognizedFieldIgnore = discard readValue(reader, JsonString) @@ -1433,7 +1433,7 @@ template prepareForkedBlockReading(blockType: typedesc, "Multiple '" & fieldName & "' fields found", blockType.name) data = Opt.some(reader.readValue(JsonString)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, blockType.name) of "block_header", "block": when (blockType is Web3SignerForkedBeaconBlock): if data.isSome(): @@ -1441,7 +1441,7 @@ template prepareForkedBlockReading(blockType: typedesc, "Multiple '" & fieldName & "' fields found", blockType.name) data = Opt.some(reader.readValue(JsonString)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, blockType.name) of "execution_payload_blinded": when (blockType is ProduceBlockResponseV3): if blinded.isSome(): @@ -1449,7 +1449,7 @@ template prepareForkedBlockReading(blockType: typedesc, "Multiple `execution_payload_blinded` fields found", blockType.name) blinded = Opt.some(reader.readValue(bool)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, blockType.name) of "execution_payload_value": when (blockType is ProduceBlockResponseV3): if payloadValue.isSome(): @@ -1457,7 +1457,7 @@ template prepareForkedBlockReading(blockType: typedesc, "Multiple `execution_payload_value` fields found", blockType.name) payloadValue = Opt.some(reader.readValue(Uint256)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, blockType.name) of "consensus_block_value": when (blockType is ProduceBlockResponseV3): if blockValue.isSome(): @@ -1465,9 +1465,9 @@ template prepareForkedBlockReading(blockType: typedesc, "Multiple `consensus_block_value` fields found", blockType.name) blockValue = Opt.some(reader.readValue(Uint256)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, blockType.name) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, blockType.name) if version.isNone(): reader.raiseUnexpectedValue("Field `version` is missing") @@ -1709,7 +1709,7 @@ proc readValue*(reader: var JsonReader[RestJson], "RestPublishedBeaconBlockBody") blob_kzg_commitments = Opt.some(reader.readValue(KzgCommitments)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if randao_reveal.isNone(): reader.raiseUnexpectedValue("Field `randao_reveal` is missing") @@ -1924,7 +1924,7 @@ proc readValue*(reader: var JsonReader[RestJson], "RestPublishedBeaconBlock") blockBody = Opt.some(reader.readValue(RestPublishedBeaconBlockBody)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if slot.isNone(): reader.raiseUnexpectedValue("Field `slot` is missing") @@ -2021,7 +2021,7 @@ proc readValue*(reader: var JsonReader[RestJson], "RestPublishedSignedBeaconBlock") signature = Opt.some(reader.readValue(ValidatorSig)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if signature.isNone(): reader.raiseUnexpectedValue("Field `signature` is missing") @@ -2098,7 +2098,7 @@ proc readValue*(reader: var JsonReader[RestJson], "RestPublishedSignedBlockContents") blobs = Opt.some(reader.readValue(deneb.Blobs)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if signed_message.isSome(): if message.isSome(): @@ -2178,7 +2178,7 @@ proc readValue*(reader: var JsonReader[RestJson], "ForkedSignedBeaconBlock") data = Opt.some(reader.readValue(JsonString)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if version.isNone(): reader.raiseUnexpectedValue("Field version is missing") @@ -2310,7 +2310,7 @@ proc readValue*(reader: var JsonReader[RestJson], "ForkedBeaconState") data = Opt.some(reader.readValue(JsonString)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if version.isNone(): reader.raiseUnexpectedValue("Field version is missing") @@ -2440,7 +2440,7 @@ proc readValue*[T: SomeForkedLightClientObject]( reader.raiseUnexpectedField("Multiple data fields found", T.name) data.ok reader.readValue(JsonString) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if version.isNone: reader.raiseUnexpectedValue("Field version is missing") @@ -2630,7 +2630,7 @@ proc readValue*(reader: var JsonReader[RestJson], data = Opt.some(reader.readValue(JsonString)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if requestKind.isNone(): reader.raiseUnexpectedValue("Field `type` is missing") @@ -2875,7 +2875,7 @@ proc readValue*(reader: var JsonReader[RestJson], reader.raiseUnexpectedValue("Invalid `status` value") ) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if status.isNone(): reader.raiseUnexpectedValue("Field `status` is missing") @@ -2932,7 +2932,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var Pbkdf2Params) {. "Pbkdf2Params") salt = Opt.some(reader.readValue(Pbkdf2Salt)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if dklen.isNone(): reader.raiseUnexpectedValue("Field `dklen` is missing") @@ -3006,7 +3006,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var ScryptParams) {. "ScryptParams") salt = Opt.some(reader.readValue(ScryptSalt)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if dklen.isNone(): reader.raiseUnexpectedValue("Field `dklen` is missing") @@ -3075,7 +3075,7 @@ proc readValue*(reader: var JsonReader[RestJson], "KeystoresAndSlashingProtection") strSlashing = Opt.some(reader.readValue(string)) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) if len(strKeystores) == 0: reader.raiseUnexpectedValue("Missing or empty `keystores` value") @@ -4385,7 +4385,7 @@ proc readValue*(reader: var JsonReader[RestJson], "RestValidatorRequest") statuses = Opt.some(reader.readValue(seq[string])) else: - unrecognizedFieldWarning() + unrecognizedFieldWarning(fieldName, typeof(value).name) let validatorIds =